summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYana Chernysheva <ychernysheva@luxoft.com>2020-09-10 11:41:13 +0300
committerYana Chernysheva <ychernysheva@luxoft.com>2020-09-10 11:41:13 +0300
commit98da72fbc909a6bc2ff8e163a328bf11d36379be (patch)
treed397c2885c850726de89b8a14301b650354015b4
parent6f1ee2ea1322e8106fb3d88534dbce657fd60b0a (diff)
parenta36ea82740e648debf1b0367c24fed85d6ef2d80 (diff)
downloadsdl_core-98da72fbc909a6bc2ff8e163a328bf11d36379be.tar.gz
Merge branch 'develop' into fix/move_duplicate_conversion_functions_to_message_helper
-rw-r--r--README.md6
-rw-r--r--src/appMain/life_cycle_impl.cc62
-rw-r--r--src/appMain/low_voltage_signals_handler.cc20
-rw-r--r--src/appMain/main.cc63
-rw-r--r--src/appMain/sdl_preloaded_pt.json14
-rw-r--r--src/appMain/signal_handlers.cc2
-rw-r--r--src/components/application_manager/include/application_manager/app_extension.h28
-rw-r--r--src/components/application_manager/include/application_manager/application.h9
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h12
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h11
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h64
-rw-r--r--src/components/application_manager/include/application_manager/application_state.h20
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_notification_impl.h9
-rw-r--r--src/components/application_manager/include/application_manager/display_capabilities_builder.h28
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h177
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h238
-rw-r--r--src/components/application_manager/include/application_manager/request_info.h5
-rw-r--r--src/components/application_manager/include/application_manager/resumption/pending_resumption_handler.h91
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h53
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h127
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_processor.h107
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h390
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h18
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h13
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc42
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h7
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h66
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h15
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h165
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h35
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc99
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc106
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc50
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc42
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc169
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc196
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc55
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc53
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc343
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc67
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc163
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt3
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc76
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h11
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc198
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc421
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt1
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_sub_menu_notification.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_file_notification.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h105
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h33
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h93
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc29
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc37
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc82
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc70
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc86
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc47
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc65
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc99
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc51
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc39
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc89
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc277
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc964
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc213
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc126
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc44
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc87
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc29
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc33
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc246
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc33
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc76
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc209
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc74
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_app_interface_unregistered_notification_test.cc140
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc415
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc297
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h60
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h150
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h27
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc75
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc46
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc129
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc409
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc143
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc636
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc10
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_data_db.cc174
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_data_impl.cc18
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_data_json.cc51
-rw-r--r--src/components/application_manager/src/app_launch/apps_launcher.cc17
-rw-r--r--src/components/application_manager/src/app_launch/device_apps_launcher.cc14
-rw-r--r--src/components/application_manager/src/app_service_manager.cc90
-rw-r--r--src/components/application_manager/src/application_data_impl.cc128
-rw-r--r--src/components/application_manager/src/application_impl.cc202
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc990
-rw-r--r--src/components/application_manager/src/application_state.cc176
-rw-r--r--src/components/application_manager/src/command_holder_impl.cc37
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc53
-rw-r--r--src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc4
-rw-r--r--src/components/application_manager/src/commands/command_notification_impl.cc9
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc113
-rw-r--r--src/components/application_manager/src/commands/command_response_impl.cc4
-rw-r--r--src/components/application_manager/src/commands/notification_from_hmi.cc6
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc30
-rw-r--r--src/components/application_manager/src/commands/request_to_hmi.cc68
-rw-r--r--src/components/application_manager/src/commands/response_from_hmi.cc6
-rw-r--r--src/components/application_manager/src/display_capabilities_builder.cc121
-rw-r--r--src/components/application_manager/src/event_engine/event_dispatcher_impl.cc12
-rw-r--r--src/components/application_manager/src/help_prompt_manager_impl.cc87
-rw-r--r--src/components/application_manager/src/helpers/application_helper.cc32
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc115
-rw-r--r--src/components/application_manager/src/hmi_language_handler.cc106
-rw-r--r--src/components/application_manager/src/hmi_state.cc249
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc529
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc37
-rw-r--r--src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc32
-rw-r--r--src/components/application_manager/src/policies/delegates/app_permission_delegate.cc4
-rw-r--r--src/components/application_manager/src/policies/delegates/statistics_delegate.cc6
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc6
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc607
-rw-r--r--src/components/application_manager/src/policies/policy_retry_sequence.cc9
-rw-r--r--src/components/application_manager/src/request_controller.cc244
-rw-r--r--src/components/application_manager/src/request_info.cc37
-rw-r--r--src/components/application_manager/src/request_tracker.cc35
-rw-r--r--src/components/application_manager/src/resumption/pending_resumption_handler.cc66
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc651
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc38
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc726
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc125
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_processor_impl.cc1209
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc137
-rw-r--r--src/components/application_manager/src/rpc_passing_handler.cc61
-rw-r--r--src/components/application_manager/src/rpc_protection_manager_impl.cc70
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc134
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc353
-rw-r--r--src/components/application_manager/src/system_time/system_time_handler_impl.cc35
-rw-r--r--src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc3
-rw-r--r--src/components/application_manager/test/application_helper_test.cc41
-rw-r--r--src/components/application_manager/test/application_impl_test.cc94
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc253
-rw-r--r--src/components/application_manager/test/application_state_test.cc122
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h9
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h73
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h26
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resumption_data_processor.h (renamed from src/components/utils/test/log_message_loop_thread_test.cc)60
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc18
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc120
-rw-r--r--src/components/application_manager/test/rc_policy_handler_test.cc6
-rw-r--r--src/components/application_manager/test/request_info_test.cc1
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc344
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc12
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc481
-rw-r--r--src/components/config_profile/src/ini_file.cc6
-rw-r--r--src/components/config_profile/src/profile.cc12
-rw-r--r--src/components/connection_handler/include/connection_handler/connection.h27
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h31
-rw-r--r--src/components/connection_handler/src/connection.cc167
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc524
-rw-r--r--src/components/connection_handler/src/device.cc6
-rw-r--r--src/components/connection_handler/src/heartbeat_monitor.cc54
-rw-r--r--src/components/connection_handler/test/connection_handler_impl_test.cc40
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h4
-rw-r--r--src/components/hmi_message_handler/src/hmi_message_handler_impl.cc30
-rw-r--r--src/components/hmi_message_handler/src/mb_controller.cc24
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc30
-rw-r--r--src/components/hmi_message_handler/src/websocket_session.cc23
-rw-r--r--src/components/include/application_manager/application_manager.h25
-rw-r--r--src/components/include/application_manager/state_controller.h23
-rw-r--r--src/components/include/connection_handler/connection_handler.h9
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h3
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h3
-rw-r--r--src/components/include/protocol_handler/protocol_handler.h3
-rw-r--r--src/components/include/protocol_handler/session_observer.h22
-rw-r--r--src/components/include/test/application_manager/mock_app_extension.h3
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h12
-rw-r--r--src/components/include/test/application_manager/mock_state_controller.h5
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h3
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler.h4
-rw-r--r--src/components/include/test/protocol_handler/mock_session_observer.h18
-rw-r--r--src/components/include/utils/auto_trace.h9
-rw-r--r--src/components/include/utils/ilogger.h (renamed from src/components/include/utils/push_log.h)67
-rw-r--r--src/components/include/utils/logger.h174
-rw-r--r--src/components/include/utils/logger_status.h52
-rw-r--r--src/components/include/utils/macro.h19
-rw-r--r--src/components/include/utils/message_queue.h10
-rw-r--r--src/components/include/utils/messagemeter.h18
-rw-r--r--src/components/include/utils/rwlock.h34
-rw-r--r--src/components/include/utils/threads/message_loop_thread.h12
-rw-r--r--src/components/include/utils/threads/thread.h230
-rw-r--r--src/components/interfaces/HMI_API.xml48
-rw-r--r--src/components/media_manager/src/audio/a2dp_source_player_adapter.cc48
-rw-r--r--src/components/media_manager/src/audio/audio_stream_sender_thread.cc36
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_adapter.cc25
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_listener.cc25
-rw-r--r--src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc48
-rw-r--r--src/components/media_manager/src/file_streamer_adapter.cc20
-rw-r--r--src/components/media_manager/src/media_adapter_impl.cc6
-rw-r--r--src/components/media_manager/src/media_manager_impl.cc52
-rw-r--r--src/components/media_manager/src/pipe_streamer_adapter.cc53
-rw-r--r--src/components/media_manager/src/socket_streamer_adapter.cc29
-rw-r--r--src/components/media_manager/src/streamer_adapter.cc46
-rw-r--r--src/components/media_manager/src/streamer_listener.cc14
-rw-r--r--src/components/media_manager/src/video/video_stream_to_file_adapter.cc49
-rw-r--r--src/components/policy/policy_external/src/access_remote_impl.cc31
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc427
-rw-r--r--src/components/policy/policy_external/src/policy_helper.cc62
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc437
-rw-r--r--src/components/policy/policy_external/src/policy_table.cc4
-rw-r--r--src/components/policy/policy_external/src/policy_table/validation.cc58
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc382
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc563
-rw-r--r--src/components/policy/policy_external/src/update_status_manager.cc66
-rw-r--r--src/components/policy/policy_regular/src/access_remote_impl.cc31
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc326
-rw-r--r--src/components/policy/policy_regular/src/policy_helper.cc61
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc292
-rw-r--r--src/components/policy/policy_regular/src/policy_table.cc4
-rw-r--r--src/components/policy/policy_regular/src/policy_table/validation.cc54
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc578
-rw-r--r--src/components/policy/policy_regular/src/update_status_manager.cc30
-rw-r--r--src/components/protocol/src/rpc_type.cc4
-rw-r--r--src/components/protocol/src/service_type.cc4
-rw-r--r--src/components/protocol_handler/include/protocol_handler/handshake_handler.h5
-rw-r--r--src/components/protocol_handler/include/protocol_handler/multiframe_builder.h2
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h19
-rw-r--r--src/components/protocol_handler/src/handshake_handler.cc93
-rw-r--r--src/components/protocol_handler/src/incoming_data_handler.cc66
-rw-r--r--src/components/protocol_handler/src/multiframe_builder.cc125
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc809
-rw-r--r--src/components/protocol_handler/src/protocol_packet.cc99
-rw-r--r--src/components/protocol_handler/src/service_status_update_handler.cc9
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc416
-rw-r--r--src/components/resumption/src/last_state_impl.cc28
-rw-r--r--src/components/resumption/src/last_state_wrapper_impl.cc4
-rw-r--r--src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h8
-rw-r--r--src/components/security_manager/src/crypto_manager_impl.cc171
-rw-r--r--src/components/security_manager/src/security_manager_impl.cc137
-rw-r--r--src/components/security_manager/src/ssl_context_impl.cc101
-rw-r--r--src/components/security_manager/test/security_manager_test.cc27
-rw-r--r--src/components/smart_objects/src/object_schema_item.cc9
-rw-r--r--src/components/telemetry_monitor/src/protocol_handler_observer.cc8
-rw-r--r--src/components/telemetry_monitor/src/telemetry_monitor.cc74
-rw-r--r--src/components/test_main.cc21
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h14
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h6
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h22
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc7
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_device.cc27
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc113
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc37
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc12
-rw-r--r--src/components/transport_manager/src/cloud/cloud_device.cc4
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc8
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc17
-rw-r--r--src/components/transport_manager/src/cloud/websocket_client_connection.cc67
-rw-r--r--src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc56
-rw-r--r--src/components/transport_manager/src/tcp/network_interface_listener_impl.cc14
-rw-r--r--src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc177
-rw-r--r--src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc12
-rw-r--r--src/components/transport_manager/src/tcp/tcp_client_listener.cc163
-rw-r--r--src/components/transport_manager/src/tcp/tcp_connection_factory.cc13
-rw-r--r--src/components/transport_manager/src/tcp/tcp_device.cc63
-rw-r--r--src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc24
-rw-r--r--src/components/transport_manager/src/tcp/tcp_socket_connection.cc2
-rw-r--r--src/components/transport_manager/src/tcp/tcp_transport_adapter.cc12
-rw-r--r--src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc116
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc359
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc123
-rw-r--r--src/components/transport_manager/src/transport_manager_default.cc12
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc540
-rw-r--r--src/components/transport_manager/src/usb/libusb/platform_usb_device.cc13
-rw-r--r--src/components/transport_manager/src/usb/libusb/usb_connection.cc128
-rw-r--r--src/components/transport_manager/src/usb/libusb/usb_handler.cc178
-rw-r--r--src/components/transport_manager/src/usb/qnx/platform_usb_device.cc4
-rw-r--r--src/components/transport_manager/src/usb/qnx/usb_connection.cc62
-rw-r--r--src/components/transport_manager/src/usb/qnx/usb_handler.cc72
-rw-r--r--src/components/transport_manager/src/usb/usb_aoa_adapter.cc16
-rw-r--r--src/components/transport_manager/src/usb/usb_connection_factory.cc27
-rw-r--r--src/components/transport_manager/src/usb/usb_device_scanner.cc34
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_connection.cc84
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_device.cc4
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_listener.cc69
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_secure_session.cc18
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc20
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_session.cc43
-rw-r--r--src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc4
-rw-r--r--src/components/transport_manager/test/tcp_client_listener_test.cc18
-rw-r--r--src/components/transport_manager/test/transport_manager_impl_test.cc8
-rw-r--r--src/components/utils/CMakeLists.txt5
-rw-r--r--src/components/utils/include/utils/file_system.h8
-rw-r--r--src/components/utils/include/utils/logger/log4cxxlogger.h (renamed from src/components/utils/src/logger_status.cc)20
-rw-r--r--src/components/utils/include/utils/logger/logger_impl.h (renamed from src/components/utils/include/utils/log_message_loop_thread.h)53
-rw-r--r--src/components/utils/src/auto_trace.cc43
-rw-r--r--src/components/utils/src/conditional_variable_boost.cc10
-rw-r--r--src/components/utils/src/file_system.cc207
-rw-r--r--src/components/utils/src/jsoncpp_reader_wrapper.cc8
-rw-r--r--src/components/utils/src/lock_boost.cc13
-rw-r--r--src/components/utils/src/log_message_loop_thread.cc56
-rw-r--r--src/components/utils/src/logger.cc58
-rw-r--r--src/components/utils/src/logger/log4cxxlogger.cc123
-rw-r--r--src/components/utils/src/logger/logger_impl.cc125
-rw-r--r--src/components/utils/src/push_log.cc139
-rw-r--r--src/components/utils/src/qdb_wrapper/sql_database.cc6
-rw-r--r--src/components/utils/src/qdb_wrapper/sql_query.cc4
-rw-r--r--src/components/utils/src/resource_usage.cc21
-rw-r--r--src/components/utils/src/rwlock_posix.cc16
-rw-r--r--src/components/utils/src/system.cc15
-rw-r--r--src/components/utils/src/threads/async_runner.cc24
-rw-r--r--src/components/utils/src/threads/pulse_thread_delegate.cc41
-rw-r--r--src/components/utils/src/threads/thread_delegate.cc4
-rw-r--r--src/components/utils/src/threads/thread_manager.cc2
-rw-r--r--src/components/utils/src/threads/thread_posix.cc445
-rw-r--r--src/components/utils/src/threads/thread_validator.cc21
-rw-r--r--src/components/utils/src/timer.cc29
-rw-r--r--src/components/utils/test/CMakeLists.txt1
-rw-r--r--src/components/utils/test/auto_trace_test.cc145
-rw-r--r--src/components/utils/test/posix_thread_test.cc542
-rwxr-xr-xtools/InterfaceGenerator/generator/generators/SmartFactoryBase.py123
-rw-r--r--tools/policy_table_validator/main.cpp23
m---------tools/rpc_spec0
802 files changed, 22945 insertions, 14281 deletions
diff --git a/README.md b/README.md
index d75e14465b..e0be6edb34 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
[![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.com)
-[![Build Status](http://opensdl-jenkins.luxoft.com:8080/view/develop/job/develop_nightly_coverage/badge/icon)](http://opensdl-jenkins.luxoft.com:8080/view/develop/job/develop_nightly_coverage/)
+[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_nightly_coverage/badge/icon?subject=UT%20coverage%20build)](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_nightly_coverage/)
+[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/badge/icon?subject=Smoke%20tests)](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/)
+[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/badge/icon?subject=Coding%20style)](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/)
# SmartDeviceLink (SDL)
@@ -18,7 +20,7 @@ Pull Requests Welcome!
## Environment
Currently supported:
* Ubuntu Linux 16.04 with GCC 5.4.x
-* Ubuntu Linux 18.04 with GCC 7.3.x
+* Ubuntu Linux 18.04 with GCC 7.5.x
* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
## Getting Started
diff --git a/src/appMain/life_cycle_impl.cc b/src/appMain/life_cycle_impl.cc
index 4c2d1e88ac..a14ca1240c 100644
--- a/src/appMain/life_cycle_impl.cc
+++ b/src/appMain/life_cycle_impl.cc
@@ -43,17 +43,13 @@
#include "security_manager/security_manager_impl.h"
#endif // ENABLE_SECURITY
-#ifdef ENABLE_LOG
-#include "utils/log_message_loop_thread.h"
-#endif // ENABLE_LOG
-
#include "appMain/low_voltage_signals_handler.h"
using threads::Thread;
namespace main_namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
+SDL_CREATE_LOG_VARIABLE("SDLMain")
LifeCycleImpl::LifeCycleImpl(const profile::Profile& profile)
: transport_manager_(NULL)
@@ -78,7 +74,7 @@ LifeCycleImpl::LifeCycleImpl(const profile::Profile& profile)
}
bool LifeCycleImpl::StartComponents() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(!last_state_wrapper_);
auto last_state = std::make_shared<resumption::LastStateImpl>(
@@ -123,7 +119,7 @@ bool LifeCycleImpl::StartComponents() {
app_manager_->set_connection_handler(connection_handler_);
app_manager_->AddPolicyObserver(protocol_handler_);
if (!app_manager_->Init(last_state_wrapper_, media_manager_)) {
- LOG4CXX_ERROR(logger_, "Application manager init failed.");
+ SDL_LOG_ERROR("Application manager init failed.");
return false;
}
@@ -146,7 +142,7 @@ bool LifeCycleImpl::StartComponents() {
app_manager_->AddPolicyObserver(security_manager_);
if (!crypto_manager_->Init()) {
- LOG4CXX_ERROR(logger_, "CryptoManager initialization fail.");
+ SDL_LOG_ERROR("CryptoManager initialization fail.");
return false;
}
#endif // ENABLE_SECURITY
@@ -175,7 +171,7 @@ bool LifeCycleImpl::StartComponents() {
app_manager_->set_protocol_handler(protocol_handler_);
if (transport_manager::E_SUCCESS !=
transport_manager_->Init(last_state_wrapper_)) {
- LOG4CXX_ERROR(logger_, "Transport manager init failed.");
+ SDL_LOG_ERROR("Transport manager init failed.");
return false;
}
// start transport manager
@@ -193,7 +189,7 @@ bool LifeCycleImpl::StartComponents() {
}
void LifeCycleImpl::LowVoltage() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager_->PerformActionOnClients(
transport_manager::TransportAction::kListeningOff);
transport_manager_->StopEventsProcessing();
@@ -202,12 +198,12 @@ void LifeCycleImpl::LowVoltage() {
}
void LifeCycleImpl::IgnitionOff() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
kill(getpid(), SIGINT);
}
void LifeCycleImpl::WakeUp() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager_->Reinit();
transport_manager_->PerformActionOnClients(
transport_manager::TransportAction::kListeningOn);
@@ -235,35 +231,35 @@ namespace {
void sig_handler(int sig) {
switch (sig) {
case SIGINT:
- LOG4CXX_DEBUG(logger_, "SIGINT signal has been caught");
+ SDL_LOG_DEBUG("SIGINT signal has been caught");
break;
case SIGTERM:
- LOG4CXX_DEBUG(logger_, "SIGTERM signal has been caught");
+ SDL_LOG_DEBUG("SIGTERM signal has been caught");
break;
case SIGSEGV:
- LOG4CXX_DEBUG(logger_, "SIGSEGV signal has been caught");
- FLUSH_LOGGER();
+ SDL_LOG_DEBUG("SIGSEGV signal has been caught");
+ SDL_FLUSH_LOGGER();
// exit need to prevent endless sending SIGSEGV
// http://stackoverflow.com/questions/2663456/how-to-write-a-signal-handler-to-catch-sigsegv
abort();
default:
- LOG4CXX_DEBUG(logger_, "Unexpected signal has been caught");
+ SDL_LOG_DEBUG("Unexpected signal has been caught");
exit(EXIT_FAILURE);
}
}
} // namespace
void LifeCycleImpl::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Register signal handlers and wait sys signals
// from OS
if (!utils::Signals::WaitTerminationSignals(&sig_handler)) {
- LOG4CXX_FATAL(logger_, "Fail to catch system signal!");
+ SDL_LOG_FATAL("Fail to catch system signal!");
}
}
void LifeCycleImpl::StopComponents() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(hmi_handler_);
hmi_handler_->set_message_observer(NULL);
@@ -277,7 +273,7 @@ void LifeCycleImpl::StopComponents() {
DCHECK_OR_RETURN_VOID(app_manager_);
app_manager_->Stop();
- LOG4CXX_INFO(logger_, "Stopping Protocol Handler");
+ SDL_LOG_INFO("Stopping Protocol Handler");
DCHECK_OR_RETURN_VOID(protocol_handler_);
protocol_handler_->RemoveProtocolObserver(media_manager_);
@@ -285,23 +281,23 @@ void LifeCycleImpl::StopComponents() {
protocol_handler_->RemoveProtocolObserver(security_manager_);
if (security_manager_) {
security_manager_->RemoveListener(app_manager_);
- LOG4CXX_INFO(logger_, "Destroying Crypto Manager");
+ SDL_LOG_INFO("Destroying Crypto Manager");
delete crypto_manager_;
crypto_manager_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying Security Manager");
+ SDL_LOG_INFO("Destroying Security Manager");
delete security_manager_;
security_manager_ = NULL;
}
#endif // ENABLE_SECURITY
protocol_handler_->Stop();
- LOG4CXX_INFO(logger_, "Destroying Media Manager");
+ SDL_LOG_INFO("Destroying Media Manager");
DCHECK_OR_RETURN_VOID(media_manager_);
media_manager_->SetProtocolHandler(NULL);
delete media_manager_;
media_manager_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying Transport Manager.");
+ SDL_LOG_INFO("Destroying Transport Manager.");
DCHECK_OR_RETURN_VOID(transport_manager_);
transport_manager_->PerformActionOnClients(
transport_manager::TransportAction::kVisibilityOff);
@@ -309,31 +305,31 @@ void LifeCycleImpl::StopComponents() {
delete transport_manager_;
transport_manager_ = NULL;
- LOG4CXX_INFO(logger_, "Stopping Connection Handler.");
+ SDL_LOG_INFO("Stopping Connection Handler.");
DCHECK_OR_RETURN_VOID(connection_handler_);
connection_handler_->Stop();
- LOG4CXX_INFO(logger_, "Destroying Protocol Handler");
+ SDL_LOG_INFO("Destroying Protocol Handler");
DCHECK(protocol_handler_);
delete protocol_handler_;
protocol_handler_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying Connection Handler.");
+ SDL_LOG_INFO("Destroying Connection Handler.");
delete connection_handler_;
connection_handler_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying Last State.");
+ SDL_LOG_INFO("Destroying Last State.");
last_state_wrapper_.reset();
- LOG4CXX_INFO(logger_, "Destroying Application Manager.");
+ SDL_LOG_INFO("Destroying Application Manager.");
DCHECK(app_manager_);
delete app_manager_;
app_manager_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying Low Voltage Signals Handler.");
+ SDL_LOG_INFO("Destroying Low Voltage Signals Handler.");
low_voltage_signals_handler_.reset();
- LOG4CXX_INFO(logger_, "Destroying HMI Message Handler and MB adapter.");
+ SDL_LOG_INFO("Destroying HMI Message Handler and MB adapter.");
#ifdef MESSAGEBROKER_HMIADAPTER
if (mb_adapter_) {
@@ -349,7 +345,7 @@ void LifeCycleImpl::StopComponents() {
delete mb_adapter_thread_;
mb_adapter_thread_ = NULL;
}
- LOG4CXX_INFO(logger_, "Destroying Message Broker");
+ SDL_LOG_INFO("Destroying Message Broker");
#endif // MESSAGEBROKER_HMIADAPTER
DCHECK_OR_RETURN_VOID(hmi_handler_);
delete hmi_handler_;
diff --git a/src/appMain/low_voltage_signals_handler.cc b/src/appMain/low_voltage_signals_handler.cc
index bb7bbfbac7..e9760e94e8 100644
--- a/src/appMain/low_voltage_signals_handler.cc
+++ b/src/appMain/low_voltage_signals_handler.cc
@@ -46,7 +46,7 @@
namespace main_namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "LowVoltageSignalsHandler")
+SDL_CREATE_LOG_VARIABLE("LowVoltageSignalsHandler")
LowVoltageSignalsHandler::LowVoltageSignalsHandler(
LifeCycle& life_cycle, const LowVoltageSignalsOffset& offset_data)
@@ -60,7 +60,7 @@ LowVoltageSignalsHandler::LowVoltageSignalsHandler(
, cpid_(-1) {
sigemptyset(&lv_mask_);
sigaddset(&lv_mask_, SIGLOWVOLTAGE_);
- signals_handler_thread_->start();
+ signals_handler_thread_->Start();
}
sigset_t LowVoltageSignalsHandler::LowVoltageSignalsMask() const {
@@ -81,7 +81,7 @@ int LowVoltageSignalsHandler::ignition_off_signo() const {
void LowVoltageSignalsHandler::Destroy() {
if (signals_handler_thread_) {
- signals_handler_thread_->join();
+ signals_handler_thread_->Stop(threads::Thread::kThreadSoftStop);
}
notifications_delegate_.reset();
threads::DeleteThread(signals_handler_thread_);
@@ -93,22 +93,21 @@ LowVoltageSignalsHandler::~LowVoltageSignalsHandler() {
void LowVoltageSignalsHandler::HandleSignal(const int signo) {
if (SIGLOWVOLTAGE_ == signo) {
- LOG4CXX_DEBUG(logger_, "Received LOW_VOLTAGE signal");
+ SDL_LOG_DEBUG("Received LOW_VOLTAGE signal");
life_cycle_.LowVoltage();
cpid_ = utils::Signals::Fork();
if (0 > cpid_) {
- LOG4CXX_FATAL(logger_,
- "Error due fork() call. Error: " << strerror(errno));
+ SDL_LOG_FATAL("Error due fork() call. Error: " << strerror(errno));
utils::Signals::ExitProcess(EXIT_FAILURE);
}
if (0 != cpid_) {
// In Parent process
- LOG4CXX_DEBUG(logger_, "Child PID: " << cpid_);
+ SDL_LOG_DEBUG("Child PID: " << cpid_);
utils::Signals::WaitPid(cpid_, nullptr, 0);
- LOG4CXX_DEBUG(logger_, "Child process: " << cpid_ << " is stopped");
+ SDL_LOG_DEBUG("Child process: " << cpid_ << " is stopped");
life_cycle_.WakeUp();
} else {
// In Child process
@@ -148,8 +147,7 @@ void NotificationThreadDelegate::threadMain() {
low_voltage_signals_handler_.LowVoltageSignalsMask();
const int err = sigwait(&lv_mask, &signo);
if (0 != err) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Sigwait() error! Signals set contains an invalid signal number!");
continue;
}
@@ -158,7 +156,7 @@ void NotificationThreadDelegate::threadMain() {
}
void NotificationThreadDelegate::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ThreadDelegate::exitThreadMain();
}
diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index ade6a0054c..34c5b4dbfa 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -42,10 +42,11 @@
#include <vector>
// ----------------------------------------------------------------------------
-
#ifdef ENABLE_LOG
-#include "utils/log_message_loop_thread.h"
+#include "utils/logger/log4cxxlogger.h"
+#include "utils/logger/logger_impl.h"
#endif // ENABLE_LOG
+
#include "utils/logger.h"
#include "appMain/life_cycle_impl.h"
@@ -62,7 +63,7 @@
#include "media_manager/media_manager_impl.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
+SDL_CREATE_LOG_VARIABLE("SDLMain")
namespace {
@@ -79,7 +80,7 @@ const std::string kLocalHostAddress = "127.0.0.1";
bool InitHmi(std::string hmi_link) {
struct stat sb;
if (stat(hmi_link.c_str(), &sb) == -1) {
- LOG4CXX_FATAL(logger_, "HMI index file " << hmi_link << " doesn't exist!");
+ SDL_LOG_FATAL("HMI index file " << hmi_link << " doesn't exist!");
return false;
}
return utils::System(kBrowser, kBrowserName)
@@ -103,6 +104,12 @@ int32_t main(int32_t argc, char** argv) {
exit(EXIT_FAILURE);
}
+#ifdef ENABLE_LOG
+ auto logger_impl =
+ std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl());
+ logger::Logger::instance(logger_impl.get());
+#endif // ENABLE_LOG
+
// --------------------------------------------------------------------------
// Components initialization
profile::Profile profile_instance;
@@ -131,57 +138,61 @@ int32_t main(int32_t argc, char** argv) {
exit(EXIT_FAILURE);
}
- // --------------------------------------------------------------------------
- // Logger initialization
- INIT_LOGGER("log4cxx.properties", profile_instance.logs_enabled());
+#ifdef ENABLE_LOG
+ if (profile_instance.logs_enabled()) {
+ // Logger initialization
+ // Redefine for each paticular logger implementation
+ auto logger = std::unique_ptr<logger::Log4CXXLogger>(
+ new logger::Log4CXXLogger("log4cxx.properties"));
+ logger_impl->Init(std::move(logger));
+ }
+#endif
threads::Thread::SetNameForId(threads::Thread::CurrentId(), "SDLCore");
if (!utils::appenders_loader.Loaded()) {
- LOG4CXX_ERROR(logger_,
- "Appenders plugin not loaded, file logging disabled");
+ SDL_LOG_ERROR("Appenders plugin not loaded, file logging disabled");
}
- LOG4CXX_INFO(logger_, "Application started!");
- LOG4CXX_INFO(logger_, "SDL version: " << profile_instance.sdl_version());
+ SDL_LOG_INFO("Application started!");
+ SDL_LOG_INFO("SDL version: " << profile_instance.sdl_version());
// Check if no error values were read from config file
if (profile_instance.ErrorOccured()) {
- LOG4CXX_FATAL(logger_, profile_instance.ErrorDescription());
- FLUSH_LOGGER();
- DEINIT_LOGGER();
+ SDL_LOG_FATAL(profile_instance.ErrorDescription());
+ SDL_DEINIT_LOGGER();
exit(EXIT_FAILURE);
}
// --------------------------------------------------------------------------
// Components initialization
if (!life_cycle->StartComponents()) {
- LOG4CXX_FATAL(logger_, "Failed to start components");
+ SDL_LOG_FATAL("Failed to start components");
life_cycle->StopComponents();
- DEINIT_LOGGER();
+ SDL_DEINIT_LOGGER();
exit(EXIT_FAILURE);
}
- LOG4CXX_INFO(logger_, "Components Started");
+ SDL_LOG_INFO("Components Started");
// --------------------------------------------------------------------------
// Third-Party components initialization.
if (!life_cycle->InitMessageSystem()) {
- LOG4CXX_FATAL(logger_, "Failed to init message system");
+ SDL_LOG_FATAL("Failed to init message system");
life_cycle->StopComponents();
- DEINIT_LOGGER();
+ SDL_DEINIT_LOGGER();
_exit(EXIT_FAILURE);
}
- LOG4CXX_INFO(logger_, "InitMessageBroker successful");
+ SDL_LOG_INFO("InitMessageBroker successful");
if (profile_instance.launch_hmi()) {
if (profile_instance.server_address() == kLocalHostAddress) {
- LOG4CXX_INFO(logger_, "Start HMI on localhost");
+ SDL_LOG_INFO("Start HMI on localhost");
#ifdef WEB_HMI
if (!InitHmi(profile_instance.link_to_web_hmi())) {
- LOG4CXX_INFO(logger_, "InitHmi successful");
+ SDL_LOG_INFO("InitHmi successful");
} else {
- LOG4CXX_WARN(logger_, "Failed to init HMI");
+ SDL_LOG_WARN("Failed to init HMI");
}
#endif
}
@@ -189,12 +200,12 @@ int32_t main(int32_t argc, char** argv) {
// --------------------------------------------------------------------------
life_cycle->Run();
- LOG4CXX_INFO(logger_, "Stop SDL due to caught signal");
+ SDL_LOG_INFO("Stop SDL due to caught signal");
life_cycle->StopComponents();
- LOG4CXX_INFO(logger_, "Application has been stopped successfuly");
+ SDL_LOG_INFO("Application has been stopped successfuly");
- DEINIT_LOGGER();
+ SDL_DEINIT_LOGGER();
return EXIT_SUCCESS;
}
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index f04a00570b..9f1b0490f3 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -422,6 +422,20 @@
"LIMITED",
"BACKGROUND"
]
+ },
+ "OnUpdateFile": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "OnUpdateSubMenu": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
}
}
},
diff --git a/src/appMain/signal_handlers.cc b/src/appMain/signal_handlers.cc
index c9c09d10a2..5386cacc99 100644
--- a/src/appMain/signal_handlers.cc
+++ b/src/appMain/signal_handlers.cc
@@ -35,6 +35,6 @@
#include "utils/logger.h"
namespace main_namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
+SDL_CREATE_LOG_VARIABLE("SDLMain")
} // namespace main_namespace
diff --git a/src/components/application_manager/include/application_manager/app_extension.h b/src/components/application_manager/include/application_manager/app_extension.h
index 5167aa88c0..3b1db4de57 100644
--- a/src/components/application_manager/include/application_manager/app_extension.h
+++ b/src/components/application_manager/include/application_manager/app_extension.h
@@ -33,15 +33,18 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_
+#include <functional>
#include <memory>
-namespace ns_smart_device_link {
-namespace ns_smart_objects {
-class SmartObject;
-}
-} // namespace ns_smart_device_link
+#include "smart_objects/smart_object.h"
+
+namespace resumption {
+struct ResumptionRequest;
+class ResumptionDataProcessor;
+} // namespace resumption
namespace application_manager {
+namespace ns_smart = ns_smart_device_link::ns_smart_objects;
typedef int AppExtensionUID;
@@ -59,16 +62,23 @@ class AppExtension {
* @param resumption_data data reference to data, that will be appended by
* plugin
*/
- virtual void SaveResumptionData(
- ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) = 0;
+ virtual void SaveResumptionData(ns_smart::SmartObject& resumption_data) = 0;
/**
* @brief ProcessResumption Method called by SDL during resumption.
* @param resumption_data list of resumption data
+ * @param subscriber callbacks for subscribing
*/
virtual void ProcessResumption(
- const ns_smart_device_link::ns_smart_objects::SmartObject&
- resumption_data) = 0;
+ const ns_smart::SmartObject& resumption_data) = 0;
+
+ /**
+ * @brief RevertResumption Method called by SDL during revert resumption.
+ * @param resumption_data Resumption data in the SmartObject representation
+ * that contains subscription (VehicleInfo, RemoteControl, etc.)
+ */
+ virtual void RevertResumption(
+ const ns_smart::SmartObject& resumption_data) = 0;
private:
const AppExtensionUID kUid_;
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index a595fc7379..6280d83278 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -348,7 +348,7 @@ class DynamicApplicationData {
/*
* @brief Finds command with the specified command id
*/
- virtual smart_objects::SmartObject* FindCommand(uint32_t cmd_id) = 0;
+ virtual smart_objects::SmartObject FindCommand(uint32_t cmd_id) = 0;
/*
* @brief Adds a menu to the application
@@ -364,7 +364,7 @@ class DynamicApplicationData {
/*
* @brief Finds menu with the specified id
*/
- virtual smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const = 0;
+ virtual smart_objects::SmartObject FindSubMenu(uint32_t menu_id) const = 0;
/*
* @brief Returns true if sub menu with such name already exist
@@ -407,7 +407,7 @@ class DynamicApplicationData {
*
* @param choice_set_id Unique ID of the interaction choice set
*/
- virtual smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id) = 0;
+ virtual smart_objects::SmartObject FindChoiceSet(uint32_t choice_set_id) = 0;
/*
* @brief Adds perform interaction choice set to the application
@@ -610,6 +610,9 @@ class Application : public virtual InitialApplicationData,
virtual void set_mobile_projection_enabled(bool option) = 0;
virtual bool mobile_projection_enabled() const = 0;
+ virtual void set_webengine_projection_enabled(const bool option) = 0;
+ virtual bool webengine_projection_enabled() const = 0;
+
virtual bool video_streaming_approved() const = 0;
virtual void set_video_streaming_approved(bool state) = 0;
virtual bool audio_streaming_approved() const = 0;
diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h
index f04d3122fa..a64e0c8f33 100644
--- a/src/components/application_manager/include/application_manager/application_data_impl.h
+++ b/src/components/application_manager/include/application_manager/application_data_impl.h
@@ -174,7 +174,7 @@ class DynamicApplicationDataImpl : public virtual Application {
* @brief Finds command with the specified command id
* @param[in] cmd_id Command id
*/
- smart_objects::SmartObject* FindCommand(const uint32_t cmd_id);
+ smart_objects::SmartObject FindCommand(const uint32_t cmd_id) OVERRIDE;
/*
* @brief Adds a menu to the application
@@ -189,7 +189,7 @@ class DynamicApplicationDataImpl : public virtual Application {
/*
* @brief Finds menu with the specified id
*/
- smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const;
+ smart_objects::SmartObject FindSubMenu(uint32_t menu_id) const OVERRIDE;
/*
* @brief Returns true if sub menu with such name already exist
@@ -223,7 +223,7 @@ class DynamicApplicationDataImpl : public virtual Application {
*
* @param choice_set_id Unique ID of the interaction choice set
*/
- smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id);
+ smart_objects::SmartObject FindChoiceSet(uint32_t choice_set_id) OVERRIDE;
/*
* @brief Adds perform interaction choice set to the application
@@ -332,12 +332,14 @@ class DynamicApplicationDataImpl : public virtual Application {
SubMenuMap sub_menu_;
mutable std::shared_ptr<sync_primitives::RecursiveLock> sub_menu_lock_ptr_;
ChoiceSetMap choice_set_map_;
- mutable std::shared_ptr<sync_primitives::Lock> choice_set_map_lock_ptr_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ choice_set_map_lock_ptr_;
PerformChoiceSetMap performinteraction_choice_set_map_;
mutable std::shared_ptr<sync_primitives::RecursiveLock>
performinteraction_choice_set_lock_ptr_;
WindowParamsMap window_params_map_;
- mutable std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ window_params_map_lock_ptr_;
uint32_t is_perform_interaction_active_;
bool is_reset_global_properties_active_;
int32_t perform_interaction_mode_;
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 185d700d58..1e24addf4a 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -113,7 +113,7 @@ class ApplicationImpl : public virtual Application,
inline bool is_navi() const {
return is_navi_;
}
- void set_is_navi(bool allow);
+ void set_is_navi(bool option);
virtual bool is_remote_control_supported() const;
@@ -123,6 +123,9 @@ class ApplicationImpl : public virtual Application,
bool mobile_projection_enabled() const;
+ void set_webengine_projection_enabled(const bool option) OVERRIDE;
+ bool webengine_projection_enabled() const OVERRIDE;
+
bool video_streaming_approved() const;
void set_video_streaming_approved(bool state);
bool audio_streaming_approved() const;
@@ -143,8 +146,7 @@ class ApplicationImpl : public virtual Application,
uint32_t timer_len = 0);
virtual bool is_voice_communication_supported() const;
- virtual void set_voice_communication_supported(
- bool is_voice_communication_supported);
+ virtual void set_voice_communication_supported(bool option);
inline bool app_allowed() const;
bool has_been_activated() const;
bool set_activated(bool is_active);
@@ -184,7 +186,7 @@ class ApplicationImpl : public virtual Application,
bool keep_context();
void set_version(const Version& ver);
void set_name(const custom_str::CustomString& name);
- void set_is_media_application(bool is_media);
+ void set_is_media_application(bool option);
void increment_put_file_in_none_count();
void increment_delete_file_in_none_count();
void increment_list_files_in_none_count();
@@ -565,6 +567,7 @@ class ApplicationImpl : public virtual Application,
bool is_navi_;
bool is_remote_control_supported_;
bool mobile_projection_enabled_;
+ bool webengine_projection_enabled_;
bool video_streaming_approved_;
bool audio_streaming_approved_;
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index c24460943b..31040aca72 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -132,7 +132,7 @@ struct AppIconInfo {
: endpoint(ws_endpoint), pending_request(pending) {}
};
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
typedef std::shared_ptr<timer::Timer> TimerSPtr;
class ApplicationManagerImpl
@@ -279,11 +279,11 @@ class ApplicationManagerImpl
/**
* @brief Checks if Application is subscribed for way points
- * @param Application pointer
+ * @param Application reference
* @return true if Application is subscribed for way points
* otherwise false
*/
- bool IsAppSubscribedForWayPoints(ApplicationSharedPtr app) const OVERRIDE;
+ bool IsAppSubscribedForWayPoints(Application& app) const OVERRIDE;
void SaveWayPointsMessage(
smart_objects::SmartObjectSPtr way_points_message) OVERRIDE;
@@ -983,6 +983,13 @@ class ApplicationManagerImpl
*/
void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE;
+ ResetGlobalPropertiesResult ResetGlobalProperties(
+ const smart_objects::SmartObject& global_properties_ids,
+ const uint32_t app_id) OVERRIDE;
+
+ ResetGlobalPropertiesResult ResetAllApplicationGlobalProperties(
+ const uint32_t app_id) OVERRIDE;
+
// TODO(AOleynik): Temporary added, to fix build. Should be reworked.
connection_handler::ConnectionHandler& connection_handler() const OVERRIDE;
protocol_handler::ProtocolHandler& protocol_handler() const OVERRIDE;
@@ -1241,14 +1248,12 @@ class ApplicationManagerImpl
void PrepareApplicationListSO(ApplicationList app_list,
smart_objects::SmartObject& applications,
ApplicationManager& app_mngr) {
- CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager");
-
smart_objects::SmartArray* app_array = applications.asArray();
uint32_t app_count = NULL == app_array ? 0 : app_array->size();
typename ApplicationList::const_iterator it;
for (it = app_list.begin(); it != app_list.end(); ++it) {
if (it->use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Application not found ");
+ SDL_LOG_ERROR("Application not found");
continue;
}
@@ -1262,12 +1267,12 @@ class ApplicationManagerImpl
app_mngr)) {
applications[app_count++] = hmi_application;
} else {
- LOG4CXX_DEBUG(logger_, "Can't CreateHMIApplicationStruct ");
+ SDL_LOG_DEBUG("Can't CreateHMIApplicationStruct");
}
}
if (0 == app_count) {
- LOG4CXX_WARN(logger_, "Empty applications list");
+ SDL_LOG_WARN("Empty applications list");
}
}
@@ -1328,6 +1333,39 @@ class ApplicationManagerImpl
*/
void SendMobileMessage(smart_objects::SmartObjectSPtr message);
+ /**
+ * @brief Sets default value of the HELPPROMT global property
+ * to the first vrCommand of the Command Menu registered in application
+ *
+ * @param app Registered application
+ * @param is_timeout_promp Flag indicating that timeout prompt
+ * should be reset
+ *
+ * @return TRUE on success, otherwise FALSE
+ */
+ bool ResetHelpPromt(ApplicationSharedPtr app) const;
+
+ /**
+ * @brief Sets default value of the TIMEOUTPROMT global property
+ * to the first vrCommand of the Command Menu registered in application
+ *
+ * @param app Registered application
+ *
+ * @return TRUE on success, otherwise FALSE
+ */
+ bool ResetTimeoutPromt(ApplicationSharedPtr app) const;
+
+ /**
+ * @brief Sets default value of the VRHELPTITLE global property
+ * to the application name and value of the VRHELPITEMS global property
+ * to value equal to registered command -1(default command “Help / Cancel”.)
+ *
+ * @param app Registered application
+ *
+ * @return TRUE on success, otherwise FALSE
+ */
+ bool ResetVrHelpTitleItems(ApplicationSharedPtr app) const;
+
private:
/*
* NaviServiceStatusMap shows which navi service (audio/video) is opened
@@ -1352,6 +1390,16 @@ class ApplicationManagerImpl
const std::string& policy_app_id) const;
/**
+ * @brief CreateAllAppGlobalPropsIDList creates an array of all application
+ * global properties IDs. Used as utility to call
+ * ApplicationManger::ResetGlobalProperties
+ * with all global properties.
+ * @return array smart object with global properties identifiers.
+ */
+ const smart_objects::SmartObjectSPtr CreateAllAppGlobalPropsIDList(
+ const uint32_t app_id) const;
+
+ /**
* @brief Removes suspended and stopped timers from timer pool
*/
void ClearTimerPool();
diff --git a/src/components/application_manager/include/application_manager/application_state.h b/src/components/application_manager/include/application_manager/application_state.h
index 8c4d2d49d6..9d80df0590 100644
--- a/src/components/application_manager/include/application_manager/application_state.h
+++ b/src/components/application_manager/include/application_manager/application_state.h
@@ -45,6 +45,7 @@ namespace application_manager {
typedef std::vector<WindowID> WindowIds;
typedef std::vector<HmiStatePtr> HmiStates;
typedef std::map<WindowID, HmiStates> HmiStatesMap;
+typedef std::map<WindowID, HmiStatePtr> HmiStateMap;
typedef std::vector<std::string> WindowNames;
typedef std::map<WindowID, std::string> WindowNamesMap;
@@ -143,6 +144,15 @@ class ApplicationState {
void RemoveHMIState(const WindowID window_id, HmiState::StateID state_id);
/**
+ * @brief EraseHMIState safely erases an HMI State from a window's HMIStates
+ * list
+ *
+ * @param hmi_states HMI States list.
+ * @param it Iterator pointing to element to be removed.
+ */
+ void EraseHMIState(HmiStates& hmi_states, HmiStates::iterator it);
+
+ /**
* @brief RemoveWindowHMIStates removes all HMI states related to specified
* window
* @param window_id window ID to remove
@@ -202,6 +212,16 @@ class ApplicationState {
*/
mutable sync_primitives::Lock hmi_states_map_lock_;
+ /**
+ * @brief Postponed states of application
+ */
+ HmiStateMap postponed_states_map_;
+
+ /**
+ * @brief postponed_states_map_lock_
+ */
+ mutable sync_primitives::Lock postponed_states_map_lock_;
+
DISALLOW_COPY_AND_ASSIGN(ApplicationState);
};
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h
index 151c4d7874..e3e30a9eff 100644
--- a/src/components/application_manager/include/application_manager/commands/command_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_impl.h
@@ -218,10 +218,6 @@ class CommandImpl : public Command {
CommandParametersPermissions parameters_permissions_;
CommandParametersPermissions removed_parameters_permissions_;
-#ifdef ENABLE_LOG
- static log4cxx::LoggerPtr logger_;
-#endif // ENABLE_LOG
-
private:
DISALLOW_COPY_AND_ASSIGN(CommandImpl);
};
diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_impl.h
index 2274bc5f3b..2f6db37eb8 100644
--- a/src/components/application_manager/include/application_manager/commands/command_notification_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_notification_impl.h
@@ -51,7 +51,14 @@ class CommandNotificationImpl : public CommandImpl {
virtual bool Init();
virtual bool CleanUp();
virtual void Run();
- void SendNotification();
+
+ /**
+ * @brief SendNotification Constructs the message with Message Type
+ * Notification and send it to mobile.
+ * @param final_message if true - connection to mobile will be closed
+ * after processing this message
+ */
+ void SendNotification(const bool final_message = false);
private:
DISALLOW_COPY_AND_ASSIGN(CommandNotificationImpl);
diff --git a/src/components/application_manager/include/application_manager/display_capabilities_builder.h b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
index 529c9a32c1..6810bfee8c 100644
--- a/src/components/application_manager/include/application_manager/display_capabilities_builder.h
+++ b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
@@ -68,6 +68,16 @@ class DisplayCapabilitiesBuilder {
const smart_objects::SmartObject& display_capabilities);
/**
+ * @brief IsWaitingForWindowCapabilities checks wheter builder is waiting for
+ * a capabilities notification for at least one window or not
+ * @param incoming_display_capabilities capabilities to analyze
+ * @return true if builder is waiting for capabilities for at least one
+ * window, otherwise returns false
+ */
+ bool IsWaitingForWindowCapabilities(
+ const smart_objects::SmartObject& incoming_display_capabilities) const;
+
+ /**
* @brief ResetDisplayCapabilities resets stored notification
*/
void ResetDisplayCapabilities();
@@ -84,13 +94,29 @@ class DisplayCapabilitiesBuilder {
*/
const smart_objects::SmartObjectSPtr display_capabilities() const;
+ /**
+ * @brief IsWindowResumptionNeeded checks that is there a need for
+ * resumption of windows (except main window)
+ * @return true if data about windows to be resumed was saved in window_info,
+ * otherwise returns false
+ */
+
+ bool IsWindowResumptionNeeded() const;
+
private:
+ /**
+ * @brief InvokeResumeCallback invokes resume callback function if all
+ * required criteria is met
+ */
+ void InvokeResumeCallback();
+
smart_objects::SmartObjectSPtr display_capabilities_;
typedef std::set<WindowID> WindowIDsToResume;
WindowIDsToResume window_ids_to_resume_;
Application& owner_;
ResumeCallback resume_callback_;
- sync_primitives::Lock display_capabilities_lock_;
+ mutable sync_primitives::Lock display_capabilities_lock_;
+ bool is_widget_windows_resumption_;
};
} // namespace application_manager
#endif
diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h
index 5b9e201391..e3a9784346 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -117,10 +117,27 @@ class HmiState {
*/
virtual mobile_apis::HMILevel::eType hmi_level() const {
if (parent_) {
- return parent_->hmi_level();
+ if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level_) {
+ return parent_->hmi_level();
+ }
+ // Higher values correlate to lower states
+ // (FULL = 0, LIMITED = 1, etc.)
+ return std::max(parent_->max_hmi_level(), hmi_level_);
}
return hmi_level_;
}
+
+ /**
+ * @brief max_hmi_level
+ * @return return maximum hmi level for app
+ */
+ virtual mobile_apis::HMILevel::eType max_hmi_level() const {
+ if (parent_) {
+ return parent_->max_hmi_level();
+ }
+ return mobile_apis::HMILevel::HMI_FULL;
+ }
+
/**
* @brief set_hmi_level set hmi_level member
* @param hmi_level hmi level to setup
@@ -136,24 +153,62 @@ class HmiState {
virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
const {
if (parent_) {
- return parent_->audio_streaming_state();
+ if (mobile_apis::AudioStreamingState::INVALID_ENUM ==
+ audio_streaming_state_) {
+ return parent_->audio_streaming_state();
+ }
+ // Higher values correlate to lower states
+ // (AUDIBLE = 0, ATTENUATED = 1, etc.)
+ return std::max(parent_->max_audio_streaming_state(),
+ audio_streaming_state_);
}
return audio_streaming_state_;
}
/**
+ * @brief max_audio_streaming_state
+ * @return return maximum audio streaming state for app
+ */
+ virtual mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const {
+ if (parent_) {
+ return parent_->max_audio_streaming_state();
+ }
+ return mobile_apis::AudioStreamingState::AUDIBLE;
+ }
+
+ /**
* @brief video_streaming_state
* @return return video streaming state member
*/
virtual mobile_apis::VideoStreamingState::eType video_streaming_state()
const {
if (parent_) {
- return parent_->video_streaming_state();
+ if (mobile_apis::VideoStreamingState::INVALID_ENUM ==
+ video_streaming_state_) {
+ return parent_->video_streaming_state();
+ }
+ // Higher values correlate to lower states
+ // (STREAMABLE = 0, NOT_STREAMABLE = 1)
+ return std::max(parent_->max_video_streaming_state(),
+ video_streaming_state_);
}
return video_streaming_state_;
}
/**
+ * @brief max_video_streaming_state
+ * @return return maximum video streaming state for app
+ */
+ virtual mobile_apis::VideoStreamingState::eType max_video_streaming_state()
+ const {
+ if (parent_) {
+ return parent_->max_video_streaming_state();
+ }
+ return mobile_apis::VideoStreamingState::STREAMABLE;
+ }
+
+ /**
* @brief set_video_streaming_state set set_video_streaming_state member
* @param video_state video_state to setup
*/
@@ -176,7 +231,9 @@ class HmiState {
* @return return system context member
*/
virtual mobile_apis::SystemContext::eType system_context() const {
- if (parent_) {
+ // Parent's context should be used if not available for current state
+ if (parent_ &&
+ system_context_ == mobile_apis::SystemContext::INVALID_ENUM) {
return parent_->system_context();
}
return system_context_;
@@ -238,6 +295,12 @@ class HmiState {
bool is_navi_app() const;
/**
+ * @brief is_projection_app check if app is projection
+ * @return true if app is projection, otherwise return false
+ */
+ bool is_projection_app() const;
+
+ /**
* @brief is_media_app check if app is media
* @return true if media_app, otherwise return false
*/
@@ -256,6 +319,48 @@ class HmiState {
*/
bool is_mobile_projection_app() const;
+ /**
+ * @brief parent_hmi_level
+ * @return return hmi level for parent state if available, otherwise return
+ * HMI_NONE
+ */
+ mobile_apis::HMILevel::eType parent_hmi_level() const;
+
+ /**
+ * @brief parent_max_hmi_level
+ * @return return maximum hmi level for parent state if available, otherwise
+ * return HMI_FULL
+ */
+ mobile_apis::HMILevel::eType parent_max_hmi_level() const;
+
+ /**
+ * @brief parent_audio_state
+ * @return return audio streaming state for parent state if available,
+ * otherwise return NOT_AUDIBLE
+ */
+ mobile_apis::AudioStreamingState::eType parent_audio_state() const;
+
+ /**
+ * @brief parent_max_audio_state
+ * @return return maximum audio streaming state for parent state if available,
+ * otherwise return AUDIBLE
+ */
+ mobile_apis::AudioStreamingState::eType parent_max_audio_state() const;
+
+ /**
+ * @brief parent_video_state
+ * @return return video streaming state for parent state if available,
+ * otherwise return NOT_STREAMABLE
+ */
+ mobile_apis::VideoStreamingState::eType parent_video_state() const;
+
+ /**
+ * @brief parent_max_video_state
+ * @return return maximum video streaming statefor parent state if available,
+ * otherwise return STREAMABLE
+ */
+ mobile_apis::VideoStreamingState::eType parent_max_video_state() const;
+
private:
void operator=(const HmiState&);
};
@@ -267,6 +372,8 @@ class VRHmiState : public HmiState {
public:
virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE;
+ virtual mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE;
VRHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
};
@@ -281,6 +388,9 @@ class TTSHmiState : public HmiState {
virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE;
+
+ virtual mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE;
};
/**
@@ -294,6 +404,9 @@ class VideoStreamingHmiState : public HmiState {
mobile_apis::VideoStreamingState::eType video_streaming_state()
const OVERRIDE;
+
+ mobile_apis::VideoStreamingState::eType max_video_streaming_state()
+ const OVERRIDE;
};
/**
@@ -307,6 +420,9 @@ class NaviStreamingHmiState : public VideoStreamingHmiState {
mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE;
+
+ mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE;
};
/**
@@ -323,6 +439,12 @@ class PhoneCallHmiState : public HmiState {
const OVERRIDE {
return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
}
+
+ mobile_apis::HMILevel::eType max_hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE {
+ return audio_streaming_state();
+ }
};
/**
@@ -342,6 +464,15 @@ class SafetyModeHmiState : public HmiState {
const OVERRIDE {
return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
}
+
+ mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE {
+ return audio_streaming_state();
+ }
+ mobile_apis::VideoStreamingState::eType max_video_streaming_state()
+ const OVERRIDE {
+ return video_streaming_state();
+ }
};
/**
@@ -362,6 +493,16 @@ class DeactivateHMI : public HmiState {
const OVERRIDE {
return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
}
+
+ mobile_apis::HMILevel::eType max_hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE {
+ return audio_streaming_state();
+ }
+ mobile_apis::VideoStreamingState::eType max_video_streaming_state()
+ const OVERRIDE {
+ return video_streaming_state();
+ }
};
/**
@@ -375,13 +516,15 @@ class AudioSource : public HmiState {
mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType audio_streaming_state()
- const OVERRIDE {
- return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
- }
+ const OVERRIDE;
mobile_apis::VideoStreamingState::eType video_streaming_state()
- const OVERRIDE {
- return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
- }
+ const OVERRIDE;
+
+ mobile_apis::HMILevel::eType max_hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE;
+ mobile_apis::VideoStreamingState::eType max_video_streaming_state()
+ const OVERRIDE;
private:
bool keep_context_;
@@ -399,13 +542,15 @@ class EmbeddedNavi : public HmiState {
mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType audio_streaming_state()
- const OVERRIDE {
- return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
- }
+ const OVERRIDE;
mobile_apis::VideoStreamingState::eType video_streaming_state()
- const OVERRIDE {
- return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
- }
+ const OVERRIDE;
+
+ mobile_apis::HMILevel::eType max_hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
+ const OVERRIDE;
+ mobile_apis::VideoStreamingState::eType max_video_streaming_state()
+ const OVERRIDE;
};
/**
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 1d03ef44db..7af9bacf27 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -61,7 +61,41 @@ class PolicyHandlerInterface;
namespace application_manager {
namespace mobile_api = mobile_apis;
-/*
+/**
+ * @brief ResetGlobalPropertiesResult
+ * contains flags indicating success of
+ * ResetGlobalProperties operation.
+ * Used in MessageHelper functions
+ * to construct relevant requests
+ **/
+struct ResetGlobalPropertiesResult {
+ bool help_prompt;
+ bool timeout_prompt;
+ bool vr_help_title_items;
+ bool menu_name;
+ bool menu_icon;
+ bool keyboard_properties;
+ bool vr_has_been_reset;
+
+ ResetGlobalPropertiesResult()
+ : help_prompt(false)
+ , timeout_prompt(false)
+ , vr_help_title_items(false)
+ , menu_name(false)
+ , menu_icon(false)
+ , keyboard_properties(false)
+ , vr_has_been_reset(false) {}
+
+ bool HasUIPropertiesReset() const {
+ return vr_help_title_items || menu_name || menu_icon || keyboard_properties;
+ }
+
+ bool HasTTSPropertiesReset() const {
+ return timeout_prompt || help_prompt;
+ }
+};
+
+/**
* @brief Typedef for VehicleData
*
* @param const char* Name of the parameter in mobile request
@@ -172,7 +206,7 @@ class MessageHelper {
static void SendGetSystemTimeRequest(const uint32_t correlation_id,
ApplicationManager& app_mngr);
- /*
+ /**
* @brief Retrieve vehicle data map for param name in mobile request
* to VehicleDataType
*
@@ -214,7 +248,7 @@ class MessageHelper {
const uint32_t correlation_id,
uint32_t connection_key);
- /*
+ /**
* @brief Prepare GetDeviceListResponse
*
*
@@ -234,6 +268,10 @@ class MessageHelper {
/**
* @brief Sends button subscription notification
+ * @param app_id Application ID
+ * @param button Enum with button name
+ * @param is_subscribed true if subscribed, false otherwise
+ * @param app_mngr reference to application manager
*/
static void SendOnButtonSubscriptionNotification(
const uint32_t app_id,
@@ -242,18 +280,46 @@ class MessageHelper {
ApplicationManager& app_mngr);
/**
+ * @brief Creates button subscription notification
+ * @param app_id Application ID
+ * @param button Enum with button name
+ * @param is_subscribed true if subscribed, false otherwise
+ * @return notification message in SmartObject format
+ */
+ static smart_objects::SmartObjectSPtr CreateOnButtonSubscriptionNotification(
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button,
+ const bool is_subscribed);
+
+ /**
* @brief Sends button subscription notifications for all buttons
* that application is subscribed on
+ * @param app shared pointer to application instance
+ * @param app_mngr reference to application manager
*/
static void SendAllOnButtonSubscriptionNotificationsForApp(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+ /**
+ * @brief Creates button subscription notifications for buttons
+ * that application is subscribed on
+ * @param app shared pointer to application instance
+ * @param app_mngr reference to application manager
+ * @param button_subscriptions collection of subscribed buttons
+ * @return list of notification messages in SmartObject format
+ */
+ static smart_objects::SmartObjectList
+ CreateOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr,
+ const ButtonSubscriptions& button_subscriptions);
+
static void SendAppDataToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_man);
static void SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr);
static smart_objects::SmartObjectList CreateGlobalPropertiesRequestsToHMI(
- ApplicationConstSharedPtr app, const uint32_t correlation_id);
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
static smart_objects::SmartObjectSPtr CreateAppVrHelp(
ApplicationConstSharedPtr app);
@@ -264,8 +330,6 @@ class MessageHelper {
ApplicationManager& app_mngr);
static void SendShowConstantTBTRequestToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_man);
- static void SendAddCommandRequestToHMI(ApplicationConstSharedPtr app,
- ApplicationManager& app_man);
static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
@@ -279,11 +343,6 @@ class MessageHelper {
*/
static void SendUIChangeRegistrationRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
- static void SendAddVRCommandToHMI(
- uint32_t cmd_id,
- const smart_objects::SmartObject& vr_commands,
- const uint32_t app_id,
- ApplicationManager& app_mngr);
static smart_objects::SmartObjectSPtr CreateAddVRCommandToHMI(
uint32_t cmd_id,
@@ -315,7 +374,7 @@ class MessageHelper {
ApplicationManager& app_mngr,
const smart_objects::SmartObject& windows_info);
- /*
+ /**
* @brief Create Common.DeviceInfo struct from device handle
* @param device_handle device handle of the app
* @param session_observer instance of SessionObserver to retrieve device
@@ -333,7 +392,7 @@ class MessageHelper {
ApplicationManager& app_mngr,
smart_objects::SmartObject* output);
- /*
+ /**
* @brief Create Common.HMIApplication struct application instance
* @param app : applicaton instace
* @param output smart object to store Common.HMIApplication struct
@@ -348,10 +407,10 @@ class MessageHelper {
static void SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr);
- static smart_objects::SmartObjectList CreateAddSubMenuRequestToHMI(
- ApplicationConstSharedPtr app, const uint32_t correlation_id);
+ static smart_objects::SmartObjectList CreateAddSubMenuRequestsToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
- /*
+ /**
* @brief Creates BasicCommunication.OnAppUnregistered notification
* @param app Application instance
* @param is_unexpected_disconnect
@@ -439,7 +498,7 @@ class MessageHelper {
ApplicationManager& app_mngr);
#endif // EXTERNAL_PROPRIETARY_MODE
- /*
+ /**
* @brief Sends SetVideoConfig request to HMI to negotiate video parameters
*
* @param app_id the application which will start video streaming
@@ -451,7 +510,7 @@ class MessageHelper {
ApplicationManager& app_mngr,
const smart_objects::SmartObject& video_params);
- /*
+ /**
* @brief Sends notification to HMI to start video streaming
*
* @param connection_key Application connection key
@@ -459,7 +518,7 @@ class MessageHelper {
*/
static void SendNaviStartStream(int32_t app_id, ApplicationManager& app_mngr);
- /*
+ /**
* @brief Sends notification to HMI to stop video streaming
*
* @param connection_key Application connection key
@@ -467,7 +526,7 @@ class MessageHelper {
*/
static void SendNaviStopStream(int32_t app_id, ApplicationManager& app_mngr);
- /*
+ /**
* @brief Send notification for Update of Policy Table
* with PT Snapshot.
* @param connection_key Id of application to send message to
@@ -481,7 +540,7 @@ class MessageHelper {
const std::string& url,
ApplicationManager& app_mngr);
- /*
+ /**
* @brief Send notification for Update of Policy Table
* with PT Snapshot.
* @param connection_key Id of application to send message to
@@ -521,7 +580,7 @@ class MessageHelper {
static void SendQueryApps(const uint32_t connection_key,
ApplicationManager& app_man);
- /*
+ /**
* @brief Send notification to mobile on application permissions update
* @param connection_key Id of application to send message to
* @param permissions updated permissions for application
@@ -534,7 +593,7 @@ class MessageHelper {
ApplicationManager& app_mngr,
const policy::EncryptionRequired encryprion_required);
- /*
+ /**
* @brief Send notification to HMI on application permissions update
* @param connection_key Id of application to send message to
* @param permissions updated permissions for application
@@ -575,7 +634,7 @@ class MessageHelper {
*/
static void SendGetSystemInfoRequest(ApplicationManager& app_mngr);
- /*
+ /**
* @brief Sends notification to HMI to start audio streaming
*
* @param connection_key Application connection key
@@ -584,7 +643,7 @@ class MessageHelper {
static void SendAudioStartStream(int32_t app_id,
ApplicationManager& app_mngr);
- /*
+ /**
* @brief Sends notification to HMI to stop audio streaming
*
* @param connection_key Application connection key
@@ -596,8 +655,7 @@ class MessageHelper {
static void SendOnDataStreaming(protocol_handler::ServiceType service,
bool available,
ApplicationManager& app_mngr);
-
- /*
+ /**
* @brief Sends notification to HMI to stop audioPathThru
*
* @param connection_key Application connection key
@@ -607,10 +665,12 @@ class MessageHelper {
static bool SendStopAudioPathThru(ApplicationManager& app_mngr);
/**
- * @brief Sends UnsubscribeWayPoints request
- * @return true if UnsubscribedWayPoints is send otherwise false
+ * @brief Creates UnsubscribeWayPoints request
+ * @param correlation_id Correlation ID
+ * @return request Request to HMI
*/
- static bool SendUnsubscribedWayPoints(ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectSPtr CreateUnsubscribeWayPointsRequest(
+ const uint32_t correlation_id);
static smart_objects::SmartObjectSPtr CreateNegativeResponse(
uint32_t connection_key,
@@ -619,6 +679,32 @@ class MessageHelper {
int32_t result_code);
/**
+ * @brief Creates negative response message from HMI using provided params
+ * @param function_id id of function
+ * @param correlation_id correlation id
+ * @param result_code result code
+ * @param info info message
+ * @return pointer to created message
+ */
+ static smart_objects::SmartObjectSPtr CreateNegativeResponseFromHmi(
+ const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code,
+ const std::string& info);
+
+ /**
+ * @brief Creates negative response message from HMI using provided params
+ * @param function_id id of function
+ * @param correlation_id correlation id
+ * @param result_code result code
+ * @return pointer to created message
+ */
+ static smart_objects::SmartObjectSPtr CreateResponseMessageFromHmi(
+ const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code);
+
+ /**
* @brief Get the full file path of an app file
*
* @param file_name The relative path of an application file
@@ -660,7 +746,7 @@ class MessageHelper {
ApplicationConstSharedPtr app,
ApplicationManager& app_mngr);
- /*
+ /**
* @brief Verify image and add image file full path
*
* @param SmartObject with image
@@ -690,7 +776,7 @@ class MessageHelper {
static ChoiceSetVRCommandsStatus CheckChoiceSetVRCommands(
const smart_objects::SmartObject& choice_set);
- /*
+ /**
* @brief Finds "Image" structure in request and verify image file presence
* in Core.
*
@@ -726,7 +812,7 @@ class MessageHelper {
const policy::PolicyHandlerInterface& policy_handler,
ApplicationManager& app_mngr);
- /*
+ /**
* @brief subscribe application to softbutton
*
* @param message_params contains data of request
@@ -743,7 +829,7 @@ class MessageHelper {
int32_t function_id,
const WindowID window_id);
- /*
+ /**
* @brief subscribe application to softbutton
*
* @param message_params contains data of request
@@ -840,19 +926,34 @@ class MessageHelper {
mobile_api::AppInterfaceUnregisteredReason::eType reason);
/**
- * @brief SendDeleteCommandRequest sends requests to HMI to remove UI/VR
+ * @brief CreateDeleteUICommandRequest creates request to HMI to remove UI
+ * command data depending on command parameters
+ * @param cmd Command data
+ * @param app_id ID of application owning the command data
+ * @param corr_id Correlation ID
+ * @return SmartObjectSPtr message to HMI
+ */
+ static smart_objects::SmartObjectSPtr CreateDeleteUICommandRequest(
+ smart_objects::SmartObject* cmd,
+ const uint32_t app_id,
+ const uint32_t corr_id);
+
+ /**
+ * @brief CreateDeleteVRCommandRequest creates request to HMI to remove VR
* command data depending on command parameters
* @param cmd Command data
* @param application Application owning the command data
- * @param app_mngr Application manager
+ * @param corr_id Correlation ID
+ * @return SmartObjectSPtr message to HMI
*/
- static void SendDeleteCommandRequest(smart_objects::SmartObject* cmd,
- ApplicationSharedPtr application,
- ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectSPtr CreateDeleteVRCommandRequest(
+ smart_objects::SmartObject* cmd,
+ ApplicationSharedPtr application,
+ const uint32_t corr_id);
/**
* @brief SendDeleteSubmenuRequest sends UI/VR requests to HMI to remove
- * submenues-related data depending on command parameters
+ * submenus-related data depending on command parameters
* @param cmd Command data
* @param application Application owning the commmand data
* @param app_mngr Application manager
@@ -897,12 +998,10 @@ class MessageHelper {
* @brief Sends HMI status notification to mobile
* @param application application with changed HMI status
* @param window_id id of affected window
- * @param application_manager reference to application manager
+ * @return SmartObjectSPtr with notification about HMI status
**/
- static void SendHMIStatusNotification(
- ApplicationSharedPtr application,
- const WindowID window_id,
- ApplicationManager& application_manager);
+ static smart_objects::SmartObjectSPtr CreateHMIStatusNotification(
+ ApplicationSharedPtr application, const WindowID window_id);
/**
* @brief SendActivateAppToHMI Sends BasicCommunication.ActivateApp request to
@@ -927,7 +1026,41 @@ class MessageHelper {
* @return HMI message object with filled header
*/
static smart_objects::SmartObjectSPtr CreateMessageForHMI(
- hmi_apis::messageType::eType message_type, const uint32_t correlation_id);
+ const hmi_apis::messageType::eType message_type,
+ const uint32_t correlation_id);
+
+ /**
+ * @brief CreateMessageForHMI Creates HMI message with prepared header
+ * according to message type
+ * @param function_id function id
+ * @param correlation_id Correlation id
+ * @return HMI message object with filled header
+ */
+ static smart_objects::SmartObjectSPtr CreateMessageForHMI(
+ const hmi_apis::FunctionID::eType function_id,
+ const uint32_t correlation_id);
+
+ /**
+ * @brief CreateUIResetGlobalPropertiesRequest Creates request
+ * to reset global properties for UI
+ * @param struct containing result of global properties reset procedure
+ * @param application which properties are to be reset
+ * @return filled smart object with relevant request data
+ */
+ static smart_objects::SmartObjectSPtr CreateUIResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ const ApplicationSharedPtr application);
+
+ /**
+ * @brief CreateTTSResetGlobalPropertiesRequest Creates request
+ * to reset global properties for TTS
+ * @param struct containing result of global properties reset procedure
+ * @param application which properties are to be reset
+ * @return filled smart object with relevant request data
+ */
+ static smart_objects::SmartObjectSPtr CreateTTSResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ const ApplicationSharedPtr application);
static smart_objects::SmartObject CreateAppServiceCapabilities(
std::vector<smart_objects::SmartObject>& all_services);
@@ -945,6 +1078,19 @@ class MessageHelper {
static smart_objects::SmartObjectSPtr CreateDisplayCapabilityUpdateToMobile(
const smart_objects::SmartObject& system_capabilities, Application& app);
+ /**
+ * @brief CreateUIDeleteWindowRequestToHMI creates request to delete specified
+ * window
+ * @param application reference to related application
+ * @param app_mngr reference to application manager instance
+ * @param window_id id of window to delete
+ * @return shared ptr to request SO
+ */
+ static smart_objects::SmartObjectSPtr CreateUIDeleteWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const WindowID window_id);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h
index 6900a50926..c6cf00caea 100644
--- a/src/components/application_manager/include/application_manager/request_info.h
+++ b/src/components/application_manager/include/application_manager/request_info.h
@@ -180,6 +180,11 @@ typedef std::set<RequestInfoPtr, RequestInfoHashComparator>
*/
class RequestInfoSet {
public:
+ /**
+ * @brief destructor
+ */
+ ~RequestInfoSet();
+
/*
* @brief Add requests into colletion by log(n) time
* @param request_info - request to add
diff --git a/src/components/application_manager/include/application_manager/resumption/pending_resumption_handler.h b/src/components/application_manager/include/application_manager/resumption/pending_resumption_handler.h
new file mode 100644
index 0000000000..8d21c1f34f
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/pending_resumption_handler.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_PENDING_RESUMPTION_HANDLER_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_PENDING_RESUMPTION_HANDLER_H
+#include "application_manager/app_extension.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/event_engine/event_observer.h"
+
+namespace resumption {
+
+namespace app_mngr = application_manager;
+
+/**
+ * @brief The PendingResumptionHandler class responsibility to avoid
+ * duplication of subscription requests to HMI if multiple applications
+ * are registering
+ */
+class PendingResumptionHandler
+ : public application_manager::event_engine::EventObserver {
+ public:
+ PendingResumptionHandler(app_mngr::ApplicationManager& application_manager);
+
+ virtual ~PendingResumptionHandler() {}
+
+ /**
+ * @brief HandleResumptionSubscriptionRequest handles all subscriptions
+ * requests, which might be send to HMI under certain conditions
+ * @param extension reference to corresponding application extension
+ * @param subscriber callback for subscribing
+ * @param app reference to application owner
+ */
+ virtual void HandleResumptionSubscriptionRequest(
+ app_mngr::AppExtension& extension,
+ application_manager::Application& app) = 0;
+
+ /**
+ * @brief OnResumptionRevert is a callback to be called in the case, when
+ * resumption is failed for current application.
+ */
+ virtual void OnResumptionRevert() = 0;
+
+ resumption::ResumptionDataProcessor& resumption_data_processor();
+
+ protected:
+ /**
+ * @brief MakeResumptionRequest creates resumption request
+ * @param corr_id correlation ID
+ * @param function_id function ID
+ * @param message Message to HMI
+ * @return instance of ResumptionRequest class
+ */
+ ResumptionRequest MakeResumptionRequest(
+ const uint32_t corr_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const smart_objects::SmartObject& message);
+
+ app_mngr::ApplicationManager& application_manager_;
+};
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_PENDING_RESUMPTION_HANDLER_H
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
index e572eaec39..d945df6154 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -46,6 +46,7 @@ typedef std::shared_ptr<const Application> ApplicationConstSharedPtr;
namespace app_mngr = application_manager;
namespace resumption {
+class ResumptionDataProcessor;
/**
* @brief Contains logic for storage/restore data of applications.
@@ -59,6 +60,16 @@ class ResumeCtrl {
virtual ~ResumeCtrl() {}
/**
+ * @brief ResumptionCallBack Function signature to be called when
+ * data resumption will be finished
+ * @param result_code result code for sending to mobile
+ * @param info additional info for sending to mobile
+ */
+ typedef std::function<void(mobile_apis::Result::eType result_code,
+ const std::string& info)>
+ ResumptionCallBack;
+
+ /**
* @brief Save all applications info to the file system
*/
virtual void SaveAllApplications() = 0;
@@ -79,13 +90,6 @@ class ResumeCtrl {
application_manager::ApplicationSharedPtr application) = 0;
/**
- * @brief Restore widgets HMI level on the resumption response from HMI
- * @param response_message smart_object with HMI message
- */
- virtual void RestoreWidgetsHMIState(
- const smart_objects::SmartObject& response_message) = 0;
-
- /**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
* @return true if success, otherwise return false
@@ -108,16 +112,6 @@ class ResumeCtrl {
bool check_policy = true) = 0;
/**
- * @brief RestoreAppWidgets add widgets for the application
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- * @return the number of widget windows to be resumed
- */
- virtual size_t RestoreAppWidgets(
- application_manager::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) = 0;
-
- /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -175,10 +169,13 @@ class ResumeCtrl {
* @brief Start timer for resumption applications
* Restore D1-D5 data
* @param application that is need to be restored
+ * @param hash stored hash value for this app
+ * @param callback Function to be called when data resumption will be finished
* @return true if it was saved, otherwise return false
*/
virtual bool StartResumption(app_mngr::ApplicationSharedPtr application,
- const std::string& hash) = 0;
+ const std::string& hash,
+ ResumptionCallBack callback) = 0;
/**
* @brief Start timer for resumption applications
* Does not restore D1-D5 data
@@ -196,6 +193,15 @@ class ResumeCtrl {
virtual void RetryResumption(const uint32_t app_id) = 0;
/**
+ * @brief Handle restored data when timeout appeared
+ * @param correlation_id - const int32_t
+ * @param function id hmi_apis::FunctionID::eType
+ */
+
+ virtual void HandleOnTimeOut(const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType) = 0;
+
+ /**
* @brief Check if there are all files need for resumption
* @param application that is need to be restored
* @return true if it all files exist, otherwise return false
@@ -206,6 +212,7 @@ class ResumeCtrl {
/**
* @brief Check application hash
* @param application that is need to be restored
+ * @param hash stored hash value to be checked for restoring application
* @return true if it was saved, otherwise return false
*/
virtual bool CheckApplicationHash(app_mngr::ApplicationSharedPtr application,
@@ -300,11 +307,19 @@ class ResumeCtrl {
virtual int32_t GetSavedAppHmiLevel(const std::string& app_id,
const std::string& device_id) const = 0;
+ /**
+ * @brief StartWaitingForDisplayCapabilitiesUpdate add application to
+ * capabilities builder waitlist
+ * @param application application to add
+ * @param is_resume_app flag to check whether app data should be resumed or
+ * not
+ */
virtual void StartWaitingForDisplayCapabilitiesUpdate(
- app_mngr::ApplicationSharedPtr application) = 0;
+ app_mngr::ApplicationSharedPtr application, const bool is_resume_app) = 0;
virtual time_t LaunchTime() const = 0;
+ virtual ResumptionDataProcessor& resumption_data_processor() = 0;
#ifdef BUILD_TESTS
virtual void set_resumption_storage(
std::shared_ptr<ResumptionData> mock_storage) = 0;
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index 3ac59b9f88..379b25d8d4 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -44,6 +44,7 @@
#include "application_manager/application.h"
#include "application_manager/event_engine/event_observer.h"
#include "application_manager/resumption/resumption_data.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "interfaces/HMI_API.h"
#include "interfaces/HMI_API_schema.h"
#include "interfaces/MOBILE_API_schema.h"
@@ -56,8 +57,7 @@ namespace resumption {
* @brief Contains logic for storage/restore data of applications.
*/
-class ResumeCtrlImpl : public ResumeCtrl,
- public app_mngr::event_engine::EventObserver {
+class ResumeCtrlImpl : public ResumeCtrl {
public:
/**
* @brief allows to create ResumeCtrlImpl object
@@ -70,12 +70,6 @@ class ResumeCtrlImpl : public ResumeCtrl,
~ResumeCtrlImpl();
/**
- * @brief Event, that raised if application get resumption response from HMI
- * @param event : event object, that contains smart_object with HMI message
- */
- void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
-
- /**
* @brief Save all applications info to the file system
*/
void SaveAllApplications() OVERRIDE;
@@ -93,9 +87,6 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
bool RestoreAppHMIState(app_mngr::ApplicationSharedPtr application) OVERRIDE;
- void RestoreWidgetsHMIState(
- const smart_objects::SmartObject& response_message) OVERRIDE;
-
/**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
@@ -118,15 +109,6 @@ class ResumeCtrlImpl : public ResumeCtrl,
bool check_policy = true) OVERRIDE;
/**
- * @brief RestoreAppWidgets add widgets for the application
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- size_t RestoreAppWidgets(
- application_manager::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) OVERRIDE;
-
- /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -181,21 +163,13 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
void StopRestoreHmiLevelTimer();
- /**
- * @brief Start timer for resumption applications
- * Restore D1-D5 data
- * @param application that is need to be restored
- * @return true if it was saved, otherwise return false
- */
bool StartResumption(app_mngr::ApplicationSharedPtr application,
- const std::string& hash) OVERRIDE;
+ const std::string& hash,
+ ResumptionCallBack callback) OVERRIDE;
+
+ void HandleOnTimeOut(const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType) OVERRIDE;
- /**
- * @brief Start timer for resumption applications
- * Does not restore D1-D5 data
- * @param application that is need to be restored
- * @return true if it was saved, otherwise return false
- */
bool StartResumptionOnlyHMILevel(
app_mngr::ApplicationSharedPtr application) OVERRIDE;
@@ -310,7 +284,8 @@ class ResumeCtrlImpl : public ResumeCtrl,
const std::string& device_id) const OVERRIDE;
void StartWaitingForDisplayCapabilitiesUpdate(
- app_mngr::ApplicationSharedPtr application) OVERRIDE;
+ app_mngr::ApplicationSharedPtr application,
+ const bool is_resume_app) OVERRIDE;
/**
* @brief geter for launch_time_
@@ -330,6 +305,8 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
void StartSavePersistentDataTimer() OVERRIDE;
+ ResumptionDataProcessor& resumption_data_processor();
+
#ifdef BUILD_TESTS
void set_resumption_storage(
std::shared_ptr<ResumptionData> mock_storage) OVERRIDE;
@@ -354,9 +331,12 @@ class ResumeCtrlImpl : public ResumeCtrl,
/**
* @brief restores saved data of application
* @param application contains application for which restores data
+ * @param callback callback, which contains logic for sending response
+ * to mobile and updating hash
* @return true if success, otherwise return false
*/
- bool RestoreApplicationData(app_mngr::ApplicationSharedPtr application);
+ bool RestoreApplicationData(app_mngr::ApplicationSharedPtr application,
+ ResumptionCallBack callback);
/**
* @brief SaveDataOnTimer :
@@ -372,67 +352,6 @@ class ResumeCtrlImpl : public ResumeCtrl,
void FinalPersistData();
/**
- * @brief AddFiles allows to add files for the application
- * which should be resumed
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- void AddFiles(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app);
-
- /**
- * @brief AddSubmenues allows to add sub menues for the application
- * which should be resumed
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- void AddSubmenues(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app);
-
- /**
- * @brief AddCommands allows to add commands for the application
- * which should be resumed
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- void AddCommands(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app);
-
- /**
- * @brief AddChoicesets allows to add choice sets for the application
- * which should be resumed
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- void AddChoicesets(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app);
-
- /**
- * @brief SetGlobalProperties allows to restore global properties.
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- void SetGlobalProperties(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app);
-
- /**
- * @brief AddSubscriptions allows to restore subscriptions
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- void AddSubscriptions(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app);
-
- /**
- * @brief AddWayPointsSubscription allows to restore subscription
- * for WayPoints
- * @param application application which will be resumed
- * @param saved_app application specific section from backup file
- */
- void AddWayPointsSubscription(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app);
-
- /**
* @brief Checks if saved HMI level is allowed for resumption
* by Ignition Cycle restrictions
* @param saved_app application specific section from backup file
@@ -541,21 +460,6 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
void SetLastIgnOffTime(time_t ign_off_time);
- /**
- * @brief Process specified HMI request
- * @param request Request to process
- * @param use_events Process request events or not flag
- * @return TRUE on success, otherwise FALSE
- */
- bool ProcessHMIRequest(smart_objects::SmartObjectSPtr request = NULL,
- bool use_events = false);
-
- /**
- * @brief Process list of HMI requests using ProcessHMIRequest method
- * @param requests List of requests to process
- */
- void ProcessHMIRequests(const smart_objects::SmartObjectList& requests);
-
void InsertToTimerQueue(uint32_t app_id, uint32_t time_stamp);
/**
@@ -635,6 +539,7 @@ class ResumeCtrlImpl : public ResumeCtrl,
time_t wake_up_time_;
std::shared_ptr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
+ std::unique_ptr<ResumptionDataProcessor> resumption_data_processor_;
/**
*@brief Mapping correlation id to request
*wait for on event response from HMI to resume HMI Level
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor.h
new file mode 100644
index 0000000000..60e2e5d1a4
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor.h
@@ -0,0 +1,107 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_PROCESSOR_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_PROCESSOR_H_
+
+#include "application_manager/application.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_types.h"
+#include "smart_objects/smart_object.h"
+
+namespace resumption {
+
+/**
+ * @brief Determines whether response is successful
+ * judging from type of response received from HMI
+ * @param response from HMI
+ */
+bool IsResponseSuccessful(const smart_objects::SmartObject& response);
+
+/**
+ * @brief The ResumptionRequestID struct contains fields, needed during
+ * processing events, related to responses from HMI to each resumption request
+ */
+using ModuleUid = rc_rpc_plugin::rc_rpc_types::ModuleUid;
+
+struct ResumptionRequestID {
+ hmi_apis::FunctionID::eType function_id;
+ int32_t correlation_id;
+
+ /**
+ * @brief This operator is needed for correct iteration through map, which
+ * contains keys with type ResumptionRequestID
+ */
+ bool operator<(const ResumptionRequestID& other) const;
+};
+
+/**
+ * @brief The ResumptionRequest struct contains information, needed for
+ * processing event, and request message
+ */
+struct ResumptionRequest {
+ ResumptionRequestID request_id;
+ smart_objects::SmartObject message;
+};
+
+/**
+ * @brief Contains logic for the resumption and revert resumption data of
+ * applications.
+ */
+class ResumptionDataProcessor {
+ public:
+ /**
+ * @brief Running resumption data process from saved_app to application.
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ * @param callback function signature to be called when
+ * data resumption will be finished
+ */
+ virtual void Restore(application_manager::ApplicationSharedPtr application,
+ smart_objects::SmartObject& saved_app,
+ ResumeCtrl::ResumptionCallBack callback) = 0;
+
+ /**
+ * @brief Handle restored data when timeout appeared
+ * @param correlation_id Correlation ID from event
+ * @param function_id Function ID from event
+ */
+ virtual void HandleOnTimeOut(
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id) = 0;
+
+ /**
+ * @brief subscribe to events for the application and save request
+ * @param app_id application id
+ * @param request for saving
+ */
+ virtual void SubscribeToResponse(const int32_t app_id,
+ const ResumptionRequest& request) = 0;
+};
+
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_PROCESSOR_H_
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
new file mode 100644
index 0000000000..12d25e2ac5
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
@@ -0,0 +1,390 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_PROCESSOR_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_PROCESSOR_IMPL_H_
+
+#include <functional>
+#include <map>
+#include <vector>
+
+#include "application_manager/application.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+#include "smart_objects/smart_object.h"
+#include "utils/rwlock.h"
+
+namespace resumption {
+
+namespace app_mngr = application_manager;
+
+/**
+ * @brief ApplicationResumptionStatus contains information about all requests,
+ * which was sent, and results of this operation
+ */
+struct ApplicationResumptionStatus {
+ std::vector<ResumptionRequest> list_of_sent_requests;
+ std::vector<ResumptionRequest> error_requests;
+ std::vector<ResumptionRequest> successful_requests;
+ std::vector<std::string> unsuccessful_vehicle_data_subscriptions_;
+ std::vector<std::string> successful_vehicle_data_subscriptions_;
+ std::vector<ModuleUid> successful_module_subscriptions_;
+ std::vector<ModuleUid> unsuccessful_module_subscriptions_;
+};
+
+/**
+ * @brief Contains logic for the resumption and revert resumption data of
+ * applications.
+ */
+class ResumptionDataProcessorImpl
+ : public ResumptionDataProcessor,
+ public app_mngr::event_engine::EventObserver {
+ public:
+ /**
+ * @brief allows to create ResumptionDataProcessor object
+ */
+ explicit ResumptionDataProcessorImpl(
+ application_manager::ApplicationManager& application_manager);
+
+ /**
+ * @brief allows to destroy ResumptionDataProcessor object
+ */
+ ~ResumptionDataProcessorImpl();
+
+ void Restore(app_mngr::ApplicationSharedPtr application,
+ smart_objects::SmartObject& saved_app,
+ ResumeCtrl::ResumptionCallBack callback) override;
+
+ void on_event(const app_mngr::event_engine::Event& event) override;
+
+ void HandleOnTimeOut(const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id) override;
+
+ void SubscribeToResponse(const int32_t app_id,
+ const ResumptionRequest& request) override;
+
+ private:
+ /**
+ * @brief GetAppIdWaitingForResponse returns application ID, which corresponds
+ * to function ID and correlation ID from event
+ * @param function_id Function ID
+ * @param corr_id Correlation ID
+ * @return optional object, which contains application ID, or empty optional,
+ * if such ID wasn't found
+ */
+ utils::Optional<uint32_t> GetAppIdWaitingForResponse(
+ const hmi_apis::FunctionID::eType function_id, const int32_t corr_id);
+
+ /**
+ * @brief GetRequest returns ResumptionRequest, which corresponds to
+ * function ID and correlation ID from event
+ * @param app_id ID of application, related to event
+ * @param function_id Function ID
+ * @param corr_id Correlation ID
+ * @return optional object, which contains resumption request, or empty
+ * optional, if such request wasn't found
+ */
+ utils::Optional<ResumptionRequest> GetRequest(
+ const uint32_t app_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const int32_t corr_id);
+
+ /**
+ * @brief ProcessResumptionStatus processes received response to determine
+ * whether it is successful or not
+ * @param app_id ID of application, related to event
+ * @param response reference to response message
+ * @param found_request reference to found request
+ */
+ void ProcessResumptionStatus(const uint32_t app_id,
+ const smart_objects::SmartObject& response,
+ const ResumptionRequest& found_request);
+
+ /**
+ * @brief IsResumptionFinished checks whether some responses are still waiting
+ * @param app_id ID of application, related to event
+ * @param found_request reference to found request
+ * @return true, if resumption for this application is finished, or false, if
+ * some requests aren't processed yet
+ */
+ bool IsResumptionFinished(const uint32_t app_id,
+ const ResumptionRequest& found_request);
+
+ /**
+ * @brief IsResumptionSuccessful checks whether overall resumption status
+ * is successful or not
+ * @param app_id ID of application, related to event
+ * @return true, if resumption is successful, false otherwise
+ */
+ bool IsResumptionSuccessful(const uint32_t app_id);
+
+ /**
+ * @brief GetResumptionCallback returns ResumptionCallBack, which was stored
+ * for application, related to event
+ * @param app_id ID of application, related to event
+ * @return optional object, which contains callback, or empty optional,
+ * if callback wasn't found for such application ID
+ */
+ utils::Optional<ResumeCtrl::ResumptionCallBack> GetResumptionCallback(
+ const uint32_t app_id);
+
+ /**
+ * @brief EraseAppResumptionData erases data, needed for resumption, for
+ * given application
+ * @param app_id ID of application, related to event
+ * @param function_id Function ID
+ * @param corr_id Correlation ID
+ */
+ void EraseAppResumptionData(const uint32_t app_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const int32_t corr_id);
+
+ /**
+ * @brief Processes response message from HMI
+ * @param response reference to response message
+ * @param function_id function id of response
+ * @param corr_id correlation id of response
+ */
+ void ProcessResponseFromHMI(const smart_objects::SmartObject& response,
+ const hmi_apis::FunctionID::eType function_id,
+ const int32_t corr_id);
+
+ /**
+ * @brief Revert the data to the state before Resumption
+ * @param shared ptr to application
+ */
+ void RevertRestoredData(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Process specified HMI message
+ * @param request Message to process
+ * @param subscribe_on_response flag to specify should message events be
+ * processed or not
+ * @return TRUE on success, otherwise FALSE
+ */
+ void ProcessMessageToHMI(smart_objects::SmartObjectSPtr request,
+ bool subscribe_on_response);
+
+ /**
+ * @brief Process list of HMI messages using ProcessHMIRequest method
+ * @param messages List of messages to process
+ */
+ void ProcessMessagesToHMI(const smart_objects::SmartObjectList& messages);
+
+ /**
+ * @brief AddFiles allows to add files for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddFiles(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddWindows allows to add widget windows for the application
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddWindows(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddSubmenus allows to add sub-menus for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddSubmenus(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief Deleting sub-menus that have been resumed
+ * @param shared ptr to application
+ */
+ void DeleteSubmenus(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief AddCommands allows to add commands for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddCommands(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief Deleting all commands that have been resumed
+ * @param shared ptr to application
+ */
+ void DeleteCommands(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief AddChoicesets allows to add choice sets for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddChoicesets(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief Deleting choice sets that have been resumed
+ * @param shared ptr to application
+ */
+ void DeleteChoicesets(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief SetGlobalProperties allows to restore global properties.
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void SetGlobalProperties(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief Reset global properties that have been resumed
+ * @param shared ptr to application
+ */
+ void DeleteGlobalProperties(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief AddSubscriptions allows to restore subscriptions
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddSubscriptions(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddSubscriptions allows to restore subscriptions
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddButtonsSubscriptions(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddSubscriptions allows to restore subscriptions
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddPluginsSubscriptions(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief Deleting subscriptions have been resumed
+ * @param shared ptr to application
+ */
+ void DeleteSubscriptions(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Deleting buttons subscriptions have been resumed
+ * @param shared ptr to application
+ */
+ void DeleteButtonsSubscriptions(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Deleting plugins subscriptions have been resumed
+ * @param app_id application id
+ */
+ void DeletePluginsSubscriptions(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Deletting subscription for CreateWindow have been resumed
+ * @param shared ptr to application
+ */
+ void DeleteWindowsSubscriptions(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Get button subscriptions that need to be resumed.
+ * Since some subscriptions can be set by default during
+ * app registration, this function is needed to discard subscriptions
+ * that do not need to be resumed
+ * @param application which subscriptions to resume
+ */
+ app_mngr::ButtonSubscriptions GetButtonSubscriptionsToResume(
+ app_mngr::ApplicationSharedPtr application) const;
+
+ /**
+ * @brief Checks whether SubscribeVehicleData response successful or not and
+ * handles it
+ * @param request reference to request SO
+ * @param response reference to response SO
+ * @param status reference to struct, which stores informaion about
+ * successful and unsuccessful subscriptions to vehicle data
+ */
+ void CheckVehicleDataResponse(const smart_objects::SmartObject& request,
+ const smart_objects::SmartObject& response,
+ ApplicationResumptionStatus& status);
+
+ void CheckModuleDataSubscription(const smart_objects::SmartObject& request,
+ const smart_objects::SmartObject& response,
+ ApplicationResumptionStatus& status);
+
+ /**
+ * @brief Checks whether CreateWindow response successful or not and handles
+ * it
+ * @param request reference to request SO
+ * @param response reference to response SO
+ */
+ void CheckCreateWindowResponse(
+ const smart_objects::SmartObject& request,
+ const smart_objects::SmartObject& response) const;
+
+ /**
+ * @brief Determines whether application has saved data, including
+ * submenus, commands, choice sets, global properties, subscriptions to
+ * restore.
+ * @param saved_app smart object containing saved app data
+ * @return bool value stating whether app has mentioned data to restore
+ */
+ bool HasDataToRestore(const smart_objects::SmartObject& saved_app) const;
+
+ app_mngr::ApplicationManager& application_manager_;
+
+ /**
+ * @brief A map of the IDs and Application Resumption Status for these ID
+ **/
+ std::map<std::int32_t, ApplicationResumptionStatus> resumption_status_;
+ sync_primitives::RWLock resumption_status_lock_;
+
+ /**
+ * @brief A map of callbacks used when resumption is finished
+ */
+ std::map<std::int32_t, ResumeCtrl::ResumptionCallBack> register_callbacks_;
+ sync_primitives::RWLock register_callbacks_lock_;
+
+ /**
+ * @brief A map of sent requests and corresponding app_id
+ */
+ std::map<ResumptionRequestID, std::uint32_t> request_app_ids_;
+ sync_primitives::RWLock request_app_ids_lock_;
+};
+
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_PROCESSOR_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h
index c6121f5d1d..d74ed4e7fa 100644
--- a/src/components/application_manager/include/application_manager/state_controller_impl.h
+++ b/src/components/application_manager/include/application_manager/state_controller_impl.h
@@ -125,6 +125,12 @@ class StateControllerImpl : public event_engine::EventObserver,
void ActivateDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
void ExitDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
+ void DeactivateApp(ApplicationSharedPtr app,
+ const WindowID window_id) OVERRIDE;
+
+ void ResumePostponedWindows(const uint32_t app_id) OVERRIDE;
+
+ void DropPostponedWindows(const uint32_t app_id) OVERRIDE;
private:
int64_t RequestHMIStateChange(ApplicationConstSharedPtr app,
@@ -274,13 +280,6 @@ class StateControllerImpl : public event_engine::EventObserver,
void TempStateStopped(HmiState::StateID ID);
/**
- * @brief Sets BACKGROUND or LIMITED hmi level to application
- * depends on application type
- * @param app Application to deactivate
- */
- void DeactivateApp(ApplicationSharedPtr app, const WindowID window_id);
-
- /**
* Function to remove temporary HmiState for application
*/
template <HmiState::StateID ID>
@@ -426,6 +425,11 @@ class StateControllerImpl : public event_engine::EventObserver,
StateIDList active_states_;
mutable sync_primitives::Lock active_states_lock_;
std::map<uint32_t, HmiStatePtr> waiting_for_response_;
+
+ typedef std::pair<WindowID, HmiStatePtr> WindowStatePair;
+ typedef std::list<WindowStatePair> WindowStatePairs;
+ std::map<uint32_t, WindowStatePairs> postponed_app_widgets_;
+
ApplicationManager& app_mngr_;
};
} // namespace application_manager
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h
index b04edbe2f4..8d307325fc 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h
@@ -97,19 +97,12 @@ class AppServiceAppExtension : public app_mngr::AppExtension {
*/
AppServiceSubscriptions Subscriptions();
- /**
- * @brief SaveResumptionData saves vehicle info data
- * @param resumption_data plase to store resumption data
- */
void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
resumption_data) OVERRIDE;
- /**
- * @brief ProcessResumption load resumtion data back to plugin during
- * resumption
- * @param resumption_data resumption data
- */
- void ProcessResumption(
+ void ProcessResumption(const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ void RevertResumption(
const smart_objects::SmartObject& resumption_data) OVERRIDE;
/**
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
index 5d85237899..444636ed75 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H
#include "application_manager/command_factory.h"
+#include "utils/ilogger.h"
namespace app_service_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,7 +76,8 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin {
};
} // namespace app_service_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create();
+extern "C" application_manager::plugin_manager::RPCPlugin* Create(
+ logger::Logger* logger_instance);
extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc
index 87f947d250..5a1815d974 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc
@@ -32,8 +32,9 @@
#include "app_service_rpc_plugin/app_service_app_extension.h"
#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/include/application_manager/smart_object_keys.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin")
namespace app_service_rpc_plugin {
@@ -44,22 +45,22 @@ AppServiceAppExtension::AppServiceAppExtension(
: app_mngr::AppExtension(AppServiceAppExtensionUID)
, plugin_(plugin)
, app_(app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
AppServiceAppExtension::~AppServiceAppExtension() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool AppServiceAppExtension::SubscribeToAppService(
const std::string app_service_type) {
- LOG4CXX_DEBUG(logger_, "Subscribe to app service: " << app_service_type);
+ SDL_LOG_DEBUG("Subscribe to app service: " << app_service_type);
return subscribed_data_.insert(app_service_type).second;
}
bool AppServiceAppExtension::UnsubscribeFromAppService(
const std::string app_service_type) {
- LOG4CXX_DEBUG(logger_, app_service_type);
+ SDL_LOG_DEBUG(app_service_type);
auto it = subscribed_data_.find(app_service_type);
if (it != subscribed_data_.end()) {
subscribed_data_.erase(it);
@@ -69,14 +70,13 @@ bool AppServiceAppExtension::UnsubscribeFromAppService(
}
void AppServiceAppExtension::UnsubscribeFromAppService() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribed_data_.clear();
}
bool AppServiceAppExtension::IsSubscribedToAppService(
const std::string app_service_type) const {
- LOG4CXX_DEBUG(logger_,
- "isSubscribedToAppService for type: " << app_service_type);
+ SDL_LOG_DEBUG("isSubscribedToAppService for type: " << app_service_type);
return subscribed_data_.find(app_service_type) != subscribed_data_.end();
}
@@ -86,22 +86,25 @@ AppServiceSubscriptions AppServiceAppExtension::Subscriptions() {
void AppServiceAppExtension::SaveResumptionData(
smart_objects::SmartObject& resumption_data) {
- const char* app_service_info = "appService";
- resumption_data[app_service_info] =
+ resumption_data[app_mngr::hmi_interface::app_service] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
int i = 0;
for (const auto& subscription : subscribed_data_) {
- resumption_data[app_service_info][i] = subscription;
+ resumption_data[app_mngr::hmi_interface::app_service][i] = subscription;
i++;
}
}
void AppServiceAppExtension::ProcessResumption(
- const smart_objects::SmartObject& resumption_data) {
- const char* app_service_info = "appService";
- if (resumption_data.keyExists(app_service_info)) {
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ const auto& subscriptions =
+ saved_app[application_manager::strings::application_subscriptions];
+
+ if (subscriptions.keyExists(app_mngr::hmi_interface::app_service)) {
const smart_objects::SmartObject& subscriptions_app_services =
- resumption_data[app_service_info];
+ subscriptions[app_mngr::hmi_interface::app_service];
for (size_t i = 0; i < subscriptions_app_services.length(); ++i) {
std::string service_type = subscriptions_app_services[i].asString();
SubscribeToAppService(service_type);
@@ -109,6 +112,15 @@ void AppServiceAppExtension::ProcessResumption(
}
}
+void AppServiceAppExtension::RevertResumption(
+ const smart_objects::SmartObject& resumption_data) {
+ SDL_LOG_AUTO_TRACE();
+
+ UNUSED(resumption_data);
+ // ToDo: implementation is blocked by
+ // https://github.com/smartdevicelink/sdl_core/issues/3470
+}
+
AppServiceAppExtension& AppServiceAppExtension::ExtractASExtension(
application_manager::Application& app) {
auto ext_ptr = app.QueryInterface(AppServiceAppExtensionUID);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
index 8ce4d10b6e..ff40b587cb 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
@@ -32,7 +32,7 @@
#include "app_service_rpc_plugin/app_service_command_factory.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin")
namespace app_service_rpc_plugin {
@@ -45,11 +45,11 @@ AppServiceCommandFactory::AppServiceCommandFactory(
application_manager, rpc_service, hmi_capabilities, policy_handler))
, mobile_command_factory_(new AppServiceMobileCommandFactory(
application_manager, rpc_service, hmi_capabilities, policy_handler)) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
AppServiceCommandFactory::~AppServiceCommandFactory() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand(
@@ -66,8 +66,7 @@ app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand(
bool AppServiceCommandFactory::IsAbleToProcess(
const int32_t function_id,
const commands::Command::CommandSource source) const {
- LOG4CXX_DEBUG(logger_,
- "AppServiceCommandFactory::IsAbleToProcess" << function_id
+ SDL_LOG_DEBUG("AppServiceCommandFactory::IsAbleToProcess" << function_id
<< " " << source);
return (commands::Command::SOURCE_HMI == source ||
commands::Command::SOURCE_SDL_TO_HMI == source)
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
index 3090ea8ced..1e468242af 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
@@ -55,7 +55,7 @@
#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h"
#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin")
namespace app_service_rpc_plugin {
namespace strings = app_mngr::strings;
@@ -69,7 +69,7 @@ AppServiceHmiCommandFactory::AppServiceHmiCommandFactory(
, rpc_service_(rpc_service)
, hmi_capabilities_(hmi_capabilities)
, policy_handler_(policy_handler) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand(
@@ -95,9 +95,8 @@ app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand(
}
UNUSED(message_type_str);
- LOG4CXX_DEBUG(logger_,
- "HMICommandFactory::CreateCommand function_id: "
- << function_id << ", message type: " << message_type_str);
+ SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
return buildCommandCreator(function_id, message_type, source).create(message);
}
@@ -105,8 +104,7 @@ app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand(
bool AppServiceHmiCommandFactory::IsAbleToProcess(
const int32_t function_id,
const app_mngr::commands::Command::CommandSource source) const {
- LOG4CXX_DEBUG(logger_,
- "HMI App Service Plugin IsAbleToProcess: " << function_id);
+ SDL_LOG_DEBUG("HMI App Service Plugin IsAbleToProcess: " << function_id);
UNUSED(source);
return buildCommandCreator(
function_id, hmi_apis::messageType::INVALID_ENUM, source)
@@ -120,8 +118,7 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator(
auto factory = app_mngr::CommandCreatorFactory(
application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
- LOG4CXX_DEBUG(logger_,
- "buildCommandCreator: " << function_id << " " << source);
+ SDL_LOG_DEBUG("buildCommandCreator: " << function_id << " " << source);
switch (function_id) {
case hmi_apis::FunctionID::AppService_PublishAppService:
@@ -191,7 +188,7 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator(
: factory.GetCreator<
commands::ASGetActiveServiceConsentResponse>();
default:
- LOG4CXX_WARN(logger_, "Unsupported HMI function_id: " << function_id);
+ SDL_LOG_WARN("Unsupported HMI function_id: " << function_id);
}
return factory.GetCreator<app_mngr::InvalidCommand>();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
index 5c44fb5fae..4a2fe5c2c9 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
@@ -50,7 +50,7 @@
#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h"
#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin")
namespace app_service_rpc_plugin {
namespace strings = app_mngr::strings;
@@ -64,7 +64,7 @@ AppServiceMobileCommandFactory::AppServiceMobileCommandFactory(
, rpc_service_(rpc_service)
, hmi_capabilities_(hmi_capabilities)
, policy_handler_(policy_handler) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand(
@@ -88,9 +88,8 @@ app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand(
}
UNUSED(message_type_str);
- LOG4CXX_DEBUG(logger_,
- "HMICommandFactory::CreateCommand function_id: "
- << function_id << ", message type: " << message_type_str);
+ SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
return buildCommandCreator(function_id, message_type, source).create(message);
}
@@ -170,7 +169,7 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator(
}
break;
default:
- LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
+ SDL_LOG_WARN("Unsupported function_id: " << function_id);
}
return factory.GetCreator<app_mngr::InvalidCommand>();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
index 1c3a9c77c5..fd7b03fabc 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
@@ -38,7 +38,7 @@
#include "application_manager/smart_object_keys.h"
namespace app_service_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin")
namespace strings = application_manager::strings;
namespace plugins = application_manager::plugin_manager;
@@ -109,12 +109,12 @@ void AppServiceRpcPlugin::DeleteSubscriptions(
extern "C" __attribute__((visibility("default")))
application_manager::plugin_manager::RPCPlugin*
-Create() {
+Create(logger::Logger* logger_instance) {
+ logger::Logger::instance(logger_instance);
return new app_service_rpc_plugin::AppServiceRpcPlugin();
}
extern "C" __attribute__((visibility("default"))) void Delete(
application_manager::plugin_manager::RPCPlugin* data) {
delete data;
- DELETE_THREAD_LOGGER(app_service_rpc_plugin::logger_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc
index fd7312ca98..d9cf7acf1b 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASAppServiceActivationRequest::ASAppServiceActivationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ ASAppServiceActivationRequest::ASAppServiceActivationRequest(
ASAppServiceActivationRequest::~ASAppServiceActivationRequest() {}
void ASAppServiceActivationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AppServiceManager& service_manager =
application_manager_.GetAppServiceManager();
smart_objects::SmartObject params = (*message_)[strings::msg_params];
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc
index c77d3ed381..434fad51e9 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc
@@ -36,6 +36,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASAppServiceActivationResponse::ASAppServiceActivationResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ ASAppServiceActivationResponse::ASAppServiceActivationResponse(
ASAppServiceActivationResponse::~ASAppServiceActivationResponse() {}
void ASAppServiceActivationResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc
index b1f3d6fdbf..e80c5f741c 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc
@@ -36,6 +36,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest(
ASGetActiveServiceConsentRequest::~ASGetActiveServiceConsentRequest() {}
void ASGetActiveServiceConsentRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc
index 038c2922ad..5e59c9f3ab 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc
@@ -36,6 +36,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse(
ASGetActiveServiceConsentResponse::~ASGetActiveServiceConsentResponse() {}
void ASGetActiveServiceConsentResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::AppService_GetActiveServiceConsent);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc
index e03c0ad15a..32fccb0192 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc
@@ -43,6 +43,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,12 +60,12 @@ ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI(
ASGetAppServiceDataRequestFromHMI::~ASGetAppServiceDataRequestFromHMI() {}
void ASGetAppServiceDataRequestFromHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string service_type =
(*message_)[strings::msg_params][strings::service_type].asString();
- LOG4CXX_DEBUG(logger_, "Get Service Type: " << service_type);
+ SDL_LOG_DEBUG("Get Service Type: " << service_type);
SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID,
hmi_apis::FunctionID::AppService_GetAppServiceData,
@@ -172,8 +174,7 @@ void ASGetAppServiceDataRequestFromHMI::GetMediaImagePaths(
bool ASGetAppServiceDataRequestFromHMI::ValidateResponse(
smart_objects::SmartObject& message_params) {
if (!message_params.keyExists(strings::service_data)) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"GASD response received without any service data, passing through");
return true;
}
@@ -185,8 +186,7 @@ bool ASGetAppServiceDataRequestFromHMI::ValidateResponse(
auto service =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
if (!service) {
- LOG4CXX_ERROR(logger_,
- "GASD response received with an unpublished service ID");
+ SDL_LOG_ERROR("GASD response received with an unpublished service ID");
SendErrorResponse(
correlation_id(),
hmi_apis::FunctionID::AppService_GetAppServiceData,
@@ -202,8 +202,7 @@ bool ASGetAppServiceDataRequestFromHMI::ValidateResponse(
service_type, &service_type_value)) {
auto app = application_manager_.application(service->connection_key);
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Failed to find service provider for GASD response");
+ SDL_LOG_ERROR("Failed to find service provider for GASD response");
SendErrorResponse(
correlation_id(),
hmi_apis::FunctionID::AppService_GetAppServiceData,
@@ -277,7 +276,7 @@ void ASGetAppServiceDataRequestFromHMI::on_event(
}
void ASGetAppServiceDataRequestFromHMI::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendErrorResponse(correlation_id(),
hmi_apis::FunctionID::AppService_GetAppServiceData,
hmi_apis::Common_Result::GENERIC_ERROR,
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc
index 635cd7319a..e0b99105d7 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI(
ASGetAppServiceDataRequestToHMI::~ASGetAppServiceDataRequestToHMI() {}
void ASGetAppServiceDataRequestToHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc
index c0b1b274fb..853c382f46 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc
@@ -41,6 +41,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI(
ASGetAppServiceDataResponseFromHMI::~ASGetAppServiceDataResponseFromHMI() {}
void ASGetAppServiceDataResponseFromHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::AppService_GetAppServiceData);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc
index b489ec4765..6c53feb68f 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI(
ASGetAppServiceDataResponseToHMI::~ASGetAppServiceDataResponseToHMI() {}
void ASGetAppServiceDataResponseToHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc
index fa704c1995..ac3666bf2e 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest(
ASGetAppServiceRecordsRequest::~ASGetAppServiceRecordsRequest() {}
void ASGetAppServiceRecordsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string type;
if ((*message_)[strings::msg_params].keyExists(strings::service_type)) {
type = (*message_)[strings::msg_params][strings::service_type].asString();
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc
index 0479aa8d31..f5f45d23f1 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc
@@ -36,6 +36,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse(
ASGetAppServiceRecordsResponse::~ASGetAppServiceRecordsResponse() {}
void ASGetAppServiceRecordsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
index 6499b08c28..f5a1aac05c 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
@@ -39,6 +39,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASPerformAppServiceInteractionRequestFromHMI::
ASPerformAppServiceInteractionRequestFromHMI(
const application_manager::commands::MessageSharedPtr& message,
@@ -56,7 +58,7 @@ ASPerformAppServiceInteractionRequestFromHMI::
~ASPerformAppServiceInteractionRequestFromHMI() {}
void ASPerformAppServiceInteractionRequestFromHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
std::string hmi_origin_id =
@@ -148,7 +150,7 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event(
}
void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject response_params;
response_params[strings::info] =
"The provider did not respond to the request";
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc
index 22876328de..a0f5d69ed8 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc
@@ -36,6 +36,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASPerformAppServiceInteractionRequestToHMI::
ASPerformAppServiceInteractionRequestToHMI(
const application_manager::commands::MessageSharedPtr& message,
@@ -53,7 +55,7 @@ ASPerformAppServiceInteractionRequestToHMI::
~ASPerformAppServiceInteractionRequestToHMI() {}
void ASPerformAppServiceInteractionRequestToHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc
index a2ffa65a73..c8608588c0 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc
@@ -36,6 +36,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASPerformAppServiceInteractionResponseFromHMI::
ASPerformAppServiceInteractionResponseFromHMI(
const application_manager::commands::MessageSharedPtr& message,
@@ -53,7 +55,7 @@ ASPerformAppServiceInteractionResponseFromHMI::
~ASPerformAppServiceInteractionResponseFromHMI() {}
void ASPerformAppServiceInteractionResponseFromHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::AppService_PerformAppServiceInteraction);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc
index 5ddef55c2a..45d6a15999 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc
@@ -36,6 +36,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASPerformAppServiceInteractionResponseToHMI::
ASPerformAppServiceInteractionResponseToHMI(
const application_manager::commands::MessageSharedPtr& message,
@@ -53,7 +55,7 @@ ASPerformAppServiceInteractionResponseToHMI::
~ASPerformAppServiceInteractionResponseToHMI() {}
void ASPerformAppServiceInteractionResponseToHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
index 35a3e8a6b3..156530f9e3 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
@@ -39,6 +39,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASPublishAppServiceRequest::ASPublishAppServiceRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,8 +56,8 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest(
ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {}
void ASPublishAppServiceRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Received a PublishAppService request from HMI");
smart_objects::SmartObject response_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject manifest =
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc
index c143315b8c..49d3968cef 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc
@@ -37,6 +37,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASPublishAppServiceResponse::ASPublishAppServiceResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ ASPublishAppServiceResponse::ASPublishAppServiceResponse(
ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {}
void ASPublishAppServiceResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
index 30905b5fa2..f29b974862 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
@@ -40,6 +40,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASUnpublishAppServiceRequest::ASUnpublishAppServiceRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ ASUnpublishAppServiceRequest::ASUnpublishAppServiceRequest(
ASUnpublishAppServiceRequest::~ASUnpublishAppServiceRequest() {}
void ASUnpublishAppServiceRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string service_id =
(*message_)[strings::msg_params][strings::service_id].asString();
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
index 0c8b479da8..6b665fafd0 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
@@ -39,6 +39,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ASUnpublishAppServiceResponse::ASUnpublishAppServiceResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ ASUnpublishAppServiceResponse::ASUnpublishAppServiceResponse(
ASUnpublishAppServiceResponse::~ASUnpublishAppServiceResponse() {}
void ASUnpublishAppServiceResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc
index db1716ecb8..0f1fbcf1ce 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc
@@ -41,6 +41,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnASAppServiceDataNotification::OnASAppServiceDataNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -156,8 +158,7 @@ void OnASAppServiceDataNotification::GetNavigationImagePaths(
bool OnASAppServiceDataNotification::ValidateParams(
smart_objects::SmartObject& message_params) {
if (!message_params.keyExists(strings::service_data)) {
- LOG4CXX_DEBUG(logger_,
- "OASD notification received without any service data");
+ SDL_LOG_DEBUG("OASD notification received without any service data");
return false;
}
smart_objects::SmartObject& service_data =
@@ -168,8 +169,7 @@ bool OnASAppServiceDataNotification::ValidateParams(
auto service =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
if (!service) {
- LOG4CXX_ERROR(logger_,
- "OASD notification received with an unpublished service ID");
+ SDL_LOG_ERROR("OASD notification received with an unpublished service ID");
return false;
}
@@ -179,8 +179,7 @@ bool OnASAppServiceDataNotification::ValidateParams(
service_type, &service_type_value)) {
auto app = application_manager_.application(service->connection_key);
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Failed to find service provider for OASD message");
+ SDL_LOG_ERROR("Failed to find service provider for OASD message");
return false;
}
@@ -204,8 +203,8 @@ bool OnASAppServiceDataNotification::ValidateParams(
}
void OnASAppServiceDataNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Sending AS data to HMI");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Sending AS data to HMI");
if (ValidateParams((*message_)[strings::msg_params])) {
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
index 1c73fc73f4..5483873c3c 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,8 +56,8 @@ OnASAppServiceDataNotificationFromHMI::
~OnASAppServiceDataNotificationFromHMI() {}
void OnASAppServiceDataNotificationFromHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Received an OnAppServiceData from HMI");
std::string service_id =
(*message_)[strings::msg_params][strings::service_data]
@@ -64,14 +66,14 @@ void OnASAppServiceDataNotificationFromHMI::Run() {
AppService* service =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
if (!service) {
- LOG4CXX_ERROR(
- logger_, "No published services exist with service ID: " << service_id);
+ SDL_LOG_ERROR(
+ "No published services exist with service ID: " << service_id);
return;
} else if (service->mobile_service) {
- LOG4CXX_ERROR(logger_, "Service was not published by the HMI");
+ SDL_LOG_ERROR("Service was not published by the HMI");
return;
} else if (!service->record[strings::service_active].asBool()) {
- LOG4CXX_ERROR(logger_, "Service is not active");
+ SDL_LOG_ERROR("Service is not active");
return;
}
@@ -83,11 +85,9 @@ void OnASAppServiceDataNotificationFromHMI::Run() {
service->record[strings::service_manifest][strings::service_type]
.asString();
if (published_service_type != service_type) {
- LOG4CXX_ERROR(logger_,
- "Service type mismatch, expected "
- << service_type
- << ", but service was published with type "
- << published_service_type);
+ SDL_LOG_ERROR("Service type mismatch, expected "
+ << service_type << ", but service was published with type "
+ << published_service_type);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
index e3bf40308d..719856625d 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
@@ -42,6 +42,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetAppServiceDataRequest::GetAppServiceDataRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,7 +59,7 @@ GetAppServiceDataRequest::GetAppServiceDataRequest(
GetAppServiceDataRequest::~GetAppServiceDataRequest() {}
void GetAppServiceDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID,
hmi_apis::FunctionID::AppService_GetAppServiceData,
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc
index 0af1a5436b..1a8912518a 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile(
GetAppServiceDataRequestToMobile::~GetAppServiceDataRequestToMobile() {}
void GetAppServiceDataRequestToMobile::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc
index 32ad8e014d..9c0b46c209 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetAppServiceDataResponse::GetAppServiceDataResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ GetAppServiceDataResponse::GetAppServiceDataResponse(
GetAppServiceDataResponse::~GetAppServiceDataResponse() {}
void GetAppServiceDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc
index 90fca04eb2..04b969502b 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc
@@ -40,6 +40,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile(
GetAppServiceDataResponseFromMobile::~GetAppServiceDataResponseFromMobile() {}
void GetAppServiceDataResponseFromMobile::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::MobileEvent event(mobile_apis::FunctionID::GetAppServiceDataID);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
index 1ffe99462d..674578946a 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
@@ -46,6 +46,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppServiceDataNotification::OnAppServiceDataNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -61,8 +63,8 @@ OnAppServiceDataNotification::OnAppServiceDataNotification(
OnAppServiceDataNotification::~OnAppServiceDataNotification() {}
void OnAppServiceDataNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Sending OnAppServiceData to consumer");
std::string service_id =
(*message_)[strings::msg_params][strings::service_data]
@@ -72,15 +74,15 @@ void OnAppServiceDataNotification::Run() {
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
if (!service) {
- LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published");
+ SDL_LOG_ERROR("Service sending OnAppServiceData is not published");
return;
} else if (!service
->record[strings::service_manifest]
[strings::allow_app_consumers]
.asBool()) {
- LOG4CXX_ERROR(logger_,
- "Service does not allow for app consumers, skipping mobile "
- "OnAppServiceData notification");
+ SDL_LOG_ERROR(
+ "Service does not allow for app consumers, skipping mobile "
+ "OnAppServiceData notification");
return;
}
@@ -93,7 +95,7 @@ void OnAppServiceDataNotification::Run() {
[service_type](const ApplicationSharedPtr app) {
DCHECK_OR_RETURN(app, false);
auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
- LOG4CXX_DEBUG(logger_, "Check subscription for type: " << service_type);
+ SDL_LOG_DEBUG("Check subscription for type: " << service_type);
return ext.IsSubscribedToAppService(service_type);
};
@@ -107,12 +109,11 @@ void OnAppServiceDataNotification::Run() {
for (; applications.end() != app_it; ++app_it) {
const ApplicationSharedPtr app = *app_it;
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
continue;
}
- LOG4CXX_DEBUG(logger_,
- "Sending OnAppServiceDataNotification to mobile connection: "
- << app->app_id());
+ SDL_LOG_DEBUG("Sending OnAppServiceDataNotification to mobile connection: "
+ << app->app_id());
(*message_)[app_mngr::strings::params][app_mngr::strings::connection_key] =
app->app_id();
SendNotification();
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
index 5caacc9801..4c1caebd36 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
@@ -41,6 +41,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,8 +59,8 @@ OnAppServiceDataNotificationFromMobile::
~OnAppServiceDataNotificationFromMobile() {}
void OnAppServiceDataNotificationFromMobile::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Received an OnAppServiceData");
MessageHelper::PrintSmartObject(*message_);
uint32_t app_connection_key = connection_key();
@@ -74,9 +76,9 @@ void OnAppServiceDataNotificationFromMobile::Run() {
app->policy_app_id(), std::string(), service_type, NULL);
if (!result) {
- LOG4CXX_DEBUG(logger_,
- "Incorrect service type received in "
- "OnAppServiceDataNotificationFromMobile");
+ SDL_LOG_DEBUG(
+ "Incorrect service type received in "
+ "OnAppServiceDataNotificationFromMobile");
return;
}
@@ -87,15 +89,15 @@ void OnAppServiceDataNotificationFromMobile::Run() {
AppService* service =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
if (!service) {
- LOG4CXX_ERROR(
- logger_, "No published services exist with service ID: " << service_id);
+ SDL_LOG_ERROR(
+ "No published services exist with service ID: " << service_id);
return;
} else if (!service->mobile_service ||
service->connection_key != app_connection_key) {
- LOG4CXX_ERROR(logger_, "Service was not published by this application");
+ SDL_LOG_ERROR("Service was not published by this application");
return;
} else if (!service->record[strings::service_active].asBool()) {
- LOG4CXX_ERROR(logger_, "Service is not active");
+ SDL_LOG_ERROR("Service is not active");
return;
}
@@ -103,11 +105,9 @@ void OnAppServiceDataNotificationFromMobile::Run() {
service->record[strings::service_manifest][strings::service_type]
.asString();
if (published_service_type != service_type) {
- LOG4CXX_ERROR(logger_,
- "Service type mismatch, expected "
- << service_type
- << ", but service was published with type "
- << published_service_type);
+ SDL_LOG_ERROR("Service type mismatch, expected "
+ << service_type << ", but service was published with type "
+ << published_service_type);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
index 63b6e47d8e..c303e6d99f 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
@@ -41,6 +41,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest(
PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {}
void PerformAppServiceInteractionRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto app = application_manager_.application(connection_key());
if (!app) {
@@ -122,7 +124,7 @@ void PerformAppServiceInteractionRequest::Run() {
void PerformAppServiceInteractionRequest::on_event(
const event_engine::Event& event) {
- LOG4CXX_DEBUG(logger_, "HMI PerformAppServiceInteraction on_event");
+ SDL_LOG_DEBUG("HMI PerformAppServiceInteraction on_event");
const smart_objects::SmartObject& event_message = event.smart_object();
auto msg_params = event_message[strings::msg_params];
@@ -169,7 +171,7 @@ void PerformAppServiceInteractionRequest::on_event(
void PerformAppServiceInteractionRequest::on_event(
const event_engine::MobileEvent& event) {
- LOG4CXX_DEBUG(logger_, "Mobile PerformAppServiceInteraction on_event");
+ SDL_LOG_DEBUG("Mobile PerformAppServiceInteraction on_event");
const smart_objects::SmartObject& event_message = event.smart_object();
auto msg_params = event_message[strings::msg_params];
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc
index 2a7b644cb3..4997f63232 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc
@@ -37,6 +37,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PerformAppServiceInteractionRequestToMobile::
PerformAppServiceInteractionRequestToMobile(
const application_manager::commands::MessageSharedPtr& message,
@@ -54,7 +56,7 @@ PerformAppServiceInteractionRequestToMobile::
~PerformAppServiceInteractionRequestToMobile() {}
void PerformAppServiceInteractionRequestToMobile::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc
index 5e84f42c34..a5a81eb325 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc
@@ -37,6 +37,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse(
PerformAppServiceInteractionResponse::~PerformAppServiceInteractionResponse() {}
void PerformAppServiceInteractionResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc
index 9912df84ce..25ef530b8d 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc
@@ -38,6 +38,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PerformAppServiceInteractionResponseFromMobile::
PerformAppServiceInteractionResponseFromMobile(
const application_manager::commands::MessageSharedPtr& message,
@@ -55,7 +57,7 @@ PerformAppServiceInteractionResponseFromMobile::
~PerformAppServiceInteractionResponseFromMobile() {}
void PerformAppServiceInteractionResponseFromMobile::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::MobileEvent event(
mobile_apis::FunctionID::PerformAppServiceInteractionID);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
index 53d1bf82fa..f2bc66520b 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -43,6 +43,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PublishAppServiceRequest::PublishAppServiceRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,8 +60,8 @@ PublishAppServiceRequest::PublishAppServiceRequest(
PublishAppServiceRequest::~PublishAppServiceRequest() {}
void PublishAppServiceRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key());
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Received a PublishAppService " << connection_key());
MessageHelper::PrintSmartObject(*message_);
smart_objects::SmartObject response_params =
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
index d1bfc6e154..53dff48f43 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
@@ -39,6 +39,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PublishAppServiceResponse::PublishAppServiceResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ PublishAppServiceResponse::PublishAppServiceResponse(
PublishAppServiceResponse::~PublishAppServiceResponse() {}
void PublishAppServiceResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
index 2cb43bce07..200bae01d9 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
@@ -41,6 +41,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UnpublishAppServiceRequest::UnpublishAppServiceRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ UnpublishAppServiceRequest::UnpublishAppServiceRequest(
UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {}
void UnpublishAppServiceRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string service_id =
(*message_)[strings::msg_params][strings::service_id].asString();
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
index 22450ecc4c..6b48c7f225 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
@@ -39,6 +39,8 @@ namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UnpublishAppServiceResponse::UnpublishAppServiceResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UnpublishAppServiceResponse::UnpublishAppServiceResponse(
UnpublishAppServiceResponse::~UnpublishAppServiceResponse() {}
void UnpublishAppServiceResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc
index 785cdd5200..f783b014c3 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc
@@ -40,7 +40,8 @@ namespace {
const std::string kAppServiceType1 = "AppServiceType1";
const std::string kAppServiceType2 = "AppServiceType2";
const std::string kResumptionDataKey = "kResumptionDataKey";
-const std::string kAppServiceInfoKey = "appService";
+const std::string kAppServiceInfoKey =
+ application_manager::hmi_interface::app_service;
} // namespace
namespace test {
@@ -195,7 +196,8 @@ TEST_F(AppServiceAppExtensionTest, ProcessResumption_SUCCESS) {
smart_objects::SmartObject(kAppServiceType2));
smart_objects::SmartObject resumption_data;
- resumption_data[kAppServiceInfoKey] = app_service_data;
+ resumption_data[application_manager::strings::application_subscriptions]
+ [kAppServiceInfoKey] = app_service_data;
app_service_app_extension_->ProcessResumption(resumption_data);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
index a75020956c..f81919f4fa 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
@@ -51,6 +51,8 @@ class RCGetInteriorVehicleDataRequest
const RCCommandParams& params);
void Run() OVERRIDE;
+ void onTimeOut() OVERRIDE;
+
~RCGetInteriorVehicleDataRequest();
};
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h
index c1fe30fa4d..e265fb7427 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h
@@ -87,6 +87,13 @@ class InteriorDataManager {
* false.
*/
virtual bool CheckRequestsToHMIFrequency(const ModuleUid& module) = 0;
+
+ /**
+ * @brief Reverts resumption data and sends ubsubscribe vehicle data request
+ * to a HMI
+ * @param subscriptions Module data that SDL should unsubscribe off
+ */
+ virtual void OnResumptionRevert(const std::set<ModuleUid>& subscriptions) = 0;
};
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h
index 791016cdcd..43927b25c8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h
@@ -65,6 +65,8 @@ class InteriorDataManagerImpl : public InteriorDataManager {
bool CheckRequestsToHMIFrequency(const ModuleUid& module) OVERRIDE;
+ void OnResumptionRevert(const std::set<ModuleUid>& subscriptions) OVERRIDE;
+
private:
/**
* @brief UpdateHMISubscriptionsOnPolicyUpdated process policy update event.
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
index 33271e64fd..8b2162c9ab 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,9 @@
#include <memory>
#include <set>
#include <string>
+
#include "application_manager/app_extension.h"
+#include "application_manager/application.h"
#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -137,9 +139,13 @@ struct Grid {
}
};
+class RCRPCPlugin;
+
class RCAppExtension : public application_manager::AppExtension {
public:
- explicit RCAppExtension(application_manager::AppExtensionUID uid);
+ explicit RCAppExtension(application_manager::AppExtensionUID uid,
+ RCRPCPlugin& plugin,
+ application_manager::Application& application);
~RCAppExtension();
/**
@@ -177,6 +183,36 @@ class RCAppExtension : public application_manager::AppExtension {
std::set<ModuleUid> InteriorVehicleDataSubscriptions() const;
/**
+ * @brief AddPendingSubscription adds pending subscription
+ * @param module interior data specification(zone, data type)
+ * @return true in case of pending subscription is successful added, otherwise
+ * false
+ */
+ bool AddPendingSubscription(const ModuleUid& module);
+
+ /**
+ * @brief RemovePendingSubscription removes some particular pending
+ * subscription
+ * @param module interior data specification(zone, data type)
+ */
+ void RemovePendingSubscription(const ModuleUid& module);
+
+ /**
+ * @brief RemovePendingSubscriptions removes all pending subscriptions
+ */
+ void RemovePendingSubscriptions();
+
+ /**
+ * @brief PendingSubscriptions list of preliminary subscriptoins
+ * That will be moved to subscriptions as soon as HMI will respond with
+ * success.
+ * Used for resumption to keep list of preliminary subscriptions and wait for
+ * HMI response
+ * @return list of preliminary subscriptions
+ */
+ std::set<ModuleUid> PendingSubscriptions();
+
+ /**
* @brief GetUserLocation
* @return grid of user location
*/
@@ -197,17 +233,33 @@ class RCAppExtension : public application_manager::AppExtension {
void SetUserLocation(const Grid& grid);
private:
+ /**
+ * @brief Checks if the application's pointer is valid and update the
+ * application's hash in this case
+ */
+ void UpdateHash();
+
std::set<ModuleUid> subscribed_interior_vehicle_data_;
+ std::set<ModuleUid> pending_subscriptions_;
+
Grid user_location_;
+ RCRPCPlugin& plugin_;
+
+ /**
+ * ApplicationSharedPtr needed for updating application's hash
+ */
+ application_manager::Application& application_;
+
// AppExtension interface
public:
- void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
- resumption_data) OVERRIDE;
- void ProcessResumption(
- const ns_smart_device_link::ns_smart_objects::SmartObject&
- resumption_data) OVERRIDE;
+ void SaveResumptionData(smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ void ProcessResumption(const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ void RevertResumption(
+ const smart_objects::SmartObject& resumption_data) OVERRIDE;
};
typedef std::shared_ptr<RCAppExtension> RCAppExtensionPtr;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
index eed860fc7f..1bf4a7a259 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
@@ -80,8 +80,12 @@ class RCHelpers {
static RCAppExtensionPtr GetRCExtension(
application_manager::Application& app);
- static smart_objects::SmartObjectSPtr CreateUnsubscribeRequestToHMI(
- const ModuleUid& module, const uint32_t correlation_id);
+ enum InteriorDataAction { SUBSCRIBE, UNSUBSCRIBE, NONE };
+
+ static smart_objects::SmartObjectSPtr CreateGetInteriorVDRequestToHMI(
+ const ModuleUid& module,
+ const uint32_t correlation_id,
+ const InteriorDataAction action);
static std::vector<application_manager::ApplicationSharedPtr>
AppsSubscribedToModule(application_manager::ApplicationManager& app_mngr,
@@ -169,6 +173,13 @@ class RCHelpers {
static smart_objects::SmartObject MergeArray(
const smart_objects::SmartObject& data1,
const smart_objects::SmartObject& data2);
+
+ /**
+ * @brief Determines the success of the response
+ * judging from message type received from HMI
+ * @param response from HMI
+ */
+ static bool IsResponseSuccessful(const smart_objects::SmartObject& response);
};
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h
new file mode 100644
index 0000000000..944d47b052
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h
@@ -0,0 +1,165 @@
+#pragma once
+
+#include <map>
+#include <queue>
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/resumption/pending_resumption_handler.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+#include "application_manager/rpc_service.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
+#include "rc_rpc_plugin/rc_app_extension.h"
+
+namespace rc_rpc_plugin {
+
+/**
+ * @brief The RCPendingResumptionHandler class
+ * responsibility to avoid duplication of subscription requests to HMI
+ * if multiple applications are registering
+ */
+class RCPendingResumptionHandler : public resumption::PendingResumptionHandler {
+ public:
+ RCPendingResumptionHandler(
+ application_manager::ApplicationManager& application_manager,
+ rc_rpc_plugin::InteriorDataCache& interior_data_cache);
+
+ void on_event(const application_manager::event_engine::Event& event) override;
+
+ void HandleResumptionSubscriptionRequest(
+ application_manager::AppExtension& extension,
+ application_manager::Application& app) override;
+
+ void OnResumptionRevert() override;
+
+ /**
+ * @brief Creates GetInteriorVehicleData subscription request
+ * @param module unique identifier of module (moduleType + moduleID) used to
+ * create the request
+ * @param correlation_id - unique ID
+ * @return subscription request in smart object representation
+ */
+ static smart_objects::SmartObjectSPtr CreateSubscriptionRequest(
+ const ModuleUid& module, const uint32_t correlation_id);
+
+ /**
+ * @brief Retrieves function id from subscription request
+ * @param subscription_request a subscription request that contains the
+ * function id
+ * @return function id
+ */
+ static hmi_apis::FunctionID::eType GetFunctionId(
+ const smart_objects::SmartObject& subscription_request);
+
+ /**
+ * @brief Retrieves module uid from subscription request
+ * @param subscription_request a subscription request that contains a unique
+ * module identifier
+ * @return unique module identifier
+ */
+ static ModuleUid GetModuleUid(
+ const smart_objects::SmartObject& subscription_request);
+
+ private:
+ /**
+ * @brief The PendingRequest struct contains fields, needed during
+ * processing events, related to responses from HMI to each resumption request
+ */
+ struct PendingRequest {
+ uint32_t app_id;
+ smart_objects::SmartObject message;
+ uint32_t correlation_id() const {
+ namespace am_strings = app_mngr::strings;
+ return message[am_strings::params][am_strings::correlation_id].asInt();
+ }
+ };
+
+ /**
+ * @brief Handles a successful response from HMI
+ * @param event contains response from HMI
+ * @param module_uid a unique identifier for module
+ */
+ void HandleSuccessfulResponse(
+ const application_manager::event_engine::Event& event,
+ const ModuleUid& module_uid);
+
+ /**
+ * @brief Creates next GetInteriorVehicleData subscription request if a
+ * previous resumption of subscriptions is not successful
+ * @param module a unique identifier for module
+ */
+ void ProcessNextPausedResumption(const ModuleUid& module);
+
+ /**
+ * @brief Notifies subscriber about resumption status
+ * @param subscription_response response from HMI
+ * @param correlation_id unique message ID
+ */
+ void RaiseEventForResponse(
+ const smart_objects::SmartObject& subscription_response,
+ const uint32_t correlation_id) const;
+
+ /**
+ * @brief Checks if SDL is still waiting on a subscription response for the
+ * specified module
+ * @param module the unique identifier for the module to be checked against
+ */
+ bool IsPendingForResponse(const ModuleUid& module) const;
+
+ /**
+ * @brief Checks if any app except passed is subscribed to a given module
+ * @param module module to check
+ * @param app_id app to ignore subscription
+ * @return true if any app except passed is subscribed to module, otherwise
+ * false
+ */
+ bool IsOtherAppsSubscribed(const uint32_t app_id,
+ const ModuleUid& module) const;
+
+ /**
+ * @brief Returns pending request, which corresponds to correlation ID
+ * @param corr_id unique message ID
+ * @return optional object, which contains subscription request, or empty
+ * optional, if such request wasn't found
+ */
+ utils::Optional<smart_objects::SmartObject> GetPendingRequest(
+ const uint32_t corr_id);
+
+ /**
+ * @brief Returns ID of application, related to pending request, which
+ * corresponds to correlation ID
+ * @param corr_id unique message ID
+ * @return optional object, which contains ID of application, or empty
+ * optional, if such request wasn't found
+ */
+ utils::Optional<uint32_t> GetPendingApp(const uint32_t corr_id);
+
+ /**
+ * @brief Removes pending request, which corresponds to
+ * correlation ID
+ * @param corr_id unique ID
+ */
+ void RemovePendingRequest(const uint32_t corr_id);
+
+ /**
+ * @brief Adds pending request, related to
+ * application ID
+ * @param request_so pending request message
+ */
+ void AddPendingRequest(const uint32_t app_id,
+ const smart_objects::SmartObject request_so);
+
+ /**
+ * @brief PendingRequestQueue contains subscription request,
+ * which will be sent to the HMI in the case that a previous resumption
+ * attempt for the same module was not successful
+ */
+ using PendingRequestQueue = std::queue<PendingRequest>;
+ std::map<ModuleUid, PendingRequestQueue> paused_resumptions_;
+
+ sync_primitives::Lock pending_resumption_lock_;
+ std::vector<PendingRequest> pending_requests_;
+
+ application_manager::rpc_service::RPCService& rpc_service_;
+ rc_rpc_plugin::InteriorDataCache& interior_data_cache_;
+};
+
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
index e12bd88e58..528e116403 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
@@ -37,11 +37,13 @@
#include "application_manager/command_factory.h"
#include "application_manager/plugin_manager/rpc_plugin.h"
+#include "application_manager/resumption/pending_resumption_handler.h"
#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/interior_data_manager.h"
#include "rc_rpc_plugin/rc_capabilities_manager.h"
#include "rc_rpc_plugin/rc_consent_manager.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
+#include "utils/ilogger.h"
namespace rc_rpc_plugin {
namespace plugins = application_manager::plugin_manager;
@@ -102,6 +104,33 @@ class RCRPCPlugin : public plugins::RPCPlugin {
void OnApplicationEvent(plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) OVERRIDE;
+ /**
+ * @brief ProcessResumptionSubscription send Subscribe vehicle data requests
+ * to HMI
+ * @param app application for subscription
+ * @param ext application extension
+ */
+ void ProcessResumptionSubscription(app_mngr::Application& app,
+ RCAppExtension& ext);
+
+ /**
+ * @brief Reverts resumption data, clears all pending resumption and sends
+ * unsubscribe interior vehicle data requests to HMI
+ * @param subscriptions Module data that SDL should unsubscribe off
+ */
+ void RevertResumption(const std::set<ModuleUid>& subscriptions);
+
+ /**
+ * @brief IsOtherAppsSubscribed check if any app except passed is subscribed
+ * to a given module
+ * @param module module to check
+ * @param app_id app to ignore subscription
+ * @return true if any app except passed is subscribed to module, otherwise
+ * false
+ */
+ bool IsOtherAppsSubscribed(const rc_rpc_types::ModuleUid& module,
+ const uint32_t app_id);
+
static const uint32_t kRCPluginID = 153;
typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
@@ -117,10 +146,14 @@ class RCRPCPlugin : public plugins::RPCPlugin {
std::unique_ptr<InteriorDataCache> interior_data_cache_;
std::unique_ptr<InteriorDataManager> interior_data_manager_;
std::unique_ptr<RCCapabilitiesManager> rc_capabilities_manager_;
+ using PendingResumptionHandlerSPtr =
+ std::shared_ptr<resumption::PendingResumptionHandler>;
+ PendingResumptionHandlerSPtr pending_resumption_handler_;
};
} // namespace rc_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create();
+extern "C" application_manager::plugin_manager::RPCPlugin* Create(
+ logger::Logger* logger_instance);
extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_RPC_PLUGIN_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc
index 75faf5db8c..6fe3e31aa4 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc
@@ -38,6 +38,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCButtonPressRequest::RCButtonPressRequest(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -50,7 +52,7 @@ RCButtonPressRequest::RCButtonPressRequest(
RCButtonPressRequest::~RCButtonPressRequest() {}
void RCButtonPressRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc
index 5c1691ed7b..33610c5a4d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc
@@ -36,6 +36,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCButtonPressResponse::RCButtonPressResponse(
const application_manager::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -47,7 +49,7 @@ RCButtonPressResponse::RCButtonPressResponse(
params.policy_handler_) {}
void RCButtonPressResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::event_engine::Event event(
hmi_apis::FunctionID::Buttons_ButtonPress);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc
index 774ee04677..a4d2d96772 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc
@@ -36,6 +36,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCGetInteriorVehicleDataConsentRequest::RCGetInteriorVehicleDataConsentRequest(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -49,7 +51,7 @@ RCGetInteriorVehicleDataConsentRequest::
~RCGetInteriorVehicleDataConsentRequest() {}
void RCGetInteriorVehicleDataConsentRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc
index 3244857656..1ae8158602 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc
@@ -36,6 +36,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCGetInteriorVehicleDataConsentResponse::
RCGetInteriorVehicleDataConsentResponse(
const application_manager::commands::MessageSharedPtr& message,
@@ -48,7 +50,7 @@ RCGetInteriorVehicleDataConsentResponse::
params.policy_handler_) {}
void RCGetInteriorVehicleDataConsentResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
index c7baf75e27..fede1dbd11 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
@@ -31,11 +31,16 @@
*/
#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
+
#include "utils/macro.h"
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCGetInteriorVehicleDataRequest::RCGetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -48,9 +53,25 @@ RCGetInteriorVehicleDataRequest::RCGetInteriorVehicleDataRequest(
RCGetInteriorVehicleDataRequest::~RCGetInteriorVehicleDataRequest() {}
void RCGetInteriorVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void RCGetInteriorVehicleDataRequest::onTimeOut() {
+ SDL_LOG_TRACE("function_id: " << function_id()
+ << " correlation_id: " << correlation_id());
+ using namespace application_manager;
+ event_engine::Event timeout_event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+
+ auto error_response = MessageHelper::CreateNegativeResponseFromHmi(
+ function_id(),
+ correlation_id(),
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ std::string("Timed out"));
+ timeout_event.set_smart_object(*error_response);
+ timeout_event.raise(application_manager_.event_dispatcher());
+}
+
} // namespace commands
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc
index a366aa65fa..7e935621d4 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc
@@ -37,6 +37,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCGetInteriorVehicleDataResponse::RCGetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -48,7 +50,7 @@ RCGetInteriorVehicleDataResponse::RCGetInteriorVehicleDataResponse(
params.policy_handler_) {}
void RCGetInteriorVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc
index c6cf1b0d5a..68587e0861 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc
@@ -37,6 +37,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCOnInteriorVehicleDataNotification::RCOnInteriorVehicleDataNotification(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -50,7 +52,7 @@ RCOnInteriorVehicleDataNotification::RCOnInteriorVehicleDataNotification(
RCOnInteriorVehicleDataNotification::~RCOnInteriorVehicleDataNotification() {}
void RCOnInteriorVehicleDataNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[app_mngr::strings::params][app_mngr::strings::function_id] =
static_cast<int>(mobile_apis::FunctionID::eType::OnInteriorVehicleDataID);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
index 45b0d13582..b7a343a907 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
@@ -47,7 +47,7 @@ std::map<std::string, hmi_apis::Common_RCAccessMode::eType> access_modes{
{enums_value::kAskDriver, hmi_apis::Common_RCAccessMode::ASK_DRIVER}};
}
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("Commands")
RCOnRemoteControlSettingsNotification::RCOnRemoteControlSettingsNotification(
const app_mngr::commands::MessageSharedPtr& message,
@@ -89,18 +89,17 @@ std::string AccessModeToString(
}
void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
interior_data_manager_.OnDisablingRC();
}
void RCOnRemoteControlSettingsNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!(*message_)[app_mngr::strings::msg_params].keyExists(
message_params::kAllowed)) {
- LOG4CXX_DEBUG(logger_,
- "Notification is ignored due to \"allow\" parameter absense");
- LOG4CXX_DEBUG(logger_, "RC Functionality remains unchanged");
+ SDL_LOG_DEBUG("Notification is ignored due to \"allow\" parameter absense");
+ SDL_LOG_DEBUG("RC Functionality remains unchanged");
return;
}
@@ -110,7 +109,7 @@ void RCOnRemoteControlSettingsNotification::Run() {
if (is_allowed) {
hmi_apis::Common_RCAccessMode::eType access_mode =
hmi_apis::Common_RCAccessMode::INVALID_ENUM;
- LOG4CXX_DEBUG(logger_, "Allowing RC Functionality");
+ SDL_LOG_DEBUG("Allowing RC Functionality");
resource_allocation_manager_.set_rc_enabled(true);
if ((*message_)[app_mngr::strings::msg_params].keyExists(
message_params::kAccessMode)) {
@@ -118,18 +117,16 @@ void RCOnRemoteControlSettingsNotification::Run() {
(*message_)[app_mngr::strings::msg_params]
[message_params::kAccessMode]
.asUInt());
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Setting up access mode : " << AccessModeToString(access_mode));
} else {
access_mode = resource_allocation_manager_.GetAccessMode();
- LOG4CXX_DEBUG(logger_,
- "No access mode received. Using last known: "
- << AccessModeToString(access_mode));
+ SDL_LOG_DEBUG("No access mode received. Using last known: "
+ << AccessModeToString(access_mode));
}
resource_allocation_manager_.SetAccessMode(access_mode);
} else {
- LOG4CXX_DEBUG(logger_, "Disallowing RC Functionality");
+ SDL_LOG_DEBUG("Disallowing RC Functionality");
DisallowRCFunctionality();
resource_allocation_manager_.ResetAllAllocations();
resource_allocation_manager_.set_rc_enabled(false);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc
index 2f203afc2d..f0ff1afbb3 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc
@@ -37,6 +37,8 @@ namespace app_mngr = application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCSetGlobalPropertiesRequest::RCSetGlobalPropertiesRequest(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -47,7 +49,7 @@ RCSetGlobalPropertiesRequest::RCSetGlobalPropertiesRequest(
params.policy_handler_) {}
void RCSetGlobalPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc
index c31314ec21..3779cfc198 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc
@@ -35,6 +35,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCSetGlobalPropertiesResponse::RCSetGlobalPropertiesResponse(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -46,7 +48,7 @@ RCSetGlobalPropertiesResponse::RCSetGlobalPropertiesResponse(
params.policy_handler_) {}
void RCSetGlobalPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::event_engine::Event event(
hmi_apis::FunctionID::RC_SetGlobalProperties);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc
index f0d5ecc177..618f200d18 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc
@@ -36,6 +36,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCSetInteriorVehicleDataRequest::RCSetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -47,7 +49,7 @@ RCSetInteriorVehicleDataRequest::RCSetInteriorVehicleDataRequest(
RCSetInteriorVehicleDataRequest::~RCSetInteriorVehicleDataRequest() {}
void RCSetInteriorVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc
index 56d924debe..94cf2837d8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc
@@ -36,6 +36,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCSetInteriorVehicleDataResponse::RCSetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -47,7 +49,7 @@ RCSetInteriorVehicleDataResponse::RCSetInteriorVehicleDataResponse(
params.policy_handler_) {}
void RCSetInteriorVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::event_engine::Event event(
hmi_apis::FunctionID::RC_SetInteriorVehicleData);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
index 3adc48dfbf..9bf7977bdf 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
@@ -45,7 +45,7 @@ namespace commands {
using namespace json_keys;
using namespace message_params;
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("Commands")
ButtonPressRequest::ButtonPressRequest(
const app_mngr::commands::MessageSharedPtr& message,
@@ -78,7 +78,7 @@ const mobile_apis::ButtonName::eType ButtonPressRequest::GetButtonId() const {
}
void ButtonPressRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
const bool button_name_matches_module_type =
@@ -106,14 +106,13 @@ void ButtonPressRequest::Execute() {
&(*message_)[app_mngr::strings::msg_params],
true);
} else if (!button_name_matches_module_type) {
- LOG4CXX_WARN(logger_, "Request module type and button name mismatch!");
+ SDL_LOG_WARN("Request module type and button name mismatch!");
SetResourceState(module_type, ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Request module type and button name mismatch!");
} else {
- LOG4CXX_WARN(logger_,
- "Requested button or module does not exist in capabilities!");
+ SDL_LOG_WARN("Requested button or module does not exist in capabilities!");
SetResourceState(module_type, ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
@@ -123,7 +122,7 @@ void ButtonPressRequest::Execute() {
AcquireResult::eType ButtonPressRequest::AcquireResource(
const app_mngr::commands::MessageSharedPtr& message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
@@ -134,13 +133,13 @@ AcquireResult::eType ButtonPressRequest::AcquireResource(
bool ButtonPressRequest::IsResourceFree(const std::string& module_type,
const std::string& module_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return resource_allocation_manager_.IsResourceFree(module_type, module_id);
}
void ButtonPressRequest::SetResourceState(const std::string& module_type,
const ResourceState::eType state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
@@ -149,7 +148,7 @@ void ButtonPressRequest::SetResourceState(const std::string& module_type,
}
void ButtonPressRequest::on_event(const app_mngr::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RCCommandRequest::on_event(event);
if (hmi_apis::FunctionID::Buttons_ButtonPress != event.id()) {
@@ -180,7 +179,7 @@ void ButtonPressRequest::on_event(const app_mngr::event_engine::Event& event) {
auto app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
+ SDL_LOG_ERROR("NULL pointer.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
return;
}
@@ -221,7 +220,7 @@ std::string ButtonPressRequest::ModuleType() const {
}
std::string ButtonPressRequest::ModuleId() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto msg_params = (*message_)[app_mngr::strings::msg_params];
if (msg_params.keyExists(message_params::kModuleId)) {
return msg_params[message_params::kModuleId].asString();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc
index 491b0363c9..7f9ccf5839 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc
@@ -36,6 +36,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ButtonPressResponse::ButtonPressResponse(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -48,7 +50,7 @@ ButtonPressResponse::ButtonPressResponse(
ButtonPressResponse::~ButtonPressResponse() {}
void ButtonPressResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.GetRPCService().SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
index fd661afd5f..a13a7f2a9e 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
@@ -45,13 +45,15 @@ namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetInteriorVehicleDataConsentRequest::GetInteriorVehicleDataConsentRequest(
const application_manager::commands::MessageSharedPtr& message,
const RCCommandParams& params)
: RCCommandRequest(message, params) {}
void GetInteriorVehicleDataConsentRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto& msg_params = (*message_)[app_mngr::strings::msg_params];
@@ -65,9 +67,9 @@ void GetInteriorVehicleDataConsentRequest::Execute() {
}
if (msg_params[message_params::kModuleIds].empty()) {
- LOG4CXX_DEBUG(logger_,
- "ModuleIds collection is empty. Will be add default "
- "module_id from capabilities");
+ SDL_LOG_DEBUG(
+ "ModuleIds collection is empty. Will be add default "
+ "module_id from capabilities");
const auto module_id =
rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities(
@@ -81,8 +83,7 @@ void GetInteriorVehicleDataConsentRequest::Execute() {
*(msg_params[message_params::kModuleIds].asArray())) {
const ModuleUid module(module_type, module_id.asString());
if (!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
- LOG4CXX_WARN(logger_,
- "Accessing not supported module: " << module_type << " "
+ SDL_LOG_WARN("Accessing not supported module: " << module_type << " "
<< module_id.asString());
SetResourceState(module_type, ResourceState::FREE);
SendResponse(false,
@@ -94,8 +95,7 @@ void GetInteriorVehicleDataConsentRequest::Execute() {
smart_objects::SmartObject response_params;
if (GetCalculatedVehicleDataConsent(response_params)) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"No need to send request to HMI. Sending cached consents to mobile");
SendResponse(true, mobile_apis::Result::SUCCESS, nullptr, &response_params);
return;
@@ -107,8 +107,8 @@ void GetInteriorVehicleDataConsentRequest::Execute() {
hmi_request_consents_ =
smart_objects::SmartObject(response_params[message_params::kAllowed]);
- LOG4CXX_DEBUG(
- logger_, "Filtering out module ids with successfully calculated consent");
+ SDL_LOG_DEBUG(
+ "Filtering out module ids with successfully calculated consent");
smart_objects::SmartObject hmi_msg_params(msg_params);
auto module_ids_for_consent =
@@ -126,9 +126,9 @@ void GetInteriorVehicleDataConsentRequest::Execute() {
}
}
- LOG4CXX_DEBUG(logger_,
- "Forwarding request to HMI with moduleIds for modules with "
- "unknown consent");
+ SDL_LOG_DEBUG(
+ "Forwarding request to HMI with moduleIds for modules with "
+ "unknown consent");
SendHMIRequest(hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent,
(&hmi_msg_params),
true);
@@ -136,10 +136,10 @@ void GetInteriorVehicleDataConsentRequest::Execute() {
void GetInteriorVehicleDataConsentRequest::on_event(
const app_mngr::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (event.id() != hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent) {
- LOG4CXX_ERROR(logger_, "Received wrong event. FunctionID: " << event.id());
+ SDL_LOG_ERROR("Received wrong event. FunctionID: " << event.id());
return;
}
@@ -169,7 +169,7 @@ void GetInteriorVehicleDataConsentRequest::on_event(
.empty()) {
std::string info_out =
"Collection of consents is absent in HMI response or empty";
- LOG4CXX_ERROR(logger_, info_out);
+ SDL_LOG_ERROR(info_out);
SendResponse(false, mobile_apis::Result::GENERIC_ERROR, info_out.c_str());
return;
}
@@ -194,13 +194,12 @@ void GetInteriorVehicleDataConsentRequest::on_event(
"HMI response has incorrect number of consents expected: " +
std::to_string(number_of_expected_response_consents) +
", actual: " + std::to_string(response_consents->size());
- LOG4CXX_ERROR(logger_, info_out);
+ SDL_LOG_ERROR(info_out);
SendResponse(false, mobile_apis::Result::GENERIC_ERROR, info_out.c_str());
return;
}
- LOG4CXX_DEBUG(logger_,
- "Adding back filtered out module ids for response to mobile");
+ SDL_LOG_DEBUG("Adding back filtered out module ids for response to mobile");
uint32_t response_consents_counter = 0;
for (auto& consent : *(hmi_request_consents_.asArray())) {
// Only modify consent for moduleIds allowed by location constraints
@@ -221,7 +220,7 @@ void GetInteriorVehicleDataConsentRequest::on_event(
response_info, hmi_response[app_mngr::strings::msg_params]);
if (!result_of_saving) {
- LOG4CXX_DEBUG(logger_, "Consent saving failed");
+ SDL_LOG_DEBUG("Consent saving failed");
SendResponse(
false, mobile_apis::Result::GENERIC_ERROR, response_info.c_str());
return;
@@ -255,7 +254,7 @@ GetInteriorVehicleDataConsentRequest::~GetInteriorVehicleDataConsentRequest() {}
bool GetInteriorVehicleDataConsentRequest::IsUserLocationValid(
const ModuleUid& module_uid) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!rc_capabilities_manager_.IsSeatLocationCapabilityProvided()) {
return true;
@@ -278,7 +277,7 @@ rc_rpc_types::ModuleConsent
GetInteriorVehicleDataConsentRequest::GetModuleConsentByAccessMode(
const ModuleUid& module_uid,
const hmi_apis::Common_RCAccessMode::eType access_mode) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto get_auto_allow_consent = [](const ModuleUid& module_uid) {
return rc_rpc_types::ModuleConsent::CONSENTED;
@@ -328,31 +327,26 @@ GetInteriorVehicleDataConsentRequest::GetModuleConsentByAccessMode(
switch (access_mode) {
case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: {
- LOG4CXX_DEBUG(logger_,
- "Calculating consent for module("
- << module_uid.first << ", " << module_uid.second
- << ") in accessMode: AUTO_ALLOW");
+ SDL_LOG_DEBUG("Calculating consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << ") in accessMode: AUTO_ALLOW");
return get_auto_allow_consent(module_uid);
}
case hmi_apis::Common_RCAccessMode::AUTO_DENY: {
- LOG4CXX_DEBUG(logger_,
- "Calculating consent for module("
- << module_uid.first << ", " << module_uid.second
- << ") in accessMode: AUTO_DENY");
+ SDL_LOG_DEBUG("Calculating consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << ") in accessMode: AUTO_DENY");
return get_auto_deny_consent(module_uid);
}
case hmi_apis::Common_RCAccessMode::ASK_DRIVER: {
- LOG4CXX_DEBUG(logger_,
- "Calculating consent for module("
- << module_uid.first << ", " << module_uid.second
- << ") in accessMode: ASK_DRIVER");
+ SDL_LOG_DEBUG("Calculating consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << ") in accessMode: ASK_DRIVER");
return get_ask_driver_consent(module_uid);
}
default: {
- LOG4CXX_DEBUG(logger_,
- "Unknown accessMode specified. Denying consent for module("
- << module_uid.first << ", " << module_uid.second
- << ")");
+ SDL_LOG_DEBUG("Unknown accessMode specified. Denying consent for module("
+ << module_uid.first << ", " << module_uid.second << ")");
return rc_rpc_types::ModuleConsent::NOT_CONSENTED;
}
}
@@ -360,7 +354,7 @@ GetInteriorVehicleDataConsentRequest::GetModuleConsentByAccessMode(
bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent(
smart_objects::SmartObject& out_response) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
out_response =
smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
@@ -391,10 +385,9 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent(
const ModuleUid module_uid(module_type, module_id.asString());
// Check if the user_location is covered by the module's serviceArea
if (!IsUserLocationValid(module_uid)) {
- LOG4CXX_DEBUG(logger_,
- "User is outside the serviceArea for module("
- << module_uid.first << ", " << module_uid.second
- << "). Denying consent");
+ SDL_LOG_DEBUG("User is outside the serviceArea for module("
+ << module_uid.first << ", " << module_uid.second
+ << "). Denying consent");
modules_consent_array->push_back(smart_objects::SmartObject(false));
continue;
}
@@ -404,10 +397,8 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent(
const bool is_multiple_access_allowed =
rc_capabilities_manager_.IsMultipleAccessAllowed(module_uid);
if (!is_multiple_access_allowed) {
- LOG4CXX_DEBUG(logger_,
- "multipleAccess disallowed for module("
- << module_uid.first << ", " << module_uid.second
- << ")");
+ SDL_LOG_DEBUG("multipleAccess disallowed for module("
+ << module_uid.first << ", " << module_uid.second << ")");
module_consent = get_disallowed_multiple_access_consent(module_uid);
modules_consent_array->push_back(smart_objects::SmartObject(
module_consent == rc_rpc_types::ModuleConsent::CONSENTED));
@@ -418,10 +409,9 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent(
module_consent = GetModuleConsentByAccessMode(module_uid, access_mode);
if (module_consent == rc_rpc_types::ModuleConsent::NOT_EXISTS) {
- LOG4CXX_DEBUG(logger_,
- "Unable to calculate consent for module("
- << module_uid.first << ", " << module_uid.second
- << "), should send moduleId to HMI for consent");
+ SDL_LOG_DEBUG("Unable to calculate consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << "), should send moduleId to HMI for consent");
modules_consent_array->push_back(smart_objects::SmartObject());
can_handle_internally = false;
continue;
@@ -434,7 +424,7 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent(
bool GetInteriorVehicleDataConsentRequest::SaveModuleIdConsents(
std::string& info_out, const smart_objects::SmartObject& msg_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& allowed = msg_params[message_params::kAllowed];
const auto& moduleIds =
@@ -444,7 +434,7 @@ bool GetInteriorVehicleDataConsentRequest::SaveModuleIdConsents(
info_out =
"The received module_id collection from mobile and received consent "
"collection from HMI are not equal by size.";
- LOG4CXX_ERROR(logger_, info_out);
+ SDL_LOG_ERROR(info_out);
return false;
}
std::string module_type = ModuleType();
@@ -456,8 +446,7 @@ bool GetInteriorVehicleDataConsentRequest::SaveModuleIdConsents(
auto application = application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_,
- "Application with connection key:" << connection_key()
+ SDL_LOG_ERROR("Application with connection key:" << connection_key()
<< " isn't registered");
return false;
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc
index 3e197fbdea..fe33e29e44 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc
@@ -35,6 +35,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetInteriorVehicleDataConsentResponse::GetInteriorVehicleDataConsentResponse(
const application_manager::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -46,7 +48,7 @@ GetInteriorVehicleDataConsentResponse::GetInteriorVehicleDataConsentResponse(
params.policy_handler_) {}
void GetInteriorVehicleDataConsentResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.GetRPCService().SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
index e89b260dca..2b801f7406 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
@@ -44,7 +44,7 @@ namespace commands {
using namespace json_keys;
using namespace message_params;
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("Commands")
GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
@@ -53,7 +53,7 @@ GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest(
, excessive_subscription_occured_(false) {}
bool GetInteriorVehicleDataRequest::ProcessCapabilities() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto rc_capability = hmi_capabilities_.rc_capability();
const std::string module_type = ModuleType();
@@ -61,9 +61,8 @@ bool GetInteriorVehicleDataRequest::ProcessCapabilities() {
const ModuleUid module(module_type, module_id);
if (rc_capability &&
!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
- LOG4CXX_WARN(
- logger_,
- "Accessing not supported module: " << module_type << " " << module_id);
+ SDL_LOG_WARN("Accessing not supported module: " << module_type << " "
+ << module_id);
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
@@ -100,7 +99,7 @@ void GetInteriorVehicleDataRequest::FilterDisabledModuleData(
void GetInteriorVehicleDataRequest::ProcessResponseToMobileFromCache(
app_mngr::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
@@ -118,29 +117,41 @@ void GetInteriorVehicleDataRequest::ProcessResponseToMobileFromCache(
module_id;
const auto& request_msg_params = (*message_)[app_mngr::strings::msg_params];
- LOG4CXX_DEBUG(logger_,
- "kSubscribe exist" << request_msg_params.keyExists(
- message_params::kSubscribe));
+ SDL_LOG_DEBUG("kSubscribe exist"
+ << request_msg_params.keyExists(message_params::kSubscribe));
+
+ mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
if (request_msg_params.keyExists(message_params::kSubscribe)) {
response_msg_params[message_params::kIsSubscribed] =
request_msg_params[message_params::kSubscribe].asBool();
if (request_msg_params[message_params::kSubscribe].asBool()) {
auto extension = RCHelpers::GetRCExtension(*app);
DCHECK(extension);
- extension->SubscribeToInteriorVehicleData(module);
+ const bool is_app_already_subscribed =
+ extension->IsSubscribedToInteriorVehicleData(module);
+ if (is_app_already_subscribed) {
+ response_msg_params[app_mngr::strings::info] =
+ "App is already subscribed to the provided module";
+ result_code = mobile_apis::Result::WARNINGS;
+ } else {
+ extension->SubscribeToInteriorVehicleData(module);
+ app->UpdateHash();
+ }
}
}
- SendResponse(
- true, mobile_apis::Result::SUCCESS, nullptr, &response_msg_params);
+ SendResponse(true, result_code, nullptr, &response_msg_params);
if (AppShouldBeUnsubscribed()) {
auto extension = RCHelpers::GetRCExtension(*app);
DCHECK(extension);
- extension->UnsubscribeFromInteriorVehicleData(module);
+ if (extension->IsSubscribedToInteriorVehicleData(module)) {
+ extension->UnsubscribeFromInteriorVehicleData(module);
+ app->UpdateHash();
+ }
}
}
bool GetInteriorVehicleDataRequest::CheckRateLimits() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
const ModuleUid module(module_type, module_id);
@@ -148,7 +159,7 @@ bool GetInteriorVehicleDataRequest::CheckRateLimits() {
}
bool GetInteriorVehicleDataRequest::AppShouldBeUnsubscribed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& msg_params = (*message_)[app_mngr::strings::msg_params];
if (msg_params.keyExists(message_params::kSubscribe)) {
return !(msg_params[message_params::kSubscribe].asBool());
@@ -158,7 +169,7 @@ bool GetInteriorVehicleDataRequest::AppShouldBeUnsubscribed() {
bool GetInteriorVehicleDataRequest::TheLastAppShouldBeUnsubscribed(
app_mngr::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (AppShouldBeUnsubscribed()) {
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
@@ -167,9 +178,8 @@ bool GetInteriorVehicleDataRequest::TheLastAppShouldBeUnsubscribed(
RCHelpers::AppsSubscribedToModule(application_manager_, module);
if (subscribed_to_module_type.size() == 1 &&
subscribed_to_module_type.front() == app) {
- LOG4CXX_DEBUG(logger_,
- "The last application unsubscribes from "
- << module_type << " " << module_id);
+ SDL_LOG_DEBUG("The last application unsubscribes from "
+ << module_type << " " << module_id);
return true;
}
}
@@ -177,7 +187,7 @@ bool GetInteriorVehicleDataRequest::TheLastAppShouldBeUnsubscribed(
}
void GetInteriorVehicleDataRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ProcessCapabilities()) {
return;
@@ -199,7 +209,7 @@ void GetInteriorVehicleDataRequest::Execute() {
RemoveExcessiveSubscription();
}
if (!CheckRateLimits()) {
- LOG4CXX_WARN(logger_, "GetInteriorVehicleData frequency is too high.");
+ SDL_LOG_WARN("GetInteriorVehicleData frequency is too high.");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -216,7 +226,7 @@ void GetInteriorVehicleDataRequest::Execute() {
void GetInteriorVehicleDataRequest::on_event(
const app_mngr::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RCCommandRequest::on_event(event);
if (hmi_apis::FunctionID::RC_GetInteriorVehicleData != event.id()) {
@@ -244,10 +254,8 @@ void GetInteriorVehicleDataRequest::on_event(
if (result) {
if (!IsModuleIdProvided(hmi_response)) {
- LOG4CXX_WARN(logger_,
- "conditional mandatory parameter "
- << message_params::kModuleId
- << " missed in hmi response");
+ SDL_LOG_WARN("conditional mandatory parameter "
+ << message_params::kModuleId << " missed in hmi response");
result = false;
result_code = mobile_apis::Result::GENERIC_ERROR;
}
@@ -260,6 +268,9 @@ void GetInteriorVehicleDataRequest::on_event(
const ModuleUid module(module_type, module_id);
if (TheLastAppShouldBeUnsubscribed(app)) {
+ SDL_LOG_DEBUG("Removing module: [" << module.first << ":" << module.second
+ << "] "
+ << "from cache");
interior_data_cache_.Remove(module);
}
ProccessSubscription(hmi_response);
@@ -288,7 +299,7 @@ GetInteriorVehicleDataRequest::~GetInteriorVehicleDataRequest() {}
void GetInteriorVehicleDataRequest::ProccessSubscription(
const ns_smart_device_link::ns_smart_objects::SmartObject& hmi_response) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool is_subscribe_present_in_request =
(*message_)[app_mngr::strings::msg_params].keyExists(
@@ -332,10 +343,8 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
}
if (is_subscribe_present_in_request && !isSubscribed_present_in_response) {
- LOG4CXX_WARN(logger_,
- "conditional mandatory parameter "
- << message_params::kIsSubscribed
- << " missed in hmi response");
+ SDL_LOG_WARN("conditional mandatory parameter "
+ << message_params::kIsSubscribed << " missed in hmi response");
is_subscribed = extension->IsSubscribedToInteriorVehicleData(module);
temp_hmi_response[app_mngr::strings::msg_params]
@@ -344,8 +353,7 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
}
if (!is_subscribe_present_in_request && isSubscribed_present_in_response) {
- LOG4CXX_WARN(logger_,
- "Parameter " << message_params::kIsSubscribed
+ SDL_LOG_WARN("Parameter " << message_params::kIsSubscribed
<< " is ignored due to absence '"
<< message_params::kSubscribe
<< "' parameter in request");
@@ -364,31 +372,31 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
.asBool();
is_subscribed = response_subscribe;
- LOG4CXX_TRACE(logger_, "request_subscribe = " << request_subscribe);
- LOG4CXX_TRACE(logger_, "response_subscribe = " << response_subscribe);
+ SDL_LOG_TRACE("request_subscribe = " << request_subscribe);
+ SDL_LOG_TRACE("response_subscribe = " << response_subscribe);
if (request_subscribe == response_subscribe) {
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
const ModuleUid module(module_type, module_id);
- if (response_subscribe) {
- LOG4CXX_DEBUG(logger_,
- "SubscribeToInteriorVehicleData " << app->app_id() << " "
- << module_type << " "
- << module_id);
+ if (response_subscribe &&
+ !extension->IsSubscribedToInteriorVehicleData(module)) {
+ SDL_LOG_DEBUG("SubscribeToInteriorVehicleData "
+ << app->app_id() << " " << module_type << " " << module_id);
extension->SubscribeToInteriorVehicleData(module);
- } else {
- LOG4CXX_DEBUG(logger_,
- "UnsubscribeFromInteriorVehicleData "
- << app->app_id() << " " << module_type << " "
- << module_id);
+ } else if (!response_subscribe &&
+ extension->IsSubscribedToInteriorVehicleData(module)) {
+ SDL_LOG_DEBUG("UnsubscribeFromInteriorVehicleData "
+ << app->app_id() << " " << module_type << " " << module_id);
extension->UnsubscribeFromInteriorVehicleData(module);
}
+
+ app->UpdateHash();
}
}
bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool is_subscribe_present_in_request =
(*message_)[app_mngr::strings::msg_params].keyExists(
message_params::kSubscribe);
@@ -416,12 +424,12 @@ bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() {
}
void GetInteriorVehicleDataRequest::RemoveExcessiveSubscription() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[app_mngr::strings::msg_params].erase(message_params::kSubscribe);
}
std::string GetInteriorVehicleDataRequest::ModuleType() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::ModuleType::eType module_type =
static_cast<mobile_apis::ModuleType::eType>(
(*message_)[app_mngr::strings::msg_params]
@@ -434,7 +442,7 @@ std::string GetInteriorVehicleDataRequest::ModuleType() const {
}
std::string GetInteriorVehicleDataRequest::ModuleId() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto msg_params = (*message_)[app_mngr::strings::msg_params];
if (msg_params.keyExists(message_params::kModuleId)) {
return msg_params[message_params::kModuleId].asString();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
index b1fa8d6ea0..1c19cc641d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
@@ -37,6 +37,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetInteriorVehicleDataResponse::GetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -49,7 +51,7 @@ GetInteriorVehicleDataResponse::GetInteriorVehicleDataResponse(
GetInteriorVehicleDataResponse::~GetInteriorVehicleDataResponse() {}
void GetInteriorVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
(*message_)[app_mngr::strings::msg_params]);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
index 91ecbe77eb..f7a9ae50bd 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
@@ -40,7 +40,7 @@
namespace rc_rpc_plugin {
namespace commands {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("Commands")
OnInteriorVehicleDataNotification::OnInteriorVehicleDataNotification(
const app_mngr::commands::MessageSharedPtr& message,
@@ -65,7 +65,7 @@ void OnInteriorVehicleDataNotification::AddDataToCache(
}
void OnInteriorVehicleDataNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
@@ -87,10 +87,9 @@ void OnInteriorVehicleDataNotification::Run() {
const auto extension = RCHelpers::GetRCExtension(app);
DCHECK(extension);
- LOG4CXX_TRACE(logger_,
- "Check subscription for " << app.app_id()
- << "and module type " << module_type
- << " " << module_id);
+ SDL_LOG_TRACE("Check subscription for "
+ << app.app_id() << "and module type " << module_type << " "
+ << module_id);
if (extension->IsSubscribedToInteriorVehicleData(module)) {
(*message_)[app_mngr::strings::params]
@@ -105,7 +104,7 @@ void OnInteriorVehicleDataNotification::Run() {
}
std::string OnInteriorVehicleDataNotification::ModuleId() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto msg_params = (*message_)[app_mngr::strings::msg_params];
if (msg_params[message_params::kModuleData].keyExists(
message_params::kModuleId)) {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
index 375db9cd9d..e7532636b2 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
@@ -41,6 +41,8 @@ namespace rc_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace {
struct ResponseParams {
std::string response_info;
@@ -90,7 +92,7 @@ ReleaseInteriorVehicleDataModuleRequest::
: RCCommandRequest(message, params) {}
bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto rc_capability = hmi_capabilities_.rc_capability();
const std::string module_type = ModuleType();
@@ -98,9 +100,8 @@ bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() {
const ModuleUid module(module_type, module_id);
if (rc_capability &&
!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
- LOG4CXX_WARN(
- logger_,
- "Accessing not supported module: " << module_type << " " << module_id);
+ SDL_LOG_WARN("Accessing not supported module: " << module_type << " "
+ << module_id);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
"Accessing not supported module");
@@ -110,7 +111,7 @@ bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() {
}
void ReleaseInteriorVehicleDataModuleRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ProcessCapabilities()) {
return;
@@ -122,7 +123,7 @@ void ReleaseInteriorVehicleDataModuleRequest::Execute() {
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -149,12 +150,11 @@ void ReleaseInteriorVehicleDataModuleRequest::Execute() {
NotificationTrigger::MODULE_ALLOCATION, app);
}
- LOG4CXX_DEBUG(logger_,
- "Resource for module: "
- << ModuleType() << " with id: " << module_id
- << " was released with result " << std::boolalpha
- << response_params.success_result
- << " and result_code: " << response_params.result_code);
+ SDL_LOG_DEBUG("Resource for module: "
+ << ModuleType() << " with id: " << module_id
+ << " was released with result " << std::boolalpha
+ << response_params.success_result
+ << " and result_code: " << response_params.result_code);
SendResponse(response_params.success_result,
response_params.result_code,
@@ -162,7 +162,7 @@ void ReleaseInteriorVehicleDataModuleRequest::Execute() {
}
std::string ReleaseInteriorVehicleDataModuleRequest::ModuleType() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::ModuleType::eType module_type =
static_cast<mobile_apis::ModuleType::eType>(
(*message_)[app_mngr::strings::msg_params]
@@ -176,7 +176,7 @@ std::string ReleaseInteriorVehicleDataModuleRequest::ModuleType() const {
}
std::string ReleaseInteriorVehicleDataModuleRequest::ModuleId() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto msg_params = (*message_)[app_mngr::strings::msg_params];
if (msg_params.keyExists(message_params::kModuleId)) {
return msg_params[message_params::kModuleId].asString();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc
index fae792f143..766c523b58 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc
@@ -35,6 +35,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ReleaseInteriorVehicleDataModuleResponse::
ReleaseInteriorVehicleDataModuleResponse(
const application_manager::commands::MessageSharedPtr& message,
@@ -47,7 +49,7 @@ ReleaseInteriorVehicleDataModuleResponse::
params.policy_handler_) {}
void ReleaseInteriorVehicleDataModuleResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.GetRPCService().SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
index dfcc6205b1..8dd4eab306 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
@@ -45,7 +45,7 @@ namespace commands {
using namespace json_keys;
using namespace message_params;
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("Commands")
SetInteriorVehicleDataRequest::SetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
@@ -62,7 +62,7 @@ SetInteriorVehicleDataRequest::~SetInteriorVehicleDataRequest() {}
*/
bool ClearUnrelatedModuleData(const std::string& module_type,
smart_objects::SmartObject& module_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& all_module_types = RCHelpers::GetModuleTypesList();
const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
bool module_type_and_data_match = false;
@@ -106,11 +106,11 @@ mobile_apis::Result::eType PrepareResultCodeAndInfo(
info = "Accessing not supported module data.";
}
return result_code;
- LOG4CXX_WARN(logger_, info);
+ SDL_LOG_WARN(info);
}
void SetInteriorVehicleDataRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& module_data =
(*message_)[app_mngr::strings::msg_params][message_params::kModuleData];
@@ -120,8 +120,7 @@ void SetInteriorVehicleDataRequest::Execute() {
const std::string module_id = ModuleId();
const ModuleUid module(module_type, module_id);
if (!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
- LOG4CXX_WARN(logger_,
- "Accessing not supported module: " << module_type << " "
+ SDL_LOG_WARN("Accessing not supported module: " << module_type << " "
<< module_id);
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
@@ -146,7 +145,7 @@ void SetInteriorVehicleDataRequest::Execute() {
if (rc_capabilities_manager_.AreAllParamsReadOnly(module_data,
module_type)) {
- LOG4CXX_WARN(logger_, "All request params in module type are READ ONLY!");
+ SDL_LOG_WARN("All request params in module type are READ ONLY!");
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::READ_ONLY,
@@ -158,7 +157,7 @@ void SetInteriorVehicleDataRequest::Execute() {
if (rc_capabilities_manager_.AreReadOnlyParamsPresent(
module_data, module_type, module_data_capabilities)) {
- LOG4CXX_DEBUG(logger_, "Request module type has READ ONLY parameters");
+ SDL_LOG_DEBUG("Request module type has READ ONLY parameters");
if (enums_value::kLight == module_data_capabilities.first &&
capabilitiesStatus::kSuccess != module_data_capabilities.second) {
@@ -170,7 +169,7 @@ void SetInteriorVehicleDataRequest::Execute() {
return;
}
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameters... ");
+ SDL_LOG_DEBUG("Cutting-off READ ONLY parameters... ");
CutOffReadOnlyParams(module_data);
}
@@ -190,7 +189,7 @@ void SetInteriorVehicleDataRequest::Execute() {
if (app_wants_to_set_audio_src) {
if (!app->IsAllowedToChangeAudioSource()) {
- LOG4CXX_WARN(logger_, "App is not allowed to change audio source");
+ SDL_LOG_WARN("App is not allowed to change audio source");
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::REJECTED,
@@ -210,7 +209,7 @@ void SetInteriorVehicleDataRequest::Execute() {
&(*message_)[app_mngr::strings::msg_params],
true);
} else {
- LOG4CXX_WARN(logger_, "Request module type & data mismatch!");
+ SDL_LOG_WARN("Request module type & data mismatch!");
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
@@ -220,7 +219,7 @@ void SetInteriorVehicleDataRequest::Execute() {
void SetInteriorVehicleDataRequest::on_event(
const app_mngr::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RCCommandRequest::on_event(event);
if (hmi_apis::FunctionID::RC_SetInteriorVehicleData != event.id()) {
@@ -244,10 +243,8 @@ void SetInteriorVehicleDataRequest::on_event(
if (result) {
if (!IsModuleIdProvided(hmi_response)) {
- LOG4CXX_WARN(logger_,
- "conditional mandatory parameter "
- << message_params::kModuleId
- << " missed in hmi response");
+ SDL_LOG_WARN("conditional mandatory parameter "
+ << message_params::kModuleId << " missed in hmi response");
result = false;
result_code = mobile_apis::Result::GENERIC_ERROR;
}
@@ -265,7 +262,7 @@ void SetInteriorVehicleDataRequest::on_event(
auto app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
+ SDL_LOG_ERROR("NULL pointer.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
return;
}
@@ -298,7 +295,7 @@ void SetInteriorVehicleDataRequest::on_event(
void SetInteriorVehicleDataRequest::CheckAudioSource(
const smart_objects::SmartObject& audio_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (audio_data.keyExists(message_params::kSource)) {
application_manager_.set_current_audio_source(
audio_data[message_params::kSource].asUInt());
@@ -307,7 +304,7 @@ void SetInteriorVehicleDataRequest::CheckAudioSource(
void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
smart_objects::SmartObject& module_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
const auto& module_type_params =
rc_capabilities_manager_.ControlDataForType(module_data, module_type);
@@ -319,9 +316,8 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
for (; it != equalizer_settings.asArray()->end(); ++it) {
if (it->keyExists(message_params::kChannelName)) {
it->erase(message_params::kChannelName);
- LOG4CXX_DEBUG(logger_,
- "Cutting-off READ ONLY parameter: "
- << message_params::kChannelName);
+ SDL_LOG_DEBUG("Cutting-off READ ONLY parameter: "
+ << message_params::kChannelName);
}
}
}
@@ -332,13 +328,13 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
for (const auto& param : ro_params) {
if (module_type_params.keyExists(param)) {
module_data[data_mapping(module_type)].erase(param);
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << param);
+ SDL_LOG_DEBUG("Cutting-off READ ONLY parameter: " << param);
}
}
}
std::string SetInteriorVehicleDataRequest::ModuleType() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::ModuleType::eType module_type =
static_cast<mobile_apis::ModuleType::eType>(
(*message_)[app_mngr::strings::msg_params]
@@ -351,7 +347,7 @@ std::string SetInteriorVehicleDataRequest::ModuleType() const {
}
std::string SetInteriorVehicleDataRequest::ModuleId() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto msg_params = (*message_)[app_mngr::strings::msg_params];
if (msg_params[message_params::kModuleData].keyExists(
message_params::kModuleId)) {
@@ -372,7 +368,7 @@ std::string SetInteriorVehicleDataRequest::ModuleId() const {
AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource(
const app_mngr::commands::MessageSharedPtr& message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
@@ -388,7 +384,7 @@ bool SetInteriorVehicleDataRequest::IsResourceFree(
void SetInteriorVehicleDataRequest::SetResourceState(
const std::string& module_type, const ResourceState::eType state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
resource_allocation_manager_.SetResourceState(
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc
index 4dedd4b5a2..aeab82e12c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc
@@ -5,6 +5,8 @@
namespace rc_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetInteriorVehicleDataResponse::SetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
@@ -17,7 +19,7 @@ SetInteriorVehicleDataResponse::SetInteriorVehicleDataResponse(
SetInteriorVehicleDataResponse::~SetInteriorVehicleDataResponse() {}
void SetInteriorVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.GetRPCService().SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
index fc342a6d86..53222e0d04 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
@@ -41,7 +41,7 @@
#include "rc_rpc_plugin/rc_module_constants.h"
#include "smart_objects/enum_schema_item.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("Commands")
namespace rc_rpc_plugin {
namespace commands {
@@ -75,7 +75,7 @@ bool RCCommandRequest::IsInterfaceAvailable(
}
void RCCommandRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
SetResourceState(module_type, ResourceState::FREE);
SendResponse(
@@ -83,7 +83,7 @@ void RCCommandRequest::onTimeOut() {
}
bool RCCommandRequest::CheckDriverConsent() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
@@ -108,14 +108,14 @@ rc_rpc_plugin::TypeAccess RCCommandRequest::CheckModule(
bool RCCommandRequest::IsModuleIdProvided(
const smart_objects::SmartObject& hmi_response) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return hmi_response[app_mngr::strings::msg_params]
[message_params::kModuleData]
.keyExists(message_params::kModuleId);
}
void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string info;
if (rc_rpc_plugin::kDisallowed == access) {
info = disallowed_info_.empty()
@@ -124,33 +124,33 @@ void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) {
} else {
return;
}
- LOG4CXX_ERROR(logger_, info);
+ SDL_LOG_ERROR(info);
SendResponse(false, mobile_apis::Result::DISALLOWED, info.c_str());
}
void RCCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
if (!IsInterfaceAvailable(app_mngr::HmiInterfaces::HMI_INTERFACE_RC)) {
- LOG4CXX_WARN(logger_, "HMI interface RC is not available");
+ SDL_LOG_WARN("HMI interface RC is not available");
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
- "Remote control is not supported by system");
+ "RC is not supported by system");
return;
}
- LOG4CXX_TRACE(logger_, "RC interface is available!");
+ SDL_LOG_TRACE("RC interface is available!");
if (!policy_handler_.CheckHMIType(
app->policy_app_id(),
mobile_apis::AppHMIType::eType::REMOTE_CONTROL,
app->app_types())) {
- LOG4CXX_WARN(logger_, "Application has no remote control functions");
+ SDL_LOG_WARN("Application has no remote control functions");
SendResponse(false, mobile_apis::Result::DISALLOWED, "");
return;
}
if (!resource_allocation_manager_.is_rc_enabled()) {
- LOG4CXX_WARN(logger_, "Remote control is disabled by user");
+ SDL_LOG_WARN("Remote control is disabled by user");
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::USER_DISALLOWED,
@@ -159,7 +159,7 @@ void RCCommandRequest::Run() {
}
auto rc_capability = hmi_capabilities_.rc_capability();
if (!rc_capability || rc_capability->empty()) {
- LOG4CXX_WARN(logger_, "Accessing not supported module: " << ModuleType());
+ SDL_LOG_WARN("Accessing not supported module: " << ModuleType());
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
@@ -178,12 +178,12 @@ void RCCommandRequest::Run() {
}
bool RCCommandRequest::AcquireResources() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
if (!IsResourceFree(module_type, module_id)) {
- LOG4CXX_WARN(logger_, "Resource is busy.");
+ SDL_LOG_WARN("Resource is busy.");
SendResponse(false, mobile_apis::Result::IN_USE, "");
return false;
}
@@ -211,7 +211,7 @@ bool RCCommandRequest::AcquireResources() {
}
void RCCommandRequest::on_event(const app_mngr::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (event.id() == hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent) {
ProcessAccessResponse(event);
@@ -223,13 +223,13 @@ void RCCommandRequest::on_event(const app_mngr::event_engine::Event& event) {
void RCCommandRequest::ProcessAccessResponse(
const app_mngr::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
+ SDL_LOG_ERROR("NULL pointer.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
return;
}
@@ -275,7 +275,7 @@ void RCCommandRequest::ProcessConsentResult(const bool is_allowed,
const std::string& module_type,
const std::string& module_id,
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (is_allowed) {
SetResourceState(module_type, ResourceState::BUSY);
Execute(); // run child's logic
@@ -293,7 +293,7 @@ void RCCommandRequest::ProcessConsentResult(const bool is_allowed,
void RCCommandRequest::ProcessAskDriverMode(const std::string& module_type,
const std::string& module_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto app =
application_manager_.application(CommandRequestImpl::connection_key());
const std::string policy_app_id = app->policy_app_id();
@@ -321,7 +321,7 @@ void RCCommandRequest::ProcessAskDriverMode(const std::string& module_type,
void RCCommandRequest::SendGetUserConsent(
const std::string& module_type,
const smart_objects::SmartObject& module_ids) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
DCHECK(app);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc
index 3e50818210..ab33fde764 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc
@@ -41,7 +41,7 @@
namespace rc_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule");
InteriorDataCacheImpl::InteriorDataCacheImpl() {}
@@ -49,9 +49,8 @@ InteriorDataCacheImpl::~InteriorDataCacheImpl() {}
void InteriorDataCacheImpl::Add(const ModuleUid& module,
const smart_objects::SmartObject& module_data) {
- LOG4CXX_TRACE(
- logger_,
- "module_type : " << module.first << " module_id : " << module.second);
+ SDL_LOG_TRACE("module_type : " << module.first
+ << " module_id : " << module.second);
sync_primitives::AutoLock autolock(cached_data_lock_);
auto it = cached_data_.find(module);
if (cached_data_.end() == it) {
@@ -63,19 +62,17 @@ void InteriorDataCacheImpl::Add(const ModuleUid& module,
smart_objects::SmartObject InteriorDataCacheImpl::Retrieve(
const ModuleUid& module) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(cached_data_lock_);
auto it = cached_data_.find(module);
if (it == cached_data_.end()) {
- LOG4CXX_WARN(logger_,
- "Module with type: " << module.first
+ SDL_LOG_WARN("Module with type: " << module.first
<< " and id: " << module.second
<< " was not found in cache");
return smart_objects::SmartObject(smart_objects::SmartType_Null);
}
- LOG4CXX_TRACE(
- logger_,
- "module_type : " << module.first << " module_id : " << module.second);
+ SDL_LOG_TRACE("module_type : " << module.first
+ << " module_id : " << module.second);
return it->second;
}
@@ -92,34 +89,31 @@ std::vector<ModuleUid> InteriorDataCacheImpl::GetCachedModulesByType(
}
bool InteriorDataCacheImpl::Contains(const ModuleUid& module) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(cached_data_lock_);
auto it = cached_data_.find(module);
const bool contains = it != cached_data_.end();
- LOG4CXX_TRACE(logger_,
- "module_type : " << module.first
+ SDL_LOG_TRACE("module_type : " << module.first
<< " module_id : " << module.second << " "
<< (contains ? "true" : "false"));
return contains;
}
void InteriorDataCacheImpl::Remove(const ModuleUid& module) {
- LOG4CXX_TRACE(
- logger_,
- "module_type : " << module.first << " module_id : " << module.second);
+ SDL_LOG_TRACE("module_type : " << module.first
+ << " module_id : " << module.second);
sync_primitives::AutoLock autolock(cached_data_lock_);
auto it = cached_data_.find(module);
if (cached_data_.end() == it) {
- LOG4CXX_TRACE(
- logger_,
- "Not existing module : " << module.first << " " << module.second);
+ SDL_LOG_TRACE("Not existing module : " << module.first << " "
+ << module.second);
return;
}
cached_data_.erase(it);
}
void InteriorDataCacheImpl::Clear() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(cached_data_lock_);
cached_data_.clear();
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc
index 50568de63a..1db25265e7 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc
@@ -5,7 +5,7 @@
#include "rc_rpc_plugin/rc_rpc_plugin.h"
namespace rc_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule");
InteriorDataManagerImpl::InteriorDataManagerImpl(
RCRPCPlugin& rc_plugin,
@@ -31,7 +31,7 @@ void InteriorDataManagerImpl::OnApplicationEvent(
}
void InteriorDataManagerImpl::OnDisablingRC() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto existing_subscription = AppsSubscribedModules();
std::set<ModuleUid> subscribed_modules;
for (auto& pair : existing_subscription) {
@@ -43,22 +43,28 @@ void InteriorDataManagerImpl::OnDisablingRC() {
}
}
for (auto& module : subscribed_modules) {
- LOG4CXX_TRACE(logger_,
- "unsubscribe from module type: " << module.first
+ SDL_LOG_TRACE("unsubscribe from module type: " << module.first
<< " id: " << module.second);
UnsubscribeFromInteriorVehicleData(module);
}
}
+void InteriorDataManagerImpl::OnResumptionRevert(
+ const std::set<ModuleUid>& subscriptions) {
+ for (const auto& module : subscriptions) {
+ UnsubscribeFromInteriorVehicleData(module);
+ }
+}
+
void InteriorDataManagerImpl::StoreRequestToHMITime(const ModuleUid& module) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(requests_to_hmi_history_lock_);
requests_to_hmi_history_[module].push_back(date_time::getCurrentTime());
}
bool InteriorDataManagerImpl::CheckRequestsToHMIFrequency(
const ModuleUid& module) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(requests_to_hmi_history_lock_);
ClearOldRequestsToHMIHistory();
const auto& history = requests_to_hmi_history_[module];
@@ -107,7 +113,7 @@ void InteriorDataManagerImpl::UpdateHMISubscriptionsOnPolicyUpdated() {
void InteriorDataManagerImpl::UpdateHMISubscriptionsOnAppUnregistered(
application_manager::Application& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto rc_extension = RCHelpers::GetRCExtension(app);
auto subscribed_data = rc_extension->InteriorVehicleDataSubscriptions();
rc_extension->UnsubscribeFromInteriorVehicleData();
@@ -126,10 +132,11 @@ void InteriorDataManagerImpl::UpdateHMISubscriptionsOnAppUnregistered(
void InteriorDataManagerImpl::UnsubscribeFromInteriorVehicleData(
const ModuleUid& module) {
cache_.Remove(module);
- auto unsubscribe_request = RCHelpers::CreateUnsubscribeRequestToHMI(
- module, app_mngr_.GetNextHMICorrelationID());
- LOG4CXX_DEBUG(logger_,
- "Send Unsubscribe from module type: " << module.first << " id: "
+ auto unsubscribe_request = RCHelpers::CreateGetInteriorVDRequestToHMI(
+ module,
+ app_mngr_.GetNextHMICorrelationID(),
+ RCHelpers::InteriorDataAction::UNSUBSCRIBE);
+ SDL_LOG_DEBUG("Send Unsubscribe from module type: " << module.first << " id: "
<< module.second);
rpc_service_.ManageHMICommand(unsubscribe_request);
}
@@ -140,11 +147,12 @@ void InteriorDataManagerImpl::UnsubscribeFromInteriorVehicleDataOfType(
for (const auto& module : modules) {
cache_.Remove(module);
- auto unsubscribe_request = RCHelpers::CreateUnsubscribeRequestToHMI(
- module, app_mngr_.GetNextHMICorrelationID());
- LOG4CXX_DEBUG(logger_,
- "Send Unsubscribe from module type: "
- << module.first << " id: " << module.second);
+ auto unsubscribe_request = RCHelpers::CreateGetInteriorVDRequestToHMI(
+ module,
+ app_mngr_.GetNextHMICorrelationID(),
+ RCHelpers::InteriorDataAction::UNSUBSCRIBE);
+ SDL_LOG_DEBUG("Send Unsubscribe from module type: "
+ << module.first << " id: " << module.second);
rpc_service_.ManageHMICommand(unsubscribe_request);
}
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
index ea9c13113c..3bfad3095b 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
@@ -30,14 +30,51 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "rc_rpc_plugin/rc_app_extension.h"
#include <algorithm>
+
+#include "rc_rpc_plugin/rc_app_extension.h"
+
#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
#include "smart_objects/smart_object.h"
+#include "utils/logger.h"
+
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule")
+
+namespace {
+std::set<rc_rpc_plugin::ModuleUid> ConvertSmartObjectToModuleCollection(
+ const smart_objects::SmartObject& resumption_data) {
+ using namespace rc_rpc_plugin;
+
+ if (!resumption_data.keyExists(application_manager::hmi_interface::rc)) {
+ SDL_LOG_DEBUG("No resumption module data subscription to revert");
+ return {};
+ }
+
+ const auto& module_data =
+ resumption_data[application_manager::hmi_interface::rc]
+ [message_params::kModuleData];
+
+ std::set<rc_rpc_plugin::ModuleUid> module_collection;
+
+ if (!module_data.empty()) {
+ for (const auto& module : *(module_data.asArray())) {
+ const auto module_type = module[message_params::kModuleType].asString();
+ const auto module_id = module[message_params::kModuleId].asString();
+
+ module_collection.insert({module_type, module_id});
+ }
+ }
+
+ return module_collection;
+}
+} // namespace
namespace rc_rpc_plugin {
-RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid)
- : AppExtension(uid) {}
+RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid,
+ RCRPCPlugin& plugin,
+ application_manager::Application& application)
+ : AppExtension(uid), plugin_(plugin), application_(application) {}
void RCAppExtension::SubscribeToInteriorVehicleData(const ModuleUid& module) {
subscribed_interior_vehicle_data_.insert(module);
@@ -50,11 +87,19 @@ void RCAppExtension::UnsubscribeFromInteriorVehicleData(
void RCAppExtension::UnsubscribeFromInteriorVehicleDataOfType(
const std::string& module_type) {
+ bool unsubscribed = false;
for (auto& item : subscribed_interior_vehicle_data_) {
if (module_type == item.first) {
subscribed_interior_vehicle_data_.erase(item);
+ unsubscribed = true;
}
}
+
+ if (unsubscribed) {
+ // If didin't unsubscribe from some module type, we don't need to update
+ // application hash
+ UpdateHash();
+ }
}
void RCAppExtension::UnsubscribeFromInteriorVehicleData() {
@@ -81,16 +126,124 @@ bool RCAppExtension::IsSubscribedToInteriorVehicleData(
}
void RCAppExtension::SaveResumptionData(
- ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) {}
+ smart_objects::SmartObject& resumption_data) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (subscribed_interior_vehicle_data_.empty()) {
+ SDL_LOG_DEBUG("Subscribed modules data is absent");
+ return;
+ }
+
+ resumption_data[message_params::kModuleData] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ auto& module_data = resumption_data[message_params::kModuleData];
+
+ uint32_t index = 0;
+ for (const auto& module_uid : subscribed_interior_vehicle_data_) {
+ SDL_LOG_DEBUG("Save module: [" << module_uid.first << ":"
+ << module_uid.second << "]");
+ auto module_info_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ module_info_so[message_params::kModuleType] = module_uid.first;
+ module_info_so[message_params::kModuleId] = module_uid.second;
+ module_data[index++] = module_info_so;
+ }
+}
void RCAppExtension::ProcessResumption(
- const ns_smart_device_link::ns_smart_objects::SmartObject&
- resumption_data) {}
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("app id : " << application_.app_id());
+
+ if (!saved_app.keyExists(
+ application_manager::strings::application_subscriptions)) {
+ SDL_LOG_DEBUG("application_subscriptions section does not exist");
+ return;
+ }
+
+ const auto& resumption_data =
+ saved_app[application_manager::strings::application_subscriptions];
+
+ if (!resumption_data.keyExists(message_params::kModuleData)) {
+ SDL_LOG_DEBUG("kModuleData section does not exist");
+ return;
+ }
+
+ auto& module_data = resumption_data[message_params::kModuleData];
+
+ if (0 == module_data.length()) {
+ SDL_LOG_WARN("Subscribed modules data is absent");
+ return;
+ }
+
+ for (const auto& module_so : *module_data.asArray()) {
+ const auto module_type = module_so[message_params::kModuleType].asString();
+ const auto module_id = module_so[message_params::kModuleId].asString();
+
+ ModuleUid module{module_type, module_id};
+ SDL_LOG_TRACE("app id " << application_.app_id() << " type : "
+ << module_type << " id <" << module_id);
+ AddPendingSubscription(module);
+ }
+
+ plugin_.ProcessResumptionSubscription(application_, *this);
+}
+
+void RCAppExtension::RevertResumption(
+ const smart_objects::SmartObject& resumption_data) {
+ SDL_LOG_AUTO_TRACE();
+
+ UnsubscribeFromInteriorVehicleData();
+
+ const auto module_subscriptions =
+ ConvertSmartObjectToModuleCollection(resumption_data);
+
+ for (auto& module : module_subscriptions) {
+ SDL_LOG_TRACE("Requested to unsubscribe module_type "
+ << module.first << "module_id: " << module.second);
+ }
+ std::set<rc_rpc_plugin::ModuleUid> to_be_unsubscribed;
+
+ const auto app_id = application_.app_id();
+ auto no_apps_subscribed = [app_id,
+ this](const rc_rpc_plugin::ModuleUid& module) {
+ if (plugin_.IsOtherAppsSubscribed(module, app_id)) {
+ SDL_LOG_DEBUG("Some other app except " << app_id
+ << " is already subscribed to "
+ << " module_type " << module.first
+ << "module_id: " << module.second);
+ return false;
+ }
+ return true;
+ };
+ std::copy_if(module_subscriptions.begin(),
+ module_subscriptions.end(),
+ std::inserter(to_be_unsubscribed, to_be_unsubscribed.end()),
+ no_apps_subscribed);
+
+ plugin_.RevertResumption(to_be_unsubscribed);
+}
std::set<ModuleUid> RCAppExtension::InteriorVehicleDataSubscriptions() const {
return subscribed_interior_vehicle_data_;
}
+bool RCAppExtension::AddPendingSubscription(const ModuleUid& module) {
+ return pending_subscriptions_.insert(module).second;
+}
+
+void RCAppExtension::RemovePendingSubscription(const ModuleUid& module) {
+ pending_subscriptions_.erase(module);
+}
+
+void RCAppExtension::RemovePendingSubscriptions() {
+ pending_subscriptions_.clear();
+}
+
+std::set<ModuleUid> RCAppExtension::PendingSubscriptions() {
+ return pending_subscriptions_;
+}
+
Grid RCAppExtension::GetUserLocation() const {
return user_location_;
}
@@ -111,5 +264,9 @@ void RCAppExtension::SetUserLocation(const Grid& grid) {
user_location_ = grid;
}
+void RCAppExtension::UpdateHash() {
+ application_.UpdateHash();
+}
+
RCAppExtension::~RCAppExtension() {}
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
index 0f68769b38..75ccd46e4d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
@@ -35,7 +35,7 @@
#include "rc_rpc_plugin/rc_module_constants.h"
namespace rc_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule")
RCCapabilitiesManagerImpl::RCCapabilitiesManagerImpl(
application_manager::HMICapabilities& hmi_capabilities)
@@ -45,22 +45,20 @@ const std::string
RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilitiesStructure(
const smart_objects::SmartObject& control_capabilities,
const std::string& module_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (control_capabilities.keyExists(message_params::kModuleInfo)) {
// moduleId - mandatory param for ModuleInfo structure
const auto module_id = control_capabilities[message_params::kModuleInfo]
[message_params::kModuleId]
.asString();
- LOG4CXX_WARN(logger_,
- "Use default moduleId from hmi capabilities: "
- << module_id
- << " for requested moduleType: " << module_type);
+ SDL_LOG_WARN("Use default moduleId from hmi capabilities: "
+ << module_id << " for requested moduleType: " << module_type);
return module_id;
}
- LOG4CXX_WARN(logger_,
- "There are no moduleInfo in hmi capabilities for requested "
- "moduleType "
- << module_type);
+ SDL_LOG_WARN(
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleType "
+ << module_type);
return "";
}
@@ -68,42 +66,40 @@ const std::string
RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilitiesArray(
const smart_objects::SmartObject& control_capabilities,
const std::string& module_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (auto& cap_item : *(control_capabilities.asArray())) {
if (cap_item.keyExists(message_params::kModuleInfo)) {
// moduleId - mandatory param for ModuleInfo structure
const auto module_id =
cap_item[message_params::kModuleInfo][message_params::kModuleId]
.asString();
- LOG4CXX_WARN(logger_,
- "Use default moduleId from hmi capabilities: "
- << module_id
- << " for requested moduleType: " << module_type);
+ SDL_LOG_WARN("Use default moduleId from hmi capabilities: "
+ << module_id
+ << " for requested moduleType: " << module_type);
return module_id;
}
}
- LOG4CXX_WARN(logger_,
- "There are no moduleInfo in hmi capabilities for requested "
- "moduleType "
- << module_type);
+ SDL_LOG_WARN(
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleType "
+ << module_type);
return "";
}
const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilities(
const std::string& module_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ SDL_LOG_WARN("RC capability is not initialized");
return std::string();
}
auto rc_capabilities = *rc_capabilities_ptr;
const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
if (!rc_capabilities.keyExists(mapping(module_type))) {
- LOG4CXX_WARN(
- logger_,
- "There is no RC capability for requested module_type " << module_type);
+ SDL_LOG_WARN("There is no RC capability for requested module_type "
+ << module_type);
return "";
}
if (enums_value::kHmiSettings == module_type ||
@@ -118,24 +114,24 @@ const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilities(
const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesStructure(
const smart_objects::SmartObject& control_capabilities,
const std::string& module_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (control_capabilities.keyExists(message_params::kModuleInfo) &&
(module_id == control_capabilities[message_params::kModuleInfo]
[message_params::kModuleId]
.asString())) {
return true;
}
- LOG4CXX_WARN(logger_,
- "There are no moduleInfo in hmi capabilities for requested "
- "moduleId "
- << module_id);
+ SDL_LOG_WARN(
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleId "
+ << module_id);
return false;
}
const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesArrays(
const smart_objects::SmartObject& control_capabilities,
const std::string& module_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (auto& cap_item : *(control_capabilities.asArray())) {
if (cap_item.keyExists(message_params::kModuleInfo) &&
(module_id ==
@@ -144,17 +140,17 @@ const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesArrays(
return true;
}
}
- LOG4CXX_WARN(logger_,
- "There are no moduleInfo in hmi capabilities for requested "
- "moduleId "
- << module_id);
+ SDL_LOG_WARN(
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleId "
+ << module_id);
return false;
}
const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilities(
const smart_objects::SmartObject& rc_capabilities,
const ModuleUid& module) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (module.second.empty()) {
return true;
}
@@ -170,11 +166,11 @@ const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilities(
bool RCCapabilitiesManagerImpl::CheckIfModuleExistsInCapabilities(
const ModuleUid& module) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ SDL_LOG_WARN("RC capability is not initialized");
return false;
}
@@ -217,7 +213,7 @@ RCCapabilitiesManagerImpl::GetCapabilitiesToModuleTypeMapping() const {
{strings::khmiSettingsControlCapabilities, enums_value::kHmiSettings}};
auto it = mapping.find(control_cap);
if (mapping.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown control capability " << control_cap);
+ SDL_LOG_ERROR("Unknown control capability " << control_cap);
return std::string();
}
return it->second;
@@ -237,7 +233,7 @@ void RCCapabilitiesManagerImpl::GetResourcesFromCapabilitiesStructure(
.asString();
out_resources.push_back(std::make_pair(mapping(capability_key), module_id));
} else {
- LOG4CXX_WARN(logger_, "There are no moduleId in " << capability_key);
+ SDL_LOG_WARN("There are no moduleId in " << capability_key);
out_resources.push_back(std::make_pair(mapping(capability_key), ""));
}
}
@@ -255,19 +251,18 @@ void RCCapabilitiesManagerImpl::GetResourcesFromCapabilitiesArray(
out_resources.push_back(
std::make_pair(mapping(capability_key), module_id));
} else {
- LOG4CXX_WARN(logger_,
- "There are no moduleId for item from " << capability_key);
+ SDL_LOG_WARN("There are no moduleId for item from " << capability_key);
out_resources.push_back(std::make_pair(mapping(capability_key), ""));
}
}
}
const std::vector<ModuleUid> RCCapabilitiesManagerImpl::GetResources() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<ModuleUid> resources;
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ SDL_LOG_WARN("RC capability is not initialized");
return resources;
}
@@ -290,11 +285,11 @@ const std::vector<ModuleUid> RCCapabilitiesManagerImpl::GetResources() const {
const std::string RCCapabilitiesManagerImpl::GetModuleIdForSeatLocation(
const mobile_apis::SupportedSeat::eType id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_WARN(logger_, "RC capability is not initialized.");
+ SDL_LOG_WARN("RC capability is not initialized.");
return std::string();
}
@@ -314,7 +309,7 @@ const std::string RCCapabilitiesManagerImpl::GetModuleIdForSeatLocation(
.asString();
}
}
- LOG4CXX_DEBUG(logger_, "There are no capabitities for requested id: " << id);
+ SDL_LOG_DEBUG("There are no capabitities for requested id: " << id);
return "";
}
@@ -322,7 +317,7 @@ bool RCCapabilitiesManagerImpl::CheckIfButtonExistInRCCaps(
const mobile_apis::ButtonName::eType button) const {
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ SDL_LOG_WARN("RC capability is not initialized");
return false;
}
@@ -344,15 +339,13 @@ bool RCCapabilitiesManagerImpl::CheckIfButtonExistInRCCaps(
const mobile_apis::ButtonName::eType current_button =
static_cast<mobile_apis::ButtonName::eType>(current_id);
if (current_button == button) {
- LOG4CXX_TRACE(
- logger_,
- "Button id " << current_button << " exist in capabilities");
+ SDL_LOG_TRACE("Button id " << current_button
+ << " exist in capabilities");
return true;
}
}
}
- LOG4CXX_TRACE(logger_,
- "Button id " << button << " do not exist in capabilities");
+ SDL_LOG_TRACE("Button id " << button << " do not exist in capabilities");
return false;
}
@@ -368,33 +361,30 @@ RCCapabilitiesManagerImpl::GetCapabilitiesByModuleIdFromArray(
return cap_item;
}
}
- LOG4CXX_WARN(logger_,
- "Capabilities for moduleId " << module_id
+ SDL_LOG_WARN("Capabilities for moduleId " << module_id
<< " do not exist in capabilities");
return smart_objects::SmartObject(smart_objects::SmartType_Null);
}
bool RCCapabilitiesManagerImpl::CheckButtonName(
const std::string& module_type, const std::string& button_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto rc_capabilities = hmi_capabilities_.rc_capability();
if (!rc_capabilities) {
- LOG4CXX_ERROR(logger_, "No remote controll capabilities available");
+ SDL_LOG_ERROR("No remote controll capabilities available");
return false;
}
if (enums_value::kRadio == module_type) {
if (!helpers::in_range(RCHelpers::buttons_radio(), button_name)) {
- LOG4CXX_WARN(logger_,
- "Trying to acceess climate button with module type radio");
+ SDL_LOG_WARN("Trying to acceess climate button with module type radio");
return false;
}
}
if (enums_value::kClimate == module_type) {
if (!helpers::in_range(RCHelpers::buttons_climate(), button_name)) {
- LOG4CXX_WARN(logger_,
- "Trying to acceess radio button with module type climate");
+ SDL_LOG_WARN("Trying to acceess radio button with module type climate");
return false;
}
}
@@ -484,10 +474,10 @@ RCCapabilitiesManagerImpl::GetModuleDataToCapabilitiesMapping() const {
ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities(
const smart_objects::SmartObject& module_data,
const std::string& module_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ SDL_LOG_WARN("RC capability is not initialized");
return {std::string(), capabilitiesStatus::kInvalidStatus};
}
@@ -505,7 +495,7 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities(
const auto capabilities_key = get_capabilities_key(module_type);
if (module_data.keyExists(module_data_key)) {
if (!rc_capabilities.keyExists(capabilities_key)) {
- LOG4CXX_DEBUG(logger_, module_data_key << " capabilities not present");
+ SDL_LOG_DEBUG(module_data_key << " capabilities not present");
return module_data_capabilities;
}
const auto& caps = rc_capabilities[capabilities_key];
@@ -528,7 +518,7 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities(
ModuleTypeCapability RCCapabilitiesManagerImpl::GetControlDataCapabilities(
const smart_objects::SmartObject& capabilities,
const smart_objects::SmartObject& control_data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::map<std::string, std::string> mapping =
GetModuleDataToCapabilitiesMapping();
@@ -582,31 +572,27 @@ capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability(
const auto it = mapping.find(request_parameter);
if (it == mapping.end()) {
- LOG4CXX_DEBUG(
- logger_,
- "Parameter " << request_parameter << " doesn't exist in capabilities.");
+ SDL_LOG_DEBUG("Parameter " << request_parameter
+ << " doesn't exist in capabilities.");
return capabilitiesStatus::kMissedParam;
}
const std::string& caps_key = it->second;
- LOG4CXX_DEBUG(logger_,
- "Checking request parameter "
- << request_parameter
- << " with capabilities. Appropriate key is " << caps_key);
+ SDL_LOG_DEBUG("Checking request parameter "
+ << request_parameter
+ << " with capabilities. Appropriate key is " << caps_key);
if (!capabilities.keyExists(caps_key)) {
- LOG4CXX_DEBUG(logger_,
- "Capability " << caps_key
+ SDL_LOG_DEBUG("Capability " << caps_key
<< " is missed in RemoteControl capabilities");
return capabilitiesStatus::kMissedParam;
}
if (!capabilities[caps_key].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is switched off in RemoteControl capabilities");
+ SDL_LOG_DEBUG("Capability "
+ << caps_key
+ << " is switched off in RemoteControl capabilities");
capabilitiesStatus status = capabilitiesStatus::kMissedParam;
if (mobile_apis::Result::READ_ONLY == switched_off_result) {
status = capabilitiesStatus::kReadOnly;
@@ -620,7 +606,7 @@ capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability(
ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightDataCapabilities(
const smart_objects::SmartObject& capabilities,
const smart_objects::SmartObject& control_data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::map<std::string, std::string> mapping = GetLightCapabilitiesMapping();
for (auto it = control_data.map_begin(); it != control_data.map_end(); ++it) {
@@ -648,14 +634,14 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightDataCapabilities(
ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightNameCapabilities(
const smart_objects::SmartObject& capabilities_status,
const smart_objects::SmartObject& light_data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (auto& so : *(capabilities_status.asArray())) {
const int64_t current_id = so[message_params::kName].asInt();
if (current_id == light_data[message_params::kId].asInt()) {
return GetLightDataCapabilities(so, light_data);
}
}
- LOG4CXX_DEBUG(logger_, "There is no such light name in capabilities");
+ SDL_LOG_DEBUG("There is no such light name in capabilities");
return std::make_pair(message_params::kLightState,
capabilitiesStatus::kMissedLightName);
}
@@ -667,18 +653,16 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetRadioBandByCapabilities(
static_cast<mobile_apis::RadioBand::eType>(request_parameter.asUInt());
if (mobile_apis::RadioBand::XM == radio_band) {
if (!capabilities_status.keyExists(strings::kSiriusxmRadioAvailable)) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << strings::kSiriusxmRadioAvailable
- << " is missed in RemoteControl capabilities");
+ SDL_LOG_DEBUG("Capability "
+ << strings::kSiriusxmRadioAvailable
+ << " is missed in RemoteControl capabilities");
return std::make_pair(strings::kSiriusxmRadioAvailable,
capabilitiesStatus::kMissedParam);
}
if (!capabilities_status[strings::kSiriusxmRadioAvailable].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << strings::kSiriusxmRadioAvailable
- << " is switched off in RemoteControl capabilities");
+ SDL_LOG_DEBUG("Capability "
+ << strings::kSiriusxmRadioAvailable
+ << " is switched off in RemoteControl capabilities");
return std::make_pair(strings::kSiriusxmRadioAvailable,
capabilitiesStatus::kMissedParam);
}
@@ -708,9 +692,8 @@ bool RCCapabilitiesManagerImpl::CheckReadOnlyParamsForAudio(
for (auto& so : *(equalizer_settings.asArray())) {
if (so.keyExists(message_params::kChannelName)) {
- LOG4CXX_DEBUG(logger_,
- "READ ONLY parameter. ChannelName = "
- << so[message_params::kChannelName].asString());
+ SDL_LOG_DEBUG("READ ONLY parameter. ChannelName = "
+ << so[message_params::kChannelName].asString());
return true;
}
}
@@ -737,10 +720,8 @@ bool RCCapabilitiesManagerImpl::CheckReadOnlyParamsForLight(
mobile_apis::LightStatus::RAMP_DOWN,
mobile_apis::LightStatus::UNKNOWN,
mobile_apis::LightStatus::INVALID)) {
- LOG4CXX_DEBUG(
- logger_,
- "READ ONLY parameter. Status = "
- << light_data[message_params::kLightStatus].asInt());
+ SDL_LOG_DEBUG("READ ONLY parameter. Status = "
+ << light_data[message_params::kLightStatus].asInt());
return true;
}
}
@@ -754,7 +735,7 @@ bool RCCapabilitiesManagerImpl::AreReadOnlyParamsPresent(
const smart_objects::SmartObject& module_data,
const std::string& module_type,
ModuleTypeCapability& module_data_capabilities) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& module_type_params =
ControlDataForType(module_data, module_type);
@@ -787,7 +768,7 @@ bool RCCapabilitiesManagerImpl::AreReadOnlyParamsPresent(
bool RCCapabilitiesManagerImpl::AreAllParamsReadOnly(
const smart_objects::SmartObject& module_data,
const std::string& module_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& module_type_params =
ControlDataForType(module_data, module_type);
auto it = module_type_params.map_begin();
@@ -799,15 +780,15 @@ bool RCCapabilitiesManagerImpl::AreAllParamsReadOnly(
}
}
- LOG4CXX_DEBUG(logger_, "All params are ReadOnly");
+ SDL_LOG_DEBUG("All params are ReadOnly");
return true;
}
bool RCCapabilitiesManagerImpl::IsSeatLocationCapabilityProvided() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto seat_location_capability = hmi_capabilities_.seat_location_capability();
if (!seat_location_capability || seat_location_capability->empty()) {
- LOG4CXX_DEBUG(logger_, "Seat Location capability is not provided by HMI");
+ SDL_LOG_DEBUG("Seat Location capability is not provided by HMI");
return false;
}
@@ -821,15 +802,14 @@ bool RCCapabilitiesManagerImpl::IsSeatLocationCapabilityProvided() const {
}
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Seat Location capability doesn't contain all necessary parameters");
return false;
}
const Grid
RCCapabilitiesManagerImpl::GetDriverLocationFromSeatLocationCapability() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Grid grid;
if (IsSeatLocationCapabilityProvided()) {
auto seat_location_capability =
@@ -845,7 +825,7 @@ RCCapabilitiesManagerImpl::GetDriverLocationFromSeatLocationCapability() const {
driver_location[strings::kRowspan].asInt(),
driver_location[strings::kLevelspan].asInt());
} else {
- LOG4CXX_DEBUG(logger_, "Driver's location doesn't provided");
+ SDL_LOG_DEBUG("Driver's location doesn't provided");
}
}
return grid;
@@ -909,7 +889,7 @@ Grid RCCapabilitiesManagerImpl::GetModuleServiceArea(
const ModuleUid& module) const {
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ SDL_LOG_WARN("RC capability is not initialized");
return Grid();
}
@@ -918,7 +898,7 @@ Grid RCCapabilitiesManagerImpl::GetModuleServiceArea(
const auto& module_type = module.first;
const auto& capabilities_key = mapping(module_type);
if (!rc_capabilities.keyExists(capabilities_key)) {
- LOG4CXX_DEBUG(logger_, module_type << "control capabilities not present");
+ SDL_LOG_DEBUG(module_type << "control capabilities not present");
return Grid();
}
const auto& caps = rc_capabilities[capabilities_key];
@@ -949,7 +929,7 @@ bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowed(
const ModuleUid& module) const {
auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
if (!rc_capabilities_ptr) {
- LOG4CXX_ERROR(logger_, "RC capability is not initialized");
+ SDL_LOG_ERROR("RC capability is not initialized");
return false;
}
@@ -958,7 +938,7 @@ bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowed(
const auto& module_type = module.first;
const auto& capabilities_key = mapping(module_type);
if (!rc_capabilities.keyExists(capabilities_key)) {
- LOG4CXX_DEBUG(logger_, module_type << "control capabilities not present");
+ SDL_LOG_DEBUG(module_type << "control capabilities not present");
return false;
}
const auto& caps = rc_capabilities[capabilities_key];
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
index 4ca2cf5182..e2b67effee 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
@@ -62,7 +62,7 @@
#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule")
namespace application_manager {
using rc_rpc_plugin::InteriorDataCache;
using rc_rpc_plugin::RCCommandParams;
@@ -113,7 +113,7 @@ struct RCCommandCreatorFactory {
template <typename RCCommandType>
CommandCreator& GetCreator() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
static RCCommandCreator<RCCommandType> res(params_);
return res;
}
@@ -178,9 +178,8 @@ bool RCCommandFactory::IsAbleToProcess(
CommandCreator& RCCommandFactory::get_mobile_command_creator(
const mobile_apis::FunctionID::eType id,
const mobile_apis::messageType::eType message_type) const {
- LOG4CXX_DEBUG(logger_,
- "get_mobile_command_creator function_id: "
- << id << " message_type: " << message_type);
+ SDL_LOG_DEBUG("get_mobile_command_creator function_id: "
+ << id << " message_type: " << message_type);
RCCommandCreatorFactory rc_factory(params_);
switch (id) {
case mobile_apis::FunctionID::ButtonPressID: {
@@ -266,8 +265,7 @@ CommandCreator& RCCommandFactory::get_mobile_creator_factory(
CommandCreator& RCCommandFactory::get_hmi_creator_factory(
const hmi_apis::FunctionID::eType id,
const hmi_apis::messageType::eType message_type) const {
- LOG4CXX_DEBUG(logger_,
- "CreateHMICommand function_id: " << id << " message_type: "
+ SDL_LOG_DEBUG("CreateHMICommand function_id: " << id << " message_type: "
<< message_type);
RCCommandCreatorFactory rc_factory(params_);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
index 1d7db181eb..e851e65adc 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
@@ -45,7 +45,7 @@
namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
-CREATE_LOGGERPTR_GLOBAL(logger_, "RCConsentManager")
+SDL_CREATE_LOG_VARIABLE("RCConsentManager")
RCConsentManagerImpl::RCConsentManagerImpl(
resumption::LastStateWrapperPtr last_state,
@@ -59,7 +59,7 @@ void RCConsentManagerImpl::SaveModuleConsents(
const std::string& policy_app_id,
const std::string& mac_address,
const rc_rpc_types::ModuleIdConsentVector& module_consents) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (const auto& consent : module_consents) {
std::string module_type = consent.module_id.first;
@@ -90,9 +90,8 @@ rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent(
last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
if (module_consents.empty()) {
- LOG4CXX_DEBUG(
- logger_,
- "For app: " << app_id << " module type doesn't have any consents");
+ SDL_LOG_DEBUG("For app: " << app_id
+ << " module type doesn't have any consents");
return rc_rpc_types::ModuleConsent::NOT_EXISTS;
}
@@ -103,8 +102,7 @@ rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent(
}
}
- LOG4CXX_DEBUG(logger_,
- "For app: " << app_id << " and module resource ["
+ SDL_LOG_DEBUG("For app: " << app_id << " and module resource ["
<< module_id.first << ":" << module_id.second
<< "] consent is absent");
@@ -112,7 +110,7 @@ rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent(
}
void RCConsentManagerImpl::RemoveExpiredConsents() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto last_state_accessor = last_state_->get_accessor();
auto last_state_dictionary = last_state_accessor.GetData().dictionary();
@@ -147,7 +145,7 @@ void RCConsentManagerImpl::RemoveAllConsents() {
rc_rpc_types::ModuleConsentState RCConsentManagerImpl::CheckModuleConsentState(
const Json::Value& module_consent) const {
if (!module_consent.isMember(message_params::kConsentDate)) {
- LOG4CXX_DEBUG(logger_, "Date of consent is absent");
+ SDL_LOG_DEBUG("Date of consent is absent");
return rc_rpc_types::ModuleConsentState::NOT_EXISTS;
}
@@ -160,10 +158,9 @@ rc_rpc_types::ModuleConsentState RCConsentManagerImpl::CheckModuleConsentState(
const auto past_period_in_days =
date_time::calculateAmountDaysFromDate(consent_date);
- LOG4CXX_DEBUG(
- logger_,
- "Keeping time of consent is: " << past_period_in_days << " days");
- LOG4CXX_DEBUG(logger_, "Period for expired: " << period_for_expiring);
+ SDL_LOG_DEBUG("Keeping time of consent is: " << past_period_in_days
+ << " days");
+ SDL_LOG_DEBUG("Period for expired: " << period_for_expiring);
return (past_period_in_days >= period_for_expiring)
? rc_rpc_types::ModuleConsentState::EXPIRED
@@ -205,17 +202,15 @@ void RCConsentManagerImpl::RemoveModuleExpiredConsents(
const bool is_expired = rc_rpc_types::ModuleConsentState::EXPIRED ==
CheckModuleConsentState(consent);
if (is_expired) {
- LOG4CXX_DEBUG(logger_,
- "Consent for module resource ["
- << consent[message_params::kModuleId].asString()
- << "] is expired and will be removed");
+ SDL_LOG_DEBUG("Consent for module resource ["
+ << consent[message_params::kModuleId].asString()
+ << "] is expired and will be removed");
}
if (is_module_id_exists && !is_expired) {
- LOG4CXX_DEBUG(logger_,
- "Consent for module resource ["
- << consent[message_params::kModuleId].asString()
- << "] is actual.");
+ SDL_LOG_DEBUG("Consent for module resource ["
+ << consent[message_params::kModuleId].asString()
+ << "] is actual.");
temp_consents.append(consent);
}
}
@@ -232,14 +227,14 @@ Json::Value& RCConsentManagerImpl::GetRemoteControlDataOrAppend(
if (!last_state_data.isMember(app_mngr::strings::remote_control)) {
last_state_data[app_mngr::strings::remote_control] =
Json::Value(Json::objectValue);
- LOG4CXX_DEBUG(logger_, "remote_control section is missed");
+ SDL_LOG_DEBUG("remote_control section is missed");
}
Json::Value& remote_control =
last_state_data[app_mngr::strings::remote_control];
if (!remote_control.isObject()) {
- LOG4CXX_ERROR(logger_, "remote_control type INVALID rewrite");
+ SDL_LOG_ERROR("remote_control type INVALID rewrite");
remote_control = Json::Value(Json::objectValue);
}
return remote_control;
@@ -252,7 +247,7 @@ Json::Value& RCConsentManagerImpl::GetDeviceApplicationsOrAppend(
auto& apps_consents = GetAppsConsentsOrAppend(last_state_data);
if (!apps_consents.isArray()) {
- LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite");
+ SDL_LOG_DEBUG("applications_consents type INVALID rewrite");
apps_consents = Json::Value(Json::arrayValue);
}
@@ -288,7 +283,7 @@ Json::Value& RCConsentManagerImpl::GetAppConsentsListOrAppend(
sync_primitives::AutoLock autolock(applications_lock_);
if (!device_applications.isArray()) {
- LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite");
+ SDL_LOG_DEBUG("applications_consents type INVALID rewrite");
device_applications = Json::Value(Json::arrayValue);
}
@@ -323,14 +318,14 @@ Json::Value& RCConsentManagerImpl::GetAppsConsentsOrAppend(
sync_primitives::AutoLock autolock(remote_control_lock_);
if (!remote_control.isMember(message_params::kAppConsents)) {
- LOG4CXX_DEBUG(logger_, "app_consents section is missed");
+ SDL_LOG_DEBUG("app_consents section is missed");
remote_control[message_params::kAppConsents] =
Json::Value(Json::arrayValue);
}
auto& app_consents = remote_control[message_params::kAppConsents];
if (!app_consents.isArray()) {
- LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite");
+ SDL_LOG_DEBUG("applications_consents type INVALID rewrite");
app_consents = Json::Value(Json::arrayValue);
}
return app_consents;
@@ -358,10 +353,8 @@ Json::Value& RCConsentManagerImpl::GetModuleTypeConsentsOrAppend(
// In case of absent specified module_type in section of specified
// application, will be added empty section with this module type.
- LOG4CXX_DEBUG(
- logger_,
- "Section module_type: " << module_type
- << " is missed for app_id:" << policy_app_id);
+ SDL_LOG_DEBUG("Section module_type: "
+ << module_type << " is missed for app_id:" << policy_app_id);
auto consent_item = Json::Value(Json::objectValue);
consent_item[message_params::kModuleType] = module_type;
consent_item[message_params::kModuleConsents] = Json::Value(Json::arrayValue);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
index f344dd15a7..61524546a8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
@@ -6,7 +6,7 @@
#include "rc_rpc_plugin/rc_rpc_plugin.h"
namespace rc_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule");
const std::vector<std::string> RCHelpers::buttons_climate() {
std::vector<std::string> data;
@@ -138,7 +138,7 @@ RCHelpers::GetModuleTypeToDataMapping() {
{enums_value::kHmiSettings, message_params::kHmiSettingsControlData}};
auto it = mapping.find(module_type);
if (mapping.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown module type" << module_type);
+ SDL_LOG_ERROR("Unknown module type " << module_type);
return std::string();
}
return it->second;
@@ -159,7 +159,7 @@ RCHelpers::GetModuleTypeToCapabilitiesMapping() {
{enums_value::kHmiSettings, strings::khmiSettingsControlCapabilities}};
auto it = mapping.find(module_type);
if (mapping.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown module type" << module_type);
+ SDL_LOG_ERROR("Unknown module type " << module_type);
return std::string();
}
return it->second;
@@ -175,15 +175,17 @@ const std::vector<std::string> RCHelpers::GetModuleTypesList() {
RCAppExtensionPtr RCHelpers::GetRCExtension(
application_manager::Application& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto extension_interface = app.QueryInterface(RCRPCPlugin::kRCPluginID);
auto extension =
std::static_pointer_cast<RCAppExtension>(extension_interface);
return extension;
}
-smart_objects::SmartObjectSPtr RCHelpers::CreateUnsubscribeRequestToHMI(
- const ModuleUid& module, const uint32_t correlation_id) {
+smart_objects::SmartObjectSPtr RCHelpers::CreateGetInteriorVDRequestToHMI(
+ const ModuleUid& module,
+ const uint32_t correlation_id,
+ const InteriorDataAction action) {
using namespace smart_objects;
namespace commands = application_manager::commands;
namespace am_strings = application_manager::strings;
@@ -200,7 +202,10 @@ smart_objects::SmartObjectSPtr RCHelpers::CreateUnsubscribeRequestToHMI(
params[am_strings::correlation_id] = correlation_id;
params[am_strings::function_id] =
hmi_apis::FunctionID::RC_GetInteriorVehicleData;
- msg_params[message_params::kSubscribe] = false;
+ if (NONE != action) {
+ msg_params[message_params::kSubscribe] =
+ (SUBSCRIBE == action) ? true : false;
+ }
msg_params[message_params::kModuleType] = module.first;
msg_params[message_params::kModuleId] = module.second;
return message;
@@ -257,7 +262,7 @@ void RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
using namespace message_params;
using namespace application_manager::strings;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!msg_params.keyExists(kModuleData)) {
return;
}
@@ -291,6 +296,11 @@ smart_objects::SmartObject RCHelpers::MergeModuleData(
smart_objects::SmartObject result = data1;
+ if (data2.empty()) {
+ SDL_LOG_ERROR("Data received from module is empty");
+ return result;
+ }
+
for (auto it = data2.map_begin(); it != data2.map_end(); ++it) {
const std::string& key = it->first;
smart_objects::SmartObject& value = it->second;
@@ -300,9 +310,9 @@ smart_objects::SmartObject RCHelpers::MergeModuleData(
}
// Merge maps and arrays with `id` param included, replace other types
- if (value.getType() == smart_objects::SmartType::SmartType_Map) {
+ if (smart_objects::SmartType::SmartType_Map == value.getType()) {
value = MergeModuleData(result[key], value);
- } else if (value.getType() == smart_objects::SmartType::SmartType_Array) {
+ } else if (smart_objects::SmartType::SmartType_Array == value.getType()) {
value = MergeArray(result[key], value);
}
result[key] = value;
@@ -362,4 +372,27 @@ smart_objects::SmartObject RCHelpers::MergeArray(
return result;
}
+bool RCHelpers::IsResponseSuccessful(
+ const smart_objects::SmartObject& response) {
+ hmi_apis::messageType::eType message_type =
+ static_cast<hmi_apis::messageType::eType>(
+ response[application_manager::strings::params]
+ [application_manager::strings::message_type]
+ .asInt());
+ const bool is_correct_message_type =
+ hmi_apis::messageType::response == message_type;
+
+ bool is_subscribe_successful = false;
+
+ if (response[application_manager::strings::msg_params].keyExists(
+ rc_rpc_plugin::message_params::kIsSubscribed)) {
+ is_subscribe_successful =
+ response[application_manager::strings::msg_params]
+ [rc_rpc_plugin::message_params::kIsSubscribed]
+ .asBool();
+ }
+
+ return is_correct_message_type && is_subscribe_successful;
+}
+
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc
new file mode 100644
index 0000000000..e66023f27a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc
@@ -0,0 +1,343 @@
+#include "rc_rpc_plugin/rc_pending_resumption_handler.h"
+#include <sstream>
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+
+namespace rc_rpc_plugin {
+
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule")
+
+RCPendingResumptionHandler::RCPendingResumptionHandler(
+ application_manager::ApplicationManager& application_manager,
+ InteriorDataCache& interior_data_cache)
+ : PendingResumptionHandler(application_manager)
+ , rpc_service_(application_manager.GetRPCService())
+ , interior_data_cache_(interior_data_cache) {}
+
+void RCPendingResumptionHandler::on_event(
+ const application_manager::event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+ namespace am_strings = application_manager::strings;
+ sync_primitives::AutoLock lock(pending_resumption_lock_);
+ const auto cid = event.smart_object_correlation_id();
+ SDL_LOG_TRACE("Received event with function id: "
+ << event.id() << " and correlation id: " << cid);
+
+ const auto request_optional = GetPendingRequest(cid);
+ const auto app_id_optional = GetPendingApp(cid);
+ if (!request_optional) {
+ SDL_LOG_ERROR("Not waiting for message with correlation id: " << cid);
+ return;
+ }
+
+ auto current_request = *request_optional;
+ const auto app_id = *app_id_optional;
+ RemovePendingRequest(cid);
+ auto module_uid = GetModuleUid(current_request);
+
+ auto& response = event.smart_object();
+ if (RCHelpers::IsResponseSuccessful(response)) {
+ SDL_LOG_DEBUG("Resumption of subscriptions is successful"
+ << " module type: " << module_uid.first
+ << " module id: " << module_uid.second);
+
+ auto app = application_manager_.application(app_id);
+ if (app) {
+ auto rc_app_extension = RCHelpers::GetRCExtension(*app);
+ rc_app_extension->SubscribeToInteriorVehicleData(module_uid);
+ }
+
+ if (response[am_strings::msg_params].keyExists(
+ message_params::kModuleData)) {
+ const auto module_data =
+ response[am_strings::msg_params][message_params::kModuleData];
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ if (module_data.keyExists(data_mapping(module_uid.first))) {
+ const auto control_data = module_data[data_mapping(module_uid.first)];
+ interior_data_cache_.Add(module_uid, control_data);
+ }
+ }
+
+ HandleSuccessfulResponse(event, module_uid);
+ } else {
+ SDL_LOG_DEBUG("Resumption of subscriptions is NOT successful"
+ << " module type: " << module_uid.first
+ << " module id: " << module_uid.second);
+
+ ProcessNextPausedResumption(module_uid);
+ }
+}
+
+template <typename RCModulesCollection>
+std::string Stringify(RCModulesCollection& collection) {
+ std::stringstream ss;
+ for (const auto& module : collection) {
+ ss << "{type : " << module.first << " id " << module.second << "} ";
+ }
+ return ss.str();
+}
+
+void RCPendingResumptionHandler::HandleResumptionSubscriptionRequest(
+ application_manager::AppExtension& extension,
+ application_manager::Application& app) {
+ UNUSED(extension);
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(pending_resumption_lock_);
+
+ auto rc_extension = RCHelpers::GetRCExtension(app);
+ auto subscriptions = rc_extension->PendingSubscriptions();
+ rc_extension->RemovePendingSubscriptions();
+ SDL_LOG_TRACE("app id " << app.app_id() << " " << Stringify(subscriptions));
+
+ std::vector<ModuleUid> ignored;
+ std::vector<ModuleUid> already_pending;
+ std::vector<ModuleUid> need_to_subscribe;
+ for (const auto& subscription : subscriptions) {
+ bool is_another_app_subscribed =
+ IsOtherAppsSubscribed(app.app_id(), subscription);
+ bool is_pending_response = IsPendingForResponse(subscription);
+ if (is_another_app_subscribed && !is_pending_response) {
+ rc_extension->SubscribeToInteriorVehicleData(subscription);
+ ignored.push_back(subscription);
+ } else if (is_pending_response) {
+ already_pending.push_back(subscription);
+ } else {
+ need_to_subscribe.push_back(subscription);
+ }
+ }
+ SDL_LOG_TRACE("ignored: " << Stringify(ignored));
+ SDL_LOG_TRACE("already_pending: " << Stringify(already_pending));
+ SDL_LOG_TRACE("need_to_subscribe: " << Stringify(need_to_subscribe));
+
+ for (auto subscription : already_pending) {
+ const auto cid = application_manager_.GetNextHMICorrelationID();
+ const auto subscription_request =
+ CreateSubscriptionRequest(subscription, cid);
+ const auto fid = GetFunctionId(*subscription_request);
+ paused_resumptions_[subscription].push(
+ {app.app_id(), *subscription_request});
+ const auto resumption_request =
+ MakeResumptionRequest(cid, fid, *subscription_request);
+ resumption_data_processor().SubscribeToResponse(app.app_id(),
+ resumption_request);
+ SDL_LOG_DEBUG("Paused request with correlation_id: "
+ << cid << " module type: " << subscription.first
+ << " module id: " << subscription.second);
+ }
+
+ for (auto module : need_to_subscribe) {
+ const auto cid = application_manager_.GetNextHMICorrelationID();
+ const auto subscription_request = CreateSubscriptionRequest(module, cid);
+ const auto fid = GetFunctionId(*subscription_request);
+ const auto resumption_request =
+ MakeResumptionRequest(cid, fid, *subscription_request);
+ AddPendingRequest(app.app_id(), *subscription_request);
+ subscribe_on_event(fid, cid);
+ resumption_data_processor().SubscribeToResponse(app.app_id(),
+ resumption_request);
+ SDL_LOG_DEBUG("Sending request with correlation id: "
+ << cid << " module type: " << module.first
+ << " module id: " << module.second);
+ application_manager_.GetRPCService().ManageHMICommand(subscription_request);
+ }
+}
+
+void RCPendingResumptionHandler::OnResumptionRevert() {
+ SDL_LOG_AUTO_TRACE();
+}
+
+void RCPendingResumptionHandler::HandleSuccessfulResponse(
+ const application_manager::event_engine::Event& event,
+ const ModuleUid& module_uid) {
+ SDL_LOG_AUTO_TRACE();
+
+ auto& response = event.smart_object();
+ auto cid = event.smart_object_correlation_id();
+
+ const auto& it = paused_resumptions_.find(module_uid);
+ if (it != paused_resumptions_.end()) {
+ SDL_LOG_DEBUG("Paused resumptions found");
+ auto& queue_paused = it->second;
+ while (!queue_paused.empty()) {
+ const auto& resumption_request = queue_paused.front();
+ cid = resumption_request.correlation_id();
+ RaiseEventForResponse(response, cid);
+ auto app = application_manager_.application(resumption_request.app_id);
+ if (app) {
+ auto rc_app_extension = RCHelpers::GetRCExtension(*app);
+ rc_app_extension->SubscribeToInteriorVehicleData(module_uid);
+ }
+ queue_paused.pop();
+ }
+ paused_resumptions_.erase(it);
+ }
+}
+
+void RCPendingResumptionHandler::ProcessNextPausedResumption(
+ const ModuleUid& module_uid) {
+ SDL_LOG_AUTO_TRACE();
+
+ auto pop_front_paused_resumptions = [this](const ModuleUid& module_uid) {
+ const auto& it = paused_resumptions_.find(module_uid);
+ if (it == paused_resumptions_.end()) {
+ return std::shared_ptr<PendingRequestQueue::value_type>(nullptr);
+ }
+ auto& queue_paused = it->second;
+ if (queue_paused.empty()) {
+ paused_resumptions_.erase(it);
+ return std::shared_ptr<PendingRequestQueue::value_type>(nullptr);
+ }
+ auto paused_resumption =
+ std::make_shared<PendingRequestQueue::value_type>(queue_paused.front());
+ queue_paused.pop();
+ if (queue_paused.empty()) {
+ paused_resumptions_.erase(it);
+ }
+ return paused_resumption;
+ };
+
+ auto paused_resumption = pop_front_paused_resumptions(module_uid);
+ if (!paused_resumption) {
+ SDL_LOG_DEBUG("No paused resumptions found");
+ return;
+ }
+
+ auto& resumption_request = *paused_resumption;
+ auto subscription_request =
+ std::make_shared<smart_objects::SmartObject>(resumption_request.message);
+ const auto fid = GetFunctionId(*subscription_request);
+ const auto cid =
+ resumption_request
+ .message[app_mngr::strings::params][app_mngr::strings::correlation_id]
+ .asInt();
+ subscribe_on_event(fid, cid);
+ AddPendingRequest(resumption_request.app_id, *subscription_request);
+ SDL_LOG_DEBUG("Sending request with correlation id: "
+ << cid << " module type: " << module_uid.first
+ << " module id: " << module_uid.second);
+ application_manager_.GetRPCService().ManageHMICommand(subscription_request);
+}
+
+void RCPendingResumptionHandler::RaiseEventForResponse(
+ const smart_objects::SmartObject& subscription_response,
+ const uint32_t correlation_id) const {
+ smart_objects::SmartObject event_message = subscription_response;
+ event_message[app_mngr::strings::params][app_mngr::strings::correlation_id] =
+ correlation_id;
+
+ app_mngr::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+ event.set_smart_object(event_message);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+bool RCPendingResumptionHandler::IsPendingForResponse(
+ const ModuleUid& module_uid) const {
+ auto is_module_exists = [&module_uid](const PendingRequest& pending) {
+ return module_uid == GetModuleUid(pending.message);
+ };
+ auto it = std::find_if(
+ pending_requests_.begin(), pending_requests_.end(), is_module_exists);
+ return it != pending_requests_.end();
+}
+
+bool RCPendingResumptionHandler::IsOtherAppsSubscribed(
+ const uint32_t app_id, const ModuleUid& module_uid) const {
+ auto get_subscriptions = [](application_manager::ApplicationSharedPtr app) {
+ std::set<ModuleUid> result;
+ auto rc_app_extension = RCHelpers::GetRCExtension(*app);
+ if (rc_app_extension) {
+ result = rc_app_extension->InteriorVehicleDataSubscriptions();
+ }
+ return result;
+ };
+
+ auto app_subscribed = [module_uid, &get_subscriptions](
+ application_manager::ApplicationSharedPtr app) {
+ auto subscriptions = get_subscriptions(app);
+ auto it = subscriptions.find(module_uid);
+ return subscriptions.end() != it;
+ };
+
+ std::set<uint32_t> subscribed_apps;
+ for (auto& app : application_manager_.applications().GetData()) {
+ if (app_subscribed(app)) {
+ SDL_LOG_DEBUG("APP " << app->app_id() << " subscribed "
+ << module_uid.first << " " << module_uid.second);
+ subscribed_apps.insert(app->app_id());
+ }
+ }
+
+ subscribed_apps.erase(app_id);
+ return !subscribed_apps.empty();
+}
+
+utils::Optional<smart_objects::SmartObject>
+RCPendingResumptionHandler::GetPendingRequest(const uint32_t corr_id) {
+ auto corr_id_match = [corr_id](const PendingRequest& item) {
+ return corr_id == item.correlation_id();
+ };
+ auto it = std::find_if(
+ pending_requests_.begin(), pending_requests_.end(), corr_id_match);
+ if (it == pending_requests_.end()) {
+ return utils::Optional<smart_objects::SmartObject>::EMPTY;
+ }
+ return it->message;
+}
+
+utils::Optional<uint32_t> RCPendingResumptionHandler::GetPendingApp(
+ const uint32_t corr_id) {
+ auto corr_id_match = [corr_id](const PendingRequest& item) {
+ return corr_id == item.correlation_id();
+ };
+ auto it = std::find_if(
+ pending_requests_.begin(), pending_requests_.end(), corr_id_match);
+ if (it == pending_requests_.end()) {
+ return utils::Optional<uint32_t>::EMPTY;
+ }
+ return it->app_id;
+}
+
+void RCPendingResumptionHandler::RemovePendingRequest(const uint32_t corr_id) {
+ auto corr_id_match = [corr_id](const PendingRequest& item) {
+ return corr_id == item.correlation_id();
+ };
+ const auto it = std::find_if(
+ pending_requests_.begin(), pending_requests_.end(), corr_id_match);
+ if (it == pending_requests_.end()) {
+ SDL_LOG_WARN("Pending request with corr_id " << corr_id << " not found");
+ return;
+ }
+ pending_requests_.erase(it);
+}
+
+void RCPendingResumptionHandler::AddPendingRequest(
+ const uint32_t app_id, const smart_objects::SmartObject request_so) {
+ pending_requests_.push_back({app_id, request_so});
+}
+
+smart_objects::SmartObjectSPtr
+RCPendingResumptionHandler::CreateSubscriptionRequest(
+ const ModuleUid& module, const uint32_t correlation_id) {
+ return RCHelpers::CreateGetInteriorVDRequestToHMI(
+ module, correlation_id, RCHelpers::InteriorDataAction::SUBSCRIBE);
+}
+
+hmi_apis::FunctionID::eType RCPendingResumptionHandler::GetFunctionId(
+ const smart_objects::SmartObject& subscription_request) {
+ const auto function_id = static_cast<hmi_apis::FunctionID::eType>(
+ subscription_request[app_mngr::strings::params]
+ [app_mngr::strings::function_id]
+ .asInt());
+ return function_id;
+}
+
+ModuleUid RCPendingResumptionHandler::GetModuleUid(
+ const smart_objects::SmartObject& subscription_request) {
+ const smart_objects::SmartObject& msg_params =
+ subscription_request[app_mngr::strings::msg_params];
+ return ModuleUid(msg_params[message_params::kModuleType].asString(),
+ msg_params[message_params::kModuleId].asString());
+}
+
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
index c2aa639fda..4345aa044a 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2018, Ford Motor Company
+ Copyright (c) 2020, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -39,11 +39,12 @@
#include "rc_rpc_plugin/rc_command_factory.h"
#include "rc_rpc_plugin/rc_consent_manager_impl.h"
#include "rc_rpc_plugin/rc_helpers.h"
+#include "rc_rpc_plugin/rc_pending_resumption_handler.h"
#include "rc_rpc_plugin/resource_allocation_manager_impl.h"
#include "utils/helpers.h"
namespace rc_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule");
namespace plugins = application_manager::plugin_manager;
@@ -76,6 +77,8 @@ bool RCRPCPlugin::Init(
command_factory_.reset(new rc_rpc_plugin::RCCommandFactory(params));
rpc_service_ = &rpc_service;
app_mngr_ = &app_manager;
+ pending_resumption_handler_ = std::make_shared<RCPendingResumptionHandler>(
+ app_manager, *(interior_data_cache_.get()));
// Check all saved consents and remove expired
rc_consent_manager_->RemoveExpiredConsents();
@@ -115,19 +118,18 @@ void RCRPCPlugin::OnPolicyEvent(
void RCRPCPlugin::OnApplicationEvent(
application_manager::plugin_manager::ApplicationEvent event,
application_manager::ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!application->is_remote_control_supported()) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Remote control is not supported for application with app_id: "
- << application->app_id());
+ << application->app_id());
return;
}
switch (event) {
case plugins::kApplicationRegistered: {
- auto extension =
- std::shared_ptr<RCAppExtension>(new RCAppExtension(kRCPluginID));
- application->AddExtension(extension);
+ auto extension = std::shared_ptr<RCAppExtension>(
+ new RCAppExtension(kRCPluginID, *this, *application));
+ DCHECK_OR_RETURN_VOID(application->AddExtension(extension));
const auto driver_location =
rc_capabilities_manager_
->GetDriverLocationFromSeatLocationCapability();
@@ -160,6 +162,49 @@ void RCRPCPlugin::OnApplicationEvent(
}
}
+void RCRPCPlugin::ProcessResumptionSubscription(
+ application_manager::Application& app, RCAppExtension& ext) {
+ SDL_LOG_AUTO_TRACE();
+
+ pending_resumption_handler_->HandleResumptionSubscriptionRequest(ext, app);
+}
+
+void RCRPCPlugin::RevertResumption(const std::set<ModuleUid>& subscriptions) {
+ SDL_LOG_AUTO_TRACE();
+
+ interior_data_manager_->OnResumptionRevert(subscriptions);
+ pending_resumption_handler_->OnResumptionRevert();
+}
+
+bool RCRPCPlugin::IsOtherAppsSubscribed(const rc_rpc_types::ModuleUid& module,
+ const uint32_t app_id) {
+ auto get_subscriptions = [](application_manager::ApplicationSharedPtr app) {
+ std::set<ModuleUid> result;
+ auto rc_app_extension = RCHelpers::GetRCExtension(*app);
+ if (rc_app_extension) {
+ result = rc_app_extension->InteriorVehicleDataSubscriptions();
+ }
+ return result;
+ };
+
+ auto another_app_subscribed =
+ [app_id, module, &get_subscriptions](
+ application_manager::ApplicationSharedPtr app) {
+ if (app_id == app->app_id()) {
+ return false;
+ }
+ auto subscriptions = get_subscriptions(app);
+ auto it = subscriptions.find(module);
+ return subscriptions.end() != it;
+ };
+
+ auto accessor = app_mngr_->applications();
+ auto it = std::find_if(accessor.GetData().begin(),
+ accessor.GetData().end(),
+ another_app_subscribed);
+ return accessor.GetData().end() != it;
+}
+
RCRPCPlugin::Apps RCRPCPlugin::GetRCApplications(
application_manager::ApplicationManager& app_mngr) {
using application_manager::ApplicationSet;
@@ -179,12 +224,12 @@ RCRPCPlugin::Apps RCRPCPlugin::GetRCApplications(
extern "C" __attribute__((visibility("default")))
application_manager::plugin_manager::RPCPlugin*
-Create() {
+Create(logger::Logger* logger_instance) {
+ logger::Logger::instance(logger_instance);
return new rc_rpc_plugin::RCRPCPlugin();
} // namespace rc_rpc_plugin
extern "C" __attribute__((visibility("default"))) void Delete(
application_manager::plugin_manager::RPCPlugin* data) {
delete data;
- DELETE_THREAD_LOGGER(rc_rpc_plugin::logger_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
index 049f9a3cf3..fe9bb5eec3 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
@@ -45,7 +45,7 @@
namespace rc_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+SDL_CREATE_LOG_VARIABLE("RemoteControlModule")
ResourceAllocationManagerImpl::ResourceAllocationManagerImpl(
application_manager::ApplicationManager& app_mngr,
@@ -63,11 +63,11 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
const std::string& module_type,
const std::string& module_id,
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const application_manager::ApplicationSharedPtr acquiring_app =
app_mngr_.application(app_id);
if (!acquiring_app) {
- LOG4CXX_WARN(logger_, "App with app_id: " << app_id << "does not exist!");
+ SDL_LOG_WARN("App with app_id: " << app_id << " does not exist!");
return AcquireResult::IN_USE;
}
@@ -75,9 +75,9 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
if (rc_capabilities_manager_.IsSeatLocationCapabilityProvided() &&
!IsUserLocationValid(module, acquiring_app)) {
- LOG4CXX_WARN(logger_,
- "Resource acquisition is not allowed "
- "according to location verification.");
+ SDL_LOG_WARN(
+ "Resource acquisition is not allowed "
+ "according to location verification.");
return AcquireResult::REJECTED;
}
@@ -85,23 +85,20 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
const AllocatedResources::const_iterator allocated_it =
allocated_resources_.find(module);
if (allocated_resources_.end() == allocated_it) {
- LOG4CXX_DEBUG(logger_,
- "Resource is not acquired yet. "
- << "App: " << app_id << " is allowed to acquire "
- << module_type << " " << module_id);
+ SDL_LOG_DEBUG("Resource is not acquired yet. "
+ << "App: " << app_id << " is allowed to acquire "
+ << module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
if (app_id == allocated_resources_[module]) {
- LOG4CXX_DEBUG(logger_,
- "App: " << app_id << " is already acquired resource "
+ SDL_LOG_DEBUG("App: " << app_id << " is already acquired resource "
<< module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
if (IsModuleTypeRejected(module_type, module_id, app_id)) {
- LOG4CXX_DEBUG(logger_,
- "Driver disallowed app: " << app_id << " to acquire "
+ SDL_LOG_DEBUG("Driver disallowed app: " << app_id << " to acquire "
<< module_type << " " << module_id);
return AcquireResult::REJECTED;
}
@@ -110,42 +107,37 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
acquiring_app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) {
- LOG4CXX_DEBUG(logger_,
- "Aquiring resources is not allowed in HMI level: "
- << acquiring_app_hmi_level << ". App: " << app_id
- << " is disallowed to acquire " << module_type << " "
- << module_id);
+ SDL_LOG_DEBUG("Acquiring resources is not allowed in HMI level: "
+ << acquiring_app_hmi_level << ". App: " << app_id
+ << " is disallowed to acquire " << module_type << " "
+ << module_id);
return AcquireResult::REJECTED;
}
if (!rc_capabilities_manager_.IsMultipleAccessAllowed(module)) {
- LOG4CXX_DEBUG(logger_,
- "Multiple access for the: " << module_type << " " << module_id
+ SDL_LOG_DEBUG("Multiple access for the: " << module_type << " " << module_id
<< " isn't allowed");
return AcquireResult::REJECTED;
}
switch (current_access_mode_) {
case hmi_apis::Common_RCAccessMode::AUTO_DENY: {
- LOG4CXX_DEBUG(logger_,
- "Current access_mode is AUTO_DENY. "
- << "App: " << app_id << " is disallowed to acquire "
- << module_type << " " << module_id);
+ SDL_LOG_DEBUG("Current access_mode is AUTO_DENY. "
+ << "App: " << app_id << " is disallowed to acquire "
+ << module_type << " " << module_id);
return AcquireResult::IN_USE;
}
case hmi_apis::Common_RCAccessMode::ASK_DRIVER: {
- LOG4CXX_DEBUG(logger_,
- "Current access_mode is ASK_DRIVER. "
- "Driver confirmation is required for app: "
- << app_id << " to acquire " << module_type << " "
- << module_id);
+ SDL_LOG_DEBUG(
+ "Current access_mode is ASK_DRIVER. "
+ "Driver confirmation is required for app: "
+ << app_id << " to acquire " << module_type << " " << module_id);
return AcquireResult::ASK_DRIVER;
}
case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: {
- LOG4CXX_DEBUG(logger_,
- "Current access_mode is AUTO_ALLOW. "
- << "App: " << app_id << " is allowed to acquire "
- << module_type << " " << module_id);
+ SDL_LOG_DEBUG("Current access_mode is AUTO_ALLOW. "
+ << "App: " << app_id << " is allowed to acquire "
+ << module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); }
@@ -154,7 +146,7 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
bool ResourceAllocationManagerImpl::IsUserLocationValid(
ModuleUid& module, application_manager::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto extension = RCHelpers::GetRCExtension(*app);
DCHECK_OR_RETURN(extension, false);
const auto user_location = extension->GetUserLocation();
@@ -166,15 +158,14 @@ bool ResourceAllocationManagerImpl::IsUserLocationValid(
if (is_driver || user_location.IntersectionExists(module_service_area)) {
return true;
}
- LOG4CXX_DEBUG(logger_, "User location is not valid");
+ SDL_LOG_DEBUG("User location is not valid");
return false;
}
void ResourceAllocationManagerImpl::ReleaseModuleType(
const std::string& module_type, const uint32_t application_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Release " << module_type << " "
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Release " << module_type << " "
<< " by " << application_id);
Resources allocated_resources = GetAcquiredResources(application_id);
for (const auto& resource : allocated_resources) {
@@ -185,7 +176,7 @@ void ResourceAllocationManagerImpl::ReleaseModuleType(
}
void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Apps app_list = RCRPCPlugin::GetRCApplications(app_mngr_);
Apps::const_iterator app = app_list.begin();
@@ -200,8 +191,7 @@ void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() {
&allowed_modules);
std::sort(allowed_modules.begin(), allowed_modules.end());
- LOG4CXX_DEBUG(logger_,
- "Acquired modules: " << acquired_modules.size()
+ SDL_LOG_DEBUG("Acquired modules: " << acquired_modules.size()
<< " , allowed modules: "
<< allowed_modules.size());
@@ -242,7 +232,7 @@ void ConstructOnRCStatusNotificationParams(
using smart_objects::SmartObject;
using smart_objects::SmartType_Array;
using smart_objects::SmartType_Map;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto modules_inserter = [](SmartObject& result_modules) {
return [&result_modules](const ModuleUid& module) {
@@ -275,7 +265,7 @@ void ConstructOnRCStatusNotificationParams(
smart_objects::SmartObjectSPtr
ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToMobile(
const application_manager::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using application_manager::MessageHelper;
auto msg_to_mobile = MessageHelper::CreateNotification(
mobile_apis::FunctionID::OnRCStatusID, app->app_id());
@@ -298,7 +288,7 @@ ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToMobile(
smart_objects::SmartObjectSPtr
ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToHmi(
const application_manager::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using application_manager::MessageHelper;
auto msg_to_hmi =
MessageHelper::CreateHMINotification(hmi_apis::FunctionID::RC_OnRCStatus);
@@ -314,7 +304,7 @@ ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToHmi(
void ResourceAllocationManagerImpl::SendOnRCStatusNotifications(
NotificationTrigger::eType event,
application_manager::ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr msg_to_mobile;
smart_objects::SmartObjectSPtr msg_to_hmi;
if (NotificationTrigger::APP_REGISTRATION == event) {
@@ -351,9 +341,8 @@ ResourceReleasedState::eType ResourceAllocationManagerImpl::ReleaseResource(
const std::string& module_type,
const std::string& module_id,
const uint32_t application_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Release " << module_type << " " << module_id << " by "
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Release " << module_type << " " << module_id << " by "
<< application_id);
return SetResourceFree(module_type, module_id, application_id);
}
@@ -362,35 +351,32 @@ void ResourceAllocationManagerImpl::SetResourceAcquired(
const std::string& module_type,
const std::string& module_id,
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ModuleUid module(module_type, module_id);
allocated_resources_[module] = app_id;
}
bool ResourceAllocationManagerImpl::IsResourceAlreadyAcquiredByApp(
const ModuleUid& moduleUid, const uint32_t app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto allocation = allocated_resources_.find(moduleUid);
if (allocated_resources_.end() == allocation) {
- LOG4CXX_DEBUG(logger_,
- "Resource " << moduleUid.first
+ SDL_LOG_DEBUG("Resource " << moduleUid.first
<< " is not allocated for any application.");
return false;
}
if (allocation->second != app_id) {
- LOG4CXX_DEBUG(logger_,
- "Resource "
- << moduleUid.first
- << " is already allocated by app:" << allocation->second
- << ". Asquire has been asked for app:" << app_id);
+ SDL_LOG_DEBUG("Resource "
+ << moduleUid.first
+ << " is already allocated by app:" << allocation->second
+ << ". Acquire has been asked for app:" << app_id);
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Resource " << moduleUid.first
+ SDL_LOG_DEBUG("Resource " << moduleUid.first
<< " is allocated by app:" << allocation->second);
return true;
@@ -404,26 +390,24 @@ ResourceReleasedState::eType ResourceAllocationManagerImpl::SetResourceFree(
AllocatedResources::const_iterator allocation =
allocated_resources_.find(module);
if (allocated_resources_.end() == allocation) {
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is not allocated.");
+ SDL_LOG_DEBUG("Resource " << module_type << " is not allocated.");
return ResourceReleasedState::NOT_ALLOCATED;
}
if (app_id != allocation->second) {
- LOG4CXX_ERROR(logger_,
- "Resource " << module_type
+ SDL_LOG_ERROR("Resource " << module_type
<< " is allocated by different application "
<< allocation->second);
return ResourceReleasedState::IS_ALLOCATED;
}
allocated_resources_.erase(allocation);
- LOG4CXX_DEBUG(
- logger_,
- "Resource " << module_type << ":" << module_id << " is released.");
+ SDL_LOG_DEBUG("Resource " << module_type << ":" << module_id
+ << " is released.");
return ResourceReleasedState::IS_RELEASED;
}
std::vector<ModuleUid> ResourceAllocationManagerImpl::GetAcquiredResources(
const uint32_t application_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Resources allocated_resources;
AllocatedResources::const_iterator allocation = allocated_resources_.begin();
for (; allocated_resources_.end() != allocation; ++allocation) {
@@ -432,8 +416,7 @@ std::vector<ModuleUid> ResourceAllocationManagerImpl::GetAcquiredResources(
}
}
- LOG4CXX_DEBUG(logger_,
- "Application " << application_id << " acquired "
+ SDL_LOG_DEBUG("Application " << application_id << " acquired "
<< allocated_resources.size()
<< " resource(s).");
@@ -442,15 +425,14 @@ std::vector<ModuleUid> ResourceAllocationManagerImpl::GetAcquiredResources(
std::set<std::string> ResourceAllocationManagerImpl::GetAcquiredModuleTypes(
const uint32_t application_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Resources allocated_resources = GetAcquiredResources(application_id);
std::set<std::string> acquired_module_types;
for (const auto& resource : allocated_resources) {
acquired_module_types.insert(resource.first);
}
- LOG4CXX_DEBUG(logger_,
- "Application " << application_id << " acquired "
+ SDL_LOG_DEBUG("Application " << application_id << " acquired "
<< acquired_module_types.size()
<< " module type(s).");
@@ -462,9 +444,8 @@ void ResourceAllocationManagerImpl::SetResourceState(
const std::string& module_id,
const uint32_t app_id,
const ResourceState::eType state) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Setting state for " << module_type << " by app_id " << app_id
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Setting state for " << module_type << " by app_id " << app_id
<< " to state " << state);
ModuleUid module(module_type, module_id);
{
@@ -474,36 +455,33 @@ void ResourceAllocationManagerImpl::SetResourceState(
const bool acquired = allocated_resources_.end() != allocated_it;
if (acquired) {
- LOG4CXX_DEBUG(logger_,
- "Resource " << module_type << " is already acquired."
+ SDL_LOG_DEBUG("Resource " << module_type << " is already acquired."
<< " Owner application id is "
<< allocated_it->second
<< " Changing application id is " << app_id);
} else {
- LOG4CXX_DEBUG(logger_,
- "Resource " << module_type << " is not acquired yet");
+ SDL_LOG_DEBUG("Resource " << module_type << " is not acquired yet");
}
}
sync_primitives::AutoLock lock(resources_state_lock_);
resources_state_[module] = state;
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " got state " << state);
+ SDL_LOG_DEBUG("Resource " << module_type << " got state " << state);
}
bool ResourceAllocationManagerImpl::IsResourceFree(
const std::string& module_type, const std::string& module_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ModuleUid module(module_type, module_id);
sync_primitives::AutoLock lock(resources_state_lock_);
const ResourcesState::const_iterator resource = resources_state_.find(module);
if (resources_state_.end() == resource) {
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is free.");
+ SDL_LOG_DEBUG("Resource " << module_type << " is free.");
return true;
}
- LOG4CXX_DEBUG(logger_,
- "Resource " << module_type << " state is " << resource->second);
+ SDL_LOG_DEBUG("Resource " << module_type << " state is " << resource->second);
return ResourceState::FREE == resource->second;
}
@@ -526,7 +504,7 @@ void ResourceAllocationManagerImpl::ForceAcquireResource(
const std::string& module_type,
const std::string& module_id,
const uint32_t app_id) {
- LOG4CXX_DEBUG(logger_, "Force " << app_id << " acquiring " << module_type);
+ SDL_LOG_DEBUG("Force " << app_id << " acquiring " << module_type);
sync_primitives::AutoLock lock(allocated_resources_lock_);
SetResourceAcquired(module_type, module_id, app_id);
}
@@ -535,7 +513,7 @@ bool ResourceAllocationManagerImpl::IsModuleTypeRejected(
const std::string& module_type,
const std::string& module_id,
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ModuleUid module(module_type, module_id);
sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
RejectedResources::iterator it =
@@ -555,7 +533,7 @@ void ResourceAllocationManagerImpl::OnDriverDisallowed(
const std::string& module_type,
const std::string& module_id,
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ModuleUid module(module_type, module_id);
sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
auto it = rejected_resources_for_application_.find(app_id);
@@ -572,9 +550,8 @@ void ResourceAllocationManagerImpl::OnApplicationEvent(
application_manager::plugin_manager::ApplicationEvent event,
application_manager::ApplicationSharedPtr application) {
using application_manager::plugin_manager::ApplicationEvent;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Event " << event << " came for " << application->app_id());
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Event " << event << " came for " << application->app_id());
if (ApplicationEvent::kApplicationExit == event ||
ApplicationEvent::kApplicationUnregistered == event) {
@@ -594,8 +571,8 @@ void ResourceAllocationManagerImpl::OnApplicationEvent(
void ResourceAllocationManagerImpl::OnPolicyEvent(
application_manager::plugin_manager::PolicyEvent event) {
using application_manager::plugin_manager::PolicyEvent;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Event " << event);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Event " << event);
if (PolicyEvent::kApplicationPolicyUpdated == event) {
ProcessApplicationPolicyUpdate();
@@ -609,7 +586,7 @@ void ResourceAllocationManagerImpl::OnPolicyEvent(
}
void ResourceAllocationManagerImpl::ResetAllAllocations() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(resources_state_lock_);
resources_state_.clear();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
index bd46bdf11f..16e95bf599 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
@@ -45,6 +45,9 @@ ${CMAKE_CURRENT_SOURCE_DIR}/interior_data_cache_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/rc_consent_manager_impl_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/grid_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/rc_helpers_test.cc
+${CMAKE_CURRENT_SOURCE_DIR}/rc_app_extension_test.cc
+${CMAKE_CURRENT_SOURCE_DIR}/rc_pending_resumption_handler_test.cc
+${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
)
set(RC_COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands)
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
index 625b2d6312..6c0962a557 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
@@ -82,15 +82,15 @@ class ButtonPressRequestTest
: rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map))
, mock_app_(std::make_shared<NiceMock<MockApplication> >())
- , rc_app_extention_(
- std::make_shared<rc_rpc_plugin::RCAppExtension>(kModuleId)) {}
+ , rc_app_extension_(std::make_shared<rc_rpc_plugin::RCAppExtension>(
+ kModuleId, rc_plugin_, *mock_app_)) {}
void SetUp() OVERRIDE {
smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
(*rc_capabilities_)[strings::kradioControlCapabilities] = control_caps;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
- .WillByDefault(Return(rc_app_extention_));
+ .WillByDefault(Return(rc_app_extension_));
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
ON_CALL(app_mngr_, hmi_capabilities())
@@ -143,7 +143,8 @@ class ButtonPressRequestTest
protected:
smart_objects::SmartObjectSPtr rc_capabilities_;
std::shared_ptr<MockApplication> mock_app_;
- std::shared_ptr<rc_rpc_plugin::RCAppExtension> rc_app_extention_;
+ RCRPCPlugin rc_plugin_;
+ std::shared_ptr<rc_rpc_plugin::RCAppExtension> rc_app_extension_;
test::components::policy_test::MockPolicyHandlerInterface
mock_policy_handler_;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
index 82b71f1be4..956a53994d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
@@ -92,8 +92,10 @@ class GetInteriorVehicleDataRequestTest
GetInteriorVehicleDataRequestTest()
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
, mock_app2_(std::make_shared<NiceMock<MockApplication> >())
- , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId))
- , rc_app_extention2_(std::make_shared<RCAppExtension>(kModuleId))
+ , rc_app_extension_(
+ std::make_shared<RCAppExtension>(kModuleId, rc_plugin_, *mock_app_))
+ , rc_app_extension2_(std::make_shared<RCAppExtension>(
+ kModuleId, rc_plugin_, *mock_app2_))
, apps_lock_(std::make_shared<sync_primitives::Lock>())
, apps_da_(apps_, apps_lock_)
, rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
@@ -105,9 +107,9 @@ class GetInteriorVehicleDataRequestTest
ON_CALL(*mock_app2_, is_remote_control_supported())
.WillByDefault(Return(true));
ON_CALL(*mock_app_, QueryInterface(_))
- .WillByDefault(Return(rc_app_extention_));
+ .WillByDefault(Return(rc_app_extension_));
ON_CALL(*mock_app2_, QueryInterface(_))
- .WillByDefault(Return(rc_app_extention2_));
+ .WillByDefault(Return(rc_app_extension2_));
}
/**
@@ -183,8 +185,9 @@ class GetInteriorVehicleDataRequestTest
protected:
std::shared_ptr<MockApplication> mock_app_;
std::shared_ptr<MockApplication> mock_app2_;
- std::shared_ptr<RCAppExtension> rc_app_extention_;
- std::shared_ptr<RCAppExtension> rc_app_extention2_;
+ RCRPCPlugin rc_plugin_;
+ std::shared_ptr<RCAppExtension> rc_app_extension_;
+ std::shared_ptr<RCAppExtension> rc_app_extension2_;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
@@ -264,7 +267,7 @@ TEST_F(
Execute_ExpectMessageNotSentToHMI_SuccessSentToMobile_AppSubscribed_DataFromCache) {
// Arrange
const ModuleUid module(module_type, module_id);
- rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
MessageSharedPtr mobile_message = CreateBasicMessage();
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kModuleType] = module_eType;
@@ -313,6 +316,51 @@ TEST_F(
TEST_F(
GetInteriorVehicleDataRequestTest,
+ Execute_ExpectMessageNotSentToHMI_DoubleSubscription_WarningsSentToMobile) {
+ // Arrange
+ const ModuleUid module(module_type, module_id);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = module_id;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kSubscribe] = true;
+
+ auto command =
+ CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ // Expectations
+ EXPECT_CALL(mock_interior_data_cache_, Contains(module))
+ .WillOnce(Return(true));
+
+ smart_objects::SmartObject radio_data;
+ radio_data[message_params::kBand] = enums_value::kAM;
+ EXPECT_CALL(mock_interior_data_cache_, Retrieve(module))
+ .WillOnce(Return(radio_data));
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+ MessageSharedPtr command_result;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::WARNINGS), _))
+ .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
+
+ // Act
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ // Assert
+ EXPECT_EQ((*command_result)[application_manager::strings::msg_params]
+ [message_params::kModuleData]
+ [message_params::kRadioControlData],
+ radio_data);
+}
+
+TEST_F(
+ GetInteriorVehicleDataRequestTest,
Execute_ExpectCorrectMessageSentToHMI_LastAppSubscribedUnsubscribe_ClearCache) {
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
@@ -335,7 +383,7 @@ TEST_F(
module_id;
apps_.insert(mock_app_);
- rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
.WillByDefault(Return(true));
@@ -379,8 +427,8 @@ TEST_F(GetInteriorVehicleDataRequestTest,
apps_.insert(mock_app_);
apps_.insert(mock_app2_);
- rc_app_extention_->SubscribeToInteriorVehicleData(module);
- rc_app_extention2_->SubscribeToInteriorVehicleData(module);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
+ rc_app_extension2_->SubscribeToInteriorVehicleData(module);
smart_objects::SmartObject radio_data;
radio_data[message_params::kBand] = enums_value::kAM;
@@ -408,7 +456,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
command->Run();
// Assert
- EXPECT_FALSE(rc_app_extention_->IsSubscribedToInteriorVehicleDataOfType(
+ EXPECT_FALSE(rc_app_extension_->IsSubscribedToInteriorVehicleDataOfType(
enums_value::kRadio));
EXPECT_EQ((*command_result)[application_manager::strings::msg_params]
[message_params::kModuleData]
@@ -571,7 +619,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
hmi_msg_params[application_manager::strings::connection_key] = kConnectionKey;
apps_.insert(mock_app_);
- rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
.WillByDefault(Return(true));
@@ -601,13 +649,13 @@ TEST_F(GetInteriorVehicleDataRequestTest,
command->on_event(event);
// Assert
- EXPECT_TRUE(rc_app_extention_->IsSubscribedToInteriorVehicleData(module));
+ EXPECT_TRUE(rc_app_extension_->IsSubscribedToInteriorVehicleData(module));
}
TEST_F(GetInteriorVehicleDataRequestTest,
Execute_ExpectRejectDuToRequestLimitation_NoCahce) {
// Arrange
- rc_app_extention_->UnsubscribeFromInteriorVehicleDataOfType(
+ rc_app_extension_->UnsubscribeFromInteriorVehicleDataOfType(
enums_value::kRadio);
MessageSharedPtr mobile_message = CreateBasicMessage();
(*mobile_message)[application_manager::strings::msg_params]
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
index d6771c534d..6c7a7ba67e 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
@@ -74,14 +74,15 @@ class OnInteriorVehicleDataNotificationTest
public:
OnInteriorVehicleDataNotificationTest()
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
- , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId))
+ , rc_app_extension_(
+ std::make_shared<RCAppExtension>(kModuleId, rc_plugin_, *mock_app_))
, apps_lock_(std::make_shared<sync_primitives::Lock>())
, apps_da_(apps_, apps_lock_) {
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
ON_CALL(*mock_app_, is_remote_control_supported())
.WillByDefault(Return(true));
ON_CALL(*mock_app_, QueryInterface(_))
- .WillByDefault(Return(rc_app_extention_));
+ .WillByDefault(Return(rc_app_extension_));
}
MessageSharedPtr CreateBasicMessage() {
@@ -120,7 +121,8 @@ class OnInteriorVehicleDataNotificationTest
protected:
std::shared_ptr<MockApplication> mock_app_;
- std::shared_ptr<RCAppExtension> rc_app_extention_;
+ RCRPCPlugin rc_plugin_;
+ std::shared_ptr<RCAppExtension> rc_app_extension_;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
@@ -141,7 +143,7 @@ TEST_F(OnInteriorVehicleDataNotificationTest,
MessageSharedPtr mobile_message = CreateBasicMessage();
apps_.insert(mock_app_);
const ModuleUid module(module_type, module_id);
- rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
// Expectations
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
index e5f96215eb..8fbaeda2f2 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
@@ -119,7 +119,8 @@ class RCGetInteriorVehicleDataConsentTest
rpc_protection_manager_,
hmi_so_factory_,
mobile_so_factoy_)
- , rc_app_extention_(std::make_shared<RCAppExtension>(kPluginID))
+ , rc_app_extension_(
+ std::make_shared<RCAppExtension>(kPluginID, rc_plugin_, *mock_app_))
, mock_rpc_plugin_manager(
std::make_shared<NiceMock<MockRPCPluginManager> >())
, rpc_plugin(mock_rpc_plugin)
@@ -136,7 +137,7 @@ class RCGetInteriorVehicleDataConsentTest
InterfaceState::STATE_AVAILABLE));
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
- .WillByDefault(Return(rc_app_extention_));
+ .WillByDefault(Return(rc_app_extension_));
testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
mock_interior_data_cache_;
ON_CALL(app_mngr_, GetPolicyHandler())
@@ -217,7 +218,8 @@ class RCGetInteriorVehicleDataConsentTest
std::shared_ptr<application_manager::MockRPCProtectionManager>
rpc_protection_manager_;
am::rpc_service::RPCServiceImpl rpc_service_;
- std::shared_ptr<RCAppExtension> rc_app_extention_;
+ RCRPCPlugin rc_plugin_;
+ std::shared_ptr<RCAppExtension> rc_app_extension_;
std::shared_ptr<am::plugin_manager::MockRPCPluginManager>
mock_rpc_plugin_manager;
utils::Optional<RPCPlugin> rpc_plugin;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
index 1e4da625b2..9b06ddb137 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
@@ -73,7 +73,8 @@ class SetInteriorVehicleDataRequestTest
public:
SetInteriorVehicleDataRequestTest()
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
- , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId))
+ , rc_app_extension_(
+ std::make_shared<RCAppExtension>(kModuleId, rc_plugin_, *mock_app_))
, rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType::SmartType_Array)) {}
@@ -89,7 +90,7 @@ class SetInteriorVehicleDataRequestTest
InterfaceState::STATE_AVAILABLE));
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
- .WillByDefault(Return(rc_app_extention_));
+ .WillByDefault(Return(rc_app_extension_));
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
ON_CALL(mock_allocation_manager_, IsResourceFree(_, _))
@@ -148,7 +149,8 @@ class SetInteriorVehicleDataRequestTest
testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
mock_interior_data_manager_;
std::shared_ptr<MockApplication> mock_app_;
- std::shared_ptr<RCAppExtension> rc_app_extention_;
+ RCRPCPlugin rc_plugin_;
+ std::shared_ptr<RCAppExtension> rc_app_extension_;
testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
mock_rc_capabilities_manager_;
smart_objects::SmartObjectSPtr rc_capabilities_;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h
index 231ac2ae36..3e64bb541f 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h
@@ -49,6 +49,8 @@ class MockInteriorDataManager : public rc_rpc_plugin::InteriorDataManager {
MOCK_METHOD1(StoreRequestToHMITime, void(const rc_rpc_plugin::ModuleUid&));
MOCK_METHOD1(CheckRequestsToHMIFrequency,
bool(const rc_rpc_plugin::ModuleUid&));
+ MOCK_METHOD1(OnResumptionRevert,
+ void(const std::set<rc_rpc_plugin::ModuleUid>& subscriptions));
};
} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h
index c73472d2a8..751291c8e2 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h
@@ -54,9 +54,11 @@ class MockRCHelpers {
MOCK_METHOD1(
GetRCExtension,
rc_rpc_plugin::RCAppExtensionPtr(application_manager::Application&));
- MOCK_METHOD2(CreateUnsubscribeRequestToHMI,
- smart_objects::SmartObjectSPtr(const rc_rpc_plugin::ModuleUid&,
- const uint32_t));
+ MOCK_METHOD3(CreateGetInteriorVDRequestToHMI,
+ smart_objects::SmartObjectSPtr(
+ const rc_rpc_plugin::ModuleUid&,
+ const uint32_t,
+ const RCHelpers::InteriorDataAction action));
MOCK_METHOD2(AppsSubscribedToModule,
std::vector<application_manager::ApplicationSharedPtr>(
application_manager::ApplicationManager&,
@@ -89,6 +91,9 @@ class MockRCHelpers {
smart_objects::SmartObject(const smart_objects::SmartObject& data1,
const smart_objects::SmartObject& data2));
+ MOCK_METHOD1(IsResponseSuccessful,
+ bool(const smart_objects::SmartObject& response));
+
static MockRCHelpers* rc_helpers_mock();
};
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc
index 3e60591c6b..2f5fed9971 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc
@@ -60,10 +60,12 @@ rc_rpc_plugin::RCAppExtensionPtr rc_rpc_plugin::RCHelpers::GetRCExtension(
}
smart_objects::SmartObjectSPtr
-rc_rpc_plugin::RCHelpers::CreateUnsubscribeRequestToHMI(
- const ModuleUid& module, const uint32_t correlation_id) {
- return MockRCHelpers::rc_helpers_mock()->CreateUnsubscribeRequestToHMI(
- module, correlation_id);
+rc_rpc_plugin::RCHelpers::CreateGetInteriorVDRequestToHMI(
+ const ModuleUid& module,
+ const uint32_t correlation_id,
+ const RCHelpers::InteriorDataAction action) {
+ return MockRCHelpers::rc_helpers_mock()->CreateGetInteriorVDRequestToHMI(
+ module, correlation_id, action);
}
std::vector<application_manager::ApplicationSharedPtr>
@@ -130,6 +132,11 @@ void RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
msg_params);
}
+bool RCHelpers::IsResponseSuccessful(
+ const smart_objects::SmartObject& response) {
+ return MockRCHelpers::rc_helpers_mock()->IsResponseSuccessful(response);
+}
+
MockRCHelpers* MockRCHelpers::rc_helpers_mock() {
static ::testing::NiceMock<MockRCHelpers> mock_rc_helpers;
return &mock_rc_helpers;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc
new file mode 100644
index 0000000000..60c3fb9135
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/rc_app_extension.h"
+
+#include <memory>
+#include <string>
+
+#include "application_manager/mock_application.h"
+#include "gtest/gtest.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+
+namespace {
+const uint32_t kRCAppExtensionId = 1ull;
+} // namespace
+
+namespace test {
+namespace components {
+namespace rc_rpc_plugin_test {
+namespace rc_app_extension_test {
+
+using test::components::application_manager_test::MockApplication;
+using ::testing::NiceMock;
+
+class RcAppExtensionTest : public testing::Test {
+ public:
+ RcAppExtensionTest()
+ : mock_app_(new NiceMock<MockApplication>())
+ , rc_app_extension_(std::make_shared<rc_rpc_plugin::RCAppExtension>(
+ kRCAppExtensionId, rc_plugin_, *mock_app_)) {}
+
+ protected:
+ std::unique_ptr<MockApplication> mock_app_;
+ rc_rpc_plugin::RCRPCPlugin rc_plugin_;
+ rc_rpc_plugin::RCAppExtensionPtr rc_app_extension_;
+};
+
+TEST_F(RcAppExtensionTest, SubscribeToInteriorVehicleData_AppDoesntUpdateHash) {
+ const std::string module_type = "CLIMATE";
+ const std::string module_id = "9cb963f3-c5e8-41cb-b001-19421cc16552";
+ rc_rpc_plugin::ModuleUid module{module_type, module_id};
+
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
+
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
+ EXPECT_TRUE(rc_app_extension_->IsSubscribedToInteriorVehicleData(module));
+
+ auto subscription = rc_app_extension_->InteriorVehicleDataSubscriptions();
+ EXPECT_EQ(1ull, subscription.size());
+}
+
+TEST_F(RcAppExtensionTest,
+ UnsubscribeFromInteriorVehicleData_AppDoesntUpdateHash) {
+ const std::string module_type = "CLIMATE";
+ const std::string module_id = "9cb963f3-c5e8-41cb-b001-19421cc16552";
+ rc_rpc_plugin::ModuleUid module{module_type, module_id};
+
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
+
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
+ rc_app_extension_->UnsubscribeFromInteriorVehicleData(module);
+
+ EXPECT_FALSE(rc_app_extension_->IsSubscribedToInteriorVehicleData(module));
+
+ auto subscription = rc_app_extension_->InteriorVehicleDataSubscriptions();
+ EXPECT_TRUE(subscription.empty());
+}
+
+TEST_F(RcAppExtensionTest,
+ UnsubscribeFromInteriorVehicleDataOfType_AppDoesntUpdateHash) {
+ const std::string module1_type = "CLIMATE";
+ const std::string module1_id = "9cb963f3-c5e8-41cb-b001-19421cc16552";
+ rc_rpc_plugin::ModuleUid module1{module1_type, module1_id};
+
+ const std::string module2_type = "RADIO";
+ const std::string module2_id = "357a3918-9f35-4d86-a8b6-60cd4308d76f";
+ rc_rpc_plugin::ModuleUid module2{module2_type, module2_id};
+
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module1);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module2);
+
+ EXPECT_CALL(*mock_app_, UpdateHash());
+ rc_app_extension_->UnsubscribeFromInteriorVehicleDataOfType(module1_type);
+
+ EXPECT_FALSE(
+ rc_app_extension_->IsSubscribedToInteriorVehicleDataOfType(module1_type));
+ EXPECT_TRUE(
+ rc_app_extension_->IsSubscribedToInteriorVehicleDataOfType(module2_type));
+
+ auto subscription = rc_app_extension_->InteriorVehicleDataSubscriptions();
+ EXPECT_EQ(1ull, subscription.size());
+}
+
+TEST_F(RcAppExtensionTest,
+ UnsubscribeFromInteriorVehicleDataOfType_UNSUCCESS_AppDoesntUpdateHash) {
+ const std::string module1_type = "CLIMATE";
+ const std::string module_id = "9cb963f3-c5e8-41cb-b001-19421cc16552";
+ rc_rpc_plugin::ModuleUid module{module1_type, module_id};
+
+ const std::string module2_type = "RADIO";
+
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module);
+
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
+ rc_app_extension_->UnsubscribeFromInteriorVehicleDataOfType(module2_type);
+
+ EXPECT_TRUE(rc_app_extension_->IsSubscribedToInteriorVehicleData(module));
+
+ auto subscription = rc_app_extension_->InteriorVehicleDataSubscriptions();
+ EXPECT_EQ(1ull, subscription.size());
+}
+
+TEST_F(RcAppExtensionTest, SaveResumptionData_SUCCESS) {
+ using namespace rc_rpc_plugin;
+
+ const std::string module1_type = "CLIMATE";
+ const std::string module1_id = "9cb963f3-c5e8-41cb-b001-19421cc16552";
+ ModuleUid module1{module1_type, module1_id};
+
+ const std::string module2_type = "RADIO";
+ const std::string module2_id = "357a3918-9f35-4d86-a8b6-60cd4308d76f";
+ ModuleUid module2{module2_type, module2_id};
+
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module1);
+ rc_app_extension_->SubscribeToInteriorVehicleData(module2);
+
+ const auto subscriptions =
+ rc_app_extension_->InteriorVehicleDataSubscriptions();
+
+ auto subscription_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ rc_app_extension_->SaveResumptionData(subscription_so);
+
+ const auto module_data =
+ subscription_so[message_params::kModuleData].asArray();
+
+ EXPECT_NE(nullptr, module_data);
+
+ EXPECT_EQ(module_data->size(), subscriptions.size());
+
+ auto module_info_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ module_info_so[message_params::kModuleType] = module1.first;
+ module_info_so[message_params::kModuleId] = module1.second;
+
+ auto found_module =
+ std::find(module_data->begin(), module_data->end(), module_info_so);
+
+ EXPECT_NE(found_module, module_data->end());
+
+ module_info_so[message_params::kModuleType] = module2.first;
+ module_info_so[message_params::kModuleId] = module2.second;
+
+ found_module =
+ std::find(module_data->begin(), module_data->end(), module_info_so);
+
+ EXPECT_NE(found_module, module_data->end());
+}
+
+} // namespace rc_app_extension_test
+} // namespace rc_rpc_plugin_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc
new file mode 100644
index 0000000000..fe8ade1e05
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include "rc_rpc_plugin/rc_pending_resumption_handler.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/mock_resumption_data_processor.h"
+#include "application_manager/mock_rpc_service.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "mock_application_manager.h"
+#include "rc_rpc_plugin/interior_data_cache_impl.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+
+namespace rc_rpc_plugin_test {
+
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::InSequence;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+
+using rc_rpc_plugin::ModuleUid;
+
+using application_manager::MockMessageHelper;
+using test::components::resumption_test::MockResumeCtrl;
+using test::components::resumption_test::MockResumptionDataProcessor;
+typedef NiceMock< ::test::components::event_engine_test::MockEventDispatcher>
+ MockEventDispatcher;
+
+typedef NiceMock<
+ ::test::components::application_manager_test::MockApplicationManager>
+ MockApplicationManager;
+typedef NiceMock< ::test::components::application_manager_test::MockApplication>
+ MockApplication;
+typedef NiceMock< ::test::components::application_manager_test::MockRPCService>
+ MockRPCService;
+typedef std::shared_ptr<MockApplication> MockAppPtr;
+
+namespace {
+const uint32_t kAppId_1 = 1u;
+const uint32_t kAppId_2 = 2u;
+const uint32_t kCorrelationId = 10u;
+const std::string kModuleType_1 = "CLIMATE";
+const std::string kModuleId_1 = "9cb963f3-c5e8-41cb-b001-19421cc16552";
+const std::string kModuleType_2 = "RADIO";
+const std::string kModuleId_2 = "357a3918-9f35-4d86-a8b6-60cd4308d76f";
+const uint32_t kRCPluginID = rc_rpc_plugin::RCRPCPlugin::kRCPluginID;
+const auto kSourceHMI = application_manager::commands::Command::SOURCE_HMI;
+} // namespace
+
+/**
+ * @brief EventCheck check that event contains apropriate data,
+ * check that is matched correlation id,
+ * check that function id is correct
+ */
+MATCHER_P(EventCheck, expected_corr_id, "") {
+ namespace strings = application_manager::strings;
+ const auto& response_message = arg.smart_object();
+ const auto cid =
+ response_message[strings::params][strings::correlation_id].asInt();
+ const bool cid_ok = (cid == expected_corr_id);
+ const auto fid =
+ response_message[strings::params][strings::function_id].asInt();
+ const bool fid_ok = (fid == hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+ return fid_ok && cid_ok;
+}
+
+/**
+ * @brief MessageCheck check that message contains apropriate data,
+ * check that is matched correlation id
+ */
+MATCHER_P(MessageCheck, correlation_id, "") {
+ const auto& request = *arg;
+ const auto cid =
+ request[app_mngr::strings::params][app_mngr::strings::correlation_id]
+ .asInt();
+ return cid == correlation_id;
+}
+
+class RCPendingResumptionHandlerTest : public ::testing::Test {
+ public:
+ RCPendingResumptionHandlerTest()
+ : applications_lock_(std::make_shared<sync_primitives::Lock>())
+ , applications_(application_set_, applications_lock_)
+ , mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
+
+ void SetUp() OVERRIDE {
+ ON_CALL(app_manager_mock_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_mock_));
+ ON_CALL(app_manager_mock_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ ON_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillByDefault(Return(kCorrelationId));
+ ON_CALL(app_manager_mock_, applications())
+ .WillByDefault(Return(applications_));
+ ON_CALL(app_manager_mock_, resume_controller())
+ .WillByDefault(ReturnRef(resume_ctrl_mock_));
+ ON_CALL(resume_ctrl_mock_, resumption_data_processor())
+ .WillByDefault(ReturnRef(resumption_data_processor_mock_));
+ resumption_handler_.reset(new rc_rpc_plugin::RCPendingResumptionHandler(
+ app_manager_mock_, cache_));
+ }
+
+ smart_objects::SmartObjectSPtr CreateHMIResponseMessage(
+ const application_manager::MessageType& message_type,
+ const hmi_apis::Common_Result::eType& response_code,
+ uint32_t correlation_id) {
+ namespace strings = application_manager::strings;
+ namespace hmi_response = application_manager::hmi_response;
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+ params[strings::function_id] =
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData;
+ params[strings::message_type] = message_type;
+ params[strings::correlation_id] = correlation_id;
+ const auto hmi_protocol_type = 1;
+ params[strings::protocol_type] = hmi_protocol_type;
+ params[hmi_response::code] = response_code;
+
+ smart_objects::SmartObjectSPtr response =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ auto& message = *response;
+ message[strings::params] = params;
+ message[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ message[strings::msg_params][rc_rpc_plugin::message_params::kIsSubscribed] =
+ true;
+ return response;
+ }
+
+ MockAppPtr CreateApp(uint32_t app_id) {
+ auto mock_app = std::make_shared<MockApplication>();
+ ON_CALL(app_manager_mock_, application(app_id))
+ .WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(app_id));
+ return mock_app;
+ }
+
+ rc_rpc_plugin::RCAppExtensionPtr CreateExtension(MockApplication& app) {
+ auto rc_app_ext = std::make_shared<rc_rpc_plugin::RCAppExtension>(
+ kRCPluginID, rc_plugin_, app);
+ ON_CALL(app, QueryInterface(kRCPluginID)).WillByDefault(Return(rc_app_ext));
+ return rc_app_ext;
+ }
+
+ protected:
+ application_manager::ApplicationSet application_set_;
+ std::shared_ptr<sync_primitives::Lock> applications_lock_;
+ DataAccessor<application_manager::ApplicationSet> applications_;
+ MockMessageHelper& mock_message_helper_;
+ MockResumeCtrl resume_ctrl_mock_;
+ MockResumptionDataProcessor resumption_data_processor_mock_;
+ MockApplicationManager app_manager_mock_;
+ MockEventDispatcher event_dispatcher_mock_;
+ MockRPCService mock_rpc_service_;
+ rc_rpc_plugin::RCRPCPlugin rc_plugin_;
+ rc_rpc_plugin::InteriorDataCacheImpl cache_;
+ std::unique_ptr<rc_rpc_plugin::RCPendingResumptionHandler>
+ resumption_handler_;
+};
+
+TEST_F(RCPendingResumptionHandlerTest, HandleResumptionNoSubscriptionNoAction) {
+ auto mock_app = CreateApp(kAppId_1);
+ auto rc_app_ext = CreateExtension(*mock_app);
+
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext,
+ *mock_app);
+}
+
+TEST_F(RCPendingResumptionHandlerTest,
+ HandleResumptionOneSubscriptionOnAction) {
+ auto mock_app = CreateApp(kAppId_1);
+ auto rc_app_ext = CreateExtension(*mock_app);
+
+ ModuleUid module_uid{kModuleType_1, kModuleId_1};
+ rc_app_ext->AddPendingSubscription(module_uid);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_1));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_1), kSourceHMI));
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext,
+ *mock_app);
+}
+
+TEST_F(RCPendingResumptionHandlerTest,
+ HandleResumptionMultipleSubscriptionsMultipleActions) {
+ auto mock_app = CreateApp(kAppId_1);
+ auto rc_app_ext = CreateExtension(*mock_app);
+
+ ModuleUid module_uid_1 = {kModuleType_1, kModuleId_1};
+ rc_app_ext->AddPendingSubscription(module_uid_1);
+
+ ModuleUid module_uid_2 = {kModuleType_2, kModuleId_2};
+ rc_app_ext->AddPendingSubscription(module_uid_2);
+
+ {
+ InSequence in_sequence;
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_1));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_1), kSourceHMI));
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_2));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_2), kSourceHMI));
+ }
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext,
+ *mock_app);
+}
+
+TEST_F(RCPendingResumptionHandlerTest,
+ HandleResumptionWithPendingSubscription) {
+ auto mock_app = CreateApp(kAppId_1);
+ auto rc_app_ext = CreateExtension(*mock_app);
+
+ ModuleUid module_uid = {kModuleType_1, kModuleId_1};
+ rc_app_ext->AddPendingSubscription(module_uid);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_1));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_1), kSourceHMI));
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext,
+ *mock_app);
+
+ auto rc_app_ext_2 = CreateExtension(*mock_app);
+ rc_app_ext_2->AddPendingSubscription(module_uid);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID());
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext_2,
+ *mock_app);
+}
+
+TEST_F(RCPendingResumptionHandlerTest,
+ HandleResumptionWithPendingSubscriptionAndNotPendingOne) {
+ auto mock_app = CreateApp(kAppId_1);
+ auto rc_app_ext = CreateExtension(*mock_app);
+
+ ModuleUid module_uid_1 = {kModuleType_1, kModuleId_1};
+ rc_app_ext->AddPendingSubscription(module_uid_1);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_1));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_1), kSourceHMI));
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext,
+ *mock_app);
+
+ auto rc_app_ext_2 = CreateExtension(*mock_app);
+ ModuleUid module_uid_2 = {kModuleType_2, kModuleId_2};
+ rc_app_ext_2->AddPendingSubscription(module_uid_1);
+ rc_app_ext_2->AddPendingSubscription(module_uid_2);
+
+ {
+ InSequence in_sequence;
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_1));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_2));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_2), kSourceHMI));
+ }
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext_2,
+ *mock_app);
+}
+
+TEST_F(RCPendingResumptionHandlerTest,
+ Resumption2ApplicationsWithCommonDataSuccess) {
+ auto mock_app_1 = CreateApp(kAppId_1);
+ auto rc_app_ext = CreateExtension(*mock_app_1);
+
+ ModuleUid module_uid = {kModuleType_1, kModuleId_1};
+ rc_app_ext->AddPendingSubscription(module_uid);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_1));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_1), kSourceHMI));
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext,
+ *mock_app_1);
+
+ auto mock_app_2 = CreateApp(kAppId_2);
+ auto rc_app_ext_2 = CreateExtension(*mock_app_2);
+
+ rc_app_ext_2->AddPendingSubscription(module_uid);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_2));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_2, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext_2,
+ *mock_app_2);
+
+ auto response =
+ CreateHMIResponseMessage(application_manager::MessageType::kResponse,
+ hmi_apis::Common_Result::SUCCESS,
+ kAppId_1);
+
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+ event.set_smart_object(*response);
+
+ EXPECT_CALL(event_dispatcher_mock_, raise_event(EventCheck(kAppId_2)));
+
+ resumption_handler_->on_event(event);
+}
+
+TEST_F(RCPendingResumptionHandlerTest,
+ Resumption2ApplicationsWithCommonDataFailedRetry) {
+ auto mock_app_1 = CreateApp(kAppId_1);
+ auto rc_app_ext = CreateExtension(*mock_app_1);
+
+ ModuleUid module_uid = {kModuleType_1, kModuleId_1};
+ rc_app_ext->AddPendingSubscription(module_uid);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_1));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_1, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext,
+ *mock_app_1);
+
+ auto mock_app_2 = CreateApp(kAppId_2);
+ auto rc_app_ext_2 = CreateExtension(*mock_app_2);
+
+ rc_app_ext_2->AddPendingSubscription(module_uid);
+
+ EXPECT_CALL(app_manager_mock_, GetNextHMICorrelationID())
+ .WillOnce(Return(kAppId_2));
+ EXPECT_CALL(resumption_data_processor_mock_,
+ SubscribeToResponse(kAppId_2, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ resumption_handler_->HandleResumptionSubscriptionRequest(*rc_app_ext_2,
+ *mock_app_2);
+
+ auto response =
+ CreateHMIResponseMessage(application_manager::MessageType::kErrorResponse,
+ hmi_apis::Common_Result::SUCCESS,
+ kAppId_1);
+
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+ event.set_smart_object(*response);
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(MessageCheck(kAppId_2), kSourceHMI));
+
+ resumption_handler_->on_event(event);
+}
+
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
index 4b10d34643..a22543ba09 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
@@ -45,6 +45,7 @@ ${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_dat
${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc
${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
index 70ed832cb1..501fbc323d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
@@ -113,7 +113,8 @@ class RAManagerTest : public ::testing::Test {
ON_CALL(mock_app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
auto plugin_id = rc_rpc_plugin::RCRPCPlugin::kRCPluginID;
- app_ext_ptr_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(plugin_id);
+ app_ext_ptr_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(
+ plugin_id, rc_plugin_, *mock_app_1_);
ON_CALL(*mock_app_1_, app_id()).WillByDefault(Return(kAppId1));
PrepareResources();
@@ -144,7 +145,9 @@ class RAManagerTest : public ::testing::Test {
void SetUp() OVERRIDE {
rc_app_extension_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(
static_cast<application_manager::AppExtensionUID>(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
+ rc_plugin_,
+ *mock_app_1_);
ON_CALL(mock_rc_capabilities_manager_,
GetDriverLocationFromSeatLocationCapability())
.WillByDefault(Return(kDriverLocation));
@@ -178,6 +181,7 @@ class RAManagerTest : public ::testing::Test {
mock_rc_capabilities_manager_;
std::vector<ModuleUid> resources_;
Grid module_service_area_;
+ RCRPCPlugin rc_plugin_;
RCAppExtensionPtr rc_app_extension_;
MockRCHelpers* mock_rc_helpers_;
};
@@ -403,9 +407,11 @@ TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) {
mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
- RCAppExtensionPtr rc_extention_ptr =
- std::make_shared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+ RCAppExtensionPtr rc_extension_ptr = std::make_shared<RCAppExtension>(
+ application_manager::AppExtensionUID(
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
+ rc_plugin_,
+ *mock_app_1_);
EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
@@ -477,12 +483,14 @@ TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) {
EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da));
- RCAppExtensionPtr rc_extention_ptr =
- std::make_shared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+ RCAppExtensionPtr rc_extension_ptr = std::make_shared<RCAppExtension>(
+ application_manager::AppExtensionUID(
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
+ rc_plugin_,
+ *mock_app_1_);
EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
- .WillRepeatedly(Return(rc_extention_ptr));
+ .WillRepeatedly(Return(rc_extension_ptr));
// Act
ra_manager.OnPolicyEvent(
@@ -508,13 +516,15 @@ TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) {
EXPECT_CALL(mock_app_mngr_, application(kAppId1))
.WillRepeatedly(Return(mock_app_1_));
- RCAppExtensionPtr rc_extention_ptr =
+ RCAppExtensionPtr rc_extension_ptr =
std::make_shared<rc_rpc_plugin::RCAppExtension>(
application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
+ rc_plugin_,
+ *mock_app_1_);
EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
- .WillRepeatedly(Return(rc_extention_ptr));
+ .WillRepeatedly(Return(rc_extension_ptr));
ON_CALL(*mock_app_1_, is_remote_control_supported())
.WillByDefault(Return(true));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
index fe8857b6b1..a03b34d742 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
@@ -54,7 +54,6 @@ set(LIBRARIES
ApplicationManager
HMI_API
MOBILE_API
- MessageHelper
connectionHandler
v4_protocol_v1_2_no_extra
SmartObjects
@@ -72,6 +71,7 @@ target_link_libraries("sdl_rpc_plugin_static" ${LIBRARIES})
add_library("sdl_rpc_plugin" SHARED "src/sdl_rpc_plugin.cc")
target_link_libraries("sdl_rpc_plugin" sdl_rpc_plugin_static)
+target_link_libraries("sdl_rpc_plugin" MessageHelper)
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
index 3def06ba9a..898a2a8f67 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
@@ -65,6 +65,8 @@ class NaviSubscribeWayPointsRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run() OVERRIDE;
+ void onTimeOut() OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h
new file mode 100644
index 0000000000..6f97469916
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_UPDATE_FILE_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_UPDATE_FILE_NOTIFICATION_H_
+
+#include "application_manager/commands/notification_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnUIUpdateFileNotification command class
+ **/
+class OnUIUpdateFileNotification
+ : public app_mngr::commands::NotificationFromHMI {
+ public:
+ /**
+ * @brief OnUIUpdateFileNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnUIUpdateFileNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnUIUpdateFileNotification class destructor
+ **/
+ virtual ~OnUIUpdateFileNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnUIUpdateFileNotification);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_UPDATE_FILE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_sub_menu_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_sub_menu_notification.h
new file mode 100644
index 0000000000..4aae254be5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_update_sub_menu_notification.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_UPDATE_SUB_MENU_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_UPDATE_SUB_MENU_NOTIFICATION_H_
+
+#include "application_manager/commands/notification_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnUiUpdateSubMenuNotification command class
+ **/
+class OnUIUpdateSubMenuNotification
+ : public app_mngr::commands::NotificationFromHMI {
+ public:
+ /**
+ * @brief OnUIUpdateSubMenuNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnUIUpdateSubMenuNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnUIUpdateSubMenuNotification class destructor
+ **/
+ virtual ~OnUIUpdateSubMenuNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnUIUpdateSubMenuNotification);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_UPDATE_SUB_MENU_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
index 009ee8f0be..2ac47ab013 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
@@ -67,6 +67,8 @@ class TTSSetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
+ void onTimeOut() OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(TTSSetGlobalPropertiesRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
index 2d1e84fbec..20e9004503 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
@@ -66,6 +66,8 @@ class UIAddCommandRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
+ void onTimeOut() OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(UIAddCommandRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
index 0cd120b3cd..660c81c4f8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
@@ -66,6 +66,8 @@ class UIAddSubmenuRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
+ void onTimeOut() OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(UIAddSubmenuRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
index 6fe8e182c4..baa181fb53 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
@@ -55,6 +55,8 @@ class UICreateWindowRequest : public app_mngr::commands::RequestToHMI {
void Run() FINAL;
+ void onTimeOut() FINAL;
+
private:
DISALLOW_COPY_AND_ASSIGN(UICreateWindowRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
index 9bcde383e0..5c7f6d4cc8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
@@ -77,7 +77,7 @@ class UIIsReadyRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief onTimeOut from requrst Controller
*/
- virtual void onTimeOut() OVERRIDE;
+ void onTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UIIsReadyRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
index 8df60a318a..145f1d7c07 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
@@ -67,6 +67,8 @@ class UISetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
+ void onTimeOut() OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(UISetGlobalPropertiesRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
index b40245256e..ba4c49ab01 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
@@ -66,6 +66,8 @@ class VRAddCommandRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
+ void onTimeOut() OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(VRAddCommandRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h
index 28508d386c..3f61631948 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h
@@ -71,6 +71,12 @@ class OnAppInterfaceUnregisteredNotification
virtual void Run();
private:
+ /**
+ * @brief Check whether a connection to mobile must be closed after sending
+ * this message
+ **/
+ bool IsFinalMessage() const;
+
DISALLOW_COPY_AND_ASSIGN(OnAppInterfaceUnregisteredNotification);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_file_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_file_notification.h
new file mode 100644
index 0000000000..8fc4d79b05
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_file_notification.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_UPDATE_FILE_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_UPDATE_FILE_NOTIFICATION_H_
+
+#include "application_manager/commands/command_notification_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnUpdateFileNotification command class
+ **/
+class OnUpdateFileNotification
+ : public app_mngr::commands::CommandNotificationImpl {
+ public:
+ /**
+ * @brief OnUpdateFileNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnUpdateFileNotification(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnUpdateFileNotification class destructor
+ **/
+ virtual ~OnUpdateFileNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnUpdateFileNotification);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_UPDATE_FILE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h
new file mode 100644
index 0000000000..ae6e5632fc
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_UPDATE_SUB_MENU_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_UPDATE_SUB_MENU_NOTIFICATION_H_
+
+#include "application_manager/commands/command_notification_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnUpdateSubMenuNotification command class
+ **/
+class OnUpdateSubMenuNotification
+ : public app_mngr::commands::CommandNotificationImpl {
+ public:
+ /**
+ * @brief OnUpdateSubMenuNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnUpdateSubMenuNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnUpdateSubMenuNotification class destructor
+ **/
+ virtual ~OnUpdateSubMenuNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnUpdateSubMenuNotification);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_UPDATE_SUB_MENU_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
index d59964bbc7..fae8f5eeb7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
@@ -71,17 +71,19 @@ class RegisterAppInterfaceRequest
/**
* @brief RegisterAppInterfaceRequest class destructor
**/
- virtual ~RegisterAppInterfaceRequest();
+ ~RegisterAppInterfaceRequest();
/**
* @brief Init required by command resources
**/
- virtual bool Init();
+ bool Init() FINAL;
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() FINAL;
+
+ uint32_t default_timeout() const FINAL;
private:
/**
@@ -98,11 +100,13 @@ class RegisterAppInterfaceRequest
* @brief Prepares and sends RegisterAppInterface response to mobile
* considering application type
* @param app_type Type of application
+ * @param status_notifier pointer to status notifier callback function
+ * @param add_info - additional information to be sent to mobile app
**/
- void SendRegisterAppInterfaceResponseToMobile(ApplicationType app_type);
-
- smart_objects::SmartObjectSPtr GetLockScreenIconUrlNotification(
- const uint32_t connection_key, app_mngr::ApplicationSharedPtr app);
+ void SendRegisterAppInterfaceResponseToMobile(
+ ApplicationType app_type,
+ policy::StatusNotifier status_notifier,
+ const std::string& add_info);
/**
* @brief SendChangeRegistration send ChangeRegistration on HMI
@@ -127,13 +131,9 @@ class RegisterAppInterfaceRequest
* @param app application with changed HMI status
* @param resumption If true, resumption-related parameters will be sent to
* the HMI
- * @param need_restore_vr If resumption is true, whether or not VR commands
- *should be resumed
**/
void SendOnAppRegisteredNotificationToHMI(
- app_mngr::ApplicationConstSharedPtr app,
- bool resumption = false,
- bool need_restore_vr = false);
+ app_mngr::ApplicationConstSharedPtr app, bool resumption);
/**
* @brief Check new ID along with known mobile application ID
@@ -236,9 +236,86 @@ class RegisterAppInterfaceRequest
connection_handler::DeviceHandle* device_id = nullptr,
std::string* mac_address = nullptr) const;
- private:
+ /**
+ * @brief Processes AppHMITypes in the received message from mobile and in the
+ * policy table
+ * @param message A message from mobile that could contain AppHMIType
+ * collection
+ * @param app_hmi_types_in_policy AppHMITypes that describes in the policy
+ * table for the app that sent the message
+ * @return Result of processing
+ */
+ mobile_apis::Result::eType ProcessingAppHMITypesPolicies(
+ smart_objects::SmartObject& message,
+ policy::StringArray& app_hmi_types_in_policy);
+
+ /**
+ * @brief Processes AppHMITypes in the received message
+ * @param message A message received from the mobile
+ * @param info Info in a string representation that should be added to the
+ * response info
+ * @param log A log in a string represenation that could contain the
+ * AppHMITypes that are absent in the policy table.
+ */
+ mobile_apis::Result::eType ProcessingAppHMITypesInMessage(
+ const smart_objects::SmartObject& message);
+
+ /**
+ * @brief WaitForHMIIsReady blocking function. Waits for HMI be ready for
+ * requests processing
+ */
+ void WaitForHMIIsReady();
+
+ /**
+ * @brief FillApplicationParams set app application attributes from the RAI
+ * request
+ * @param application applicaiton to fill params
+ */
+ void FillApplicationParams(
+ application_manager::ApplicationSharedPtr application);
+
+ /**
+ * @brief SetupAppDeviceInfo add applicaiton device information to policies
+ * @param application applicaiton to process
+ */
+ void SetupAppDeviceInfo(
+ application_manager::ApplicationSharedPtr application);
+
+ /**
+ * @brief ApplicationDataShouldBeResumed check if application data should be
+ * resumed
+ * @return true if app data should be resumed, otherwise returns false
+ */
+ bool ApplicationDataShouldBeResumed(std::string& add_info);
+
+ /**
+ * @brief CalculateFinalResultCode calculates the final result code
+ * considering all previous conditions
+ * @return calculated result code
+ */
+ mobile_apis::Result::eType CalculateFinalResultCode() const;
+
+ /**
+ * @brief AddApplicationDataToPolicy adds specified application to policy
+ * database and returns a callback with extra actions to be done if required
+ * @param application pointer to application to add
+ * @return callback with extra actions after adding specified application
+ */
+ policy::StatusNotifier AddApplicationDataToPolicy(
+ application_manager::ApplicationSharedPtr application);
+
+ /**
+ * @brief CheckLanguage check if language in RAI matches hmi_capabilities
+ * Setup result_code variable in case of does not match
+ */
+ void CheckLanguage();
+
std::string response_info_;
- mobile_apis::Result::eType result_code_;
+ bool are_tts_chunks_invalid_;
+ bool are_hmi_types_invalid_;
+ bool is_resumption_failed_;
+ bool is_wrong_language_;
+
connection_handler::DeviceHandle device_handle_;
std::string device_id_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
index 880fced6ba..7475520889 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
@@ -85,40 +85,6 @@ class ResetGlobalPropertiesRequest
private:
/*
- * @brief Sets default value of the HELPPROMT global property
- * to the first vrCommand of each Command Menu registered in application
- *
- * @param app Registered application
- * @param is_timeout_promp Flag indicating that timeout prompt
- * should be reset
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool ResetHelpPromt(app_mngr::ApplicationSharedPtr app);
-
- /*
- * @brief Sets default value of the TIMEOUTPROMT global property
- * to the first vrCommand of each Command Menu registered in application
- *
- * @param app Registered application
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool ResetTimeoutPromt(application_manager::ApplicationSharedPtr const app);
-
- /*
- * @brief Sets default value of the VRHELPTITLE global property
- * to the application name and value of the VRHELPITEMS global property
- * to value equal to registered command -1(default command “Help / Cancel”.)
- *
- * @param app Registered application
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool ResetVrHelpTitleItems(
- application_manager::ApplicationSharedPtr const app);
-
- /*
* @brief Prepare result for sending to mobile application
* @param out_result_code contains result code for sending to mobile
* application
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
index 3a32d1b671..190cb07459 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
@@ -82,6 +82,8 @@ class SetGlobalPropertiesRequest
*/
bool Init() FINAL;
+ void onTimeOut() OVERRIDE;
+
/**
* @brief Prepares total result for mobile according to three results:
* ui_properties_result, tts_properties_result, rc_properties_result.
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h
index 935716aa30..09fbc565c5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h
@@ -62,11 +62,12 @@ class SystemCapabilityAppExtension : public app_mngr_::AppExtension {
SystemCapabilitySubscriptions Subscriptions();
- void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
- resumption_data) OVERRIDE;
+ void SaveResumptionData(smart_objects::SmartObject& resumption_data) OVERRIDE;
- void ProcessResumption(
- const smart_objects::SmartObject& resumption_data) OVERRIDE;
+ void ProcessResumption(const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ void RevertResumption(
+ const smart_objects::SmartObject& subscriptions) OVERRIDE;
static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
index 9c770279ab..b4ef7e6aed 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
@@ -34,16 +34,20 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H
#include "application_manager/command_factory.h"
#include "application_manager/plugin_manager/rpc_plugin.h"
+#include "application_manager/resumption/pending_resumption_handler.h"
+#include "utils/ilogger.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
class SystemCapabilityAppExtension;
+class WayPointsAppExtension;
class SDLRPCPlugin : public plugins::RPCPlugin {
// RPCPlugin interface
public:
+ SDLRPCPlugin();
bool Init(app_mngr::ApplicationManager& app_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
@@ -57,6 +61,28 @@ class SDLRPCPlugin : public plugins::RPCPlugin {
policy::PolicyHandlerInterface& policy_handler,
resumption::LastState& last_state) OVERRIDE;
+ /**
+ * @brief ProcessResumptionSubscription send appropriate subscribe requests
+ * to HMI
+ * @param app application for subscription
+ * @param ext application extension
+ */
+ void ProcessResumptionSubscription(application_manager::Application& app,
+ WayPointsAppExtension& ext);
+
+ /**
+ * @brief Revert the data to the state before Resumption.
+ * @param app Application owning resumption data
+ **/
+ void RevertResumption(application_manager::Application& app);
+
+ /**
+ * @brief SaveResumptionData saves subscription data
+ * @param resumption_data plase to store resumption data
+ */
+ void SaveResumptionData(application_manager::Application& app,
+ smart_objects::SmartObject& resumption_data);
+
bool IsAbleToProcess(
const int32_t function_id,
const app_mngr::commands::Command::CommandSource message_source) OVERRIDE;
@@ -71,9 +97,14 @@ class SDLRPCPlugin : public plugins::RPCPlugin {
void ClearSubscriptions(app_mngr::ApplicationSharedPtr app);
std::unique_ptr<application_manager::CommandFactory> command_factory_;
+ application_manager::ApplicationManager* application_manager_;
+ using PendingResumptionHandlerSPtr =
+ std::shared_ptr<resumption::PendingResumptionHandler>;
+ PendingResumptionHandlerSPtr pending_resumption_handler_;
};
} // namespace sdl_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create();
+extern "C" application_manager::plugin_manager::RPCPlugin* Create(
+ logger::Logger* logger_instances);
extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h
new file mode 100644
index 0000000000..9243baedee
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h
@@ -0,0 +1,69 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_WAYPOINTS_APP_EXTENSION_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_WAYPOINTS_APP_EXTENSION_H
+
+#include <application_manager/application_manager.h>
+
+namespace sdl_rpc_plugin {
+class SDLRPCPlugin;
+
+namespace app_mngr = application_manager;
+
+/**
+ * @brief Intended to handle subscriptions on way points
+ */
+class WayPointsAppExtension : public app_mngr::AppExtension {
+ public:
+ /**
+ * @brief WayPointsAppExtension constructor
+ * @param plugin sdl info plugin
+ * @param app application that contains this plugin
+ */
+ WayPointsAppExtension(SDLRPCPlugin& plugin, app_mngr::Application& app);
+ virtual ~WayPointsAppExtension();
+
+ void SaveResumptionData(smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ void ProcessResumption(const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ void RevertResumption(
+ const smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ /**
+ * @brief WayPointsAppExtensionUID unique identifier of waypoints
+ * aplication extension
+ */
+ static unsigned WayPointsAppExtensionUID;
+
+ private:
+ SDLRPCPlugin& plugin_;
+ app_mngr::Application& app_;
+};
+} // namespace sdl_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_WAYPOINTS_APP_EXTENSION_H
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h
new file mode 100644
index 0000000000..5dad6d07ac
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h
@@ -0,0 +1,93 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_PENDING_RESUMPTION_HANDLER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_PENDING_RESUMPTION_HANDLER_H_
+
+#include <map>
+#include <queue>
+#include <vector>
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/resumption/pending_resumption_handler.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+#include "sdl_rpc_plugin/waypoints_app_extension.h"
+
+namespace sdl_rpc_plugin {
+
+namespace app_mngr = application_manager;
+
+class WayPointsPendingResumptionHandler
+ : public resumption::PendingResumptionHandler {
+ public:
+ WayPointsPendingResumptionHandler(
+ app_mngr::ApplicationManager& application_manager);
+
+ // EventObserver interface
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ void HandleResumptionSubscriptionRequest(
+ app_mngr::AppExtension& extension,
+ application_manager::Application& app) OVERRIDE;
+
+ void OnResumptionRevert() OVERRIDE;
+
+ private:
+ /**
+ * @brief RaiseFakeSuccessfulResponse raise event for the subscriber that
+ * contains emulated successful response from HMI To avoid double subscription
+ * WayPointsPendingResumptionHandler freezes sending requests to HMI. But
+ * resumption_data_processor().SubscribeOnResponse() need to be called to
+ * provide information that some data need to be resumed. So if pending
+ * request exists, SDL creates preliminary requests to HMI, subscribe the
+ * subscriber to this request but do not send it to HMI. It freezes this
+ * requests to precess the one by one when a response to the current request
+ * will be received When SDL receives a response from HMI it may satisfy some
+ * frozen requests. If it does SDL will create faked HMI response(based on the
+ * real one with corr_id replacement) and raise event. So that
+ * subscriber::on_event will be called with an appropriate response to the
+ * request that SDL was not sent to HMI.
+ * @param response message that will be raised with corr_id replacement
+ * @param corr_id correlation id that will be replaced in response to notify
+ * the subscriber
+ */
+ void RaiseFakeSuccessfulResponse(smart_objects::SmartObject response,
+ const int32_t corr_id);
+ smart_objects::SmartObjectSPtr CreateSubscriptionRequest();
+
+ struct ResumptionAwaitingHandling {
+ const uint32_t app_id;
+ WayPointsAppExtension& ext;
+ resumption::ResumptionRequest request_to_send_;
+ };
+
+ std::vector<ResumptionAwaitingHandling> frozen_resumptions_;
+ std::map<uint32_t, smart_objects::SmartObject> pending_requests_;
+ std::queue<uint32_t> app_ids_;
+};
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_PENDING_RESUMPTION_HANDLER_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc
index c6d181bf57..35fb2204ac 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ActivateAppRequest::ActivateAppRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +54,11 @@ ActivateAppRequest::ActivateAppRequest(
policy_handle) {}
ActivateAppRequest::~ActivateAppRequest() {
- LOG4CXX_TRACE(logger_, "~ActivateAppRequest");
+ SDL_LOG_TRACE("~ActivateAppRequest");
}
void ActivateAppRequest::Run() {
- LOG4CXX_TRACE(logger_, "enter " << correlation_id());
+ SDL_LOG_TRACE("enter " << correlation_id());
uint32_t app_id = RequestToHMI::application_id();
application_manager_.set_application_id(correlation_id(), app_id);
#ifdef ENABLE_LOG
@@ -66,11 +68,11 @@ void ActivateAppRequest::Run() {
static_cast<mobile_apis::HMILevel::eType>(
(*message_)[strings::msg_params][strings::activate_app_hmi_level]
.asInt());
- LOG4CXX_TRACE(logger_, "requested_hmi_level = " << requested_hmi_level);
+ SDL_LOG_TRACE("requested_hmi_level = " << requested_hmi_level);
}
#endif
SendRequest();
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc
index b829ef711e..9615f83170 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ActivateAppResponse::ActivateAppResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,12 +55,12 @@ ActivateAppResponse::ActivateAppResponse(
ActivateAppResponse::~ActivateAppResponse() {}
void ActivateAppResponse::Run() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_ActivateApp);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc
index 93999f704d..8ddad0945c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AddStatisticsInfoNotification::AddStatisticsInfoNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ AddStatisticsInfoNotification::AddStatisticsInfoNotification(
AddStatisticsInfoNotification::~AddStatisticsInfoNotification() {}
void AddStatisticsInfoNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
int type = (*message_)[strings::msg_params][hmi_notification::statistic_type]
.asInt();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc
index 68c7896a7f..fdb2f454d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AllowAllAppsRequest::AllowAllAppsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ AllowAllAppsRequest::AllowAllAppsRequest(
AllowAllAppsRequest::~AllowAllAppsRequest() {}
void AllowAllAppsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc
index c2182f4853..be049aaea2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AllowAllAppsResponse::AllowAllAppsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ AllowAllAppsResponse::AllowAllAppsResponse(
AllowAllAppsResponse::~AllowAllAppsResponse() {}
void AllowAllAppsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.SetAllAppsAllowed(
(*message_)[strings::msg_params][hmi_response::allowed].asBool());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc
index 6b5af76fb1..32fb35b344 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AllowAppRequest::AllowAppRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ AllowAppRequest::AllowAppRequest(
AllowAppRequest::~AllowAppRequest() {}
void AllowAppRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc
index c62645c6c0..458b7097e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AllowAppResponse::AllowAppResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ AllowAppResponse::AllowAppResponse(
AllowAppResponse::~AllowAppResponse() {}
void AllowAppResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t connection_key =
(*message_)[strings::params][strings::connection_key].asInt();
@@ -61,7 +63,7 @@ void AllowAppResponse::Run() {
ApplicationSharedPtr app = application_manager_.application(connection_key);
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
app->set_app_allowed(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
index b021faefd8..f87f103b0f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
@@ -36,6 +36,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BasicCommunicationCloseApplicationRequest::
BasicCommunicationCloseApplicationRequest(
const application_manager::commands::MessageSharedPtr& message,
@@ -53,7 +55,7 @@ BasicCommunicationCloseApplicationRequest::
~BasicCommunicationCloseApplicationRequest() {}
void BasicCommunicationCloseApplicationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
index 2e56271cf2..74df410213 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
@@ -36,6 +36,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BasicCommunicationCloseApplicationResponse::
BasicCommunicationCloseApplicationResponse(
const application_manager::commands::MessageSharedPtr& message,
@@ -53,7 +55,7 @@ BasicCommunicationCloseApplicationResponse::
~BasicCommunicationCloseApplicationResponse() {}
void BasicCommunicationCloseApplicationResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_CloseApplication);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
index 19c9fa91d8..a6e95f9f72 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -50,7 +52,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest(
policy_handler) {}
void BasicCommunicationGetSystemTimeRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc
index e26753b3f2..1376376bb8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc
@@ -33,7 +33,7 @@
#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h"
#include "utils/logger.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "Commands")
+SDL_CREATE_LOG_VARIABLE("Commands")
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -53,7 +53,7 @@ BasicCommunicationGetSystemTimeResponse::
policy_handler) {}
void BasicCommunicationGetSystemTimeResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_GetSystemTime);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc
index 361dc5fea6..52f8c4329f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAwakeSDLNotification::OnAwakeSDLNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ OnAwakeSDLNotification::OnAwakeSDLNotification(
OnAwakeSDLNotification::~OnAwakeSDLNotification() {}
void OnAwakeSDLNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!application_manager_.resume_controller().is_suspended()) {
return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc
index 052a40a888..62c4a0ff3d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BasicCommunicationSystemRequest::BasicCommunicationSystemRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ BasicCommunicationSystemRequest::BasicCommunicationSystemRequest(
BasicCommunicationSystemRequest::~BasicCommunicationSystemRequest() {}
void BasicCommunicationSystemRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc
index 0b052de88d..06b31cb73d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BasicCommunicationSystemResponse::BasicCommunicationSystemResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ BasicCommunicationSystemResponse::BasicCommunicationSystemResponse(
BasicCommunicationSystemResponse::~BasicCommunicationSystemResponse() {}
void BasicCommunicationSystemResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_SystemRequest);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc
index 0dafa21e33..fddcc50a16 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc
@@ -39,6 +39,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BCGetAppPropertiesRequest::BCGetAppPropertiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,15 +56,14 @@ BCGetAppPropertiesRequest::BCGetAppPropertiesRequest(
void BCGetAppPropertiesRequest::FillAppProperties(
const std::string& policy_app_id,
smart_objects::SmartObject& out_properties) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy::AppProperties app_properties;
const bool result =
policy_handler_.GetAppProperties(policy_app_id, app_properties);
if (!result) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Failed to get app parameters for policy_app_id: " << policy_app_id);
return;
}
@@ -98,7 +99,7 @@ void BCGetAppPropertiesRequest::FillAppProperties(
}
void BCGetAppPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& msg_params = (*message_)[strings::msg_params];
smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
@@ -111,9 +112,9 @@ void BCGetAppPropertiesRequest::Run() {
response_params[strings::properties][0] = properties;
}
} else {
- LOG4CXX_DEBUG(logger_,
- "policyAppID was absent in request, all apps properties "
- "will be returned.");
+ SDL_LOG_DEBUG(
+ "policyAppID was absent in request, all apps properties "
+ "will be returned.");
const auto app_ids = policy_handler_.GetApplicationPolicyIDs();
int i = 0;
for (auto& app_id : app_ids) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc
index 57949a949b..006cc536bf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc
@@ -40,6 +40,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BCGetAppPropertiesResponse::BCGetAppPropertiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ BCGetAppPropertiesResponse::BCGetAppPropertiesResponse(
policy_handler) {}
void BCGetAppPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
index b735cd9bdf..a8a47d1fef 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
@@ -39,6 +39,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BCGetFilePathRequest::BCGetFilePathRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ BCGetFilePathRequest::BCGetFilePathRequest(
BCGetFilePathRequest::~BCGetFilePathRequest() {}
void BCGetFilePathRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
index 58cda68a2b..f9d3fbe953 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
@@ -40,6 +40,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BCGetFilePathResponse::BCGetFilePathResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ BCGetFilePathResponse::BCGetFilePathResponse(
BCGetFilePathResponse::~BCGetFilePathResponse() {}
void BCGetFilePathResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager::event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_GetFilePath);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc
index a4c5d6b1b4..dd5ea3bb85 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc
@@ -40,6 +40,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BCSetAppPropertiesRequest::BCSetAppPropertiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ BCSetAppPropertiesRequest::BCSetAppPropertiesRequest(
policy_handler) {}
void BCSetAppPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& properties =
(*message_)[strings::msg_params][strings::properties];
@@ -81,9 +83,8 @@ void BCSetAppPropertiesRequest::Run() {
application_manager_.GetRPCService().ManageHMICommand(notification);
}
if (is_new_app) {
- LOG4CXX_ERROR(logger_,
- "Message contains unknow policyAppId: "
- << policy_app_id << ", PTU will be triggered");
+ SDL_LOG_ERROR("Message contains unknow policyAppId: "
+ << policy_app_id << ", PTU will be triggered");
policy_handler_.OnLocalAppAdded();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc
index 928a17d0f8..a99e3d6a3e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc
@@ -41,6 +41,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
BCSetAppPropertiesResponse::BCSetAppPropertiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ BCSetAppPropertiesResponse::BCSetAppPropertiesResponse(
policy_handler) {}
void BCSetAppPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToHMI(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
index c0d22dcb89..d9c7901c67 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ButtonGetCapabilitiesRequest::ButtonGetCapabilitiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,13 +55,13 @@ ButtonGetCapabilitiesRequest::ButtonGetCapabilitiesRequest(
ButtonGetCapabilitiesRequest::~ButtonGetCapabilitiesRequest() {}
void ButtonGetCapabilitiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void ButtonGetCapabilitiesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::Buttons_GetCapabilities);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
index cc3a61a9df..20250af222 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ButtonGetCapabilitiesResponse::ButtonGetCapabilitiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ ButtonGetCapabilitiesResponse::ButtonGetCapabilitiesResponse(
ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() {}
void ButtonGetCapabilitiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -62,7 +64,7 @@ void ButtonGetCapabilitiesResponse::Run() {
hmi_apis::FunctionID::Buttons_GetCapabilities);
if (hmi_apis::Common_Result::SUCCESS != code) {
- LOG4CXX_ERROR(logger_, "Error is returned. Capabilities won't be updated.");
+ SDL_LOG_ERROR("Error is returned. Capabilities won't be updated.");
return;
}
@@ -81,8 +83,7 @@ void ButtonGetCapabilitiesResponse::Run() {
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::buttons, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save Buttons.GetCapabilities response to cache");
+ SDL_LOG_ERROR("Failed to save Buttons.GetCapabilities response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc
index 988794f668..b4b838b8dd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ClosePopupRequest::ClosePopupRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ ClosePopupRequest::ClosePopupRequest(
ClosePopupRequest::~ClosePopupRequest() {}
void ClosePopupRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc
index 072e1960e9..76ed7a749a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ClosePopupResponse::ClosePopupResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ ClosePopupResponse::ClosePopupResponse(
ClosePopupResponse::~ClosePopupResponse() {}
void ClosePopupResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(VS): Process response from HMI
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc
index 71782ef575..0bc9090bbe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DecryptCertificateRequest::DecryptCertificateRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -50,7 +52,7 @@ DecryptCertificateRequest::DecryptCertificateRequest(
policy_handle) {}
void DecryptCertificateRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t correlation_id = RequestToHMI::correlation_id();
const uint32_t app_id = RequestToHMI::application_id();
application_manager_.set_application_id(correlation_id, app_id);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc
index cf2a4d092c..5c3bf9d0e2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DecryptCertificateResponse::DecryptCertificateResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ DecryptCertificateResponse::DecryptCertificateResponse(
DecryptCertificateResponse::~DecryptCertificateResponse() {}
void DecryptCertificateResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
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/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
index 7a505a46f3..1b42abd055 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetSystemInfoRequest::GetSystemInfoRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ GetSystemInfoRequest::GetSystemInfoRequest(
GetSystemInfoRequest::~GetSystemInfoRequest() {}
void GetSystemInfoRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t correlation_id = RequestToHMI::correlation_id();
uint32_t app_id = RequestToHMI::application_id();
application_manager_.set_application_id(correlation_id, app_id);
@@ -60,7 +62,7 @@ void GetSystemInfoRequest::Run() {
}
void GetSystemInfoRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateCachedCapabilities();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
index 5185a448fa..8229e1978c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
@@ -37,6 +37,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetSystemInfoResponse::GetSystemInfoResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,14 +54,14 @@ GetSystemInfoResponse::GetSystemInfoResponse(
GetSystemInfoResponse::~GetSystemInfoResponse() {}
void GetSystemInfoResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
hmi_capabilities_.set_ccpu_version(policy_handler_.GetCCPUVersionFromPT());
if (hmi_apis::Common_Result::SUCCESS != code) {
- LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code);
+ SDL_LOG_WARN("GetSystemError returns an error code " << code);
hmi_capabilities_.UpdateCachedCapabilities();
policy_handler_.SetPreloadedPtFlag(false);
return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc
index b8c61ca902..288d7c0927 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
MixingAudioSupportedRequest::MixingAudioSupportedRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ MixingAudioSupportedRequest::MixingAudioSupportedRequest(
MixingAudioSupportedRequest::~MixingAudioSupportedRequest() {}
void MixingAudioSupportedRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc
index 089e56e598..e9dc69db2b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
MixingAudioSupportedResponse::MixingAudioSupportedResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ MixingAudioSupportedResponse::MixingAudioSupportedResponse(
MixingAudioSupportedResponse::~MixingAudioSupportedResponse() {}
void MixingAudioSupportedResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.set_attenuated_supported(
(*message_)[strings::msg_params][hmi_response::attenuated_supported]
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc
index 8390fea5bc..9010e32125 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviAlertManeuverRequest::NaviAlertManeuverRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviAlertManeuverRequest::NaviAlertManeuverRequest(
NaviAlertManeuverRequest::~NaviAlertManeuverRequest() {}
void NaviAlertManeuverRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc
index a1603f069d..40f4471586 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviAlertManeuverResponse::NaviAlertManeuverResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ NaviAlertManeuverResponse::NaviAlertManeuverResponse(
NaviAlertManeuverResponse::~NaviAlertManeuverResponse() {}
void NaviAlertManeuverResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_AlertManeuver);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
index 47f2f2505e..b9860bcd02 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AudioStartStreamRequest::AudioStartStreamRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,13 +55,12 @@ AudioStartStreamRequest::AudioStartStreamRequest(
policy_handle)
, EventObserver(application_manager.event_dispatcher())
, retry_number_(0) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::pair<uint32_t, int32_t> stream_retry =
application_manager_.get_settings().start_stream_retry_amount();
default_timeout_ = stream_retry.second;
retry_number_ = stream_retry.first;
- LOG4CXX_DEBUG(logger_,
- "default_timeout_ = " << default_timeout_
+ SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_
<< "; retry_number_ = " << retry_number_);
}
@@ -69,17 +70,16 @@ AudioStartStreamRequest::~AudioStartStreamRequest() {
}
void AudioStartStreamRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
- LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ SDL_LOG_INFO("Interface Navi is not supported by system");
return;
}
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Application with hmi_app_id " << application_id()
+ SDL_LOG_ERROR("Application with hmi_app_id " << application_id()
<< " does not exist");
return;
}
@@ -92,33 +92,31 @@ void AudioStartStreamRequest::Run() {
void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "StartAudioStreamRequest aborted. Application not found");
+ SDL_LOG_ERROR("StartAudioStreamRequest aborted. Application not found");
return;
}
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_StartAudioStream: {
- LOG4CXX_DEBUG(logger_, "Received StartStream event");
+ SDL_LOG_DEBUG("Received StartStream event");
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == code) {
- LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS");
+ SDL_LOG_INFO("StartAudioStream response SUCCESS");
if (application_manager_.HMIStateAllowsStreaming(app->app_id(),
ServiceType::kAudio)) {
app->set_audio_streaming_approved(true);
} else {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"StartAudioStreamRequest aborted. Application can not stream");
}
application_manager_.TerminateRequest(
@@ -126,25 +124,25 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
break;
}
if (hmi_apis::Common_Result::REJECTED == code) {
- LOG4CXX_INFO(logger_, "StartAudioStream response REJECTED");
+ SDL_LOG_INFO("StartAudioStream response REJECTED");
RetryStartSession();
break;
}
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
}
void AudioStartStreamRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RetryStartSession();
}
void AudioStartStreamRequest::RetryStartSession() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.TerminateRequest(
connection_key(), correlation_id(), function_id());
@@ -152,20 +150,18 @@ void AudioStartStreamRequest::RetryStartSession() {
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "StartAudioStreamRequest aborted. Application not found");
+ SDL_LOG_ERROR("StartAudioStreamRequest aborted. Application not found");
return;
}
if (!app->audio_streaming_allowed()) {
- LOG4CXX_WARN(logger_, "Audio streaming not allowed");
+ SDL_LOG_WARN("Audio streaming not allowed");
return;
}
if (app->audio_streaming_approved()) {
- LOG4CXX_INFO(logger_,
- "AudioStartStream retry sequence stopped. "
- << "SUCCESS received");
+ SDL_LOG_INFO("AudioStartStream retry sequence stopped. "
+ << "SUCCESS received");
app->set_audio_stream_retry_number(0);
return;
}
@@ -173,15 +169,13 @@ void AudioStartStreamRequest::RetryStartSession() {
uint32_t curr_retry_number = app->audio_stream_retry_number();
if (curr_retry_number <= retry_number_) {
- LOG4CXX_DEBUG(
- logger_,
- "Retry number " << curr_retry_number << " of " << retry_number_);
+ SDL_LOG_DEBUG("Retry number " << curr_retry_number << " of "
+ << retry_number_);
MessageHelper::SendAudioStartStream(app->app_id(), application_manager_);
app->set_audio_stream_retry_number(++curr_retry_number);
} else {
- LOG4CXX_DEBUG(logger_,
- "Audio start stream retry sequence stopped. "
- << "Attempts expired.");
+ SDL_LOG_DEBUG("Audio start stream retry sequence stopped. "
+ << "Attempts expired.");
application_manager_.EndNaviServices(app->app_id());
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc
index 61d49577f6..99ddceaa55 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AudioStartStreamResponse::AudioStartStreamResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ AudioStartStreamResponse::AudioStartStreamResponse(
AudioStartStreamResponse::~AudioStartStreamResponse() {}
void AudioStartStreamResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_StartAudioStream);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc
index a5d436f015..e20d0e1cb6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AudioStopStreamRequest::AudioStopStreamRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,10 +53,10 @@ AudioStopStreamRequest::AudioStopStreamRequest(
AudioStopStreamRequest::~AudioStopStreamRequest() {}
void AudioStopStreamRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
- LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ SDL_LOG_INFO("Interface Navi is not supported by system");
return;
}
SendRequest();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc
index 98023ab571..1b2f2c476c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AudioStopStreamResponse::AudioStopStreamResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ AudioStopStreamResponse::AudioStopStreamResponse(
AudioStopStreamResponse::~AudioStopStreamResponse() {}
void AudioStopStreamResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc
index edc4afe1e4..d0ef35c8fa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviGetWayPointsRequest::NaviGetWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviGetWayPointsRequest::NaviGetWayPointsRequest(
NaviGetWayPointsRequest::~NaviGetWayPointsRequest() {}
void NaviGetWayPointsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc
index 0f0b652d01..97ef0cae2b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviGetWayPointsResponse::NaviGetWayPointsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ NaviGetWayPointsResponse::NaviGetWayPointsResponse(
NaviGetWayPointsResponse::~NaviGetWayPointsResponse() {}
void NaviGetWayPointsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_GetWayPoints);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
index 15e5b46b36..4caa307be3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviIsReadyRequest::NaviIsReadyRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,18 +55,18 @@ NaviIsReadyRequest::NaviIsReadyRequest(
NaviIsReadyRequest::~NaviIsReadyRequest() {}
void NaviIsReadyRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribe_on_event(hmi_apis::FunctionID::Navigation_IsReady,
correlation_id());
SendRequest();
}
void NaviIsReadyRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_IsReady: {
- LOG4CXX_DEBUG(logger_, "Received Navigation_IsReady event");
+ SDL_LOG_DEBUG("Received Navigation_IsReady event");
unsubscribe_from_event(hmi_apis::FunctionID::Navigation_IsReady);
const bool is_available = app_mngr::commands::ChangeInterfaceState(
application_manager_,
@@ -76,7 +78,7 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc
index 073513eda9..2d7f2ec025 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviIsReadyResponse::NaviIsReadyResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ NaviIsReadyResponse::NaviIsReadyResponse(
NaviIsReadyResponse::~NaviIsReadyResponse() {}
void NaviIsReadyResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_IsReady);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc
index 360870e21c..db7e73144d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviSendLocationRequest::NaviSendLocationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviSendLocationRequest::NaviSendLocationRequest(
NaviSendLocationRequest::~NaviSendLocationRequest() {}
void NaviSendLocationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc
index dc60f2fbf0..d4d3ea0c2c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviSendLocationResponse::NaviSendLocationResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviSendLocationResponse::NaviSendLocationResponse(
NaviSendLocationResponse::~NaviSendLocationResponse() {}
void NaviSendLocationResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_SendLocation);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
index 764315f37f..e4fbdaa0d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviSetVideoConfigRequest::NaviSetVideoConfigRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,19 +57,18 @@ NaviSetVideoConfigRequest::NaviSetVideoConfigRequest(
NaviSetVideoConfigRequest::~NaviSetVideoConfigRequest() {}
void NaviSetVideoConfigRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
- LOG4CXX_WARN(logger_, "HMI interface Navigation is not supported");
+ SDL_LOG_WARN("HMI interface Navigation is not supported");
return;
}
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
- "Application with hmi_app_id " << application_id() << "does not exist");
+ SDL_LOG_ERROR("Application with hmi_app_id " << application_id()
+ << " does not exist");
return;
}
@@ -77,13 +78,12 @@ void NaviSetVideoConfigRequest::Run() {
}
void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Application is not found, abort NaviSetVideoConfigRequest");
+ SDL_LOG_ERROR("Application is not found, abort NaviSetVideoConfigRequest");
return;
}
@@ -97,12 +97,11 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) {
std::vector<std::string> rejected_params;
if (code == hmi_apis::Common_Result::SUCCESS) {
- LOG4CXX_DEBUG(logger_, "Received SetVideoConfig success response");
+ SDL_LOG_DEBUG("Received SetVideoConfig success response");
result = true;
} else {
- LOG4CXX_DEBUG(
- logger_,
- "Received SetVideoConfig failure response (" << event.id() << ")");
+ SDL_LOG_DEBUG("Received SetVideoConfig failure response (" << event.id()
+ << ")");
result = false;
if (message[strings::msg_params].keyExists(strings::rejected_params)) {
const smart_objects::SmartArray* list =
@@ -128,18 +127,18 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) {
break;
}
default:
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
void NaviSetVideoConfigRequest::onTimeOut() {
- LOG4CXX_WARN(logger_, "Timed out while waiting for SetVideoConfig response");
+ SDL_LOG_WARN("Timed out while waiting for SetVideoConfig response");
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not found");
+ SDL_LOG_ERROR("Application is not found");
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc
index e4a30c9da5..5291ef8adf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviSetVideoConfigResponse::NaviSetVideoConfigResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviSetVideoConfigResponse::NaviSetVideoConfigResponse(
NaviSetVideoConfigResponse::~NaviSetVideoConfigResponse() {}
void NaviSetVideoConfigResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_SetVideoConfig);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc
index 95dd4561fc..ddfc7cc187 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviShowConstantTBTRequest::NaviShowConstantTBTRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviShowConstantTBTRequest::NaviShowConstantTBTRequest(
NaviShowConstantTBTRequest::~NaviShowConstantTBTRequest() {}
void NaviShowConstantTBTRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc
index f73099d29a..869b76863d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviShowConstantTBTResponse::NaviShowConstantTBTResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ NaviShowConstantTBTResponse::NaviShowConstantTBTResponse(
NaviShowConstantTBTResponse::~NaviShowConstantTBTResponse() {}
void NaviShowConstantTBTResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_ShowConstantTBT);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
index 00974085c3..d0f95ee385 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviStartStreamRequest::NaviStartStreamRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,13 +55,12 @@ NaviStartStreamRequest::NaviStartStreamRequest(
policy_handle)
, EventObserver(application_manager.event_dispatcher())
, retry_number_(0) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::pair<uint32_t, int32_t> stream_retry =
application_manager_.get_settings().start_stream_retry_amount();
default_timeout_ = stream_retry.second;
retry_number_ = stream_retry.first;
- LOG4CXX_DEBUG(logger_,
- "default_timeout_ = " << default_timeout_
+ SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_
<< "; retry_number_ = " << retry_number_);
}
@@ -71,18 +72,17 @@ NaviStartStreamRequest::~NaviStartStreamRequest() {
}
void NaviStartStreamRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
- LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ SDL_LOG_INFO("Interface Navi is not supported by system");
return;
}
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
- "Application with hmi_app_id " << application_id() << "does not exist");
+ SDL_LOG_ERROR("Application with hmi_app_id " << application_id()
+ << " does not exist");
return;
}
SetAllowedToTerminate(false);
@@ -94,33 +94,31 @@ void NaviStartStreamRequest::Run() {
void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "NaviStartStreamRequest aborted. Application not found");
+ SDL_LOG_ERROR("NaviStartStreamRequest aborted. Application not found");
return;
}
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_StartStream: {
- LOG4CXX_DEBUG(logger_, "Received StartStream event");
+ SDL_LOG_DEBUG("Received StartStream event");
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == code) {
- LOG4CXX_INFO(logger_, "NaviStartStreamResponse SUCCESS");
+ SDL_LOG_INFO("NaviStartStreamResponse SUCCESS");
if (application_manager_.HMIStateAllowsStreaming(
app->app_id(), ServiceType::kMobileNav)) {
app->set_video_streaming_approved(true);
} else {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"NaviStartStreamRequest aborted. Application can not stream");
}
application_manager_.TerminateRequest(
@@ -128,25 +126,25 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
break;
}
if (hmi_apis::Common_Result::REJECTED == code) {
- LOG4CXX_INFO(logger_, "StartStream response REJECTED ");
+ SDL_LOG_INFO("StartStream response REJECTED");
RetryStartSession();
break;
}
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
}
void NaviStartStreamRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RetryStartSession();
}
void NaviStartStreamRequest::RetryStartSession() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.TerminateRequest(
connection_key(), correlation_id(), function_id());
@@ -154,20 +152,18 @@ void NaviStartStreamRequest::RetryStartSession() {
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "NaviStartStreamRequest aborted. Application not found");
+ SDL_LOG_ERROR("NaviStartStreamRequest aborted. Application not found");
return;
}
if (!app->video_streaming_allowed()) {
- LOG4CXX_WARN(logger_, "Video streaming not allowed");
+ SDL_LOG_WARN("Video streaming not allowed");
return;
}
if (app->video_streaming_approved()) {
- LOG4CXX_INFO(logger_,
- "NaviStartStream retry sequence stopped. "
- << "SUCCESS received");
+ SDL_LOG_INFO("NaviStartStream retry sequence stopped. "
+ << "SUCCESS received");
app->set_video_stream_retry_number(0);
return;
}
@@ -175,15 +171,13 @@ void NaviStartStreamRequest::RetryStartSession() {
uint32_t curr_retry_number = app->video_stream_retry_number();
if (curr_retry_number <= retry_number_) {
- LOG4CXX_DEBUG(
- logger_,
- "Retry number " << curr_retry_number << " of " << retry_number_);
+ SDL_LOG_DEBUG("Retry number " << curr_retry_number << " of "
+ << retry_number_);
MessageHelper::SendNaviStartStream(app->app_id(), application_manager_);
app->set_video_stream_retry_number(++curr_retry_number);
} else {
- LOG4CXX_DEBUG(logger_,
- "NaviStartStream retry sequence stopped. "
- << "Attempts expired");
+ SDL_LOG_DEBUG("NaviStartStream retry sequence stopped. "
+ << "Attempts expired");
application_manager_.EndNaviServices(app->app_id());
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc
index eafd81148a..a6595f1b8a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviStartStreamResponse::NaviStartStreamResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ NaviStartStreamResponse::NaviStartStreamResponse(
NaviStartStreamResponse::~NaviStartStreamResponse() {}
void NaviStartStreamResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_StartStream);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc
index ad09b0aee1..c86803413b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviStopStreamRequest::NaviStopStreamRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,10 +53,10 @@ NaviStopStreamRequest::NaviStopStreamRequest(
NaviStopStreamRequest::~NaviStopStreamRequest() {}
void NaviStopStreamRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
- LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ SDL_LOG_INFO("Interface Navi is not supported by system");
return;
}
SendRequest();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc
index ff8c0bddff..3c12c527d8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviStopStreamResponse::NaviStopStreamResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ NaviStopStreamResponse::NaviStopStreamResponse(
NaviStopStreamResponse::~NaviStopStreamResponse() {}
void NaviStopStreamResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
index ba29f552b7..7305ae37b1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
@@ -31,12 +31,15 @@
*/
#include "sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviSubscribeWayPointsRequest::NaviSubscribeWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +55,19 @@ NaviSubscribeWayPointsRequest::NaviSubscribeWayPointsRequest(
NaviSubscribeWayPointsRequest::~NaviSubscribeWayPointsRequest() {}
void NaviSubscribeWayPointsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void NaviSubscribeWayPointsRequest::onTimeOut() {
+ auto& resume_ctrl = application_manager_.resume_controller();
+
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc
index ddf8f75e58..37b4e8bbd3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviSubscribeWayPointsResponse::NaviSubscribeWayPointsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ NaviSubscribeWayPointsResponse::NaviSubscribeWayPointsResponse(
NaviSubscribeWayPointsResponse::~NaviSubscribeWayPointsResponse() {}
void NaviSubscribeWayPointsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::Navigation_SubscribeWayPoints);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc
index d3c998cfdf..e3a690a971 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviUnsubscribeWayPointsRequest::NaviUnsubscribeWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviUnsubscribeWayPointsRequest::NaviUnsubscribeWayPointsRequest(
NaviUnsubscribeWayPointsRequest::~NaviUnsubscribeWayPointsRequest() {}
void NaviUnsubscribeWayPointsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc
index beed29e1e2..b84d89e658 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviUnsubscribeWayPointsResponse::NaviUnsubscribeWayPointsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ NaviUnsubscribeWayPointsResponse::NaviUnsubscribeWayPointsResponse(
NaviUnsubscribeWayPointsResponse::~NaviUnsubscribeWayPointsResponse() {}
void NaviUnsubscribeWayPointsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc
index a8a258b1c0..91c764b5b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviUpdateTurnListRequest::NaviUpdateTurnListRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ NaviUpdateTurnListRequest::NaviUpdateTurnListRequest(
NaviUpdateTurnListRequest::~NaviUpdateTurnListRequest() {}
void NaviUpdateTurnListRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc
index a2f737df38..033c7f1383 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NaviUpdateTurnListResponse::NaviUpdateTurnListResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ NaviUpdateTurnListResponse::NaviUpdateTurnListResponse(
NaviUpdateTurnListResponse::~NaviUpdateTurnListResponse() {}
void NaviUpdateTurnListResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc
index 204cc7d347..985056e788 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification(
OnAllowSDLFunctionalityNotification::~OnAllowSDLFunctionalityNotification() {}
void OnAllowSDLFunctionalityNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string device_id;
if ((*message_)[strings::msg_params].keyExists("device")) {
device_id = (*message_)[strings::msg_params]["device"]["id"].asString();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc
index e882020f8b..144c184e82 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppActivatedNotification::OnAppActivatedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnAppActivatedNotification::OnAppActivatedNotification(
OnAppActivatedNotification::~OnAppActivatedNotification() {}
void OnAppActivatedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc
index 18b796eaa8..81b07ed6f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppDeactivatedNotification::OnAppDeactivatedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,7 +59,7 @@ OnAppDeactivatedNotification::OnAppDeactivatedNotification(
OnAppDeactivatedNotification::~OnAppDeactivatedNotification() {}
void OnAppDeactivatedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc
index a1eb412c66..801e74eedd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppPermissionChangedNotification::OnAppPermissionChangedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnAppPermissionChangedNotification::OnAppPermissionChangedNotification(
OnAppPermissionChangedNotification::~OnAppPermissionChangedNotification() {}
void OnAppPermissionChangedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc
index 0033b392d2..37552e003a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc
@@ -112,6 +112,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppPermissionConsentNotification::OnAppPermissionConsentNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -127,7 +129,7 @@ OnAppPermissionConsentNotification::OnAppPermissionConsentNotification(
OnAppPermissionConsentNotification::~OnAppPermissionConsentNotification() {}
void OnAppPermissionConsentNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
uint32_t connection_key = 0;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc
index f1fa703bbb..d31d8436f7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppPropertiesChangeNotification::OnAppPropertiesChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -50,7 +52,7 @@ OnAppPropertiesChangeNotification::OnAppPropertiesChangeNotification(
policy_handle) {}
void OnAppPropertiesChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc
index 51c3125921..382b402383 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppRegisteredNotification::OnAppRegisteredNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnAppRegisteredNotification::OnAppRegisteredNotification(
OnAppRegisteredNotification::~OnAppRegisteredNotification() {}
void OnAppRegisteredNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// SDL must notify system about app registration before any dependent actions
// will be started
SendNotification();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc
index 07aadada81..4ff985cdf0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppUnregisteredNotification::OnAppUnregisteredNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,13 +56,13 @@ OnAppUnregisteredNotification::OnAppUnregisteredNotification(
OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {}
bool OnAppUnregisteredNotification::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Replacement of hmi id is skipped.");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Replacement of hmi id is skipped.");
return true;
}
void OnAppUnregisteredNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// sending event for delete VRCommand on PerformInteraction
event_engine::Event event(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc
index d9c1120409..d72fb1244e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAudioDataStreamingNotification::OnAudioDataStreamingNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnAudioDataStreamingNotification::OnAudioDataStreamingNotification(
OnAudioDataStreamingNotification::~OnAudioDataStreamingNotification() {}
void OnAudioDataStreamingNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
index 1a104c0fa1..9caec22bd2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
@@ -42,6 +42,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnBCSystemCapabilityUpdatedNotification::
OnBCSystemCapabilityUpdatedNotification(
const application_manager::commands::MessageSharedPtr& message,
@@ -59,10 +61,10 @@ OnBCSystemCapabilityUpdatedNotification::
~OnBCSystemCapabilityUpdatedNotification() {}
void OnBCSystemCapabilityUpdatedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Sending BasicCommunication.OnSystemCapabilityUpdated "
- "Notification to HMI");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG(
+ "Sending BasicCommunication.OnSystemCapabilityUpdated "
+ "Notification to HMI");
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
@@ -150,9 +152,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
app_services->end(),
matching_service_predicate);
if (it != app_services->end()) {
- LOG4CXX_DEBUG(
- logger_,
- "Replacing updated record with service_id " << service_id);
+ SDL_LOG_DEBUG("Replacing updated record with service_id "
+ << service_id);
app_services->erase(it);
}
app_services->push_back(updated_capabilities[i]);
@@ -163,7 +164,7 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
}
case mobile_apis::SystemCapabilityType::DISPLAYS: {
if (!hmi_capabilities_.system_display_capabilities()) {
- LOG4CXX_INFO(logger_, "system_display_capabilities are not available");
+ SDL_LOG_INFO("system_display_capabilities are not available");
return;
}
msg_params[strings::system_capability][strings::display_capabilities] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
index f32aef1102..7ba330caa8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnBCSystemCapabilityUpdatedNotificationFromHMI::
OnBCSystemCapabilityUpdatedNotificationFromHMI(
const application_manager::commands::MessageSharedPtr& message,
@@ -63,10 +65,10 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI::
OnBCSystemCapabilityUpdatedNotificationFromHMI::
ProcessSystemDisplayCapabilities(
const smart_objects::SmartObject& display_capabilities) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!(*message_)[strings::msg_params].keyExists(strings::app_id)) {
- LOG4CXX_DEBUG(logger_, "Updating general display capabilities");
+ SDL_LOG_DEBUG("Updating general display capabilities");
hmi_capabilities_.set_system_display_capabilities(display_capabilities);
return ProcessSystemDisplayCapabilitiesResult::SUCCESS;
}
@@ -75,22 +77,22 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI::
(*message_)[strings::msg_params][strings::app_id].asUInt();
auto app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Application with app_id " << app_id << " is not registered");
+ SDL_LOG_ERROR("Application with app_id " << app_id << " is not registered");
return ProcessSystemDisplayCapabilitiesResult::FAIL;
}
- LOG4CXX_DEBUG(logger_, "Updating display capabilities for app " << app_id);
+ SDL_LOG_DEBUG("Updating display capabilities for app " << app_id);
app->set_display_capabilities(display_capabilities);
// Remove app_id from notification to mobile
(*message_)[strings::params][strings::connection_key] =
(*message_)[strings::msg_params][strings::app_id];
(*message_)[strings::msg_params].erase(strings::app_id);
- if (app->is_resuming() && app->is_app_data_resumption_allowed()) {
- LOG4CXX_DEBUG(logger_, "Application is resuming");
- app->display_capabilities_builder().UpdateDisplayCapabilities(
- display_capabilities);
+
+ auto& builder = app->display_capabilities_builder();
+ if (builder.IsWaitingForWindowCapabilities(display_capabilities)) {
+ SDL_LOG_DEBUG("Application is waiting for capabilities");
+ builder.UpdateDisplayCapabilities(display_capabilities);
return ProcessSystemDisplayCapabilitiesResult::CAPABILITIES_CACHED;
}
@@ -98,7 +100,7 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI::
}
void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] = static_cast<int32_t>(
@@ -113,15 +115,13 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
const auto result = ProcessSystemDisplayCapabilities(
system_capability[strings::display_capabilities]);
if (ProcessSystemDisplayCapabilitiesResult::FAIL == result) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Failed to process display capabilities. Notification will "
"be ignored");
return;
} else if (ProcessSystemDisplayCapabilitiesResult::
CAPABILITIES_CACHED == result) {
- LOG4CXX_TRACE(logger_,
- "Capabilities are being cached for resuming app");
+ SDL_LOG_TRACE("Capabilities are being cached for resuming app");
return;
}
}
@@ -129,7 +129,7 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
}
case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: {
if (system_capability.keyExists(strings::rc_capability)) {
- LOG4CXX_DEBUG(logger_, "Updating RC Capabilities");
+ SDL_LOG_DEBUG("Updating RC Capabilities");
hmi_capabilities_.set_rc_capability(
system_capability[strings::rc_capability]);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc
index f25e6202cd..f6911637f9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc
@@ -42,6 +42,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnButtonEventNotification::OnButtonEventNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnButtonEventNotification::OnButtonEventNotification(
policy_handle) {}
void OnButtonEventNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnButtonEventID);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc
index fee6b1b485..db2d81ccd1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc
@@ -43,6 +43,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnButtonPressNotification::OnButtonPressNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ OnButtonPressNotification::OnButtonPressNotification(
policy_handle) {}
void OnButtonPressNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::Buttons_OnButtonPress);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc
index 4ac752d6c5..c8d36407b8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc
@@ -39,6 +39,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnButtonSubscriptionNotification::OnButtonSubscriptionNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ OnButtonSubscriptionNotification::OnButtonSubscriptionNotification(
OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {}
void OnButtonSubscriptionNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc
index f27c1fe5e5..9938c26192 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnDeviceChosenNotification::OnDeviceChosenNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnDeviceChosenNotification::OnDeviceChosenNotification(
OnDeviceChosenNotification::~OnDeviceChosenNotification() {}
void OnDeviceChosenNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if ((*message_)[strings::msg_params].keyExists(strings::device_info)) {
application_manager_.ConnectToDevice(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc
index 129ba8c9ba..a6619c579c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc
@@ -80,6 +80,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnDeviceStateChangedNotification::OnDeviceStateChangedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -95,7 +97,7 @@ OnDeviceStateChangedNotification::OnDeviceStateChangedNotification(
OnDeviceStateChangedNotification::~OnDeviceStateChangedNotification() {}
void OnDeviceStateChangedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if ((*message_)[strings::msg_params]["deviceState"] ==
hmi_apis::Common_DeviceState::UNPAIRED) {
@@ -110,11 +112,11 @@ void OnDeviceStateChangedNotification::Run() {
}
} else {
// Policy uses hashed MAC address as device_id
- LOG4CXX_DEBUG(logger_, "Device_id from HMI: " << device_id);
+ SDL_LOG_DEBUG("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);
+ SDL_LOG_DEBUG("Device_id as BT MAC: " << bt_mac);
device_id = encryption::MakeHash(bt_mac);
- LOG4CXX_DEBUG(logger_, "Device_id hashed as BT MAC : " << device_id);
+ SDL_LOG_DEBUG("Device_id hashed as BT MAC : " << device_id);
}
policy_handler_.RemoveDevice(device_id);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
index a74d399fcd..167176aa0f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
@@ -123,6 +123,8 @@ struct OnDriverDistractionProcessor {
};
} // namespace
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnDriverDistractionNotification::OnDriverDistractionNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -138,7 +140,7 @@ OnDriverDistractionNotification::OnDriverDistractionNotification(
OnDriverDistractionNotification::~OnDriverDistractionNotification() {}
void OnDriverDistractionNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto state =
static_cast<hmi_apis::Common_DriverDistractionState::eType>(
(*message_)[strings::msg_params][hmi_notification::state].asInt());
@@ -146,7 +148,7 @@ void OnDriverDistractionNotification::Run() {
auto on_driver_distraction = std::make_shared<smart_objects::SmartObject>();
if (!on_driver_distraction) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
(*on_driver_distraction)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc
index f6ea22ae34..13e76979a4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnEventChangedNotification::OnEventChangedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnEventChangedNotification::OnEventChangedNotification(
OnEventChangedNotification::~OnEventChangedNotification() {}
void OnEventChangedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc
index 4c168f9eff..079e4f3d10 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc
@@ -46,6 +46,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnExitAllApplicationsNotification::OnExitAllApplicationsNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -61,12 +63,12 @@ OnExitAllApplicationsNotification::OnExitAllApplicationsNotification(
OnExitAllApplicationsNotification::~OnExitAllApplicationsNotification() {}
void OnExitAllApplicationsNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
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);
+ SDL_LOG_DEBUG("Reason " << reason);
mobile_api::AppInterfaceUnregisteredReason::eType mob_reason =
mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM;
@@ -90,7 +92,7 @@ void OnExitAllApplicationsNotification::Run() {
return;
}
default: {
- LOG4CXX_ERROR(logger_, "Unknown Application close reason" << reason);
+ SDL_LOG_ERROR("Unknown Application close reason" << reason);
return;
}
}
@@ -106,7 +108,7 @@ void OnExitAllApplicationsNotification::Run() {
}
void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
index 3eec6c5d1a..2b95d2e3e8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
@@ -44,6 +44,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnExitApplicationNotification::OnExitApplicationNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -59,7 +61,7 @@ OnExitApplicationNotification::OnExitApplicationNotification(
OnExitApplicationNotification::~OnExitApplicationNotification() {}
void OnExitApplicationNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
using namespace hmi_apis;
@@ -68,7 +70,7 @@ void OnExitApplicationNotification::Run() {
ApplicationSharedPtr app_impl = application_manager_.application(app_id);
if (app_impl.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Application does not exist");
+ SDL_LOG_ERROR("Application does not exist");
return;
}
@@ -112,9 +114,17 @@ void OnExitApplicationNotification::Run() {
break;
}
#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+ case Common_ApplicationExitReason::RESOURCE_CONSTRAINT: {
+ const auto message =
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, AppInterfaceUnregisteredReason::RESOURCE_CONSTRAINT);
+ SendNotificationToMobile(message);
+ application_manager_.UnregisterApplication(app_id, Result::SUCCESS);
+ return;
+ }
default: {
- LOG4CXX_WARN(logger_, "Unhandled reason");
+ SDL_LOG_WARN("Unhandled reason");
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc
index e1f0e2b104..d96f0498a5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnFileRemovedNotification::OnFileRemovedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnFileRemovedNotification::OnFileRemovedNotification(
OnFileRemovedNotification::~OnFileRemovedNotification() {}
void OnFileRemovedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc
index 2e8f15387f..5f03d5ffa0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnFindApplications::OnFindApplications(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnFindApplications::OnFindApplications(
OnFindApplications::~OnFindApplications() {}
void OnFindApplications::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(PV): add UpdateAppsOnDevice to ApplicationManager
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc
index 1e8da19c0a..2af2d1c2d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnIgnitionCycleOverNotification::OnIgnitionCycleOverNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ OnIgnitionCycleOverNotification::OnIgnitionCycleOverNotification(
OnIgnitionCycleOverNotification::~OnIgnitionCycleOverNotification() {}
void OnIgnitionCycleOverNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_handler_.OnIgnitionCycleOver();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc
index f611b81764..01de5ccb06 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnNaviTBTClientStateNotification::OnNaviTBTClientStateNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnNaviTBTClientStateNotification::OnNaviTBTClientStateNotification(
OnNaviTBTClientStateNotification::~OnNaviTBTClientStateNotification() {}
void OnNaviTBTClientStateNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
index 2a1a9c29fb..2440e918b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnNaviWayPointChangeNotification::OnNaviWayPointChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& app_man,
@@ -49,7 +51,7 @@ OnNaviWayPointChangeNotification::OnNaviWayPointChangeNotification(
OnNaviWayPointChangeNotification::~OnNaviWayPointChangeNotification() {}
void OnNaviWayPointChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc
index a0e75371b5..b883ac5c16 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc
@@ -38,6 +38,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnPolicyUpdate::OnPolicyUpdate(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnPolicyUpdate::OnPolicyUpdate(
OnPolicyUpdate::~OnPolicyUpdate() {}
void OnPolicyUpdate::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_handler_.OnPTExchangeNeeded();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc
index 441e36a385..9349bc326d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnPutFileNotification::OnPutFileNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnPutFileNotification::OnPutFileNotification(
OnPutFileNotification::~OnPutFileNotification() {}
void OnPutFileNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
index c9270fd80b..ef92c28ba4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnReadyNotification::OnReadyNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnReadyNotification::OnReadyNotification(
OnReadyNotification::~OnReadyNotification() {}
void OnReadyNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.OnHMIReady();
event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnReady);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
index b2c9151b40..2f5901c9e2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnReceivedPolicyUpdate::OnReceivedPolicyUpdate(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,20 +58,20 @@ OnReceivedPolicyUpdate::OnReceivedPolicyUpdate(
OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {}
void OnReceivedPolicyUpdate::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
const std::string& file_path =
(*message_)[strings::msg_params][hmi_notification::policyfile].asString();
policy::BinaryMessage file_content;
if (!file_system::ReadBinaryFile(file_path, file_content)) {
- LOG4CXX_ERROR(logger_, "Failed to read Update file.");
+ SDL_LOG_ERROR("Failed to read Update file.");
return;
}
policy_handler_.ReceiveMessageFromSDK(file_path, file_content);
#else
- LOG4CXX_WARN(logger_,
- "This RPC is part of extended policy flow."
- "Please re-build with extended policy mode enabled.");
+ SDL_LOG_WARN(
+ "This RPC is part of extended policy flow. "
+ "Please re-build with extended policy mode enabled.");
#endif
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc
index dbef717539..e05c5860db 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnRecordStartdNotification::OnRecordStartdNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnRecordStartdNotification::OnRecordStartdNotification(
OnRecordStartdNotification::~OnRecordStartdNotification() {}
void OnRecordStartdNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc
index 11d549655e..a56a6a26e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnResumeAudioSourceNotification::OnResumeAudioSourceNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnResumeAudioSourceNotification::OnResumeAudioSourceNotification(
OnResumeAudioSourceNotification::~OnResumeAudioSourceNotification() {}
void OnResumeAudioSourceNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc
index d0c584c66c..90a6cdf1ce 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSDLCloseNotification::OnSDLCloseNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnSDLCloseNotification::OnSDLCloseNotification(
OnSDLCloseNotification::~OnSDLCloseNotification() {}
void OnSDLCloseNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc
index 314a9e8f71..0774414222 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSDLConsentNeededNotification::OnSDLConsentNeededNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnSDLConsentNeededNotification::OnSDLConsentNeededNotification(
OnSDLConsentNeededNotification::~OnSDLConsentNeededNotification() {}
void OnSDLConsentNeededNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc
index 5db38d070b..efa880f484 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSDLPersistenceCompleteNotification::OnSDLPersistenceCompleteNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnSDLPersistenceCompleteNotification::OnSDLPersistenceCompleteNotification(
OnSDLPersistenceCompleteNotification::~OnSDLPersistenceCompleteNotification() {}
void OnSDLPersistenceCompleteNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc
index de03b75214..c1f8c337bb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc
@@ -39,6 +39,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnServiceUpdateNotification::OnServiceUpdateNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ OnServiceUpdateNotification::OnServiceUpdateNotification(
OnServiceUpdateNotification::~OnServiceUpdateNotification() {}
void OnServiceUpdateNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc
index 035def10e0..5e86618b31 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnStartDeviceDiscovery::OnStartDeviceDiscovery(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnStartDeviceDiscovery::OnStartDeviceDiscovery(
OnStartDeviceDiscovery::~OnStartDeviceDiscovery() {}
void OnStartDeviceDiscovery::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager_.StartDevicesDiscovery();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc
index 5ee2ede198..4a2e310151 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnStatusUpdateNotification::OnStatusUpdateNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnStatusUpdateNotification::OnStatusUpdateNotification(
OnStatusUpdateNotification::~OnStatusUpdateNotification() {}
void OnStatusUpdateNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
index bf52492ae1..c86ef48225 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
@@ -40,6 +40,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSystemContextNotification::OnSystemContextNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnSystemContextNotification::OnSystemContextNotification(
OnSystemContextNotification::~OnSystemContextNotification() {}
void OnSystemContextNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_api::SystemContext::eType system_context =
static_cast<mobile_api::SystemContext::eType>(
@@ -93,7 +95,7 @@ void OnSystemContextNotification::Run() {
application_manager_.state_controller().SetRegularState(
app, window_id, system_context);
} else {
- LOG4CXX_ERROR(logger_, "Application does not exist");
+ SDL_LOG_ERROR("Application does not exist");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc
index 9b8523e882..1f0d02ac83 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSystemErrorNotification::OnSystemErrorNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnSystemErrorNotification::OnSystemErrorNotification(
OnSystemErrorNotification::~OnSystemErrorNotification() {}
void OnSystemErrorNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int code =
(*message_)[strings::msg_params][hmi_notification::error].asInt();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc
index 55ead3959d..48071cc1b2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSystemInfoChangedNotification::OnSystemInfoChangedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnSystemInfoChangedNotification::OnSystemInfoChangedNotification(
OnSystemInfoChangedNotification::~OnSystemInfoChangedNotification() {}
void OnSystemInfoChangedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t lang_code =
(*message_)[strings::msg_params][strings::language].asUInt();
const std::string language = application_manager::EnumToString(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
index 4f83e3e653..b75081e30f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
@@ -48,6 +48,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSystemRequestNotification::OnSystemRequestNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -63,7 +65,7 @@ OnSystemRequestNotification::OnSystemRequestNotification(
OnSystemRequestNotification::~OnSystemRequestNotification() {}
void OnSystemRequestNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& params = (*message_)[strings::params];
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
@@ -96,8 +98,7 @@ void OnSystemRequestNotification::Run() {
msg_params[strings::url] = policy_handler_.GetNextUpdateUrl(
policy::PTUIterationType::DefaultIteration, app_id);
if (0 == app_id) {
- LOG4CXX_WARN(logger_,
- "Can't select application to forward OnSystemRequest.");
+ SDL_LOG_WARN("Can't select application to forward OnSystemRequest.");
return;
}
msg_params[strings::app_id] = app_id;
@@ -110,26 +111,24 @@ void OnSystemRequestNotification::Run() {
ApplicationSharedPtr app;
if (msg_params.keyExists(strings::app_id)) {
const uint32_t app_id = msg_params[strings::app_id].asUInt();
- LOG4CXX_DEBUG(logger_, "Received OnSystemRequest for appID " << app_id);
- LOG4CXX_DEBUG(logger_, "Searching app to send OnSystemRequest by appID.");
+ SDL_LOG_DEBUG("Received OnSystemRequest for appID " << app_id);
+ SDL_LOG_DEBUG("Searching app to send OnSystemRequest by appID.");
app = application_manager_.application(app_id);
} else {
- LOG4CXX_DEBUG(logger_,
- "Received OnSystemRequest without appID."
- " One of registered apps will be used.");
- LOG4CXX_DEBUG(logger_, "Searching registered app to send OnSystemRequest.");
+ SDL_LOG_DEBUG(
+ "Received OnSystemRequest without appID."
+ " One of registered apps will be used.");
+ SDL_LOG_DEBUG("Searching registered app to send OnSystemRequest.");
const uint32_t selected_app_id = policy_handler_.GetAppIdForSending();
if (0 == selected_app_id) {
- LOG4CXX_WARN(logger_,
- "Can't select application to forward OnSystemRequest.");
+ SDL_LOG_WARN("Can't select application to forward OnSystemRequest.");
return;
}
app = application_manager_.application(selected_app_id);
}
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_,
- "No valid application found to forward OnSystemRequest.");
+ SDL_LOG_WARN("No valid application found to forward OnSystemRequest.");
return;
}
@@ -140,16 +139,14 @@ void OnSystemRequestNotification::Run() {
if (policy::kDeviceAllowed !=
policy_handler_.GetUserConsentForDevice(device_mac)) {
- LOG4CXX_WARN(logger_,
- "Application "
- << app->policy_app_id()
- << " is registered from non-consented device."
- "Can't forward notification to application.");
+ SDL_LOG_WARN("Application "
+ << app->policy_app_id()
+ << " is registered from non-consented device. "
+ "Can't forward notification to application.");
return;
}
- LOG4CXX_DEBUG(logger_,
- "Sending request with application id " << app->policy_app_id());
+ SDL_LOG_DEBUG("Sending request with application id " << app->policy_app_id());
params[strings::connection_key] = app->app_id();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc
index b068835545..980c2ded17 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSystemTimeReadyNotification::OnSystemTimeReadyNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& app_man,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
index 293857f8d5..f652761178 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,7 +59,7 @@ OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification(
OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {}
void OnTTSLanguageChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.set_active_tts_language(
static_cast<hmi_apis::Common_Language::eType>(
@@ -72,14 +74,12 @@ void OnTTSLanguageChangeNotification::Run() {
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::tts, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save TTS.OnLanguageChange response to cache");
+ SDL_LOG_ERROR("Failed to save TTS.OnLanguageChange response to cache");
}
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vr, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save VR.OnLanguageChange response to cache");
+ SDL_LOG_ERROR("Failed to save VR.OnLanguageChange response to cache");
}
(*message_)[strings::msg_params][strings::hmi_display_language] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc
index 8b60762b31..96f6c5cd5b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc
@@ -40,6 +40,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification(
OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {}
void OnTTSResetTimeoutNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc
index 2d215b2ec9..4126a1bd21 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnTTSStartedNotification::OnTTSStartedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnTTSStartedNotification::OnTTSStartedNotification(
OnTTSStartedNotification::~OnTTSStartedNotification() {}
void OnTTSStartedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_Started);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc
index 6910b188f2..da69c4670e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnTTSStoppedNotification::OnTTSStoppedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ OnTTSStoppedNotification::OnTTSStoppedNotification(
OnTTSStoppedNotification::~OnTTSStoppedNotification() {}
void OnTTSStoppedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_Stopped);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc
index 6cc9f85d6f..939e3ad649 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnUICommandNotification::OnUICommandNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnUICommandNotification::OnUICommandNotification(
OnUICommandNotification::~OnUICommandNotification() {}
void OnUICommandNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc
index f069e4ed65..d1aa146e4f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc
@@ -40,6 +40,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnUIKeyBoardInputNotification::OnUIKeyBoardInputNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnUIKeyBoardInputNotification::OnUIKeyBoardInputNotification(
OnUIKeyBoardInputNotification::~OnUIKeyBoardInputNotification() {}
void OnUIKeyBoardInputNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
index 995d69cc45..2f2cb2ddc6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnUILanguageChangeNotification::OnUILanguageChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,7 +59,7 @@ OnUILanguageChangeNotification::OnUILanguageChangeNotification(
OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {}
void OnUILanguageChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.set_active_ui_language(
static_cast<hmi_apis::Common_Language::eType>(
@@ -66,8 +68,7 @@ void OnUILanguageChangeNotification::Run() {
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::ui, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save UI.OnLanguageChange response to cache");
+ SDL_LOG_ERROR("Failed to save UI.OnLanguageChange response to cache");
}
(*message_)[strings::msg_params][strings::hmi_display_language] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc
index bd1e1b8ea7..d8de31cfbc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc
@@ -41,6 +41,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnUIResetTimeoutNotification::OnUIResetTimeoutNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ OnUIResetTimeoutNotification::OnUIResetTimeoutNotification(
OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {}
void OnUIResetTimeoutNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc
index b2f5f80055..dedeb38a34 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnUISubtleAlertPressedNotification::OnUISubtleAlertPressedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnUISubtleAlertPressedNotification::OnUISubtleAlertPressedNotification(
OnUISubtleAlertPressedNotification::~OnUISubtleAlertPressedNotification() {}
void OnUISubtleAlertPressedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::function_id] = static_cast<int32_t>(
mobile_apis::FunctionID::eType::OnSubtleAlertPressedID);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc
index 193c3666d2..ae980070ea 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc
@@ -40,6 +40,8 @@ namespace commands {
namespace hmi {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnUITouchEventNotification::OnUITouchEventNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnUITouchEventNotification::OnUITouchEventNotification(
OnUITouchEventNotification::~OnUITouchEventNotification() {}
void OnUITouchEventNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc
new file mode 100644
index 0000000000..b0821a0890
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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 "sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/file_system.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+OnUIUpdateFileNotification::OnUIUpdateFileNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : NotificationFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnUIUpdateFileNotification::~OnUIUpdateFileNotification() {}
+
+void OnUIUpdateFileNotification::Run() {
+ SDL_LOG_AUTO_TRACE();
+
+ // Prepare SmartObject for mobile factory
+ (*message_)[strings::params][strings::function_id] =
+ static_cast<int32_t>(mobile_apis::FunctionID::OnUpdateFileID);
+
+ const auto app_id =
+ (*message_)[strings::msg_params][strings::app_id].asUInt();
+ auto app = application_manager_.application(app_id);
+
+ if (!app) {
+ SDL_LOG_ERROR("Application with app_id " << app_id << " is not registered");
+ return;
+ }
+
+ // Remove app_id from notification to mobile
+ (*message_)[strings::params][strings::connection_key] =
+ (*message_)[strings::msg_params][strings::app_id];
+ (*message_)[strings::msg_params].erase(strings::app_id);
+
+ // Parse fileName in case the full path was sent by the HMI
+ auto fileName =
+ (*message_)[strings::msg_params][strings::file_name].asString();
+ (*message_)[strings::msg_params][strings::file_name] =
+ file_system::GetFileName(fileName);
+
+ SendNotificationToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc
new file mode 100644
index 0000000000..2e8c37f7cd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc
@@ -0,0 +1,82 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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 "sdl_rpc_plugin/commands/hmi/on_ui_update_sub_menu_notification.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+OnUIUpdateSubMenuNotification::OnUIUpdateSubMenuNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : NotificationFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnUIUpdateSubMenuNotification::~OnUIUpdateSubMenuNotification() {}
+
+void OnUIUpdateSubMenuNotification::Run() {
+ SDL_LOG_AUTO_TRACE();
+ // Prepare SmartObject for mobile factory
+ (*message_)[strings::params][strings::function_id] =
+ static_cast<int32_t>(mobile_apis::FunctionID::OnUpdateSubMenuID);
+
+ const auto app_id =
+ (*message_)[strings::msg_params][strings::app_id].asUInt();
+ auto app = application_manager_.application(app_id);
+
+ if (!app) {
+ SDL_LOG_ERROR("Application with app_id " << app_id << " is not registered");
+ return;
+ }
+
+ // Remove app_id from notification to mobile
+ (*message_)[strings::params][strings::connection_key] =
+ (*message_)[strings::msg_params][strings::app_id];
+ (*message_)[strings::msg_params].erase(strings::app_id);
+
+ SendNotificationToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc
index e6275adab2..0ff97a664c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnUpdateDeviceList::OnUpdateDeviceList(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ OnUpdateDeviceList::OnUpdateDeviceList(
OnUpdateDeviceList::~OnUpdateDeviceList() {}
void OnUpdateDeviceList::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
index 99c6520fee..9f4e707b83 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification(
OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {}
void OnVIAccPedalPositionNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
index dbfd9487e3..4227847153 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIBeltStatusNotification::OnVIBeltStatusNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIBeltStatusNotification::OnVIBeltStatusNotification(
OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {}
void OnVIBeltStatusNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
index b8e66b9c0f..663f9342f4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIBodyInformationNotification::OnVIBodyInformationNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIBodyInformationNotification::OnVIBodyInformationNotification(
OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {}
void OnVIBodyInformationNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc
index 418c751d1c..62bec16546 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIDeviceStatusNotification::OnVIDeviceStatusNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIDeviceStatusNotification::OnVIDeviceStatusNotification(
OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {}
void OnVIDeviceStatusNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
index 29545fcd87..722fddc5f1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIDriverBrakingNotification::OnVIDriverBrakingNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIDriverBrakingNotification::OnVIDriverBrakingNotification(
OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {}
void OnVIDriverBrakingNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
index 4c2fb94400..8c524a3f1d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIEngineTorqueNotification::OnVIEngineTorqueNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIEngineTorqueNotification::OnVIEngineTorqueNotification(
OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {}
void OnVIEngineTorqueNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
index 6ac26a74fc..3cbd22eb97 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification(
OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {}
void OnVIExternalTemperatureNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
index 1f1cad5b8b..8065434063 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIFuelLevelNotification::OnVIFuelLevelNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIFuelLevelNotification::OnVIFuelLevelNotification(
OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {}
void OnVIFuelLevelNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
index 31c80860fd..c0c60108f3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification(
OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {}
void OnVIFuelLevelStateNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
index 43ae3524ad..1e18d18eba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIGpsDataNotification::OnVIGpsDataNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIGpsDataNotification::OnVIGpsDataNotification(
OnVIGpsDataNotification::~OnVIGpsDataNotification() {}
void OnVIGpsDataNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
index 282a173b69..29906df43f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification(
OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {}
void OnVIHeadLampStatusNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
index f9bb3eca3f..c4bc32e825 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIInstantFuelConsumptionNotification::OnVIInstantFuelConsumptionNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ OnVIInstantFuelConsumptionNotification::
~OnVIInstantFuelConsumptionNotification() {}
void OnVIInstantFuelConsumptionNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
index 8f5e845c02..6139d143f6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIMyKeyNotification::OnVIMyKeyNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIMyKeyNotification::OnVIMyKeyNotification(
OnVIMyKeyNotification::~OnVIMyKeyNotification() {}
void OnVIMyKeyNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
index ea5d8be9ca..92f4b47fcf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIOdometerNotification::OnVIOdometerNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIOdometerNotification::OnVIOdometerNotification(
OnVIOdometerNotification::~OnVIOdometerNotification() {}
void OnVIOdometerNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
index 73231ff4de..c2afd7d697 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIPrndlNotification::OnVIPrndlNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIPrndlNotification::OnVIPrndlNotification(
OnVIPrndlNotification::~OnVIPrndlNotification() {}
void OnVIPrndlNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
index 4587939b8f..f41f5d3f56 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIRpmNotification::OnVIRpmNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIRpmNotification::OnVIRpmNotification(
OnVIRpmNotification::~OnVIRpmNotification() {}
void OnVIRpmNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
index df0bfd5cd7..73313b6ea4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVISpeedNotification::OnVISpeedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVISpeedNotification::OnVISpeedNotification(
OnVISpeedNotification::~OnVISpeedNotification() {}
void OnVISpeedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
index b7eaad7edf..e04eaab3b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification(
OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {}
void OnVISteeringWheelAngleNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
index 5f438ef8d1..bc013c2e2c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVITirePressureNotification::OnVITirePressureNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVITirePressureNotification::OnVITirePressureNotification(
OnVITirePressureNotification::~OnVITirePressureNotification() {}
void OnVITirePressureNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
index 1b40da4c40..4b33c2d589 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIVinNotification::OnVIVinNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIVinNotification::OnVIVinNotification(
OnVIVinNotification::~OnVIVinNotification() {}
void OnVIVinNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
index 7221e88ef1..dde1e642c3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIWiperStatusNotification::OnVIWiperStatusNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVIWiperStatusNotification::OnVIWiperStatusNotification(
OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {}
void OnVIWiperStatusNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc
index 7d5c0165aa..a2e56300f0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVideoDataStreamingNotification::OnVideoDataStreamingNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnVideoDataStreamingNotification::OnVideoDataStreamingNotification(
OnVideoDataStreamingNotification::~OnVideoDataStreamingNotification() {}
void OnVideoDataStreamingNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
index c4678f69e0..366a17ec64 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
@@ -45,6 +45,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVRCommandNotification::OnVRCommandNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -60,14 +62,14 @@ OnVRCommandNotification::OnVRCommandNotification(
OnVRCommandNotification::~OnVRCommandNotification() {}
void OnVRCommandNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t cmd_id =
(*message_)[strings::msg_params][strings::cmd_id].asUInt();
uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id();
// Check if this is one of standard VR commands (i.e. "Help")
if (cmd_id > max_cmd_id + 1) {
- LOG4CXX_INFO(logger_, "Switched App");
+ SDL_LOG_INFO("Switched App");
const uint32_t app_id = cmd_id - max_cmd_id;
ApplicationSharedPtr app = application_manager_.application(app_id);
if (app) {
@@ -77,7 +79,7 @@ void OnVRCommandNotification::Run() {
mobile_apis::HMILevel::HMI_FULL,
true);
} else {
- LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id);
+ SDL_LOG_ERROR("Unable to find appication " << app_id);
}
return;
}
@@ -90,7 +92,7 @@ void OnVRCommandNotification::Run() {
(*message_)[strings::msg_params][strings::app_id].asUInt();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
/* check if perform interaction is active
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
index 1500f272ab..bf00291c88 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVRLanguageChangeNotification::OnVRLanguageChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,7 +60,7 @@ OnVRLanguageChangeNotification::OnVRLanguageChangeNotification(
OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {}
void OnVRLanguageChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.set_active_vr_language(
static_cast<hmi_apis::Common_Language::eType>(
@@ -67,8 +69,7 @@ void OnVRLanguageChangeNotification::Run() {
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vr, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save VR.OnLanguageChange response to cache");
+ SDL_LOG_ERROR("Failed to save VR.OnLanguageChange response to cache");
}
(*message_)[strings::msg_params][strings::hmi_display_language] =
@@ -77,12 +78,9 @@ void OnVRLanguageChangeNotification::Run() {
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
- const ApplicationSet& accessor =
- application_manager_.applications().GetData();
+ const auto applications = application_manager_.applications().GetData();
- ApplicationSetConstIt it = accessor.begin();
- for (; accessor.end() != it;) {
- ApplicationSharedPtr app = *it++;
+ for (auto app : applications) {
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
if (static_cast<int32_t>(app->language()) !=
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc
index bfc033a865..ab0ef67535 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVRStartedNotification::OnVRStartedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnVRStartedNotification::OnVRStartedNotification(
OnVRStartedNotification::~OnVRStartedNotification() {}
void OnVRStartedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VR_Started);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc
index ede1efab85..e784eac244 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVRStoppedNotification::OnVRStoppedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnVRStoppedNotification::OnVRStoppedNotification(
OnVRStoppedNotification::~OnVRStoppedNotification() {}
void OnVRStoppedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VR_Stopped);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
index d882dcd6e7..774acf54f1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCGetCapabilitiesRequest::RCGetCapabilitiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ RCGetCapabilitiesRequest::RCGetCapabilitiesRequest(
RCGetCapabilitiesRequest::~RCGetCapabilitiesRequest() {}
void RCGetCapabilitiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void RCGetCapabilitiesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::RC_GetCapabilities);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
index 910c12e979..10507a516f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCGetCapabilitiesResponse::RCGetCapabilitiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ RCGetCapabilitiesResponse::RCGetCapabilitiesResponse(
RCGetCapabilitiesResponse::~RCGetCapabilitiesResponse() {}
void RCGetCapabilitiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -60,8 +62,7 @@ void RCGetCapabilitiesResponse::Run() {
hmi_apis::FunctionID::RC_GetCapabilities);
if (hmi_apis::Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -89,8 +90,7 @@ void RCGetCapabilitiesResponse::Run() {
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::rc, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save RC.GetCapabilities response to cache");
+ SDL_LOG_ERROR("Failed to save RC.GetCapabilities response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
index 4ea0d43dc3..c9a9af87fb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCIsReadyRequest::RCIsReadyRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,17 +59,17 @@ RCIsReadyRequest::RCIsReadyRequest(
RCIsReadyRequest::~RCIsReadyRequest() {}
void RCIsReadyRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribe_on_event(hmi_apis::FunctionID::RC_IsReady, correlation_id());
SendRequest();
}
void RCIsReadyRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::RC_IsReady: {
- LOG4CXX_DEBUG(logger_, "Received RC_IsReady event");
+ SDL_LOG_DEBUG("Received RC_IsReady event");
unsubscribe_from_event(hmi_apis::FunctionID::RC_IsReady);
const bool is_available = app_mngr::commands::ChangeInterfaceState(
application_manager_, message, HmiInterfaces::HMI_INTERFACE_RC);
@@ -82,15 +84,14 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) {
application_manager_, HmiInterfaces::HMI_INTERFACE_RC)) {
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::RC_GetCapabilities);
- LOG4CXX_INFO(logger_,
- "HmiInterfaces::HMI_INTERFACE_RC isn't available");
+ SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_RC isn't available");
return;
}
RequestInterfaceCapabilities(hmi_interface::rc);
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc
index 71e16a831c..1ad9a30a23 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RCIsReadyResponse::RCIsReadyResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ RCIsReadyResponse::RCIsReadyResponse(
RCIsReadyResponse::~RCIsReadyResponse() {}
void RCIsReadyResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::RC_IsReady);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
index 0a6632fca8..527cf911b9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
@@ -82,6 +82,8 @@ struct SendLaunchApp
};
} // namespace
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLActivateAppRequest::SDLActivateAppRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -99,12 +101,11 @@ SDLActivateAppRequest::~SDLActivateAppRequest() {}
uint32_t SDLActivateAppRequest::app_id() const {
using namespace strings;
if (!(*message_).keyExists(msg_params)) {
- LOG4CXX_DEBUG(logger_, msg_params << " section is absent in the message.");
+ SDL_LOG_DEBUG(msg_params << " section is absent in the message.");
return 0;
}
if (!(*message_)[msg_params].keyExists(strings::app_id)) {
- LOG4CXX_DEBUG(logger_,
- strings::app_id << " section is absent in the message.");
+ SDL_LOG_DEBUG(strings::app_id << " section is absent in the message.");
return 0;
}
return (*message_)[msg_params][strings::app_id].asUInt();
@@ -112,22 +113,22 @@ uint32_t SDLActivateAppRequest::app_id() const {
#ifdef EXTERNAL_PROPRIETARY_MODE
void SDLActivateAppRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis::FunctionID;
ApplicationConstSharedPtr app =
application_manager_.WaitingApplicationByID(app_id());
if (application_manager_.state_controller().IsStateActive(
HmiState::STATE_ID_DEACTIVATE_HMI)) {
- LOG4CXX_DEBUG(logger_,
- "DeactivateHmi state is active. "
- "Sends response with result code REJECTED");
+ SDL_LOG_DEBUG(
+ "DeactivateHmi state is active. "
+ "Sends response with result code REJECTED");
SendErrorResponse(correlation_id(),
static_cast<eType>(function_id()),
hmi_apis::Common_Result::REJECTED,
"HMIDeactivate is active");
} else if (app && !app->IsRegistered() && app->is_cloud_app()) {
- LOG4CXX_DEBUG(logger_, "Starting cloud application.");
+ SDL_LOG_DEBUG("Starting cloud application.");
const ApplicationManagerSettings& settings =
application_manager_.get_settings();
uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() *
@@ -144,7 +145,7 @@ void SDLActivateAppRequest::Run() {
#else // EXTERNAL_PROPRIETARY_MODE
void SDLActivateAppRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis::FunctionID;
using namespace hmi_apis::Common_Result;
@@ -162,22 +163,20 @@ void SDLActivateAppRequest::Run() {
application_manager_.WaitingApplicationByID(application_id);
if (!app_to_activate) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Can't find application within waiting apps: " << application_id);
return;
}
}
- LOG4CXX_DEBUG(logger_,
- "Found application to activate. Application id is "
- << app_to_activate->app_id());
+ SDL_LOG_DEBUG("Found application to activate. Application id is "
+ << app_to_activate->app_id());
if (application_manager_.state_controller().IsStateActive(
HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) {
- LOG4CXX_WARN(logger_,
- "DeactivateHmi state is active. "
- "Sends response with result code REJECTED");
+ SDL_LOG_WARN(
+ "DeactivateHmi state is active. "
+ "Sends response with result code REJECTED");
SendErrorResponse(correlation_id(),
static_cast<hmi_apis::FunctionID::eType>(function_id()),
hmi_apis::Common_Result::REJECTED,
@@ -186,11 +185,11 @@ void SDLActivateAppRequest::Run() {
}
if (app_to_activate->IsRegistered()) {
- LOG4CXX_DEBUG(logger_, "Application is registered. Activating.");
+ SDL_LOG_DEBUG("Application is registered. Activating.");
policy_handler_.OnActivateApp(application_id, correlation_id());
return;
} else if (app_to_activate->is_cloud_app()) {
- LOG4CXX_DEBUG(logger_, "Starting cloud application.");
+ SDL_LOG_DEBUG("Starting cloud application.");
const ApplicationManagerSettings& settings =
application_manager_.get_settings();
uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() *
@@ -208,29 +207,29 @@ void SDLActivateAppRequest::Run() {
V4ProtoApps v4_proto_apps = get_v4_proto_apps(device_handle);
if (!foreground_v4_app && v4_proto_apps.empty()) {
- LOG4CXX_ERROR(logger_,
- "Can't find regular foreground app with the same "
- "connection id:"
- << device_handle);
+ SDL_LOG_ERROR(
+ "Can't find regular foreground app with the same "
+ "connection id: "
+ << device_handle);
SendErrorResponse(
correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED, "");
return;
}
- LOG4CXX_DEBUG(logger_,
- "Application is not registered yet. "
- "Sending launch request.");
+ SDL_LOG_DEBUG(
+ "Application is not registered yet. "
+ "Sending launch request.");
if (foreground_v4_app) {
- LOG4CXX_DEBUG(logger_, "Sending request to foreground application.");
+ SDL_LOG_DEBUG("Sending request to foreground application.");
MessageHelper::SendLaunchApp(foreground_v4_app->app_id(),
app_to_activate->SchemaUrl(),
app_to_activate->PackageName(),
application_manager_);
} else {
- LOG4CXX_DEBUG(logger_,
- "No preffered (foreground) application is found. "
- "Sending request to all v4 applications.");
+ SDL_LOG_DEBUG(
+ "No preffered (foreground) application is found. "
+ "Sending request to all v4 applications.");
std::for_each(v4_proto_apps.begin(),
v4_proto_apps.end(),
SendLaunchApp(app_to_activate, application_manager_));
@@ -266,8 +265,8 @@ void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(hmi_application_id);
if (!app) {
- LOG4CXX_ERROR(
- logger_, "Application not found by HMI app id: " << hmi_application_id);
+ SDL_LOG_ERROR(
+ "Application not found by HMI app id: " << hmi_application_id);
return;
}
policy_handler_.OnActivateApp(app->app_id(), correlation_id());
@@ -277,16 +276,15 @@ uint32_t SDLActivateAppRequest::hmi_app_id(
const smart_objects::SmartObject& so) const {
using namespace strings;
if (!so.keyExists(params)) {
- LOG4CXX_DEBUG(logger_, params << " section is absent in the message.");
+ SDL_LOG_DEBUG(params << " section is absent in the message.");
return 0;
}
if (!so[msg_params].keyExists(application)) {
- LOG4CXX_DEBUG(logger_, application << " section is absent in the message.");
+ SDL_LOG_DEBUG(application << " section is absent in the message.");
return 0;
}
if (!so[msg_params][application].keyExists(strings::app_id)) {
- LOG4CXX_DEBUG(logger_,
- strings::app_id << " section is absent in the message.");
+ SDL_LOG_DEBUG(strings::app_id << " section is absent in the message.");
return 0;
}
return so[msg_params][application][strings::app_id].asUInt();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc
index 560b75213c..2748c23a65 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLActivateAppResponse::SDLActivateAppResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ SDLActivateAppResponse::SDLActivateAppResponse(
SDLActivateAppResponse::~SDLActivateAppResponse() {}
void SDLActivateAppResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc
index c8266e0f39..6cf855904c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetListOfPermissionsRequest::SDLGetListOfPermissionsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SDLGetListOfPermissionsRequest::SDLGetListOfPermissionsRequest(
SDLGetListOfPermissionsRequest::~SDLGetListOfPermissionsRequest() {}
void SDLGetListOfPermissionsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
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/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc
index 280d2cb071..b27fe08b47 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetListOfPermissionsResponse::SDLGetListOfPermissionsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ SDLGetListOfPermissionsResponse::SDLGetListOfPermissionsResponse(
SDLGetListOfPermissionsResponse::~SDLGetListOfPermissionsResponse() {}
void SDLGetListOfPermissionsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
index 52b7f83e9b..7478a40eeb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetPolicyConfigurationDataRequest::SDLGetPolicyConfigurationDataRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SDLGetPolicyConfigurationDataRequest::SDLGetPolicyConfigurationDataRequest(
SDLGetPolicyConfigurationDataRequest::~SDLGetPolicyConfigurationDataRequest() {}
void SDLGetPolicyConfigurationDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject response_value(
smart_objects::SmartType::SmartType_Array);
@@ -63,7 +65,7 @@ void SDLGetPolicyConfigurationDataRequest::Run() {
PrepareResponseParams(response_value);
if (hmi_apis::Common_Result::SUCCESS != result_code) {
- LOG4CXX_ERROR(logger_, "Unable to PrepareResponseParams");
+ SDL_LOG_ERROR("Unable to PrepareResponseParams");
SendErrorResponse(
correlation_id(),
hmi_apis::FunctionID::SDL_GetPolicyConfigurationData,
@@ -87,7 +89,7 @@ void SDLGetPolicyConfigurationDataRequest::Run() {
hmi_apis::Common_Result::eType
SDLGetPolicyConfigurationDataRequest::PrepareResponseParams(
smart_objects::SmartObject& response_out) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto policy_type =
(*message_)[strings::msg_params][strings::policy_type].asString();
@@ -96,17 +98,15 @@ SDLGetPolicyConfigurationDataRequest::PrepareResponseParams(
auto policy_table_data = policy_handler_.GetPolicyTableData();
if (!policy_table_data.isMember(policy_type)) {
- LOG4CXX_ERROR(
- logger_,
- "policy_type " << policy_type << " doesn't exist in policy table.");
+ SDL_LOG_ERROR("policy_type " << policy_type
+ << " doesn't exist in policy table.");
return hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
}
auto& policy_section_table_data = policy_table_data[policy_type];
if (!policy_section_table_data.isMember(property)) {
- LOG4CXX_ERROR(
- logger_,
- "property " << property << " doesn't exist in " << policy_type);
+ SDL_LOG_ERROR("property " << property << " doesn't exist in "
+ << policy_type);
return hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
}
@@ -126,7 +126,7 @@ void clear_new_line_symbol(std::string& str_to_clear) {
smart_objects::SmartObject SDLGetPolicyConfigurationDataRequest::GetValueParam(
const Json::Value& policy_property) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject value(smart_objects::SmartType_Array);
auto put_element_in_value_array = [&value](const Json::Value& element,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc
index 21b7dea41c..c934ef7bab 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetPolicyConfigurationDataResponse::SDLGetPolicyConfigurationDataResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SDLGetPolicyConfigurationDataResponse::
~SDLGetPolicyConfigurationDataResponse() {}
void SDLGetPolicyConfigurationDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
rpc_service_.SendMessageToHMI(message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc
index b494be56e8..ce1cb6b098 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest(
SDLGetStatusUpdateRequest::~SDLGetStatusUpdateRequest() {}
void SDLGetStatusUpdateRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_handler_.OnGetStatusUpdate(
(*message_)[strings::params][strings::correlation_id].asUInt());
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc
index 4b0f3d0ca8..122c209906 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetStatusUpdateResponse::SDLGetStatusUpdateResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ SDLGetStatusUpdateResponse::SDLGetStatusUpdateResponse(
SDLGetStatusUpdateResponse::~SDLGetStatusUpdateResponse() {}
void SDLGetStatusUpdateResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc
index db6168c3a3..57831bbc4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetUserFriendlyMessageRequest::SDLGetUserFriendlyMessageRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,11 +56,10 @@ SDLGetUserFriendlyMessageRequest::SDLGetUserFriendlyMessageRequest(
SDLGetUserFriendlyMessageRequest::~SDLGetUserFriendlyMessageRequest() {}
void SDLGetUserFriendlyMessageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string messageCodes = "messageCodes";
if (!(*message_)[strings::msg_params].keyExists(messageCodes)) {
- LOG4CXX_WARN(logger_,
- "Mandatory parameter '" + messageCodes + "'' is missing");
+ SDL_LOG_WARN("Mandatory parameter '" + messageCodes + "'' is missing");
return;
}
smart_objects::SmartArray* msg =
@@ -71,7 +72,7 @@ void SDLGetUserFriendlyMessageRequest::Run() {
for (; it != it_end; ++it) {
std::string str = (*it).asString();
if (!CheckSyntax(str)) {
- LOG4CXX_WARN(logger_, "Invalid data");
+ SDL_LOG_WARN("Invalid data");
SendErrorResponse(correlation_id(),
static_cast<hmi_apis::FunctionID::eType>(function_id()),
hmi_apis::Common_Result::INVALID_DATA,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc
index b95591c4fa..b56a664e4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLGetUserFriendlyMessageResponse::SDLGetUserFriendlyMessageResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ SDLGetUserFriendlyMessageResponse::SDLGetUserFriendlyMessageResponse(
SDLGetUserFriendlyMessageResponse::~SDLGetUserFriendlyMessageResponse() {}
void SDLGetUserFriendlyMessageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc
index 5f69903548..fa5e1beeb9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLPolicyUpdate::SDLPolicyUpdate(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ SDLPolicyUpdate::SDLPolicyUpdate(
SDLPolicyUpdate::~SDLPolicyUpdate() {}
void SDLPolicyUpdate::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
SendRequest();
#else
- LOG4CXX_WARN(logger_,
- "This RPC is part of extended policy flow."
- "Please re-build with extended policy mode enabled.");
+ SDL_LOG_WARN(
+ "This RPC is part of extended policy flow. "
+ "Please re-build with extended policy mode enabled.");
#endif
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
index bfbf73270e..5b76a405d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
@@ -37,6 +37,9 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SDLPolicyUpdateResponse::SDLPolicyUpdateResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +55,7 @@ SDLPolicyUpdateResponse::SDLPolicyUpdateResponse(
SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {}
void SDLPolicyUpdateResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -62,7 +65,7 @@ void SDLPolicyUpdateResponse::Run() {
helpers::ALL>(code,
hmi_apis::Common_Result::SUCCESS,
hmi_apis::Common_Result::WARNINGS)) {
- LOG4CXX_ERROR(logger_, "Error is returned. PTU won't be started.");
+ SDL_LOG_ERROR("Error is returned. PTU won't be started.");
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc
index 988be68a80..84ea5590d3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSChangeRegistrationRequest::TTSChangeRegistrationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ TTSChangeRegistrationRequest::TTSChangeRegistrationRequest(
TTSChangeRegistrationRequest::~TTSChangeRegistrationRequest() {}
void TTSChangeRegistrationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc
index e5e38ef34a..521df2ed6d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSChangeRegistratioResponse::TTSChangeRegistratioResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ TTSChangeRegistratioResponse::TTSChangeRegistratioResponse(
TTSChangeRegistratioResponse::~TTSChangeRegistratioResponse() {}
void TTSChangeRegistratioResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_ChangeRegistration);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
index 85f0b93b8c..3bca6c05c1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSGetCapabilitiesRequest::TTSGetCapabilitiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ TTSGetCapabilitiesRequest::TTSGetCapabilitiesRequest(
TTSGetCapabilitiesRequest::~TTSGetCapabilitiesRequest() {}
void TTSGetCapabilitiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void TTSGetCapabilitiesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::TTS_GetCapabilities);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
index e6edcdb365..167966e55b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSGetCapabilitiesResponse::TTSGetCapabilitiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ TTSGetCapabilitiesResponse::TTSGetCapabilitiesResponse(
TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {}
void TTSGetCapabilitiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -59,8 +61,7 @@ void TTSGetCapabilitiesResponse::Run() {
hmi_apis::FunctionID::TTS_GetCapabilities);
if (hmi_apis::Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -81,8 +82,7 @@ void TTSGetCapabilitiesResponse::Run() {
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::tts, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save TTS.GetCapabilities response to cache");
+ SDL_LOG_ERROR("Failed to save TTS.GetCapabilities response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
index d62c9627f5..2b409c68de 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSGetLanguageRequest::TTSGetLanguageRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ TTSGetLanguageRequest::TTSGetLanguageRequest(
TTSGetLanguageRequest::~TTSGetLanguageRequest() {}
void TTSGetLanguageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void TTSGetLanguageRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::TTS_GetLanguage);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
index 1487fd7915..2b14bea681 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSGetLanguageResponse::TTSGetLanguageResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ TTSGetLanguageResponse::TTSGetLanguageResponse(
TTSGetLanguageResponse::~TTSGetLanguageResponse() {}
void TTSGetLanguageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
@@ -63,8 +65,7 @@ void TTSGetLanguageResponse::Run() {
hmi_apis::FunctionID::TTS_GetLanguage);
if (Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -81,13 +82,11 @@ void TTSGetLanguageResponse::Run() {
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::tts, sections_to_update, message_->getSchema())) {
- LOG4CXX_DEBUG(logger_, "Failed to save TTS.GetLanguage response to cache");
+ SDL_LOG_DEBUG("Failed to save TTS.GetLanguage response to cache");
}
- LOG4CXX_DEBUG(logger_,
- "Raising event for function_id " << function_id()
- << " and correlation_id "
- << correlation_id());
+ SDL_LOG_DEBUG("Raising event for function_id "
+ << function_id() << " and correlation_id " << correlation_id());
event_engine::Event event(FunctionID::TTS_GetLanguage);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
index 5d758c84b7..87df2402bb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSGetSupportedLanguagesRequest::TTSGetSupportedLanguagesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ TTSGetSupportedLanguagesRequest::TTSGetSupportedLanguagesRequest(
TTSGetSupportedLanguagesRequest::~TTSGetSupportedLanguagesRequest() {}
void TTSGetSupportedLanguagesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void TTSGetSupportedLanguagesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::TTS_GetSupportedLanguages);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
index baa10394c5..6b074005b2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSGetSupportedLanguagesResponse::TTSGetSupportedLanguagesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ TTSGetSupportedLanguagesResponse::TTSGetSupportedLanguagesResponse(
TTSGetSupportedLanguagesResponse::~TTSGetSupportedLanguagesResponse() {}
void TTSGetSupportedLanguagesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -63,8 +65,7 @@ void TTSGetSupportedLanguagesResponse::Run() {
hmi_apis::FunctionID::TTS_GetSupportedLanguages);
if (hmi_apis::Common_Result::SUCCESS != code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -74,8 +75,7 @@ void TTSGetSupportedLanguagesResponse::Run() {
std::vector<std::string> sections_to_update{hmi_response::languages};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::tts, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save TTS.GetSupportedLanguages response to cache");
+ SDL_LOG_ERROR("Failed to save TTS.GetSupportedLanguages response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
index 4ae737bec4..1f1f3e7eab 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSIsReadyRequest::TTSIsReadyRequest(
const app_mngr::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,18 +56,18 @@ TTSIsReadyRequest::TTSIsReadyRequest(
TTSIsReadyRequest::~TTSIsReadyRequest() {}
void TTSIsReadyRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribe_on_event(hmi_apis::FunctionID::TTS_IsReady, correlation_id());
SendRequest();
}
void TTSIsReadyRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::TTS_IsReady: {
- LOG4CXX_DEBUG(logger_, "Received TTS_IsReady event");
+ SDL_LOG_DEBUG("Received TTS_IsReady event");
unsubscribe_from_event(hmi_apis::FunctionID::TTS_IsReady);
const bool is_available = app_mngr::commands::ChangeInterfaceState(
application_manager_, message, HmiInterfaces::HMI_INTERFACE_TTS);
@@ -74,8 +76,7 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) {
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_TTS)) {
UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::tts);
- LOG4CXX_INFO(logger_,
- "HmiInterfaces::HMI_INTERFACE_TTS isn't available");
+ SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_TTS isn't available");
return;
}
@@ -83,7 +84,7 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc
index 67e0fb6396..c94210e330 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSIsReadyResponse::TTSIsReadyResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ TTSIsReadyResponse::TTSIsReadyResponse(
TTSIsReadyResponse::~TTSIsReadyResponse() {}
void TTSIsReadyResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_IsReady);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
index 0b3d9a77bf..35059bf48d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
@@ -31,12 +31,15 @@
*/
#include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSSetGlobalPropertiesRequest::TTSSetGlobalPropertiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +55,18 @@ TTSSetGlobalPropertiesRequest::TTSSetGlobalPropertiesRequest(
TTSSetGlobalPropertiesRequest::~TTSSetGlobalPropertiesRequest() {}
void TTSSetGlobalPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void TTSSetGlobalPropertiesRequest::onTimeOut() {
+ auto& resume_ctrl = application_manager_.resume_controller();
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc
index 0901378c4a..35b3ce87d3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSSetGlobalPropertiesResponse::TTSSetGlobalPropertiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ TTSSetGlobalPropertiesResponse::TTSSetGlobalPropertiesResponse(
TTSSetGlobalPropertiesResponse::~TTSSetGlobalPropertiesResponse() {}
void TTSSetGlobalPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc
index 6dce94f931..0dd48f90a9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSSpeakRequest::TTSSpeakRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ TTSSpeakRequest::TTSSpeakRequest(
TTSSpeakRequest::~TTSSpeakRequest() {}
void TTSSpeakRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc
index 69be5ab160..c461996358 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSSpeakResponse::TTSSpeakResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ TTSSpeakResponse::TTSSpeakResponse(
TTSSpeakResponse::~TTSSpeakResponse() {}
void TTSSpeakResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc
index 43c595040c..8e6270e643 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSStopSpeakingRequest::TTSStopSpeakingRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ TTSStopSpeakingRequest::TTSStopSpeakingRequest(
TTSStopSpeakingRequest::~TTSStopSpeakingRequest() {}
void TTSStopSpeakingRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc
index 892b3e6295..64d76dcec2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
TTSStopSpeakingResponse::TTSStopSpeakingResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ TTSStopSpeakingResponse::TTSStopSpeakingResponse(
TTSStopSpeakingResponse::~TTSStopSpeakingResponse() {}
void TTSStopSpeakingResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::TTS_StopSpeaking);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
index 7c95e8a919..067ada3153 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
@@ -31,12 +31,15 @@
*/
#include "sdl_rpc_plugin/commands/hmi/ui_add_command_request.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIAddCommandRequest::UIAddCommandRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +55,19 @@ UIAddCommandRequest::UIAddCommandRequest(
UIAddCommandRequest::~UIAddCommandRequest() {}
void UIAddCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void UIAddCommandRequest::onTimeOut() {
+ auto& resume_ctrl = application_manager_.resume_controller();
+
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc
index 72d841a878..9a582807a9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIAddCommandResponse::UIAddCommandResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UIAddCommandResponse::UIAddCommandResponse(
UIAddCommandResponse::~UIAddCommandResponse() {}
void UIAddCommandResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_AddCommand);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
index 15342c6ecb..275c411eae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
@@ -31,12 +31,15 @@
*/
#include "sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIAddSubmenuRequest::UIAddSubmenuRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +55,18 @@ UIAddSubmenuRequest::UIAddSubmenuRequest(
UIAddSubmenuRequest::~UIAddSubmenuRequest() {}
void UIAddSubmenuRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void UIAddSubmenuRequest::onTimeOut() {
+ auto& resume_ctrl = application_manager_.resume_controller();
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc
index ae699dc2bd..89aa425cfb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIAddSubmenuResponse::UIAddSubmenuResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UIAddSubmenuResponse::UIAddSubmenuResponse(
UIAddSubmenuResponse::~UIAddSubmenuResponse() {}
void UIAddSubmenuResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_AddSubMenu);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
index 793e70d9e1..def1636fbd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIAlertRequest::UIAlertRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ UIAlertRequest::UIAlertRequest(
UIAlertRequest::~UIAlertRequest() {}
void UIAlertRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc
index f53f14e050..e1a5afa5e5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIAlertResponse::UIAlertResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UIAlertResponse::UIAlertResponse(
UIAlertResponse::~UIAlertResponse() {}
void UIAlertResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_Alert);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc
index c186077b1e..db35e550bc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UICancelInteractionRequest::UICancelInteractionRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UICancelInteractionRequest::UICancelInteractionRequest(
UICancelInteractionRequest::~UICancelInteractionRequest() {}
void UICancelInteractionRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc
index 2d5db4eecb..29d18ba384 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UICancelInteractionResponse::UICancelInteractionResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UICancelInteractionResponse::UICancelInteractionResponse(
UICancelInteractionResponse::~UICancelInteractionResponse() {}
void UICancelInteractionResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_CancelInteraction);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc
index bb001b37c7..3ba9d149c4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIChangeRegistrationRequest::UIChangeRegistrationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIChangeRegistrationRequest::UIChangeRegistrationRequest(
UIChangeRegistrationRequest::~UIChangeRegistrationRequest() {}
void UIChangeRegistrationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc
index 8acd654488..1790f44bce 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIChangeRegistratioResponse::UIChangeRegistratioResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UIChangeRegistratioResponse::UIChangeRegistratioResponse(
UIChangeRegistratioResponse::~UIChangeRegistratioResponse() {}
void UIChangeRegistratioResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_ChangeRegistration);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
index b354009e3f..e98ad5c45e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
@@ -31,12 +31,15 @@
*/
#include "sdl_rpc_plugin/commands/hmi/ui_create_window_request.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UICreateWindowRequest::UICreateWindowRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +55,19 @@ UICreateWindowRequest::UICreateWindowRequest(
UICreateWindowRequest::~UICreateWindowRequest() {}
void UICreateWindowRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void UICreateWindowRequest::onTimeOut() {
+ auto& resume_ctrl = application_manager_.resume_controller();
+
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc
index c3a323818d..1021e47595 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UICreateWindowResponse::UICreateWindowResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ UICreateWindowResponse::UICreateWindowResponse(
UICreateWindowResponse::~UICreateWindowResponse() {}
void UICreateWindowResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_CreateWindow);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc
index 1d741bba74..2b46723216 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIDeleteCommandRequest::UIDeleteCommandRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIDeleteCommandRequest::UIDeleteCommandRequest(
UIDeleteCommandRequest::~UIDeleteCommandRequest() {}
void UIDeleteCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc
index 40a5ec8a73..0cd3e1943d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIDeleteCommandResponse::UIDeleteCommandResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UIDeleteCommandResponse::UIDeleteCommandResponse(
UIDeleteCommandResponse::~UIDeleteCommandResponse() {}
void UIDeleteCommandResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_DeleteCommand);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc
index fdca37cee6..ea5745486a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIDeleteSubmenuRequest::UIDeleteSubmenuRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIDeleteSubmenuRequest::UIDeleteSubmenuRequest(
UIDeleteSubmenuRequest::~UIDeleteSubmenuRequest() {}
void UIDeleteSubmenuRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc
index 9d522431dc..0d2d5360cc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIDeleteSubmenuResponse::UIDeleteSubmenuResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UIDeleteSubmenuResponse::UIDeleteSubmenuResponse(
UIDeleteSubmenuResponse::~UIDeleteSubmenuResponse() {}
void UIDeleteSubmenuResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc
index 7933574d92..066b5969a6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIDeleteWindowRequest::UIDeleteWindowRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIDeleteWindowRequest::UIDeleteWindowRequest(
UIDeleteWindowRequest::~UIDeleteWindowRequest() {}
void UIDeleteWindowRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc
index ba703e18ae..507369c4f7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIDeleteWindowResponse::UIDeleteWindowResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ UIDeleteWindowResponse::UIDeleteWindowResponse(
UIDeleteWindowResponse::~UIDeleteWindowResponse() {}
void UIDeleteWindowResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_DeleteWindow);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc
index 92f51bc9cf..3e99b5298e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIEndAudioPassThruRequest::UIEndAudioPassThruRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIEndAudioPassThruRequest::UIEndAudioPassThruRequest(
UIEndAudioPassThruRequest::~UIEndAudioPassThruRequest() {}
void UIEndAudioPassThruRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc
index b6639dcbb9..3b9f56f7e6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIEndAudioPassThruResponse::UIEndAudioPassThruResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UIEndAudioPassThruResponse::UIEndAudioPassThruResponse(
UIEndAudioPassThruResponse::~UIEndAudioPassThruResponse() {}
void UIEndAudioPassThruResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_EndAudioPassThru);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
index 32c19eabcd..00a8ad761e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIGetCapabilitiesRequest::UIGetCapabilitiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ UIGetCapabilitiesRequest::UIGetCapabilitiesRequest(
UIGetCapabilitiesRequest::~UIGetCapabilitiesRequest() {}
void UIGetCapabilitiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void UIGetCapabilitiesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::UI_GetCapabilities);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
index 9f45d174e7..31dda22709 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIGetCapabilitiesResponse::UIGetCapabilitiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ UIGetCapabilitiesResponse::UIGetCapabilitiesResponse(
UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {}
void UIGetCapabilitiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -60,8 +62,7 @@ void UIGetCapabilitiesResponse::Run() {
hmi_apis::FunctionID::UI_GetCapabilities);
if (hmi_apis::Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -145,6 +146,7 @@ void UIGetCapabilitiesResponse::Run() {
strings::driver_distraction_capability)) {
if (!system_capabilities_so[strings::driver_distraction_capability]
.empty()) {
+ sections_to_update.push_back(strings::driver_distraction_capability);
hmi_capabilities_.set_driver_distraction_capability(
system_capabilities_so[strings::driver_distraction_capability]);
hmi_capabilities_.set_driver_distraction_supported(true);
@@ -165,8 +167,7 @@ void UIGetCapabilitiesResponse::Run() {
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::ui, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save UI.GetCapabilities response to cache");
+ SDL_LOG_ERROR("Failed to save UI.GetCapabilities response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
index 948adbdece..bf91b7e294 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIGetLanguageRequest::UIGetLanguageRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ UIGetLanguageRequest::UIGetLanguageRequest(
UIGetLanguageRequest::~UIGetLanguageRequest() {}
void UIGetLanguageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void UIGetLanguageRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::UI_GetLanguage);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
index e32dbf3c47..ffeec025be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIGetLanguageResponse::UIGetLanguageResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UIGetLanguageResponse::UIGetLanguageResponse(
UIGetLanguageResponse::~UIGetLanguageResponse() {}
void UIGetLanguageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -63,8 +65,7 @@ void UIGetLanguageResponse::Run() {
hmi_apis::FunctionID::UI_GetLanguage);
if (Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -81,13 +82,11 @@ void UIGetLanguageResponse::Run() {
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::ui, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_, "Failed to save UI.GetLanguage response to cache");
+ SDL_LOG_ERROR("Failed to save UI.GetLanguage response to cache");
}
- LOG4CXX_DEBUG(logger_,
- "Raising event for function_id " << function_id()
- << " and correlation_id "
- << correlation_id());
+ SDL_LOG_DEBUG("Raising event for function_id "
+ << function_id() << " and correlation_id " << correlation_id());
event_engine::Event event(FunctionID::UI_GetLanguage);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
index 0001af9203..480fa2499f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIGetSupportedLanguagesRequest::UIGetSupportedLanguagesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ UIGetSupportedLanguagesRequest::UIGetSupportedLanguagesRequest(
UIGetSupportedLanguagesRequest::~UIGetSupportedLanguagesRequest() {}
void UIGetSupportedLanguagesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void UIGetSupportedLanguagesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::UI_GetSupportedLanguages);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
index 53704b3705..20606294ae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIGetSupportedLanguagesResponse::UIGetSupportedLanguagesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UIGetSupportedLanguagesResponse::UIGetSupportedLanguagesResponse(
UIGetSupportedLanguagesResponse::~UIGetSupportedLanguagesResponse() {}
void UIGetSupportedLanguagesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -63,8 +65,7 @@ void UIGetSupportedLanguagesResponse::Run() {
hmi_apis::FunctionID::UI_GetSupportedLanguages);
if (hmi_apis::Common_Result::SUCCESS != code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -74,8 +75,7 @@ void UIGetSupportedLanguagesResponse::Run() {
std::vector<std::string> sections_to_update{hmi_response::languages};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::ui, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save UI.GetSupportedLanguages response to cache");
+ SDL_LOG_ERROR("Failed to save UI.GetSupportedLanguages response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
index 4882095d42..d020972ce6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIIsReadyRequest::UIIsReadyRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,17 +56,17 @@ UIIsReadyRequest::UIIsReadyRequest(
UIIsReadyRequest::~UIIsReadyRequest() {}
void UIIsReadyRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribe_on_event(hmi_apis::FunctionID::UI_IsReady, correlation_id());
SendRequest();
}
void UIIsReadyRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_IsReady: {
- LOG4CXX_DEBUG(logger_, "Received UI_IsReady event");
+ SDL_LOG_DEBUG("Received UI_IsReady event");
unsubscribe_from_event(hmi_apis::FunctionID::UI_IsReady);
const bool is_available = app_mngr::commands::ChangeInterfaceState(
application_manager_, message, HmiInterfaces::HMI_INTERFACE_UI);
@@ -73,8 +75,7 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) {
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_UI)) {
UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::ui);
- LOG4CXX_INFO(logger_,
- "HmiInterfaces::HMI_INTERFACE_UI isn't available");
+ SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_UI isn't available");
return;
}
@@ -82,7 +83,7 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc
index 96a2d1212c..99730691de 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIIsReadyResponse::UIIsReadyResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ UIIsReadyResponse::UIIsReadyResponse(
UIIsReadyResponse::~UIIsReadyResponse() {}
void UIIsReadyResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_IsReady);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
index 18d5376b25..c8a3dc3704 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIPerformAudioPassThruRequest::UIPerformAudioPassThruRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIPerformAudioPassThruRequest::UIPerformAudioPassThruRequest(
UIPerformAudioPassThruRequest::~UIPerformAudioPassThruRequest() {}
void UIPerformAudioPassThruRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
index afbd1bbed7..b953dc73e6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIPerformAudioPassThruResponse::UIPerformAudioPassThruResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UIPerformAudioPassThruResponse::UIPerformAudioPassThruResponse(
UIPerformAudioPassThruResponse::~UIPerformAudioPassThruResponse() {}
void UIPerformAudioPassThruResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
index a07c72cbf4..83e63c006d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIPerformInteractionRequest::UIPerformInteractionRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ UIPerformInteractionRequest::UIPerformInteractionRequest(
UIPerformInteractionRequest::~UIPerformInteractionRequest() {}
void UIPerformInteractionRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc
index 4cbc58d278..00f6f702cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIPerformInteractionResponse::UIPerformInteractionResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UIPerformInteractionResponse::UIPerformInteractionResponse(
UIPerformInteractionResponse::~UIPerformInteractionResponse() {}
void UIPerformInteractionResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_PerformInteraction);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
index cad68e23aa..366235bb6d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIScrollableMessageRequest::UIScrollableMessageRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ UIScrollableMessageRequest::UIScrollableMessageRequest(
UIScrollableMessageRequest::~UIScrollableMessageRequest() {}
void UIScrollableMessageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc
index 4e844095b4..b9a184528e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIScrollableMessageResponse::UIScrollableMessageResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UIScrollableMessageResponse::UIScrollableMessageResponse(
UIScrollableMessageResponse::~UIScrollableMessageResponse() {}
void UIScrollableMessageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_ScrollableMessage);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc
index 4a538ac992..9e8f4837f8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISendHapticDataRequest::UISendHapticDataRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UISendHapticDataRequest::UISendHapticDataRequest(
UISendHapticDataRequest::~UISendHapticDataRequest() {}
void UISendHapticDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc
index 92afdaaa4a..9b55d6d63d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISendHapticDataResponse::UISendHapticDataResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UISendHapticDataResponse::UISendHapticDataResponse(
UISendHapticDataResponse::~UISendHapticDataResponse() {}
void UISendHapticDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_SendHapticData);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc
index 821f78a046..4d158bfc20 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISetAppIconRequest::UISetAppIconRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UISetAppIconRequest::UISetAppIconRequest(
UISetAppIconRequest::~UISetAppIconRequest() {}
void UISetAppIconRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc
index 68e96725d4..91e341375b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISetAppIconResponse::UISetAppIconResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UISetAppIconResponse::UISetAppIconResponse(
UISetAppIconResponse::~UISetAppIconResponse() {}
void UISetAppIconResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_SetAppIcon);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc
index 63166157c8..df0f2a9f98 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest(
UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {}
void UiSetDisplayLayoutRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc
index f35427895e..35fe55ec4d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse(
UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {}
void UiSetDisplayLayoutResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
index 0aaaae7cc7..c82a4d2131 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
@@ -31,12 +31,15 @@
*/
#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISetGlobalPropertiesRequest::UISetGlobalPropertiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +55,18 @@ UISetGlobalPropertiesRequest::UISetGlobalPropertiesRequest(
UISetGlobalPropertiesRequest::~UISetGlobalPropertiesRequest() {}
void UISetGlobalPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void UISetGlobalPropertiesRequest::onTimeOut() {
+ auto& resume_ctrl = application_manager_.resume_controller();
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc
index 48d73d146c..e0d7f8136e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISetGlobalPropertiesResponse::UISetGlobalPropertiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UISetGlobalPropertiesResponse::UISetGlobalPropertiesResponse(
UISetGlobalPropertiesResponse::~UISetGlobalPropertiesResponse() {}
void UISetGlobalPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc
index 4c8fcefcdf..fdb477e41e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISetMediaClockTimerRequest::UISetMediaClockTimerRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UISetMediaClockTimerRequest::UISetMediaClockTimerRequest(
UISetMediaClockTimerRequest::~UISetMediaClockTimerRequest() {}
void UISetMediaClockTimerRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc
index fb5b25fc2b..3df2a14863 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISetMediaClockTimerResponse::UISetMediaClockTimerResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UISetMediaClockTimerResponse::UISetMediaClockTimerResponse(
UISetMediaClockTimerResponse::~UISetMediaClockTimerResponse() {}
void UISetMediaClockTimerResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc
index c2c8566e82..beba7ebba9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc
@@ -37,6 +37,8 @@ namespace app_mngr = application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIShowAppMenuRequest::UIShowAppMenuRequest(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIShowAppMenuRequest::UIShowAppMenuRequest(
UIShowAppMenuRequest::~UIShowAppMenuRequest() {}
void UIShowAppMenuRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc
index 14bbc79e03..c0e13d377a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc
@@ -37,6 +37,9 @@ namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIShowAppMenuResponse::UIShowAppMenuResponse(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -52,7 +55,7 @@ UIShowAppMenuResponse::UIShowAppMenuResponse(
UIShowAppMenuResponse::~UIShowAppMenuResponse() {}
void UIShowAppMenuResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::event_engine::Event event(hmi_apis::FunctionID::UI_ShowAppMenu);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc
index d7160dc70b..4312a4d252 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIShowRequest::UIShowRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIShowRequest::UIShowRequest(
UIShowRequest::~UIShowRequest() {}
void UIShowRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc
index 768069bf3a..7e57aec971 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UIShowResponse::UIShowResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UIShowResponse::UIShowResponse(
UIShowResponse::~UIShowResponse() {}
void UIShowResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
index eae8cc523c..63bc1e0c0e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISliderRequest::UISliderRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ UISliderRequest::UISliderRequest(
UISliderRequest::~UISliderRequest() {}
void UISliderRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc
index 9cf7224ddb..3c78e73fdd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISliderResponse::UISliderResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ UISliderResponse::UISliderResponse(
UISliderResponse::~UISliderResponse() {}
void UISliderResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_Slider);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc
index 02e9af4c3c..7136a533e6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISubtleAlertRequest::UISubtleAlertRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -60,7 +62,7 @@ UISubtleAlertRequest::UISubtleAlertRequest(
UISubtleAlertRequest::~UISubtleAlertRequest() {}
void UISubtleAlertRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc
index 51e9802db7..a551988c07 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UISubtleAlertResponse::UISubtleAlertResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UISubtleAlertResponse::UISubtleAlertResponse(
UISubtleAlertResponse::~UISubtleAlertResponse() {}
void UISubtleAlertResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::UI_SubtleAlert);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc
index c5966fcb36..ca23f36d5c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UpdateAppListRequest::UpdateAppListRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UpdateAppListRequest::UpdateAppListRequest(
UpdateAppListRequest::~UpdateAppListRequest() {}
void UpdateAppListRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc
index 7fc830b4e6..3468a7a253 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UpdateAppListResponse::UpdateAppListResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UpdateAppListResponse::UpdateAppListResponse(
UpdateAppListResponse::~UpdateAppListResponse() {}
void UpdateAppListResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(PV): add check
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
index 3a014480c1..c8aa295645 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UpdateDeviceListRequest::UpdateDeviceListRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,7 +59,7 @@ UpdateDeviceListRequest::UpdateDeviceListRequest(
UpdateDeviceListRequest::~UpdateDeviceListRequest() {}
void UpdateDeviceListRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(wait_hmi_lock);
// Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA.
// Flag conditional compilation for specific customer is used in order to
@@ -65,10 +67,10 @@ void UpdateDeviceListRequest::Run() {
// hit code to RTC
if (true == application_manager_.get_settings().launch_hmi()) {
if (!application_manager_.IsHMICooperating()) {
- LOG4CXX_INFO(logger_, "Wait for HMI Cooperation");
+ SDL_LOG_INFO("Wait for HMI Cooperation");
subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
termination_condition_.Wait(auto_lock);
- LOG4CXX_DEBUG(logger_, "HMI Cooperation OK");
+ SDL_LOG_DEBUG("HMI Cooperation OK");
}
}
@@ -76,17 +78,17 @@ void UpdateDeviceListRequest::Run() {
}
void UpdateDeviceListRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(wait_hmi_lock);
switch (event.id()) {
case hmi_apis::FunctionID::BasicCommunication_OnReady: {
- LOG4CXX_INFO(logger_, "received OnReady");
+ SDL_LOG_INFO("received OnReady");
unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
termination_condition_.Broadcast();
break;
};
default: {
- LOG4CXX_ERROR(logger_, "Unknown event ");
+ SDL_LOG_ERROR("Unknown event " << event.id());
break;
};
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc
index d69e683f2b..9458c22aa2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UpdateDeviceListResponse::UpdateDeviceListResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ UpdateDeviceListResponse::UpdateDeviceListResponse(
UpdateDeviceListResponse::~UpdateDeviceListResponse() {}
void UpdateDeviceListResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(PV): add check for correctness.
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc
index a52f03b998..b9c06945b6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UpdateSDLRequest::UpdateSDLRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UpdateSDLRequest::UpdateSDLRequest(
UpdateSDLRequest::~UpdateSDLRequest() {}
void UpdateSDLRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_handler_.PTExchangeAtUserRequest(
(*message_)[strings::params][strings::correlation_id].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc
index c02cde4111..a6981b6d82 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UpdateSDLResponse::UpdateSDLResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ UpdateSDLResponse::UpdateSDLResponse(
UpdateSDLResponse::~UpdateSDLResponse() {}
void UpdateSDLResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
index 788eda5a87..c8979ca62b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
@@ -31,12 +31,15 @@
*/
#include "sdl_rpc_plugin/commands/hmi/vr_add_command_request.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRAddCommandRequest::VRAddCommandRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,11 +55,19 @@ VRAddCommandRequest::VRAddCommandRequest(
VRAddCommandRequest::~VRAddCommandRequest() {}
void VRAddCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
+void VRAddCommandRequest::onTimeOut() {
+ auto& resume_ctrl = application_manager_.resume_controller();
+
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc
index 37b3e4696d..111fd1ffe5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRAddCommandResponse::VRAddCommandResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ VRAddCommandResponse::VRAddCommandResponse(
VRAddCommandResponse::~VRAddCommandResponse() {}
void VRAddCommandResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc
index d1be04ad44..32d326687a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRChangeRegistrationRequest::VRChangeRegistrationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ VRChangeRegistrationRequest::VRChangeRegistrationRequest(
VRChangeRegistrationRequest::~VRChangeRegistrationRequest() {}
void VRChangeRegistrationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc
index 27bde2bafa..85c346421d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRChangeRegistrationResponse::VRChangeRegistrationResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ VRChangeRegistrationResponse::VRChangeRegistrationResponse(
VRChangeRegistrationResponse::~VRChangeRegistrationResponse() {}
void VRChangeRegistrationResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VR_ChangeRegistration);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc
index ebcfe78fa9..cc6650a7ae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRDeleteCommandRequest::VRDeleteCommandRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ VRDeleteCommandRequest::VRDeleteCommandRequest(
VRDeleteCommandRequest::~VRDeleteCommandRequest() {}
void VRDeleteCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc
index d1d725b356..ae40f3c1f8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRDeleteCommandResponse::VRDeleteCommandResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ VRDeleteCommandResponse::VRDeleteCommandResponse(
VRDeleteCommandResponse::~VRDeleteCommandResponse() {}
void VRDeleteCommandResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VR_DeleteCommand);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
index dd0d78cf2d..3f528f2f58 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRGetCapabilitiesRequest::VRGetCapabilitiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ VRGetCapabilitiesRequest::VRGetCapabilitiesRequest(
VRGetCapabilitiesRequest::~VRGetCapabilitiesRequest() {}
void VRGetCapabilitiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void VRGetCapabilitiesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VR_GetCapabilities);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
index 79d532bff8..315107d94a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRGetCapabilitiesResponse::VRGetCapabilitiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ VRGetCapabilitiesResponse::VRGetCapabilitiesResponse(
VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {}
void VRGetCapabilitiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -59,8 +61,7 @@ void VRGetCapabilitiesResponse::Run() {
hmi_apis::FunctionID::VR_GetCapabilities);
if (hmi_apis::Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -75,8 +76,7 @@ void VRGetCapabilitiesResponse::Run() {
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vr, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_,
- "Failed to save VR.GetCapabilities response to cache");
+ SDL_LOG_ERROR("Failed to save VR.GetCapabilities response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
index 3aa36aee33..f5e9b0e848 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRGetLanguageRequest::VRGetLanguageRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ VRGetLanguageRequest::VRGetLanguageRequest(
VRGetLanguageRequest::~VRGetLanguageRequest() {}
void VRGetLanguageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void VRGetLanguageRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VR_GetLanguage);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
index 462ccc529c..e8c881f6f8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRGetLanguageResponse::VRGetLanguageResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ VRGetLanguageResponse::VRGetLanguageResponse(
VRGetLanguageResponse::~VRGetLanguageResponse() {}
void VRGetLanguageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -63,8 +65,7 @@ void VRGetLanguageResponse::Run() {
hmi_apis::FunctionID::VR_GetLanguage);
if (Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -81,13 +82,11 @@ void VRGetLanguageResponse::Run() {
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vr, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(logger_, "Failed to save VR.GetLanguage response to cache");
+ SDL_LOG_ERROR("Failed to save VR.GetLanguage response to cache");
}
- LOG4CXX_DEBUG(logger_,
- "Raising event for function_id " << function_id()
- << " and correlation_id "
- << correlation_id());
+ SDL_LOG_DEBUG("Raising event for function_id "
+ << function_id() << " and correlation_id " << correlation_id());
event_engine::Event event(FunctionID::VR_GetLanguage);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
index 5755b91ab6..73e68e8503 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRGetSupportedLanguagesRequest::VRGetSupportedLanguagesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,13 +54,13 @@ VRGetSupportedLanguagesRequest::VRGetSupportedLanguagesRequest(
VRGetSupportedLanguagesRequest::~VRGetSupportedLanguagesRequest() {}
void VRGetSupportedLanguagesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void VRGetSupportedLanguagesRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VR_GetSupportedLanguages);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
index 59602cf10a..72278fcddd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRGetSupportedLanguagesResponse::VRGetSupportedLanguagesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ VRGetSupportedLanguagesResponse::VRGetSupportedLanguagesResponse(
VRGetSupportedLanguagesResponse::~VRGetSupportedLanguagesResponse() {}
void VRGetSupportedLanguagesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -71,8 +73,8 @@ void VRGetSupportedLanguagesResponse::Run() {
std::vector<std::string> sections_to_update{hmi_response::languages};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vr, sections_to_update, message_->getSchema())) {
- LOG4CXX_ERROR(
- logger_, "Failed to save VR.GetSupportedLanguages response to cache");
+ SDL_LOG_ERROR(
+ "Failed to save VR.GetSupportedLanguages response to cache");
}
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
index f65f58f423..303e7a6843 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRIsReadyRequest::VRIsReadyRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,17 +56,17 @@ VRIsReadyRequest::VRIsReadyRequest(
VRIsReadyRequest::~VRIsReadyRequest() {}
void VRIsReadyRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribe_on_event(hmi_apis::FunctionID::VR_IsReady, correlation_id());
SendRequest();
}
void VRIsReadyRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::VR_IsReady: {
- LOG4CXX_DEBUG(logger_, "Received VR_IsReady event");
+ SDL_LOG_DEBUG("Received VR_IsReady event");
unsubscribe_from_event(hmi_apis::FunctionID::VR_IsReady);
const bool is_available = app_mngr::commands::ChangeInterfaceState(
application_manager_, message, HmiInterfaces::HMI_INTERFACE_VR);
@@ -74,8 +76,7 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) {
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_VR)) {
UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::vr);
- LOG4CXX_INFO(logger_,
- "HmiInterfaces::HMI_INTERFACE_VR isn't available");
+ SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_VR isn't available");
return;
}
@@ -83,7 +84,7 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc
index 373f97bf80..486cf32890 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRIsReadyResponse::VRIsReadyResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -51,7 +53,7 @@ VRIsReadyResponse::VRIsReadyResponse(
VRIsReadyResponse::~VRIsReadyResponse() {}
void VRIsReadyResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VR_IsReady);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
index 4257158f6a..db834f05a8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRPerformInteractionRequest::VRPerformInteractionRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ VRPerformInteractionRequest::VRPerformInteractionRequest(
VRPerformInteractionRequest::~VRPerformInteractionRequest() {}
void VRPerformInteractionRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc
index 16378ab55a..2622b4f493 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VRPerformInteractionResponse::VRPerformInteractionResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ VRPerformInteractionResponse::VRPerformInteractionResponse(
VRPerformInteractionResponse::~VRPerformInteractionResponse() {}
void VRPerformInteractionResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VR_PerformInteraction);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
index 1dbfc97458..6717f332f8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
@@ -36,6 +36,7 @@
#include "application_manager/application.h"
#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "utils/custom_string.h"
#include "utils/file_system.h"
#include "utils/helpers.h"
@@ -45,6 +46,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace custom_str = utils::custom_string;
AddCommandRequest::AddCommandRequest(
@@ -68,7 +71,7 @@ AddCommandRequest::AddCommandRequest(
AddCommandRequest::~AddCommandRequest() {}
void AddCommandRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RemoveCommand();
CommandRequestImpl::onTimeOut();
}
@@ -79,13 +82,13 @@ bool AddCommandRequest::Init() {
}
void AddCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -97,22 +100,26 @@ void AddCommandRequest::Run() {
application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(
- logger_, "MessageHelper::VerifyImage return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyImage return "
+ << verification_result);
SendResponse(false, verification_result);
return;
}
}
if (!((*message_)[strings::msg_params].keyExists(strings::cmd_id))) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA");
+ SDL_LOG_ERROR("INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
- if (app->FindCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asUInt())) {
- LOG4CXX_ERROR(logger_, "INVALID_ID");
+ const auto command_id = static_cast<uint32_t>(
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt());
+
+ const auto command = app->FindCommand(command_id);
+
+ if (smart_objects::SmartType_Null != command.getType()) {
+ SDL_LOG_ERROR("INVALID_ID");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -149,13 +156,13 @@ void AddCommandRequest::Run() {
}
if (!data_exist) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA");
+ SDL_LOG_ERROR("INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_, "Incoming add command has contains \t\n \\t \\n");
+ SDL_LOG_ERROR("Incoming add command has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -245,9 +252,9 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) {
[strings::menu_name]
.asString()) &&
(saved_parent_id == parent_id)) {
- LOG4CXX_INFO(logger_,
- "AddCommandRequest::CheckCommandName received"
- " command name already exist in same level menu");
+ SDL_LOG_INFO(
+ "AddCommandRequest::CheckCommandName received"
+ " command name already exist in same level menu");
return false;
}
}
@@ -279,9 +286,9 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) {
.asCustomString();
if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) {
- LOG4CXX_INFO(logger_,
- "AddCommandRequest::CheckCommandVRSynonym"
- " received command vr synonym already exist");
+ SDL_LOG_INFO(
+ "AddCommandRequest::CheckCommandVRSynonym"
+ " received command vr synonym already exist");
return false;
}
}
@@ -299,12 +306,12 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][strings::menu_params]
[hmi_request::parent_id]
.asInt();
- smart_objects::SmartObject* parent = app->FindSubMenu(parent_id);
+ smart_objects::SmartObject parent = app->FindSubMenu(parent_id);
- if (!parent) {
- LOG4CXX_INFO(logger_,
- "AddCommandRequest::CheckCommandParentId received"
- " submenu doesn't exist");
+ if (smart_objects::SmartType_Null == parent.getType()) {
+ SDL_LOG_INFO(
+ "AddCommandRequest::CheckCommandParentId received"
+ " submenu doesn't exist");
return false;
}
return true;
@@ -312,7 +319,7 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) {
// TODO(AKUTSAN) APPLINK-26973: Refactor AddCommandRequest
void AddCommandRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
@@ -321,7 +328,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -333,7 +340,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_AddCommand: {
- LOG4CXX_INFO(logger_, "Received UI_AddCommand event");
+ SDL_LOG_INFO("Received UI_AddCommand event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -345,7 +352,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::VR_AddCommand: {
- LOG4CXX_INFO(logger_, "Received VR_AddCommand event");
+ SDL_LOG_INFO("Received VR_AddCommand event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
is_vr_received_ = true;
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -357,7 +364,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event" << event.id());
return;
}
}
@@ -411,8 +418,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
(is_no_ui_error && is_vr_invalid_unsupported) ||
(is_no_vr_error && is_ui_invalid_unsupported);
- LOG4CXX_DEBUG(logger_,
- "calculated result " << ui_result_ << " " << is_no_ui_error
+ SDL_LOG_DEBUG("calculated result " << ui_result_ << " " << is_no_ui_error
<< " " << is_no_vr_error);
const bool is_vr_or_ui_warning =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
@@ -445,7 +451,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == vr_result_) {
result_code = MessageHelper::HMIToMobileResult(ui_result_);
}
- LOG4CXX_DEBUG(logger_, "HMIToMobileResult " << result_code);
+ SDL_LOG_DEBUG("HMIToMobileResult " << result_code);
}
if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) {
@@ -466,7 +472,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
application->RemoveCommand(cmd_id);
result = false;
- LOG4CXX_DEBUG(logger_, "Result " << result);
+ SDL_LOG_DEBUG("Result " << result);
}
}
@@ -481,7 +487,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
application->RemoveCommand(cmd_id);
result = false;
- LOG4CXX_DEBUG(logger_, "Result " << result);
+ SDL_LOG_DEBUG("Result " << result);
}
HmiInterfaces::InterfaceState ui_interface_state =
@@ -496,12 +502,12 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
HmiInterfaces::STATE_NOT_AVAILABLE == vr_interface_state) ||
(is_ui_unsupported &&
HmiInterfaces::STATE_NOT_AVAILABLE == ui_interface_state))) {
- LOG4CXX_DEBUG(logger_, "!BothSend() && is_vr_or_ui_unsupported");
+ SDL_LOG_DEBUG("!BothSend() && is_vr_or_ui_unsupported");
result = false;
}
if (is_vr_and_ui_unsupported) {
- LOG4CXX_DEBUG(logger_, "UI and VR interface both unsupported");
+ SDL_LOG_DEBUG("UI and VR interface both unsupported");
result = false;
}
@@ -524,7 +530,7 @@ bool AddCommandRequest::IsPendingResponseExist() {
}
bool AddCommandRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
@@ -532,7 +538,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
[strings::menu_name]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed.");
+ SDL_LOG_ERROR("Invalid menu name syntax check failed.");
return true;
}
}
@@ -545,7 +551,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::vr_commands][i]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_commands syntax check failed");
return true;
}
}
@@ -555,7 +561,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::cmd_icon][strings::value]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid cmd_icon value syntax check failed");
+ SDL_LOG_ERROR("Invalid cmd_icon value syntax check failed");
return true;
}
}
@@ -596,10 +602,10 @@ const std::string AddCommandRequest::GenerateMobileResponseInfo() {
}
void AddCommandRequest::RemoveCommand() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc
index 24ff3b5a28..6e8c589cb6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AddCommandResponse::AddCommandResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ AddCommandResponse::AddCommandResponse(
AddCommandResponse::~AddCommandResponse() {}
void AddCommandResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
index 71bf867054..288cafb94e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AddSubMenuRequest::AddSubMenuRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,12 +59,12 @@ AddSubMenuRequest::AddSubMenuRequest(
AddSubMenuRequest::~AddSubMenuRequest() {}
void AddSubMenuRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -77,16 +79,19 @@ void AddSubMenuRequest::Run() {
received_msg_params[strings::menu_icon], app, application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(
- logger_, "MessageHelper::VerifyImage return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyImage return "
+ << verification_result);
SendResponse(false, verification_result);
return;
}
}
const int32_t menu_id = received_msg_params[strings::menu_id].asInt();
- if (app->FindSubMenu(menu_id)) {
- LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found.");
+
+ const auto sub_menu = app->FindSubMenu(menu_id);
+
+ if (smart_objects::SmartType_Null != sub_menu.getType()) {
+ SDL_LOG_ERROR("Menu with id " << menu_id << " already exists.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -100,13 +105,13 @@ void AddSubMenuRequest::Run() {
: 0;
if (app->IsSubMenuNameAlreadyExist(menu_name, parent_id)) {
- LOG4CXX_ERROR(logger_, "Menu name " << menu_name << " is duplicated.");
+ SDL_LOG_ERROR("Menu name " << menu_name << " is duplicated.");
SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
return;
}
if (!CheckSubMenuName()) {
- LOG4CXX_ERROR(logger_, "Sub-menu name is not valid.");
+ SDL_LOG_ERROR("Sub-menu name is not valid.");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -146,7 +151,7 @@ void AddSubMenuRequest::Run() {
}
void AddSubMenuRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -164,7 +169,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -191,7 +196,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event" << event.id());
return;
}
}
@@ -203,12 +208,12 @@ bool AddSubMenuRequest::Init() {
}
bool AddSubMenuRequest::CheckSubMenuName() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::menu_name].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_INFO(logger_, "Invalid subMenu name.");
+ SDL_LOG_INFO("Invalid subMenu name.");
return false;
}
return true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc
index d91f13f1df..c9e8d1809f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AddSubMenuResponse::AddSubMenuResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ AddSubMenuResponse::AddSubMenuResponse(
AddSubMenuResponse::~AddSubMenuResponse() {}
void AddSubMenuResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
index 9f36f260ae..47b3a87d52 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AlertManeuverRequest::AlertManeuverRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,11 +58,11 @@ AlertManeuverRequest::AlertManeuverRequest(
AlertManeuverRequest::~AlertManeuverRequest() {}
void AlertManeuverRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if ((!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) &&
(!(*message_)[strings::msg_params].keyExists(strings::tts_chunks))) {
- LOG4CXX_ERROR(logger_, "AlertManeuverRequest::Request without parameters!");
+ SDL_LOG_ERROR("AlertManeuverRequest::Request without parameters!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -69,15 +71,15 @@ void AlertManeuverRequest::Run() {
(*message_)[strings::params][strings::connection_key].asUInt());
if (NULL == app.get()) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming alert maneuver has contains \\t\\n \\\\t \\\\n"
- "text contains only whitespace in ttsChunks");
+ SDL_LOG_ERROR(
+ "Incoming alert maneuver has contains \\t\\n \\\\t \\\\n"
+ "text contains only whitespace in ttsChunks");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -91,7 +93,7 @@ void AlertManeuverRequest::Run() {
application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!");
+ SDL_LOG_ERROR("Wrong soft buttons parameters!");
SendResponse(false, processing_result);
return;
}
@@ -107,9 +109,8 @@ void AlertManeuverRequest::Run() {
MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_chunks are not present");
@@ -154,12 +155,12 @@ void AlertManeuverRequest::Run() {
}
void AlertManeuverRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
hmi_apis::FunctionID::eType event_id = event.id();
switch (event_id) {
case hmi_apis::FunctionID::Navigation_AlertManeuver: {
- LOG4CXX_INFO(logger_, "Received Navigation_AlertManeuver event");
+ SDL_LOG_INFO("Received Navigation_AlertManeuver event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
pending_requests_.Remove(event_id);
navi_alert_maneuver_result_code_ =
@@ -169,7 +170,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
- LOG4CXX_INFO(logger_, "Received TTS_Speak event");
+ SDL_LOG_INFO("Received TTS_Speak event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
pending_requests_.Remove(event_id);
tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -178,24 +179,24 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event");
+ SDL_LOG_INFO("Received TTS_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
SendResponse(
- false, mobile_apis::Result::INVALID_ENUM, "Received unknown event");
+ false, mobile_apis::Result::INVALID_ENUM, "Received unknown event ");
return;
}
}
if (!pending_requests_.IsFinal(event_id)) {
- LOG4CXX_DEBUG(logger_,
- "There are some pending responses from HMI."
- "AlertManeuverRequest still waiting.");
+ SDL_LOG_DEBUG(
+ "There are some pending responses from HMI. "
+ "AlertManeuverRequest still waiting.");
return;
}
std::string return_info;
@@ -214,7 +215,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
bool AlertManeuverRequest::PrepareResponseParameters(
mobile_apis::Result::eType& result_code, std::string& return_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
app_mngr::commands::ResponseInfo navigation_alert_info(
@@ -246,7 +247,7 @@ bool AlertManeuverRequest::PrepareResponseParameters(
}
bool AlertManeuverRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using smart_objects::SmartArray;
if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
@@ -258,7 +259,7 @@ bool AlertManeuverRequest::IsWhiteSpaceExist() {
for (; it_tts_chunk != tts_chunks_arr->end(); ++it_tts_chunk) {
const char* tts_chunk_text = (*it_tts_chunk)[strings::text].asCharArray();
if (strlen(tts_chunk_text) && !CheckSyntax(tts_chunk_text)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_chunks syntax check failed");
return true;
}
}
@@ -277,7 +278,7 @@ bool AlertManeuverRequest::IsWhiteSpaceExist() {
const char* soft_button_text =
(*it_soft_button)[strings::text].asCharArray();
if (!CheckSyntax(soft_button_text)) {
- LOG4CXX_ERROR(logger_, "Invalid soft_buttons syntax check failed");
+ SDL_LOG_ERROR("Invalid soft_buttons syntax check failed");
return true;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
index 97c93d7455..993dc75548 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AlertManeuverResponse::AlertManeuverResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ AlertManeuverResponse::AlertManeuverResponse(
AlertManeuverResponse::~AlertManeuverResponse() {}
void AlertManeuverResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index a0544ee444..55783be4cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -47,6 +47,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AlertRequest::AlertRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -81,9 +83,9 @@ bool AlertRequest::Init() {
// If soft buttons are present, SDL will not use initiate timeout tracking for
// response.
if (msg_params.keyExists(strings::soft_buttons)) {
- LOG4CXX_INFO(logger_,
- "Request contains soft buttons - request timeout "
- "will be set to 0.");
+ SDL_LOG_INFO(
+ "Request contains soft buttons - request timeout "
+ "will be set to 0.");
default_timeout_ = 0;
}
@@ -91,7 +93,7 @@ bool AlertRequest::Init() {
}
void AlertRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id =
(*message_)[strings::params][strings::connection_key].asInt();
@@ -122,24 +124,24 @@ void AlertRequest::Run() {
}
void AlertRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::TTS_OnResetTimeout:
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_INFO(logger_,
- "Received UI_OnResetTimeout event "
- " or TTS_OnResetTimeout event"
- << awaiting_tts_speak_response_ << " "
- << awaiting_tts_stop_speaking_response_ << " "
- << awaiting_ui_alert_response_);
+ SDL_LOG_INFO(
+ "Received UI_OnResetTimeout event "
+ " or TTS_OnResetTimeout event "
+ << awaiting_tts_speak_response_ << " "
+ << awaiting_tts_stop_speaking_response_ << " "
+ << awaiting_ui_alert_response_);
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::UI_Alert: {
- LOG4CXX_INFO(logger_, "Received UI_Alert event");
+ SDL_LOG_INFO("Received UI_Alert event");
// Unsubscribe from event to avoid unwanted messages
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
unsubscribe_from_event(hmi_apis::FunctionID::UI_Alert);
@@ -163,7 +165,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
- LOG4CXX_INFO(logger_, "Received TTS_Speak event");
+ SDL_LOG_INFO("Received TTS_Speak event");
// Unsubscribe from event to avoid unwanted messages
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak);
@@ -174,7 +176,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_StopSpeaking: {
- LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event");
+ SDL_LOG_INFO("Received TTS_StopSpeaking event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
// Unsubscribe from event to avoid unwanted messages
unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking);
@@ -182,7 +184,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
@@ -238,11 +240,11 @@ bool AlertRequest::PrepareResponseParameters(
}
bool AlertRequest::Validate(uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
@@ -252,7 +254,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::POLICY_TABLE)) {
- LOG4CXX_ERROR(logger_, "Alert frequency is too high.");
+ SDL_LOG_ERROR("Alert frequency is too high.");
SendResponse(false, mobile_apis::Result::REJECTED);
return false;
}
@@ -271,7 +273,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, processing_result);
return false;
}
@@ -281,7 +283,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
(!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) &&
(!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) &&
(1 > (*message_)[strings::msg_params][strings::tts_chunks].length()))) {
- LOG4CXX_ERROR(logger_, "Mandatory parameters are missing");
+ SDL_LOG_ERROR("Mandatory parameters are missing");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Mandatory parameters are missing");
@@ -295,9 +297,8 @@ bool AlertRequest::Validate(uint32_t app_id) {
MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_chunks are not present");
@@ -309,7 +310,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
}
void AlertRequest::SendAlertRequest(int32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(app_id);
smart_objects::SmartObject msg_params =
@@ -364,7 +365,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SDL_LOG_ERROR("Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -401,7 +402,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
void AlertRequest::SendSpeakRequest(int32_t app_id,
bool tts_chunks_exists,
size_t length_tts_chunks) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace smart_objects;
// crate HMI speak request
@@ -423,13 +424,13 @@ void AlertRequest::SendSpeakRequest(int32_t app_id,
}
bool AlertRequest::CheckStrings() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) {
str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_1 syntax check failed");
return false;
}
}
@@ -437,7 +438,7 @@ bool AlertRequest::CheckStrings() {
if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) {
str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_2 syntax check failed");
return false;
}
}
@@ -445,7 +446,7 @@ bool AlertRequest::CheckStrings() {
if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) {
str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_3 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_3 syntax check failed");
return false;
}
}
@@ -456,7 +457,7 @@ bool AlertRequest::CheckStrings() {
for (size_t i = 0; i < tts_chunks_array.length(); ++i) {
str = tts_chunks_array[i][strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_chunks text syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_chunks text syntax check failed");
return false;
}
}
@@ -465,7 +466,7 @@ bool AlertRequest::CheckStrings() {
}
bool AlertRequest::HasHmiResponsesToWait() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ ||
awaiting_tts_stop_speaking_response_;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
index b709d13958..1b8eebe7d7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AlertResponse::AlertResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,7 +59,7 @@ AlertResponse::AlertResponse(
AlertResponse::~AlertResponse() {}
void AlertResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
index 6873cb7bf1..27020f2719 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
@@ -41,6 +41,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CancelInteractionRequest::CancelInteractionRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ CancelInteractionRequest::CancelInteractionRequest(
CancelInteractionRequest::~CancelInteractionRequest() {}
void CancelInteractionRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto function_id = static_cast<mobile_apis::FunctionID::eType>(
(*message_)[strings::msg_params][strings::func_id].asInt());
@@ -69,7 +71,7 @@ void CancelInteractionRequest::Run() {
mobile_apis::FunctionID::SubtleAlertID,
mobile_apis::FunctionID::ScrollableMessageID,
mobile_apis::FunctionID::SliderID)) {
- LOG4CXX_ERROR(logger_, "Bad function ID" << function_id);
+ SDL_LOG_ERROR("Bad function ID " << function_id);
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -87,10 +89,10 @@ void CancelInteractionRequest::Run() {
}
void CancelInteractionRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (event.id() != hmi_apis::FunctionID::UI_CancelInteraction) {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc
index af73e72a6f..9adec06c9f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc
@@ -37,6 +37,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CancelInteractionResponse::CancelInteractionResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,9 +54,9 @@ CancelInteractionResponse::CancelInteractionResponse(
CancelInteractionResponse::~CancelInteractionResponse() {}
void CancelInteractionResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
} // namespace commands
-} // namespace sdl_rpc_plugin \ No newline at end of file
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
index 27cac83fad..8e13110515 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
@@ -59,6 +59,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ChangeRegistrationRequest::ChangeRegistrationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -144,19 +146,18 @@ void ChangeRegistrationRequest::SendUIRequest(
}
void ChangeRegistrationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_INFO(logger_,
- "Incoming request contains \t\n \\t \\n or whitespace");
+ SDL_LOG_INFO("Incoming request contains \t\n \\t \\n or whitespace");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -176,14 +177,14 @@ void ChangeRegistrationRequest::Run() {
if (false == (IsLanguageSupportedByUI(hmi_language) &&
IsLanguageSupportedByVR(language) &&
IsLanguageSupportedByTTS(language))) {
- LOG4CXX_ERROR(logger_, "Language is not supported");
+ SDL_LOG_ERROR("Language is not supported");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
if (msg_params.keyExists(strings::app_name) &&
!IsNicknameAllowed(msg_params[strings::app_name].asCustomString())) {
- LOG4CXX_ERROR(logger_, "Nickname is not allowed.");
+ SDL_LOG_ERROR("Nickname is not allowed.");
SendResponse(false, mobile_apis::Result::DISALLOWED);
return;
}
@@ -195,9 +196,8 @@ void ChangeRegistrationRequest::Run() {
MessageHelper::VerifyTtsFiles(tts_name, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_name are not present");
@@ -244,14 +244,14 @@ void ChangeRegistrationRequest::Run() {
}
void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
hmi_apis::FunctionID::eType event_id = event.id();
switch (event_id) {
case hmi_apis::FunctionID::UI_ChangeRegistration: {
- LOG4CXX_INFO(logger_, "Received UI_ChangeRegistration event");
+ SDL_LOG_INFO("Received UI_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
pending_requests_.Remove(event_id);
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -260,7 +260,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::VR_ChangeRegistration: {
- LOG4CXX_INFO(logger_, "Received VR_ChangeRegistration event");
+ SDL_LOG_INFO("Received VR_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
pending_requests_.Remove(event_id);
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -269,7 +269,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_ChangeRegistration: {
- LOG4CXX_INFO(logger_, "Received TTS_ChangeRegistration event");
+ SDL_LOG_INFO("Received TTS_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
pending_requests_.Remove(event_id);
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -278,7 +278,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event_id);
+ SDL_LOG_ERROR("Received unknown event " << event_id);
return;
}
}
@@ -288,7 +288,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -315,9 +315,9 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
response_info.empty() ? NULL : response_info.c_str(),
&(message[strings::msg_params]));
} else {
- LOG4CXX_INFO(logger_,
- "There are some pending responses from HMI."
- "ChangeRegistrationRequest still waiting.");
+ SDL_LOG_INFO(
+ "There are some pending responses from HMI."
+ "ChangeRegistrationRequest still waiting.");
}
}
@@ -331,7 +331,7 @@ void CheckInfo(std::string& str) {
bool ChangeRegistrationRequest::PrepareResponseParameters(
mobile_apis::Result::eType& result_code, std::string& response_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const bool is_tts_succeeded_unsupported =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
@@ -463,7 +463,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
const auto ui_languages = hmi_capabilities.ui_supported_languages();
if (!ui_languages) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return false;
}
@@ -473,7 +473,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
}
}
- LOG4CXX_ERROR(logger_, "Language isn't supported by UI");
+ SDL_LOG_ERROR("Language isn't supported by UI");
return false;
}
@@ -484,7 +484,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
const auto vr_languages = hmi_capabilities.vr_supported_languages();
if (!vr_languages) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return false;
}
@@ -494,7 +494,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
}
}
- LOG4CXX_ERROR(logger_, "Language isn't supported by VR");
+ SDL_LOG_ERROR("Language isn't supported by VR");
return false;
}
@@ -505,7 +505,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS(
const auto tts_languages = hmi_capabilities.tts_supported_languages();
if (!tts_languages) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return false;
}
@@ -516,7 +516,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS(
}
}
- LOG4CXX_ERROR(logger_, "Language isn't supported by TTS");
+ SDL_LOG_ERROR("Language isn't supported by TTS");
return false;
}
@@ -526,7 +526,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::app_name)) {
str = (*message_)[strings::msg_params][strings::app_name].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed");
+ SDL_LOG_ERROR("Invalid app_name syntax check failed");
return true;
}
}
@@ -541,7 +541,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
for (; it_tn != it_tn_end; ++it_tn) {
str = (*it_tn)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_name syntax check failed");
return true;
}
}
@@ -552,8 +552,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid ngn_media_screen_app_name syntax check failed");
+ SDL_LOG_ERROR("Invalid ngn_media_screen_app_name syntax check failed");
return true;
}
}
@@ -568,7 +567,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
for (; it_vs != it_vs_end; ++it_vs) {
str = (*it_vs).asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_synonyms syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_synonyms syntax check failed");
return true;
}
}
@@ -578,7 +577,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
const connection_handler::DeviceHandle& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -610,7 +609,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
const auto& cur_name = app->name();
if (msg_params.keyExists(strings::app_name)) {
if (app_name.CompareIgnoreCase(cur_name)) {
- LOG4CXX_ERROR(logger_, "Application name is known already.");
+ SDL_LOG_ERROR("Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
const auto vr = app->vr_synonyms();
@@ -619,7 +618,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
CoincidencePredicateVR v(app_name);
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
- LOG4CXX_ERROR(logger_, "Application name is known already.");
+ SDL_LOG_ERROR("Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
}
@@ -631,7 +630,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
- LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
+ SDL_LOG_ERROR("vr_synonyms duplicated with app_name .");
return mobile_apis::Result::DUPLICATE_NAME;
}
} // End vr check
@@ -646,11 +645,9 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
tts_curr->end(),
compare_tts_name);
if (it_tts != tts_array->end()) {
- LOG4CXX_ERROR(
- logger_,
- "TTS name: "
- << (*it_tts)[strings::text].asCustomString().AsMBString()
- << " is known already");
+ SDL_LOG_ERROR("TTS name: "
+ << (*it_tts)[strings::text].asCustomString().AsMBString()
+ << " is known already");
return mobile_apis::Result::DUPLICATE_NAME;
}
} // End tts check
@@ -661,13 +658,12 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
bool ChangeRegistrationRequest::IsNicknameAllowed(
const custom_str::CustomString& app_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
- "Can't find appication with connection key " << connection_key());
+ SDL_LOG_ERROR("Can't find appication with connection key "
+ << connection_key());
return false;
}
@@ -680,9 +676,8 @@ bool ChangeRegistrationRequest::IsNicknameAllowed(
policy_app_id, &app_nicknames, &app_hmi_types);
if (!init_result) {
- LOG4CXX_ERROR(logger_,
- "Error during getting of nickname list for application "
- << policy_app_id);
+ SDL_LOG_ERROR("Error during getting of nickname list for application "
+ << policy_app_id);
return false;
}
@@ -691,8 +686,7 @@ bool ChangeRegistrationRequest::IsNicknameAllowed(
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.");
+ SDL_LOG_WARN("Application name was not found in nicknames list.");
usage_statistics::AppCounter count_of_rejections_nickname_mismatch(
policy_handler_.GetStatisticManager(),
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc
index 78c60bc746..58bf5f4caa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ChangeRegistrationResponse::ChangeRegistrationResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ ChangeRegistrationResponse::ChangeRegistrationResponse(
ChangeRegistrationResponse::~ChangeRegistrationResponse() {}
void ChangeRegistrationResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
index 275f1d82a6..b4a09844f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
@@ -39,6 +39,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CloseApplicationRequest::CloseApplicationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,11 +56,11 @@ CloseApplicationRequest::CloseApplicationRequest(
CloseApplicationRequest::~CloseApplicationRequest() {}
void CloseApplicationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Application does not exist");
+ SDL_LOG_ERROR("Application does not exist");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -71,7 +73,7 @@ void CloseApplicationRequest::Run() {
}
void CloseApplicationRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
auto msg_params = message[strings::msg_params];
@@ -89,7 +91,7 @@ void CloseApplicationRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Application does not exist");
+ SDL_LOG_ERROR("Application does not exist");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
index 934804e1b1..a03c7a64f4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
@@ -38,6 +38,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CloseApplicationResponse::CloseApplicationResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ CloseApplicationResponse::CloseApplicationResponse(
CloseApplicationResponse::~CloseApplicationResponse() {}
void CloseApplicationResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
index 258aefd63f..d43e8e0710 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -39,6 +39,7 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "utils/gen_hash.h"
#include "utils/helpers.h"
@@ -47,6 +48,8 @@ const char* kInvalidImageWarningInfo = "Requested image(s) not found.";
namespace sdl_rpc_plugin {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
using namespace application_manager;
CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
@@ -68,16 +71,16 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
, is_timed_out_(false) {}
CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void CreateInteractionChoiceSetRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -105,7 +108,7 @@ void CreateInteractionChoiceSetRequest::Run() {
}
if (verification_result_image == Result::INVALID_DATA ||
verification_result_secondary_image == Result::INVALID_DATA) {
- LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SDL_LOG_ERROR("Image verification failed.");
SendResponse(false, Result::INVALID_DATA);
return;
} else if (verification_result_image == Result::WARNINGS ||
@@ -119,9 +122,10 @@ void CreateInteractionChoiceSetRequest::Run() {
(*message_)[strings::msg_params][strings::interaction_choice_set_id]
.asInt();
- if (app->FindChoiceSet(choice_set_id_)) {
- LOG4CXX_ERROR(logger_,
- "Choice set with id " << choice_set_id_ << " is not found.");
+ const auto choice_set = app->FindChoiceSet(choice_set_id_);
+
+ if (smart_objects::SmartType_Null != choice_set.getType()) {
+ SDL_LOG_ERROR("Choice set with id " << choice_set_id_ << " is not found.");
SendResponse(false, Result::INVALID_ID);
return;
}
@@ -160,7 +164,7 @@ void CreateInteractionChoiceSetRequest::Run() {
mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
ApplicationConstSharedPtr app) {
using namespace smart_objects;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::set<uint32_t> choice_id_set;
@@ -175,15 +179,14 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
choice_id_set.insert(
(*current_choice_set_it)[strings::choice_id].asInt());
if (!ins_res.second) {
- LOG4CXX_ERROR(logger_,
- "Choice with ID "
- << (*current_choice_set_it)[strings::choice_id].asInt()
- << " already exists");
+ SDL_LOG_ERROR("Choice with ID "
+ << (*current_choice_set_it)[strings::choice_id].asInt()
+ << " already exists");
return mobile_apis::Result::INVALID_ID;
}
if (IsWhiteSpaceExist(*current_choice_set_it)) {
- LOG4CXX_ERROR(logger_, "Incoming choice set has contains \t\n \\t \\n");
+ SDL_LOG_ERROR("Incoming choice set has contains \t\n \\t \\n");
return mobile_apis::Result::INVALID_DATA;
}
for (next_choice_set_it = current_choice_set_it + 1;
@@ -218,8 +221,8 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms(
CreateInteractionChoiceSetRequest::compareStr);
if (it != vr_cmds_1->end()) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Incoming choice set has duplicated VR synonyms " << it->asString());
return true;
}
@@ -235,19 +238,19 @@ bool CreateInteractionChoiceSetRequest::compareStr(
bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
const smart_objects::SmartObject& choice_set) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
str = choice_set[strings::menu_name].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid menu_name syntax check failed");
+ SDL_LOG_ERROR("Invalid menu_name syntax check failed");
return true;
}
if (choice_set.keyExists(strings::secondary_text)) {
str = choice_set[strings::secondary_text].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid secondary_text syntax check failed");
+ SDL_LOG_ERROR("Invalid secondary_text syntax check failed");
return true;
}
}
@@ -255,7 +258,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
if (choice_set.keyExists(strings::tertiary_text)) {
str = choice_set[strings::tertiary_text].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tertiary_text syntax check failed");
+ SDL_LOG_ERROR("Invalid tertiary_text syntax check failed");
return true;
}
}
@@ -266,7 +269,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
for (size_t i = 0; i < len; ++i) {
str = choice_set[strings::vr_commands][i].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_commands syntax check failed");
return true;
}
}
@@ -275,7 +278,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
if (choice_set.keyExists(strings::image)) {
str = choice_set[strings::image][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid image value syntax check failed");
+ SDL_LOG_ERROR("Invalid image value syntax check failed");
return true;
}
}
@@ -283,9 +286,9 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
if (choice_set.keyExists(strings::secondary_image)) {
str = choice_set[strings::secondary_image][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid secondary_image value. "
- "Syntax check failed");
+ SDL_LOG_ERROR(
+ "Invalid secondary_image value. "
+ "Syntax check failed");
return true;
}
}
@@ -294,7 +297,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist(
void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
application_manager::ApplicationSharedPtr const app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params];
smart_objects::SmartObject msg_params =
@@ -311,8 +314,7 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
{
sync_primitives::AutoLock error_lock(error_from_hmi_lock_);
if (error_from_hmi_) {
- LOG4CXX_WARN(logger_,
- "Error from HMI received. Stop sending VRCommands");
+ SDL_LOG_WARN("Error from HMI received. Stop sending VRCommands");
break;
}
}
@@ -332,19 +334,18 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
VRCommandInfo vr_command(vr_cmd_id);
sent_commands_map_[vr_corr_id] = vr_command;
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"VR_command sent corr_id " << vr_corr_id << " cmd_id " << vr_corr_id);
}
expected_chs_count_ = chs_num;
- LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_);
+ SDL_LOG_DEBUG("expected_chs_count_ = " << expected_chs_count_);
}
void CreateInteractionChoiceSetRequest::ProcessHmiError(
const hmi_apis::Common_Result::eType vr_result) {
- LOG4CXX_DEBUG(logger_,
- "Hmi response is not Success: "
- << vr_result << ". Stop sending VRAddCommand requests");
+ SDL_LOG_DEBUG("Hmi response is not Success: "
+ << vr_result << ". Stop sending VRAddCommand requests");
if (!error_from_hmi_) {
error_from_hmi_ = true;
std::string info =
@@ -359,7 +360,7 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse(
const uint32_t corr_id) {
SentCommandsMap::iterator it = sent_commands_map_.find(corr_id);
if (sent_commands_map_.end() == it) {
- LOG4CXX_WARN(logger_, "HMI response for unknown VR command received");
+ SDL_LOG_WARN("HMI response for unknown VR command received");
return false;
}
VRCommandInfo& vr_command = it->second;
@@ -369,14 +370,13 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse(
void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() {
received_chs_count_++;
- LOG4CXX_DEBUG(logger_,
- "Got VR.AddCommand response, there are "
- << expected_chs_count_ - received_chs_count_
- << " more to wait.");
+ SDL_LOG_DEBUG("Got VR.AddCommand response, there are "
+ << expected_chs_count_ - received_chs_count_
+ << " more to wait.");
if (received_chs_count_ < expected_chs_count_) {
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
- LOG4CXX_DEBUG(logger_, "Timeout for request was updated");
+ SDL_LOG_DEBUG("Timeout for request was updated");
} else {
OnAllHMIResponsesReceived();
}
@@ -386,7 +386,7 @@ void CreateInteractionChoiceSetRequest::on_event(
const event_engine::Event& event) {
using namespace hmi_apis;
using namespace helpers;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
const Common_Result::eType result = static_cast<Common_Result::eType>(
@@ -412,7 +412,7 @@ void CreateInteractionChoiceSetRequest::on_event(
}
void CreateInteractionChoiceSetRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!error_from_hmi_) {
SendResponse(false, mobile_apis::Result::GENERIC_ERROR);
@@ -420,6 +420,12 @@ void CreateInteractionChoiceSetRequest::onTimeOut() {
CommandRequestImpl::onTimeOut();
DeleteChoices();
+ auto& resume_ctrl = application_manager_.resume_controller();
+
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+
// We have to keep request alive until receive all responses from HMI
// according to SDLAQ-CRS-2976
sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_);
@@ -434,12 +440,12 @@ bool CreateInteractionChoiceSetRequest::Init() {
}
void CreateInteractionChoiceSetRequest::DeleteChoices() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
application->RemoveChoiceSet(choice_set_id_);
@@ -455,16 +461,15 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
msg_param[strings::cmd_id] = vr_command_info.cmd_id_;
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param);
} else {
- LOG4CXX_WARN(logger_,
- "succesful response has not been received for cmd_id = "
- << vr_command_info.cmd_id_);
+ SDL_LOG_WARN("succesful response has not been received for cmd_id = "
+ << vr_command_info.cmd_id_);
}
}
sent_commands_map_.clear();
}
void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!error_from_hmi_ && should_send_warnings_) {
SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc
index 43dba2f238..5b274adeb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,12 +58,12 @@ CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse(
CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {}
void CreateInteractionChoiceSetResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
if ((*message_)[strings::msg_params][strings::success].asBool() == false) {
- LOG4CXX_ERROR(logger_, "Success = false");
+ SDL_LOG_ERROR("Success = false");
SendResponse(false);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
index b69b0ee801..2a0ca4ddb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
@@ -45,6 +45,8 @@ using app_mngr::ApplicationSharedPtr;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CreateWindowRequest::CreateWindowRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -64,17 +66,15 @@ bool CreateWindowRequest::CheckWindowName(
const app_mngr::WindowID window_id,
const std::string& window_name) const {
if (mobile_apis::PredefinedWindows::PRIMARY_WIDGET == window_id) {
- LOG4CXX_DEBUG(logger_,
- "Window name check is ignored for the primary widgets");
+ SDL_LOG_DEBUG("Window name check is ignored for the primary widgets");
return true;
}
const bool names_are_equal = window_name == app->name().c_str();
if (names_are_equal &&
mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
- LOG4CXX_ERROR(logger_,
- "Regular widget can't have the same name as application: "
- << window_name);
+ SDL_LOG_ERROR("Regular widget can't have the same name as application: "
+ << window_name);
return false;
}
@@ -132,12 +132,12 @@ app_mngr::WindowID CreateWindowRequest::window_id() const {
}
void CreateWindowRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto application = application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -145,8 +145,7 @@ void CreateWindowRequest::Run() {
const auto window_id =
(*message_)[strings::msg_params][strings::window_id].asInt();
if (application->WindowIdExists(window_id)) {
- LOG4CXX_ERROR(logger_,
- "Window with id #" << window_id << " does already exist");
+ SDL_LOG_ERROR("Window with id #" << window_id << " does already exist");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -155,7 +154,7 @@ void CreateWindowRequest::Run() {
(*message_)[strings::msg_params][strings::window_type].asInt();
if (mobile_apis::WindowType::eType::MAIN == window_type) {
- LOG4CXX_ERROR(logger_, "MAIN application window already exists");
+ SDL_LOG_ERROR("MAIN application window already exists");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -167,8 +166,7 @@ void CreateWindowRequest::Run() {
[strings::duplicate_updates_from_window_id]
.asInt();
if (!application->WindowIdExists(duplicate_updates_from_window_id)) {
- LOG4CXX_ERROR(logger_,
- "Window with id #" << duplicate_updates_from_window_id
+ SDL_LOG_ERROR("Window with id #" << duplicate_updates_from_window_id
<< " does not exist");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
@@ -178,8 +176,7 @@ void CreateWindowRequest::Run() {
const std::string window_name =
(*message_)[strings::msg_params][strings::window_name].asString();
if (!CheckWindowName(application, window_id, window_name)) {
- LOG4CXX_ERROR(logger_,
- "Window name \"" << window_name
+ SDL_LOG_ERROR("Window name \"" << window_name
<< "\" is disallowed for window #"
<< window_id);
SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
@@ -198,22 +195,22 @@ void CreateWindowRequest::Run() {
}
void CreateWindowRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (hmi_apis::FunctionID::UI_CreateWindow != event.id()) {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
auto application = application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- LOG4CXX_INFO(logger_, "Received CreateWindow event");
+ SDL_LOG_INFO("Received CreateWindow event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
const smart_objects::SmartObject& response_message = event.smart_object();
@@ -226,7 +223,7 @@ void CreateWindowRequest::on_event(const event_engine::Event& event) {
GetInfo(response_message, response_info);
if (!is_success) {
- LOG4CXX_ERROR(logger_, "CreateWindow request has failed on HMI side");
+ SDL_LOG_ERROR("CreateWindow request has failed on HMI side");
SendResponse(is_success,
result_code,
response_info.empty() ? nullptr : response_info.c_str());
@@ -247,7 +244,7 @@ bool CreateWindowRequest::Init() {
bool CreateWindowRequest::IsWindowForAssociatedServiceCreated(
app_mngr::ApplicationSharedPtr app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto window_optional_params_map =
app->window_optional_params_map().GetData();
@@ -266,8 +263,7 @@ bool CreateWindowRequest::IsWindowForAssociatedServiceCreated(
window_optional_params_map.end(),
[&associated_service_type](
const std::pair<WindowID, smart_objects::SmartObjectSPtr>& element) {
- LOG4CXX_DEBUG(logger_,
- "Searching for " << associated_service_type
+ SDL_LOG_DEBUG("Searching for " << associated_service_type
<< " in window info for id "
<< element.first);
if (element.second->keyExists(strings::associated_service_type) &&
@@ -285,7 +281,7 @@ bool CreateWindowRequest::IsWindowForAssociatedServiceCreated(
bool CreateWindowRequest::DoesExceedMaxAllowedWindows(
app_mngr::ApplicationSharedPtr app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto get_current_number_of_windows =
[&app](const mobile_apis::WindowType::eType window_type) -> size_t {
@@ -298,7 +294,7 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows(
}
default: {
- LOG4CXX_WARN(logger_, "Unknown window type");
+ SDL_LOG_WARN("Unknown window type");
return 0u;
}
}
@@ -313,7 +309,7 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows(
}
if (!display_capabilities) {
- LOG4CXX_WARN(logger_, "Application has no capabilities");
+ SDL_LOG_WARN("Application has no capabilities");
return false;
}
@@ -337,7 +333,7 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows(
});
if (find_res == windowTypeSupported->end()) {
- LOG4CXX_WARN(logger_, "Requested Window Type is not supported by the HMI");
+ SDL_LOG_WARN("Requested Window Type is not supported by the HMI");
return true;
}
@@ -351,11 +347,11 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows(
bool CreateWindowRequest::ValidateWindowCreation(
app_mngr::ApplicationSharedPtr app, const WindowID window_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (DoesExceedMaxAllowedWindows(app)) {
std::string info("Maximum allowed amount of windows is exceeded");
- LOG4CXX_WARN(logger_, info);
+ SDL_LOG_WARN(info);
SendResponse(false, mobile_apis::Result::REJECTED, info.c_str());
return false;
}
@@ -363,7 +359,7 @@ bool CreateWindowRequest::ValidateWindowCreation(
if (IsWindowForAssociatedServiceCreated(app)) {
std::string info(
"Window for this associated service type is already created");
- LOG4CXX_WARN(logger_, info);
+ SDL_LOG_WARN(info);
SendResponse(false, mobile_apis::Result::REJECTED, info.c_str());
return false;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc
index 0d9bbc2815..830539b355 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CreateWindowResponse::CreateWindowResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ CreateWindowResponse::CreateWindowResponse(
CreateWindowResponse::~CreateWindowResponse() {}
void CreateWindowResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
index 2d28d686bb..9704d43ba7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
@@ -44,6 +44,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteCommandRequest::DeleteCommandRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -65,13 +67,13 @@ DeleteCommandRequest::DeleteCommandRequest(
DeleteCommandRequest::~DeleteCommandRequest() {}
void DeleteCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -79,10 +81,10 @@ void DeleteCommandRequest::Run() {
const int32_t cmd_id =
(*message_)[strings::msg_params][strings::cmd_id].asInt();
- smart_objects::SmartObject* command = application->FindCommand(cmd_id);
+ smart_objects::SmartObject command = application->FindCommand(cmd_id);
- if (!command) {
- LOG4CXX_ERROR(logger_, "Command with id " << cmd_id << " is not found.");
+ if (smart_objects::SmartType::SmartType_Null == command.getType()) {
+ SDL_LOG_ERROR("Command with id " << cmd_id << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -96,20 +98,20 @@ void DeleteCommandRequest::Run() {
// we should specify amount of required responses in the 1st request
uint32_t chaining_counter = 0;
- if ((*command).keyExists(strings::menu_params)) {
+ if (command.keyExists(strings::menu_params)) {
++chaining_counter;
}
- if ((*command).keyExists(strings::vr_commands)) {
+ if (command.keyExists(strings::vr_commands)) {
++chaining_counter;
}
/* Need to set all flags before sending request to HMI
* for correct processing this flags in method on_event */
- if ((*command).keyExists(strings::menu_params)) {
+ if (command.keyExists(strings::menu_params)) {
is_ui_send_ = true;
}
// check vr params
- if ((*command).keyExists(strings::vr_commands)) {
+ if (command.keyExists(strings::vr_commands)) {
is_vr_send_ = true;
}
if (is_ui_send_) {
@@ -142,17 +144,17 @@ bool DeleteCommandRequest::PrepareResponseParameters(
ui_delete_info, ui_info_, vr_delete_info, vr_info_);
if (is_vr_or_ui_warning && !ui_delete_info.is_unsupported_resource &&
!vr_delete_info.is_unsupported_resource) {
- LOG4CXX_DEBUG(logger_, "VR or UI result is warning");
+ SDL_LOG_DEBUG("VR or UI result is warning");
result_code = mobile_apis::Result::WARNINGS;
return result;
}
result_code = PrepareResultCodeForResponse(ui_delete_info, vr_delete_info);
- LOG4CXX_DEBUG(logger_, "Result is " << (result ? "true" : "false"));
+ SDL_LOG_DEBUG("Result is " << (result ? "true" : "false"));
return result;
}
void DeleteCommandRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -161,9 +163,8 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- LOG4CXX_DEBUG(logger_,
- "Received UI_DeleteCommand event with result "
- << EnumToString(ui_result_));
+ SDL_LOG_DEBUG("Received UI_DeleteCommand event with result "
+ << EnumToString(ui_result_));
GetInfo(message, ui_info_);
break;
}
@@ -172,20 +173,19 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
is_vr_received_ = true;
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- LOG4CXX_DEBUG(logger_,
- "Received VR_DeleteCommand event with result "
- << EnumToString(vr_result_));
+ SDL_LOG_DEBUG("Received VR_DeleteCommand event with result "
+ << EnumToString(vr_result_));
GetInfo(message, vr_info_);
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event" << event.id());
return;
}
}
if (IsPendingResponseExist()) {
- LOG4CXX_DEBUG(logger_, "Still awaiting for other responses.");
+ SDL_LOG_DEBUG("Still awaiting for other responses.");
return;
}
@@ -193,18 +193,17 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
const uint32_t cmd_id = msg_params[strings::cmd_id].asUInt();
- smart_objects::SmartObject* command = application->FindCommand(cmd_id);
+ const auto command = application->FindCommand(cmd_id);
- if (!command) {
- LOG4CXX_ERROR(logger_,
- "Command id " << cmd_id
+ if (smart_objects::SmartType_Null == command.getType()) {
+ SDL_LOG_ERROR("Command id " << cmd_id
<< " not found for "
"application with connection key "
<< connection_key());
@@ -227,7 +226,7 @@ bool DeleteCommandRequest::Init() {
}
bool DeleteCommandRequest::IsPendingResponseExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc
index 919385ee50..80497241e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteCommandResponse::DeleteCommandResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ DeleteCommandResponse::DeleteCommandResponse(
DeleteCommandResponse::~DeleteCommandResponse() {}
void DeleteCommandResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
index 46af8353b7..127843813c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteFileRequest::DeleteFileRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,14 +59,14 @@ DeleteFileRequest::DeleteFileRequest(
DeleteFileRequest::~DeleteFileRequest() {}
void DeleteFileRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
@@ -75,8 +77,7 @@ void DeleteFileRequest::Run() {
application->delete_file_in_none_count())) {
// If application is in the HMI_NONE level the quantity of allowed
// DeleteFile request is limited by the configuration profile
- LOG4CXX_ERROR(logger_,
- "Too many requests from the app with HMILevel HMI_NONE ");
+ SDL_LOG_ERROR("Too many requests from the app with HMILevel HMI_NONE");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -86,7 +87,7 @@ void DeleteFileRequest::Run() {
if (!file_system::IsFileNameValid(sync_file_name)) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
- LOG4CXX_ERROR(logger_, err_msg);
+ SDL_LOG_ERROR(err_msg);
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc
index 732a1e56b5..7f9181e29a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteFileResponse::DeleteFileResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,12 +57,12 @@ DeleteFileResponse::DeleteFileResponse(
DeleteFileResponse::~DeleteFileResponse() {}
void DeleteFileResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id =
(*message_)[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application not registered");
+ SDL_LOG_ERROR("Application not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
index 7950595b1c..d8b74eb770 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,13 +60,13 @@ DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest(
DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {}
void DeleteInteractionChoiceSetRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"No application associated with connection key " << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
@@ -74,15 +76,16 @@ void DeleteInteractionChoiceSetRequest::Run() {
(*message_)[strings::msg_params][strings::interaction_choice_set_id]
.asInt();
- if (!app->FindChoiceSet(choice_set_id)) {
- LOG4CXX_ERROR(logger_,
- "Choice set with id " << choice_set_id << " is not found.");
+ const auto choice_set = app->FindChoiceSet(choice_set_id);
+
+ if (smart_objects::SmartType_Null == choice_set.getType()) {
+ SDL_LOG_ERROR("Choice set with id " << choice_set_id << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
if (ChoiceSetInUse(app)) {
- LOG4CXX_ERROR(logger_, "Choice set currently in use.");
+ SDL_LOG_ERROR("Choice set currently in use.");
SendResponse(false, mobile_apis::Result::IN_USE);
return;
}
@@ -108,7 +111,7 @@ bool DeleteInteractionChoiceSetRequest::Init() {
bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(
ApplicationConstSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app->is_perform_interaction_active()) {
return false;
}
@@ -126,8 +129,7 @@ bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(
PerformChoice::const_iterator choice_it = choice.begin();
for (; choice.end() != choice_it; ++choice_it) {
if (choice_it->first == choice_set_id) {
- LOG4CXX_ERROR(logger_,
- "Choice set with id " << choice_set_id << " is in use.");
+ SDL_LOG_ERROR("Choice set with id " << choice_set_id << " is in use.");
return true;
}
}
@@ -137,17 +139,16 @@ bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(
void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand(
application_manager::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t choice_set_id =
(*message_)[strings::msg_params][strings::interaction_choice_set_id]
.asUInt();
- smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_set_id);
+ smart_objects::SmartObject choice_set = app->FindChoiceSet(choice_set_id);
- if (!choice_set) {
- LOG4CXX_ERROR(logger_,
- "Choice set with id " << choice_set_id << " is not found.");
+ if (smart_objects::SmartType_Null == choice_set.getType()) {
+ SDL_LOG_ERROR("Choice set with id " << choice_set_id << " is not found.");
return;
}
@@ -155,10 +156,10 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand(
smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = app->app_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
- msg_params[strings::grammar_id] = (*choice_set)[strings::grammar_id];
- choice_set = &((*choice_set)[strings::choice_set]);
- for (uint32_t i = 0; i < (*choice_set).length(); ++i) {
- msg_params[strings::cmd_id] = (*choice_set)[i][strings::choice_id];
+ msg_params[strings::grammar_id] = choice_set[strings::grammar_id];
+ choice_set = choice_set[strings::choice_set];
+ for (uint32_t i = 0; i < choice_set.length(); ++i) {
+ msg_params[strings::cmd_id] = choice_set[i][strings::choice_id];
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc
index cf5ad3a2c2..5aaa896b02 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,12 +59,12 @@ DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse(
DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {}
void DeleteInteractionChoiceSetResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
if ((*message_)[strings::msg_params][strings::success].asBool() == false) {
- LOG4CXX_ERROR(logger_, "Success = false");
+ SDL_LOG_ERROR("Success = false");
SendResponse(false);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
index 383daa9b83..19ec2dfb27 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
@@ -44,6 +44,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteSubMenuRequest::DeleteSubMenuRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -59,21 +61,23 @@ DeleteSubMenuRequest::DeleteSubMenuRequest(
DeleteSubMenuRequest::~DeleteSubMenuRequest() {}
void DeleteSubMenuRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
const int32_t menu_id =
(*message_)[strings::msg_params][strings::menu_id].asInt();
- if (!app->FindSubMenu(menu_id)) {
- LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found.");
+ const auto sub_menu = app->FindSubMenu(menu_id);
+
+ if (smart_objects::SmartType_Null == sub_menu.getType()) {
+ SDL_LOG_ERROR("Menu with id " << menu_id << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -92,13 +96,13 @@ void DeleteSubMenuRequest::Run() {
void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app,
uint32_t parentID,
const SubMenuMap& subMenus) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SubMenuMap::const_iterator it = subMenus.begin();
- LOG4CXX_DEBUG(logger_, "Delete Submenus with Parent ID: " << parentID);
+ SDL_LOG_DEBUG("Delete Submenus with Parent ID: " << parentID);
while (subMenus.end() != it) {
if (!(*it->second).keyExists(strings::parent_id)) {
- LOG4CXX_ERROR(logger_, "parent ID does not exist");
+ SDL_LOG_ERROR("parent ID does not exist");
++it;
continue;
}
@@ -114,7 +118,7 @@ void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app,
msg_params[strings::app_id] = app->app_id();
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params);
++it;
- LOG4CXX_DEBUG(logger_, "Removing submenuID: " << menuID);
+ SDL_LOG_DEBUG("Removing submenuID: " << menuID);
app->RemoveSubMenu(menuID);
} else {
++it;
@@ -124,7 +128,7 @@ void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app,
void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
ApplicationConstSharedPtr app, uint32_t parentID) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const DataAccessor<CommandsMap> accessor = app->commands_map();
const CommandsMap& commands = accessor.GetData();
@@ -151,15 +155,15 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
void DeleteSubMenuRequest::DeleteSubMenuUICommands(
ApplicationSharedPtr const app, uint32_t parentID) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Delete UI Commands with Parent ID: " << parentID);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Delete UI Commands with Parent ID: " << parentID);
const DataAccessor<CommandsMap> accessor(app->commands_map());
const CommandsMap& commands = accessor.GetData();
CommandsMap::const_iterator it = commands.begin();
while (commands.end() != it) {
if (!(*it->second).keyExists(strings::menu_params)) {
- LOG4CXX_ERROR(logger_, "menu_params not exist");
+ SDL_LOG_ERROR("menu_params not exist");
++it;
continue;
}
@@ -171,7 +175,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(
const uint32_t cmd_id = (*it->second)[strings::cmd_id].asUInt();
msg_params[strings::app_id] = app->app_id();
msg_params[strings::cmd_id] = cmd_id;
- LOG4CXX_DEBUG(logger_, "Removing UI Command: " << cmd_id);
+ SDL_LOG_DEBUG("Removing UI Command: " << cmd_id);
app->RemoveCommand(cmd_id);
app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false);
it = commands.begin(); // Can not relay on
@@ -185,7 +189,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(
}
void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -203,7 +207,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -227,7 +231,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event" << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc
index 3cefef5c38..25c4dc7cb9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteSubMenuResponse::DeleteSubMenuResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ DeleteSubMenuResponse::DeleteSubMenuResponse(
DeleteSubMenuResponse::~DeleteSubMenuResponse() {}
void DeleteSubMenuResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
index 7f253e25fd..214a9c2bab 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteWindowRequest::DeleteWindowRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,13 +60,12 @@ bool DeleteWindowRequest::CheckWindowId(
const WindowID window_id =
(*message_)[strings::msg_params][strings::window_id].asInt();
if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) {
- LOG4CXX_ERROR(logger_, "Main application window can't be deleted");
+ SDL_LOG_ERROR("Main application window can't be deleted");
return false;
}
if (!app->WindowIdExists(window_id)) {
- LOG4CXX_ERROR(logger_,
- "Window with id #" << window_id << " does not exist");
+ SDL_LOG_ERROR("Window with id #" << window_id << " does not exist");
return false;
}
@@ -85,13 +86,13 @@ void DeleteWindowRequest::DeleteWindow(
}
void DeleteWindowRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -109,10 +110,10 @@ void DeleteWindowRequest::Run() {
}
void DeleteWindowRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (hmi_apis::FunctionID::UI_DeleteWindow != event.id()) {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
@@ -120,12 +121,12 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- LOG4CXX_INFO(logger_, "Received DeleteWindow event");
+ SDL_LOG_INFO("Received DeleteWindow event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
const smart_objects::SmartObject& response_message = event.smart_object();
@@ -138,7 +139,7 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) {
GetInfo(response_message, response_info);
if (!is_success) {
- LOG4CXX_ERROR(logger_, "DeleteWindow request has failed on HMI side");
+ SDL_LOG_ERROR("DeleteWindow request has failed on HMI side");
SendResponse(is_success,
result_code,
response_info.empty() ? nullptr : response_info.c_str());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc
index f9ac9a46d6..1703623a38 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DeleteWindowResponse::DeleteWindowResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ DeleteWindowResponse::DeleteWindowResponse(
DeleteWindowResponse::~DeleteWindowResponse() {}
void DeleteWindowResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
index 1de7a3ea03..f0ef2e0028 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DialNumberRequest::DialNumberRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ DialNumberRequest::DialNumberRequest(
DialNumberRequest::~DialNumberRequest() {}
bool DialNumberRequest::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
default_timeout_ = 0;
@@ -64,13 +66,13 @@ bool DialNumberRequest::Init() {
}
void DialNumberRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -78,15 +80,14 @@ void DialNumberRequest::Run() {
std::string number =
(*message_)[strings::msg_params][strings::number].asString();
if (!CheckSyntax(number)) {
- LOG4CXX_ERROR(logger_, "Invalid incoming data");
+ SDL_LOG_ERROR("Invalid incoming data");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
StripNumberParam(number);
if (number.empty()) {
- LOG4CXX_ERROR(logger_,
- "After strip number param is empty. Invalid incoming data");
+ SDL_LOG_ERROR("After strip number param is empty. Invalid incoming data");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -102,12 +103,12 @@ void DialNumberRequest::Run() {
}
void DialNumberRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -115,7 +116,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) {
mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
switch (event.id()) {
case hmi_apis::FunctionID::BasicCommunication_DialNumber: {
- LOG4CXX_INFO(logger_, "Received DialNumber event");
+ SDL_LOG_INFO("Received DialNumber event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication);
result_code = CommandRequestImpl::GetMobileResultCode(
static_cast<hmi_apis::Common_Result::eType>(
@@ -123,7 +124,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc
index 4385b3fe90..4bbe5e2eb7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DialNumberResponse::DialNumberResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ DialNumberResponse::DialNumberResponse(
DialNumberResponse::~DialNumberResponse() {}
void DialNumberResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
index 66ff7b48d5..f5506503e9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
EndAudioPassThruRequest::EndAudioPassThruRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,14 +56,14 @@ EndAudioPassThruRequest::EndAudioPassThruRequest(
EndAudioPassThruRequest::~EndAudioPassThruRequest() {}
void EndAudioPassThruRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_EndAudioPassThru, NULL, true);
}
void EndAudioPassThruRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -89,7 +91,7 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc
index 6c9bd05e09..8e5672bfd9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
EndAudioPassThruResponse::EndAudioPassThruResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ EndAudioPassThruResponse::EndAudioPassThruResponse(
EndAudioPassThruResponse::~EndAudioPassThruResponse() {}
void EndAudioPassThruResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
index c5e94da378..585636bfa8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
@@ -6,6 +6,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -21,11 +23,11 @@ GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest(
GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {}
void GetCloudAppPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -83,7 +85,7 @@ void GetCloudAppPropertiesRequest::Run() {
void GetCloudAppPropertiesRequest::on_event(
const app_mngr::event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "GetCloudAppPropertiesRequest on_event");
+ SDL_LOG_INFO("GetCloudAppPropertiesRequest on_event");
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
index f50897303a..35bdaaeb44 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
@@ -7,6 +7,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -22,7 +24,7 @@ GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse(
GetCloudAppPropertiesResponse::~GetCloudAppPropertiesResponse() {}
void GetCloudAppPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
index 75263494c2..620d901f3c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
@@ -59,6 +59,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetFileRequest::GetFileRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -85,8 +87,7 @@ bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) {
if ((*message_)[strings::msg_params].keyExists(strings::app_service_id)) {
std::string service_id =
(*message_)[strings::msg_params][strings::app_service_id].asString();
- LOG4CXX_DEBUG(logger_,
- "Finding storage directory for service id: " << service_id);
+ SDL_LOG_DEBUG("Finding storage directory for service id: " << service_id);
AppService* app_service_info =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
@@ -101,7 +102,7 @@ bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) {
return false;
}
} else {
- LOG4CXX_DEBUG(logger_, "Using current storage directory");
+ SDL_LOG_DEBUG("Using current storage directory");
}
ApplicationSharedPtr app = application_manager_.application(connect_key);
@@ -110,15 +111,15 @@ bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) {
}
void GetFileRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "Received GetFile request");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_INFO("Received GetFile request");
ApplicationSharedPtr app = application_manager_.application(connection_key());
smart_objects::SmartObject response_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -126,8 +127,7 @@ void GetFileRequest::Run() {
file_name_ = (*message_)[strings::msg_params][strings::file_name].asString();
if (!file_system::IsFileNameValid(file_name_)) {
- LOG4CXX_ERROR(logger_,
- "File name " << file_name_ << " contains forbidden symbols.");
+ SDL_LOG_ERROR("File name " << file_name_ << " contains forbidden symbols.");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"File name contains forbidden symbols",
@@ -136,7 +136,7 @@ void GetFileRequest::Run() {
}
// Initialize other params with default values. If exists overwrite the values
- LOG4CXX_DEBUG(logger_, "Intialize non manadatory params with default values");
+ SDL_LOG_DEBUG("Intialize non manadatory params with default values");
if ((*message_)[strings::msg_params].keyExists(strings::file_type)) {
file_type_ = static_cast<mobile_apis::FileType::eType>(
@@ -145,13 +145,13 @@ void GetFileRequest::Run() {
// Check if file exists on system (may have to use app service id to get the
// correct app folder)
- LOG4CXX_DEBUG(logger_, "Check if file exists on system");
+ SDL_LOG_DEBUG("Check if file exists on system");
std::string file_path;
bool forward_to_hmi;
if (GetFilePath(file_path, forward_to_hmi)) {
if (forward_to_hmi) {
- LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI");
+ SDL_LOG_DEBUG("Forwarding GetFile request to HMI");
application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
correlation_id());
SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath,
@@ -160,7 +160,7 @@ void GetFileRequest::Run() {
return;
}
} else {
- LOG4CXX_ERROR(logger_, "Could not get file path");
+ SDL_LOG_ERROR("Could not get file path");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Could not get file path",
@@ -170,7 +170,7 @@ void GetFileRequest::Run() {
const std::string full_path = file_path + "/" + file_name_;
if (!file_system::FileExists(full_path)) {
- LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SDL_LOG_ERROR("File " << full_path << " does not exist");
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"File does not exist",
@@ -179,7 +179,7 @@ void GetFileRequest::Run() {
}
// Handle offset
- LOG4CXX_DEBUG(logger_, "Handle offset and length parameters");
+ SDL_LOG_DEBUG("Handle offset and length parameters");
const uint64_t file_size = file_system::FileSize(full_path);
if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
@@ -195,9 +195,8 @@ void GetFileRequest::Run() {
}
if (offset_ > file_size) {
- LOG4CXX_ERROR(
- logger_,
- "Offset " << offset_ << " greater than file size " << file_size);
+ SDL_LOG_ERROR("Offset " << offset_ << " greater than file size "
+ << file_size);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Offset greater than file size",
@@ -205,8 +204,7 @@ void GetFileRequest::Run() {
return;
}
if (length_ > file_size - offset_) {
- LOG4CXX_ERROR(logger_,
- "Length " << length_ << " greater than file size - offset"
+ SDL_LOG_ERROR("Length " << length_ << " greater than file size - offset"
<< file_size);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
@@ -216,10 +214,10 @@ void GetFileRequest::Run() {
}
// Load data from file as binary data
- LOG4CXX_DEBUG(logger_, "Load binary data from file");
+ SDL_LOG_DEBUG("Load binary data from file");
std::vector<uint8_t> bin_data;
if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
- LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SDL_LOG_ERROR("Failed to read from file: " << full_path);
SendResponse(false,
mobile_apis::Result::GENERIC_ERROR,
"Unable to read from file",
@@ -248,7 +246,7 @@ void GetFileRequest::Run() {
}
void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (hmi_apis::FunctionID::BasicCommunication_GetFilePath != event.id()) {
return;
@@ -287,7 +285,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
event_message[strings::msg_params][strings::file_path].asString();
if (!file_system::FileExists(full_path)) {
- LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SDL_LOG_ERROR("File " << full_path << " does not exist");
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"File does not exist",
@@ -309,9 +307,8 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
}
if (offset_ > file_size) {
- LOG4CXX_ERROR(
- logger_,
- "Offset " << offset_ << " greater than file size " << file_size);
+ SDL_LOG_ERROR("Offset " << offset_ << " greater than file size "
+ << file_size);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Offset greater than file size",
@@ -319,8 +316,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
return;
}
if (length_ > file_size - offset_) {
- LOG4CXX_ERROR(logger_,
- "Length " << length_ << " greater than file size - offset"
+ SDL_LOG_ERROR("Length " << length_ << " greater than file size - offset"
<< file_size);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
@@ -329,7 +325,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
return;
}
if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
- LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SDL_LOG_ERROR("Failed to read from file: " << full_path);
SendResponse(false,
mobile_apis::Result::GENERIC_ERROR,
"Failed to read from file",
@@ -341,7 +337,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
response_params[strings::crc32_check_sum] = crc_calculated;
} else {
- LOG4CXX_ERROR(logger_, "HMI did not return a file path: ");
+ SDL_LOG_ERROR("HMI did not return a file path: ");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"HMI did not return a file path",
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
index 2ea8dde02a..55f6e0b8a0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
@@ -39,6 +39,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetFileResponse::GetFileResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,8 +56,8 @@ GetFileResponse::GetFileResponse(
GetFileResponse::~GetFileResponse() {}
void GetFileResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "Sending GetFile response");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_INFO("Sending GetFile response");
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
index 8b557efc5d..1cd4806f7e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetSystemCapabilityRequest::GetSystemCapabilityRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,18 +59,18 @@ GetSystemCapabilityRequest::GetSystemCapabilityRequest(
GetSystemCapabilityRequest::~GetSystemCapabilityRequest() {}
void GetSystemCapabilityRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if ((*message_)[strings::msg_params].empty()) {
- LOG4CXX_ERROR(logger_, strings::msg_params << " is empty.");
+ SDL_LOG_ERROR(strings::msg_params << " is empty.");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -181,7 +183,7 @@ void GetSystemCapabilityRequest::Run() {
if (!capabilities) {
SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
- LOG4CXX_INFO(logger_, "system_display_capabilities are not available");
+ SDL_LOG_INFO("system_display_capabilities are not available");
return;
}
@@ -202,12 +204,10 @@ void GetSystemCapabilityRequest::Run() {
auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
if ((*message_)[app_mngr::strings::msg_params][strings::subscribe]
.asBool() == true) {
- LOG4CXX_DEBUG(logger_,
- "Subscribe to system capability: " << response_type);
+ SDL_LOG_DEBUG("Subscribe to system capability: " << response_type);
ext.SubscribeTo(response_type);
} else {
- LOG4CXX_DEBUG(logger_,
- "Unsubscribe from system capability: " << response_type);
+ SDL_LOG_DEBUG("Unsubscribe from system capability: " << response_type);
ext.UnsubscribeFrom(response_type);
}
}
@@ -224,7 +224,7 @@ void GetSystemCapabilityRequest::Run() {
}
void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "GetSystemCapabilityRequest on_event");
+ SDL_LOG_INFO("GetSystemCapabilityRequest on_event");
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc
index 5df0c72607..e20ea00a7b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetSystemCapabilityResponse::GetSystemCapabilityResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ GetSystemCapabilityResponse::GetSystemCapabilityResponse(
GetSystemCapabilityResponse::~GetSystemCapabilityResponse() {}
void GetSystemCapabilityResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
index cd7d7a37b7..33d3479941 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetWayPointsRequest::GetWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,14 +58,13 @@ GetWayPointsRequest::GetWayPointsRequest(
GetWayPointsRequest::~GetWayPointsRequest() {}
void GetWayPointsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "An application with connection key "
- << connection_key() << " is not registered.");
+ SDL_LOG_ERROR("An application with connection key "
+ << connection_key() << " is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -79,17 +80,17 @@ void GetWayPointsRequest::Run() {
}
void GetWayPointsRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event");
+ SDL_LOG_INFO("Received UI_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::Navigation_GetWayPoints: {
- LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event");
+ SDL_LOG_INFO("Received Navigation_GetWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -105,7 +106,7 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc
index e481c926b8..cbb9607d0d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetWayPointsResponse::GetWayPointsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ GetWayPointsResponse::GetWayPointsResponse(
GetWayPointsResponse::~GetWayPointsResponse() {}
void GetWayPointsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
index b8714b4784..9262466e34 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
@@ -44,6 +44,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ListFilesRequest::ListFilesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -59,14 +61,14 @@ ListFilesRequest::ListFilesRequest(
ListFilesRequest::~ListFilesRequest() {}
void ListFilesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
@@ -77,8 +79,7 @@ void ListFilesRequest::Run() {
application->list_files_in_none_count())) {
// If application is in the HMI_NONE level the quantity of allowed
// DeleteFile request is limited by the configuration profile
- LOG4CXX_ERROR(logger_,
- "Too many requests from the app with HMILevel HMI_NONE ");
+ SDL_LOG_ERROR("Too many requests from the app with HMILevel HMI_NONE ");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -97,11 +98,10 @@ void ListFilesRequest::Run() {
std::vector<std::string>::const_iterator it = persistent_files.begin();
for (; it != persistent_files.end(); ++it) {
if (i < application_manager_.get_settings().list_files_response_size()) {
- LOG4CXX_DEBUG(logger_, "File " + *it + " added to ListFiles response");
+ SDL_LOG_DEBUG("File " + *it + " added to ListFiles response");
(*message_)[strings::msg_params][strings::filenames][i++] = *it;
} else {
- LOG4CXX_DEBUG(logger_,
- "File " + *it + " not added to ListFiles response");
+ SDL_LOG_DEBUG("File " + *it + " not added to ListFiles response");
}
}
(*message_)[strings::params][strings::message_type] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc
index ffa8a443d5..e71c2de316 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ListFilesResponse::ListFilesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ ListFilesResponse::ListFilesResponse(
ListFilesResponse::~ListFilesResponse() {}
void ListFilesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc
index 5714043a51..96045552a0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc
@@ -39,6 +39,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAppInterfaceUnregisteredNotification::OnAppInterfaceUnregisteredNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,9 +57,17 @@ OnAppInterfaceUnregisteredNotification::
~OnAppInterfaceUnregisteredNotification() {}
void OnAppInterfaceUnregisteredNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
+
+ const bool final_message = IsFinalMessage();
+ SendNotification(final_message);
+}
- SendNotification();
+bool OnAppInterfaceUnregisteredNotification::IsFinalMessage() const {
+ using Reason = mobile_apis::AppInterfaceUnregisteredReason::eType;
+ const auto reason = static_cast<Reason>(
+ (*message_)[strings::msg_params][strings::reason].asInt());
+ return Reason::RESOURCE_CONSTRAINT == reason;
}
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc
index 3088c7df33..21a20c38c1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc
@@ -37,6 +37,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnAudioPassThruNotification::OnAudioPassThruNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -52,7 +54,7 @@ OnAudioPassThruNotification::OnAudioPassThruNotification(
OnAudioPassThruNotification::~OnAudioPassThruNotification() {}
void OnAudioPassThruNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
index 9c4be847a1..14787d0a08 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
@@ -43,6 +43,8 @@ namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnButtonEventNotification::OnButtonEventNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,7 +60,7 @@ OnButtonEventNotification::OnButtonEventNotification(
OnButtonEventNotification::~OnButtonEventNotification() {}
void OnButtonEventNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t btn_id = static_cast<uint32_t>(
(*message_)[strings::msg_params][hmi_response::button_name].asInt());
@@ -71,7 +73,7 @@ void OnButtonEventNotification::Run() {
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
if (!is_app_id_exists) {
- LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id.");
+ SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without app_id.");
return;
}
@@ -81,13 +83,12 @@ void OnButtonEventNotification::Run() {
// custom_button_id is mandatory for CUSTOM_BUTTON notification
if (false == (*message_)[strings::msg_params].keyExists(
hmi_response::custom_button_id)) {
- LOG4CXX_ERROR(logger_,
- "CUSTOM_BUTTON OnButtonEvent without custom_button_id.");
+ SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without custom_button_id.");
return;
}
if (!app) {
- LOG4CXX_ERROR(logger_, "Application doesn't exist.");
+ SDL_LOG_ERROR("Application doesn't exist.");
return;
}
@@ -97,8 +98,7 @@ void OnButtonEventNotification::Run() {
.asUInt();
if (false == app->IsSubscribedToSoftButton(custom_btn_id)) {
- LOG4CXX_ERROR(logger_,
- "Application doesn't subscribed to this custom_button_id.");
+ SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id.");
return;
}
@@ -106,9 +106,9 @@ void OnButtonEventNotification::Run() {
(*message_)[strings::msg_params][strings::window_id] = window_id;
const auto window_hmi_level = app->hmi_level(window_id);
if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
- LOG4CXX_WARN(logger_,
- "CUSTOM_BUTTON OnButtonEvent notification is not allowed in "
- "NONE hmi level");
+ SDL_LOG_WARN(
+ "CUSTOM_BUTTON OnButtonEvent notification is not allowed in "
+ "NONE hmi level");
return;
}
@@ -124,7 +124,7 @@ void OnButtonEventNotification::Run() {
for (; subscribed_apps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
- LOG4CXX_WARN(logger_, "Null pointer to subscribed app.");
+ SDL_LOG_WARN("Null pointer to subscribed app.");
continue;
}
@@ -134,9 +134,8 @@ void OnButtonEventNotification::Run() {
mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
(mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
- LOG4CXX_WARN(logger_,
- "OnButtonEvent notification is allowed only"
- << "in FULL or LIMITED hmi level");
+ SDL_LOG_WARN("OnButtonEvent notification is allowed only"
+ << "in FULL or LIMITED hmi level");
continue;
}
// if OK button and "app_id" absent send notification only in HMI_FULL mode
@@ -150,7 +149,7 @@ void OnButtonEventNotification::Run() {
void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
if (!app) {
- LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer");
+ SDL_LOG_ERROR("OnButtonEvent NULL pointer");
return;
}
@@ -158,7 +157,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
std::make_shared<smart_objects::SmartObject>();
if (!on_btn_event) {
- LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer");
+ SDL_LOG_ERROR("OnButtonEvent NULL pointer");
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
index 87d16e87e6..4444f0d156 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
@@ -44,6 +44,8 @@ namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnButtonPressNotification::OnButtonPressNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -59,7 +61,7 @@ OnButtonPressNotification::OnButtonPressNotification(
OnButtonPressNotification::~OnButtonPressNotification() {}
void OnButtonPressNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t btn_id = static_cast<uint32_t>(
(*message_)[strings::msg_params][hmi_response::button_name].asInt());
@@ -76,20 +78,19 @@ void OnButtonPressNotification::Run() {
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
if (!is_app_id_exists) {
- LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonPress without app_id.");
+ SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without app_id.");
return;
}
// custom_button_id is mandatory for CUSTOM_BUTTON notification
if (false == (*message_)[strings::msg_params].keyExists(
hmi_response::custom_button_id)) {
- LOG4CXX_ERROR(logger_,
- "CUSTOM_BUTTON OnButtonPress without custom_button_id.");
+ SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without custom_button_id.");
return;
}
if (!app) {
- LOG4CXX_ERROR(logger_, "Application doesn't exist.");
+ SDL_LOG_ERROR("Application doesn't exist.");
return;
}
@@ -99,8 +100,7 @@ void OnButtonPressNotification::Run() {
.asUInt();
if (false == app->IsSubscribedToSoftButton(custom_btn_id)) {
- LOG4CXX_ERROR(logger_,
- "Application doesn't subscribed to this custom_button_id.");
+ SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id.");
return;
}
@@ -110,9 +110,9 @@ void OnButtonPressNotification::Run() {
(*message_)[strings::msg_params][strings::window_id] = window_id;
const auto window_hmi_level = app->hmi_level(window_id);
if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
- LOG4CXX_WARN(logger_,
- "CUSTOM_BUTTON OnButtonPress notification is not allowed in "
- "NONE hmi level");
+ SDL_LOG_WARN(
+ "CUSTOM_BUTTON OnButtonPress notification is not allowed in "
+ "NONE hmi level");
return;
}
@@ -128,7 +128,7 @@ void OnButtonPressNotification::Run() {
for (; subscribed_apps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
- LOG4CXX_WARN(logger_, "Null pointer to subscribed app.");
+ SDL_LOG_WARN("Null pointer to subscribed app.");
continue;
}
@@ -138,9 +138,8 @@ void OnButtonPressNotification::Run() {
mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
(mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
- LOG4CXX_WARN(logger_,
- "OnButtonPress notification is allowed only"
- << "in FULL or LIMITED hmi level");
+ SDL_LOG_WARN("OnButtonPress notification is allowed only "
+ << "in FULL or LIMITED hmi level");
continue;
}
// if "appID" is present, send it to named app only if its FULL or
@@ -160,7 +159,7 @@ void OnButtonPressNotification::Run() {
void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
if (!app) {
- LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer");
+ SDL_LOG_ERROR("OnButtonPress NULL pointer");
return;
}
@@ -168,7 +167,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
std::make_shared<smart_objects::SmartObject>();
if (!on_btn_press) {
- LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer");
+ SDL_LOG_ERROR("OnButtonPress NULL pointer");
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc
index 9c7edf74e6..e973a546af 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc
@@ -39,6 +39,7 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
OnCommandNotification::OnCommandNotification(
const application_manager::commands::MessageSharedPtr& message,
@@ -55,21 +56,23 @@ OnCommandNotification::OnCommandNotification(
OnCommandNotification::~OnCommandNotification() {}
void OnCommandNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::msg_params][strings::app_id].asInt());
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
return;
}
const uint32_t cmd_id =
(*message_)[strings::msg_params][strings::cmd_id].asUInt();
- if (!app->FindCommand(cmd_id)) {
- LOG4CXX_ERROR(logger_, " No applications found for the command " << cmd_id);
+ const auto command = app->FindCommand(cmd_id);
+
+ if (smart_objects::SmartType_Null == command.getType()) {
+ SDL_LOG_ERROR(" No applications found for the command " << cmd_id);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc
index 42a1928f2e..960f9d9630 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc
@@ -43,6 +43,8 @@ namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnDriverDistractionNotification::OnDriverDistractionNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,7 +60,7 @@ OnDriverDistractionNotification::OnDriverDistractionNotification(
OnDriverDistractionNotification::~OnDriverDistractionNotification() {}
void OnDriverDistractionNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc
index c2ce2550b9..873e9f1788 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc
@@ -45,6 +45,8 @@ namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnHashChangeNotification::OnHashChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -60,7 +62,7 @@ OnHashChangeNotification::OnHashChangeNotification(
OnHashChangeNotification::~OnHashChangeNotification() {}
void OnHashChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
@@ -72,8 +74,7 @@ void OnHashChangeNotification::Run() {
(*message_)[strings::msg_params][strings::hash_id] = app->curHash();
SendNotification();
} else {
- LOG4CXX_WARN(logger_,
- "Application with app_id " << app_id << " does not exist");
+ SDL_LOG_WARN("Application with app_id " << app_id << " does not exist");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc
index df3bce0154..66a0fbb3f6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc
@@ -41,6 +41,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnHMIStatusNotification::OnHMIStatusNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,20 +58,20 @@ OnHMIStatusNotification::OnHMIStatusNotification(
OnHMIStatusNotification::~OnHMIStatusNotification() {}
void OnHMIStatusNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist");
+ SDL_LOG_ERROR("OnHMIStatusNotification application doesn't exist");
return;
}
// If the response has no hmi level, return and don't send the notification
if (!(*message_)[strings::msg_params].keyExists(strings::hmi_level)) {
// our notification clearly isn't well-formed
- LOG4CXX_ERROR(logger_, "OnHMIStatusNotification has no hmiLevel field");
+ SDL_LOG_ERROR("OnHMIStatusNotification has no hmiLevel field");
return;
}
@@ -82,8 +84,7 @@ 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");
+ SDL_LOG_INFO("OnHMIStatusNotification AddAppToTTSGlobalPropertiesList");
application_manager_.AddAppToTTSGlobalPropertiesList(app->app_id());
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
index 28325a40f5..2263e4b989 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
@@ -39,6 +39,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,15 +56,15 @@ OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile(
OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {}
void OnHMIStatusNotificationFromMobile::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (app.use_count() == 0) {
- LOG4CXX_ERROR(
- logger_, "OnHMIStatusNotificationFromMobile application doesn't exist");
+ SDL_LOG_ERROR(
+ "OnHMIStatusNotificationFromMobile application doesn't exist");
return;
}
@@ -79,9 +81,8 @@ void OnHMIStatusNotificationFromMobile::Run() {
bool is_apps_requested_before =
application_manager_.IsAppsQueriedFrom(handle);
- LOG4CXX_DEBUG(logger_,
- "Mobile HMI state notication came for connection key:"
- << connection_key() << " and handle: " << handle);
+ SDL_LOG_DEBUG("Mobile HMI state notification came for connection key: "
+ << connection_key() << " and handle: " << handle);
if (!is_apps_requested_before &&
Message::is_sufficient_version(
@@ -96,10 +97,10 @@ void OnHMIStatusNotificationFromMobile::Run() {
}
if (is_apps_requested_before) {
- LOG4CXX_DEBUG(logger_,
- "Remote apps list had been requested already "
- " for handle: "
- << handle);
+ SDL_LOG_DEBUG(
+ "Remote apps list had been requested already "
+ "for handle: "
+ << handle);
if (Message::is_sufficient_version(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
index 1c0609e17d..38f346ac5c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
@@ -43,6 +43,8 @@ namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnKeyBoardInputNotification::OnKeyBoardInputNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,7 +60,7 @@ OnKeyBoardInputNotification::OnKeyBoardInputNotification(
OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {}
void OnKeyBoardInputNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app_to_notify;
@@ -70,15 +72,14 @@ void OnKeyBoardInputNotification::Run() {
if (app->is_perform_interaction_active() &&
(*it)->perform_interaction_layout() ==
mobile_apis::LayoutMode::KEYBOARD) {
- LOG4CXX_INFO(logger_,
- "There is application with active PerformInteraction");
+ SDL_LOG_INFO("There is application with active PerformInteraction");
app_to_notify = app;
break;
}
if (mobile_apis::HMILevel::eType::HMI_FULL ==
app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
- LOG4CXX_INFO(logger_, "There is application in HMI_FULL level");
+ SDL_LOG_INFO("There is application in HMI_FULL level");
app_to_notify = app;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc
index 9605fd6074..363ea9bbc3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnLanguageChangeNotification::OnLanguageChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnLanguageChangeNotification::OnLanguageChangeNotification(
OnLanguageChangeNotification::~OnLanguageChangeNotification() {}
void OnLanguageChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc
index f64ca34bf2..7c0c27040d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnPermissionsChangeNotification::OnPermissionsChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ OnPermissionsChangeNotification::OnPermissionsChangeNotification(
OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {}
void OnPermissionsChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc
index ce1d1b16d1..6cbd391070 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSubtleAlertPressedNotification::OnSubtleAlertPressedNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,13 +55,13 @@ OnSubtleAlertPressedNotification::OnSubtleAlertPressedNotification(
OnSubtleAlertPressedNotification::~OnSubtleAlertPressedNotification() {}
void OnSubtleAlertPressedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::msg_params][strings::app_id].asInt());
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
index cc6ab7b65b..850aa64b5f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
@@ -13,6 +13,8 @@ using namespace application_manager;
namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSystemCapabilityUpdatedNotification::OnSystemCapabilityUpdatedNotification(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -29,7 +31,7 @@ OnSystemCapabilityUpdatedNotification::
~OnSystemCapabilityUpdatedNotification() {}
void OnSystemCapabilityUpdatedNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
const auto system_capability_type =
@@ -117,9 +119,8 @@ void OnSystemCapabilityUpdatedNotification::Run() {
app_services->end(),
matching_service_predicate);
if (it != app_services->end()) {
- LOG4CXX_DEBUG(
- logger_,
- "Replacing updated record with service_id " << service_id);
+ SDL_LOG_DEBUG("Replacing updated record with service_id "
+ << service_id);
app_services->erase(it);
}
app_services->push_back(updated_capabilities[i]);
@@ -136,11 +137,10 @@ void OnSystemCapabilityUpdatedNotification::Run() {
}
default: {
- LOG4CXX_ERROR(logger_,
- "Unknown system capability type: "
- << msg_params[strings::system_capability]
- [strings::system_capability_type]
- .asInt());
+ SDL_LOG_ERROR("Unknown system capability type: "
+ << msg_params[strings::system_capability]
+ [strings::system_capability_type]
+ .asInt());
return;
}
}
@@ -157,25 +157,35 @@ void OnSystemCapabilityUpdatedNotification::Run() {
[&system_capability_type,
&initial_connection_key](const ApplicationSharedPtr app) {
DCHECK_OR_RETURN(app, false);
- auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
- if (!ext.IsSubscribedTo(system_capability_type)) {
- LOG4CXX_DEBUG(logger_,
- "App " << app->app_id()
- << " is not subscribed to this capability type");
- return false;
- }
if (mobile_apis::SystemCapabilityType::DISPLAYS ==
system_capability_type &&
initial_connection_key > 0) {
- LOG4CXX_DEBUG(logger_,
- "Display capabilities notification for app "
- << initial_connection_key << " only");
+ SDL_LOG_DEBUG("Display capabilities notification for app "
+ << initial_connection_key << " only");
return app->app_id() == initial_connection_key;
}
- LOG4CXX_DEBUG(logger_,
- "App " << app->app_id()
+ auto ext_ptr = app->QueryInterface(
+ SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID);
+
+ if (!ext_ptr) {
+ SDL_LOG_DEBUG("App "
+ << app->app_id()
+ << " does not have SystemCapabilityAppExtension");
+ return false;
+ }
+
+ auto ext =
+ std::static_pointer_cast<SystemCapabilityAppExtension>(ext_ptr);
+
+ if (!ext->IsSubscribedTo(system_capability_type)) {
+ SDL_LOG_DEBUG("App " << app->app_id()
+ << " is not subscribed to this capability type");
+ return false;
+ }
+
+ SDL_LOG_DEBUG("App " << app->app_id()
<< " is subscribed to specified capability type");
return true;
};
@@ -183,8 +193,7 @@ void OnSystemCapabilityUpdatedNotification::Run() {
const std::vector<ApplicationSharedPtr>& applications = FindAllApps(
application_manager_.applications(), subscribed_to_capability_predicate);
- LOG4CXX_DEBUG(logger_,
- "Number of Notifications to be sent: " << applications.size());
+ SDL_LOG_DEBUG("Number of Notifications to be sent: " << applications.size());
std::vector<ApplicationSharedPtr>::const_iterator app_it =
applications.begin();
@@ -194,31 +203,29 @@ void OnSystemCapabilityUpdatedNotification::Run() {
if (system_capability_type ==
mobile_apis::SystemCapabilityType::REMOTE_CONTROL &&
!app->is_remote_control_supported()) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"App with connection key: "
- << app->app_id()
- << " was subcribed to REMOTE_CONTROL system capabilities, but "
- "does not have RC permissions. Unsubscribing");
+ << app->app_id()
+ << " was subcribed to REMOTE_CONTROL system capabilities, but "
+ "does not have RC permissions. Unsubscribing");
auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
ext.UnsubscribeFrom(system_capability_type);
continue;
}
if (mobile_apis::SystemCapabilityType::DISPLAYS == system_capability_type) {
- LOG4CXX_DEBUG(logger_, "Using common display capabilities");
+ SDL_LOG_DEBUG("Using common display capabilities");
auto capabilities = hmi_capabilities_.system_display_capabilities();
- if (app->is_resuming() && app->is_app_data_resumption_allowed()) {
- LOG4CXX_DEBUG(logger_,
- "Application "
- << app->app_id()
- << " is resuming. Providing cached capabilities");
- auto display_caps =
- app->display_capabilities_builder().display_capabilities();
+
+ auto& builder = app->display_capabilities_builder();
+ if (app->is_resuming() && builder.IsWindowResumptionNeeded()) {
+ SDL_LOG_DEBUG("Application "
+ << app->app_id()
+ << " is resuming. Providing cached capabilities");
+ auto display_caps = builder.display_capabilities();
capabilities = display_caps;
} else if (app->display_capabilities()) {
- LOG4CXX_DEBUG(logger_,
- "Application " << app->app_id()
+ SDL_LOG_DEBUG("Application " << app->app_id()
<< " has specific display capabilities");
const WindowID window_id =
msg_params[strings::system_capability]
@@ -229,8 +236,7 @@ void OnSystemCapabilityUpdatedNotification::Run() {
}
if (!capabilities) {
- LOG4CXX_WARN(logger_,
- "No available display capabilities for sending. Skipping");
+ SDL_LOG_WARN("No available display capabilities for sending. Skipping");
continue;
}
@@ -238,8 +244,7 @@ void OnSystemCapabilityUpdatedNotification::Run() {
*capabilities;
}
- LOG4CXX_INFO(logger_,
- "Sending OnSystemCapabilityUpdated " << capability_type_string
+ SDL_LOG_INFO("Sending OnSystemCapabilityUpdated " << capability_type_string
<< " application id "
<< app->app_id());
(*message_)[strings::params][strings::connection_key] = app->app_id();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index 9c868172f5..90ed038b89 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -48,6 +48,8 @@ namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnSystemRequestNotification::OnSystemRequestNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -63,7 +65,7 @@ OnSystemRequestNotification::OnSystemRequestNotification(
OnSystemRequestNotification::~OnSystemRequestNotification() {}
void OnSystemRequestNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace application_manager;
using namespace mobile_apis;
using namespace helpers;
@@ -71,8 +73,7 @@ void OnSystemRequestNotification::Run() {
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_,
- "Application with connection key " << connection_key()
+ SDL_LOG_ERROR("Application with connection key " << connection_key()
<< " is not registered.");
return;
}
@@ -88,8 +89,7 @@ void OnSystemRequestNotification::Run() {
if (!policy_handler.IsRequestTypeAllowed(
app->device(), app->policy_app_id(), request_type)) {
- LOG4CXX_WARN(logger_,
- "Request type " << stringified_request_type
+ SDL_LOG_WARN("Request type " << stringified_request_type
<< " is not allowed by policies");
return;
}
@@ -101,15 +101,13 @@ void OnSystemRequestNotification::Run() {
(*message_)[strings::msg_params][strings::request_subtype].asString();
if (!policy_handler.IsRequestSubTypeAllowed(app->policy_app_id(),
request_subtype)) {
- LOG4CXX_ERROR(logger_,
- "Request subtype: " << request_subtype
+ SDL_LOG_ERROR("Request subtype: " << request_subtype
<< " is DISALLOWED by policies");
return;
}
}
- LOG4CXX_DEBUG(logger_,
- "Processing Request type : " << stringified_request_type);
+ SDL_LOG_DEBUG("Processing Request type : " << stringified_request_type);
const bool binary_data_is_required =
Compare<mobile_apis::RequestType::eType, EQ, ONE>(
@@ -154,8 +152,7 @@ void OnSystemRequestNotification::Run() {
} else if (mobile_apis::RequestType::LOCK_SCREEN_ICON_URL == request_type) {
if (!(*message_)[strings::msg_params].keyExists(strings::url) ||
(*message_)[strings::msg_params][strings::url].empty()) {
- LOG4CXX_ERROR(logger_,
- "discarding LOCK_SCREEN_ICON_URL request without URL");
+ SDL_LOG_ERROR("discarding LOCK_SCREEN_ICON_URL request without URL");
return;
}
}
@@ -165,7 +162,7 @@ void OnSystemRequestNotification::Run() {
#ifdef PROPRIETARY_MODE
void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t timeout = policy_handler_.TimeoutExchangeSec();
size_t content_length;
@@ -223,8 +220,8 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
message.clear();
message.assign(header.begin(), header.end());
- LOG4CXX_DEBUG(
- logger_, "Header added: " << std::string(message.begin(), message.end()));
+ SDL_LOG_DEBUG(
+ "Header added: " << std::string(message.begin(), message.end()));
}
size_t OnSystemRequestNotification::ParsePTString(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
index 0a8420b6a3..944fb0c148 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnTBTClientStateNotification::OnTBTClientStateNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ OnTBTClientStateNotification::OnTBTClientStateNotification(
OnTBTClientStateNotification::~OnTBTClientStateNotification() {}
void OnTBTClientStateNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc
index 6ceb381d2e..02ec1be53f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc
@@ -42,6 +42,8 @@ namespace commands {
namespace mobile {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnTouchEventNotification::OnTouchEventNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,7 +59,7 @@ OnTouchEventNotification::OnTouchEventNotification(
OnTouchEventNotification::~OnTouchEventNotification() {}
void OnTouchEventNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::vector<ApplicationSharedPtr>& applications_with_navi =
application_manager_.applications_with_navi();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc
new file mode 100644
index 0000000000..d3257844ec
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc
@@ -0,0 +1,64 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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 "sdl_rpc_plugin/commands/mobile/on_update_file_notification.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+OnUpdateFileNotification::OnUpdateFileNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandNotificationImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnUpdateFileNotification::~OnUpdateFileNotification() {}
+
+void OnUpdateFileNotification::Run() {
+ SDL_LOG_AUTO_TRACE();
+ SendNotification();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc
new file mode 100644
index 0000000000..05ff9fc8e5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc
@@ -0,0 +1,64 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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 "sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+OnUpdateSubMenuNotification::OnUpdateSubMenuNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandNotificationImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnUpdateSubMenuNotification::~OnUpdateSubMenuNotification() {}
+
+void OnUpdateSubMenuNotification::Run() {
+ SDL_LOG_AUTO_TRACE();
+ SendNotification();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
index 39e0735013..33413f805d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
@@ -38,6 +38,8 @@ namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnWayPointChangeNotification::OnWayPointChangeNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ OnWayPointChangeNotification::OnWayPointChangeNotification(
OnWayPointChangeNotification::~OnWayPointChangeNotification() {}
void OnWayPointChangeNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::set<uint32_t> subscribed_for_way_points =
application_manager_.GetAppsSubscribedForWayPoints();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
index 2f3d38f0b0..5918c05f2d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace str = strings;
PerformAudioPassThruRequest::PerformAudioPassThruRequest(
@@ -64,7 +66,7 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest(
PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {}
void PerformAudioPassThruRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FinishTTSSpeak();
CommandRequestImpl::onTimeOut();
@@ -77,28 +79,28 @@ bool PerformAudioPassThruRequest::Init() {
}
void PerformAudioPassThruRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED");
+ SDL_LOG_ERROR("APPLICATION_NOT_REGISTERED");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if (mobile_api::HMILevel::HMI_NONE ==
app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
- LOG4CXX_ERROR(logger_, "application isn't activated");
+ SDL_LOG_ERROR("application isn't activated");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming perform audio pass thru has contains "
- "\\t\\n \\\\t \\\\n"
- " text contains only whitespace in initialPrompt");
+ SDL_LOG_ERROR(
+ "Incoming perform audio pass thru has contains "
+ "\\t\\n \\\\t \\\\n"
+ " text contains only whitespace in initialPrompt");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -114,9 +116,8 @@ void PerformAudioPassThruRequest::Run() {
initial_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
SendResponse(
false,
mobile_apis::Result::FILE_NOT_FOUND,
@@ -135,14 +136,14 @@ void PerformAudioPassThruRequest::Run() {
}
void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_PerformAudioPassThru: {
- LOG4CXX_TRACE(logger_, "Received UI_PerformAudioPassThru");
+ SDL_LOG_TRACE("Received UI_PerformAudioPassThru");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
result_ui_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -151,7 +152,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
// in case perform audio is started by other request skip stopping
if (hmi_apis::Common_Result::REJECTED == result_ui_) {
- LOG4CXX_ERROR(logger_, "Request was rejected");
+ SDL_LOG_ERROR("Request was rejected");
SendResponse(false,
MessageHelper::HMIToMobileResult(result_ui_),
NULL,
@@ -162,7 +163,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
- LOG4CXX_INFO(logger_, "Received TTS_Speak event");
+ SDL_LOG_INFO("Received TTS_Speak event");
result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, tts_info_);
@@ -188,14 +189,14 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event");
+ SDL_LOG_INFO("Received TTS_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
@@ -214,7 +215,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
const PerformAudioPassThruRequest::ResponseParams&
PerformAudioPassThruRequest::PrepareResponseParameters() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::commands::ResponseInfo ui_perform_info(
result_ui_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
@@ -252,7 +253,7 @@ PerformAudioPassThruRequest::PrepareResponseParameters() {
}
void PerformAudioPassThruRequest::SendSpeakRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace smart_objects;
@@ -274,7 +275,7 @@ void PerformAudioPassThruRequest::SendSpeakRequest() {
}
void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -321,7 +322,7 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
}
void PerformAudioPassThruRequest::SendRecordStartNotification() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -331,7 +332,7 @@ void PerformAudioPassThruRequest::SendRecordStartNotification() {
}
void PerformAudioPassThruRequest::StartMicrophoneRecording() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id = connection_key();
application_manager_.BeginAudioPassThru(app_id);
@@ -346,7 +347,7 @@ void PerformAudioPassThruRequest::StartMicrophoneRecording() {
}
bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) {
@@ -359,7 +360,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
for (; it_ip != it_ip_end; ++it_ip) {
str = (*it_ip)[strings::text].asCharArray();
if (std::strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed");
+ SDL_LOG_ERROR("Invalid initial_prompt syntax check failed");
return true;
}
}
@@ -370,8 +371,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::audio_pass_display_text1]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Invalid audio_pass_display_text1 value syntax check failed");
return true;
}
@@ -382,8 +382,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::audio_pass_display_text2]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Invalid audio_pass_display_text2 value syntax check failed");
return true;
}
@@ -392,14 +391,14 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
}
void PerformAudioPassThruRequest::FinishTTSSpeak() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id = connection_key();
if (application_manager_.EndAudioPassThru(app_id)) {
- LOG4CXX_DEBUG(logger_, "Stop AudioPassThru.");
+ SDL_LOG_DEBUG("Stop AudioPassThru.");
application_manager_.StopAudioPassThru(app_id);
}
if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) {
- LOG4CXX_WARN(logger_, "TTS Speak is inactive.");
+ SDL_LOG_WARN("TTS Speak is inactive.");
return;
}
SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL);
@@ -446,7 +445,7 @@ PerformAudioPassThruRequest::PrepareAudioPassThruResultCodeForResponse(
}
bool PerformAudioPassThruRequest::IsWaitingHMIResponse() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) ||
IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc
index 5dae6327eb..8712eae150 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PerformAudioPassThruResponse::PerformAudioPassThruResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ PerformAudioPassThruResponse::PerformAudioPassThruResponse(
PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {}
void PerformAudioPassThruResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index 881c838c1a..9c218e0e99 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -56,6 +56,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace custom_str = utils::custom_string;
uint32_t PerformInteractionRequest::pi_requests_count_ = 0;
@@ -108,18 +110,18 @@ bool PerformInteractionRequest::Init() {
}
void PerformInteractionRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if (app->is_perform_interaction_active()) {
- LOG4CXX_DEBUG(logger_, "Application has active PerformInteraction");
+ SDL_LOG_DEBUG("Application has active PerformInteraction");
app_pi_was_active_before_ = true;
}
@@ -134,9 +136,9 @@ void PerformInteractionRequest::Run() {
if ((mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) &&
(mobile_apis::LayoutMode::KEYBOARD == interaction_layout)) {
- LOG4CXX_ERROR(logger_,
- "PerformInteraction contains InteractionMode"
- "=VR_ONLY and interactionLayout=KEYBOARD");
+ SDL_LOG_ERROR(
+ "PerformInteraction contains InteractionMode"
+ "=VR_ONLY and interactionLayout=KEYBOARD");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -147,17 +149,17 @@ void PerformInteractionRequest::Run() {
if (0 == choice_set_id_list_length) {
if (mobile_apis::LayoutMode::KEYBOARD == interaction_layout) {
if (mobile_apis::InteractionMode::BOTH == interaction_mode_) {
- LOG4CXX_ERROR(logger_,
- "interactionChoiceSetIDList is empty,"
- " InteractionMode=BOTH and"
- " interactionLayout=KEYBOARD");
+ SDL_LOG_ERROR(
+ "interactionChoiceSetIDList is empty,"
+ " InteractionMode=BOTH and"
+ " interactionLayout=KEYBOARD");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
} else {
- LOG4CXX_ERROR(logger_,
- "interactionChoiceSetIDList is empty"
- " and interactionLayout!=KEYBOARD");
+ SDL_LOG_ERROR(
+ "interactionChoiceSetIDList is empty"
+ " and interactionLayout!=KEYBOARD");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -167,9 +169,9 @@ void PerformInteractionRequest::Run() {
app,
choice_set_id_list_length,
msg_params[strings::interaction_choice_set_id_list])) {
- LOG4CXX_ERROR(logger_,
- "PerformInteraction has choice sets with "
- "duplicated IDs or application does not have choice sets");
+ SDL_LOG_ERROR(
+ "PerformInteraction has choice sets with "
+ "duplicated IDs or application does not have choice sets");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -178,23 +180,21 @@ void PerformInteractionRequest::Run() {
if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
msg_params[strings::vr_help], app, application_manager_)) {
- LOG4CXX_ERROR(logger_,
- "Verification of " << strings::vr_help << " failed.");
+ SDL_LOG_ERROR("Verification of " << strings::vr_help << " failed.");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming perform interaction has contains \t\n \\t \\n");
+ SDL_LOG_ERROR("Incoming perform interaction has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
switch (interaction_mode_) {
case mobile_apis::InteractionMode::BOTH: {
- LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH");
+ SDL_LOG_DEBUG("Interaction Mode: BOTH");
if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
!CheckVrHelpItemPositions(app) ||
!CheckChoiceSetListVRCommands(app)) {
@@ -203,7 +203,7 @@ void PerformInteractionRequest::Run() {
break;
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
- LOG4CXX_DEBUG(logger_, "Interaction Mode: MANUAL_ONLY");
+ SDL_LOG_DEBUG("Interaction Mode: MANUAL_ONLY");
if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
!CheckVrHelpItemPositions(app)) {
return;
@@ -211,7 +211,7 @@ void PerformInteractionRequest::Run() {
break;
}
case mobile_apis::InteractionMode::VR_ONLY: {
- LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY");
+ SDL_LOG_DEBUG("Interaction Mode: VR_ONLY");
if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app) ||
!CheckChoiceSetListVRCommands(app)) {
return;
@@ -219,7 +219,7 @@ void PerformInteractionRequest::Run() {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Unknown interaction mode");
+ SDL_LOG_ERROR("Unknown interaction mode");
return;
}
}
@@ -234,18 +234,18 @@ void PerformInteractionRequest::Run() {
}
void PerformInteractionRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_DEBUG(logger_, "Received UI_OnResetTimeout event");
+ SDL_LOG_DEBUG("Received UI_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::UI_PerformInteraction: {
- LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event");
+ SDL_LOG_DEBUG("Received UI_PerformInteraction event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
ui_response_received_ = true;
@@ -257,7 +257,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
- LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction");
+ SDL_LOG_DEBUG("Received VR_PerformInteraction");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
vr_response_received_ = true;
@@ -271,15 +271,14 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event" << event.id());
break;
}
}
if (!HasHMIResponsesToWait()) {
- LOG4CXX_DEBUG(logger_,
- "Send response in interaction mode "
- << static_cast<int32_t>(interaction_mode_));
+ SDL_LOG_DEBUG("Send response in interaction mode "
+ << static_cast<int32_t>(interaction_mode_));
if (SetChoiceIdToResponseMsgParams(response_msg_params)) {
SendBothModeResponse(response_msg_params);
} else {
@@ -292,11 +291,11 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
}
void PerformInteractionRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (interaction_mode_) {
case mobile_apis::InteractionMode::BOTH: {
- LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH");
+ SDL_LOG_DEBUG("Interaction Mode: BOTH");
if (true == vr_response_received_) {
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
DisablePerformInteraction();
@@ -308,21 +307,21 @@ void PerformInteractionRequest::onTimeOut() {
break;
}
case mobile_apis::InteractionMode::VR_ONLY: {
- LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY");
+ SDL_LOG_DEBUG("Interaction Mode: VR_ONLY");
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
DisablePerformInteraction();
CommandRequestImpl::onTimeOut();
break;
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
- LOG4CXX_DEBUG(logger_, "InteractionMode: MANUAL_ONLY");
+ SDL_LOG_DEBUG("InteractionMode: MANUAL_ONLY");
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
DisablePerformInteraction();
CommandRequestImpl::onTimeOut();
break;
}
default: {
- LOG4CXX_ERROR(logger_, "INVALID ENUM");
+ SDL_LOG_ERROR("INVALID ENUM");
return;
}
};
@@ -331,7 +330,7 @@ void PerformInteractionRequest::onTimeOut() {
bool PerformInteractionRequest::ProcessVRResponse(
const smart_objects::SmartObject& message,
smart_objects::SmartObject& msg_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace mobile_apis;
using namespace smart_objects;
@@ -340,7 +339,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return false;
}
@@ -351,14 +350,14 @@ bool PerformInteractionRequest::ProcessVRResponse(
vr_result_code_, Common_Result::ABORTED, Common_Result::TIMED_OUT);
if (is_vr_aborted_timeout) {
- LOG4CXX_DEBUG(logger_, "VR response aborted");
+ SDL_LOG_DEBUG("VR response aborted");
if (InteractionMode::VR_ONLY == interaction_mode_) {
- LOG4CXX_DEBUG(logger_, "Aborted or Timeout Send Close Popup");
+ SDL_LOG_DEBUG("Aborted or Timeout Send Close Popup");
TerminatePerformInteraction();
SendResponse(false, MessageHelper::HMIToMobileResult(vr_result_code_));
return true;
}
- LOG4CXX_DEBUG(logger_, "Update timeout for UI");
+ SDL_LOG_DEBUG("Update timeout for UI");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout_);
return false;
@@ -373,7 +372,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
if (hmi_msg_params.keyExists(strings::choice_id)) {
const int choice_id = hmi_msg_params[strings::choice_id].asInt();
if (!CheckChoiceIDFromResponse(app, choice_id)) {
- LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI");
+ SDL_LOG_ERROR("Wrong choiceID was received from HMI");
TerminatePerformInteraction();
SendResponse(
false, Result::GENERIC_ERROR, "Wrong choiceID was received from HMI");
@@ -384,7 +383,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
- LOG4CXX_DEBUG(logger_, "Update timeout for UI");
+ SDL_LOG_DEBUG("Update timeout for UI");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout_);
}
@@ -394,9 +393,8 @@ bool PerformInteractionRequest::ProcessVRResponse(
if (is_vr_result_success &&
InteractionMode::MANUAL_ONLY == interaction_mode_) {
- LOG4CXX_DEBUG(logger_,
- "VR response is successfull in MANUAL_ONLY mode "
- << "Wait for UI response");
+ SDL_LOG_DEBUG("VR response is successfull in MANUAL_ONLY mode "
+ << "Wait for UI response");
// in case MANUAL_ONLY mode VR.PI SUCCESS just return
return false;
}
@@ -407,13 +405,13 @@ bool PerformInteractionRequest::ProcessVRResponse(
void PerformInteractionRequest::ProcessUIResponse(
const smart_objects::SmartObject& message,
smart_objects::SmartObject& msg_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
using namespace smart_objects;
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -476,7 +474,7 @@ void PerformInteractionRequest::ProcessUIResponse(
void PerformInteractionRequest::SendUIPerformInteractionRequest(
application_manager::ApplicationSharedPtr const app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& choice_set_id_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
@@ -519,24 +517,24 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
}
int32_t index_array_of_vr_help = 0;
for (size_t i = 0; i < choice_set_id_list.length(); ++i) {
- smart_objects::SmartObject* choice_set =
+ smart_objects::SmartObject choice_set =
app->FindChoiceSet(choice_set_id_list[i].asInt());
- if (choice_set) {
+ if (smart_objects::SmartType_Null != choice_set.getType()) {
// save perform interaction choice set
app->AddPerformInteractionChoiceSet(
- correlation_id(), choice_set_id_list[i].asInt(), *choice_set);
- for (size_t j = 0; j < (*choice_set)[strings::choice_set].length(); ++j) {
+ correlation_id(), choice_set_id_list[i].asInt(), choice_set);
+ for (size_t j = 0; j < choice_set[strings::choice_set].length(); ++j) {
if (mobile_apis::InteractionMode::VR_ONLY != mode) {
size_t index = msg_params[strings::choice_set].length();
msg_params[strings::choice_set][index] =
- (*choice_set)[strings::choice_set][j];
+ choice_set[strings::choice_set][j];
// vrCommands should be added via VR.AddCommand only
msg_params[strings::choice_set][index].erase(strings::vr_commands);
}
if (mobile_apis::InteractionMode::MANUAL_ONLY != mode &&
!is_vr_help_item) {
smart_objects::SmartObject& vr_commands =
- (*choice_set)[strings::choice_set][j][strings::vr_commands];
+ choice_set[strings::choice_set][j][strings::vr_commands];
if (0 < vr_commands.length()) {
// copy only first synonym
smart_objects::SmartObject item(smart_objects::SmartType_Map);
@@ -562,7 +560,7 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
void PerformInteractionRequest::SendVRPerformInteractionRequest(
application_manager::ApplicationSharedPtr const app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -581,14 +579,14 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
int32_t grammar_id_index = 0;
for (uint32_t i = 0; i < choice_list.length(); ++i) {
- smart_objects::SmartObject* choice_set =
- app->FindChoiceSet(choice_list[i].asInt());
- if (!choice_set) {
- LOG4CXX_WARN(logger_, "Couldn't found choiceset");
+ const auto choice_id = choice_list[i].asInt();
+ smart_objects::SmartObject choice_set = app->FindChoiceSet(choice_id);
+ if (smart_objects::SmartType_Null == choice_set.getType()) {
+ SDL_LOG_WARN("Couldn't found choiceset : " << choice_id);
continue;
}
msg_params[strings::grammar_id][grammar_id_index++] =
- (*choice_set)[strings::grammar_id].asUInt();
+ choice_set[strings::grammar_id].asUInt();
}
}
@@ -600,8 +598,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("help_prompt");
} else {
@@ -614,14 +612,14 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
}
int32_t index = 0;
for (uint32_t i = 0; i < choice_list.length(); ++i) {
- smart_objects::SmartObject* choice_set =
+ smart_objects::SmartObject choice_set =
app->FindChoiceSet(choice_list[i].asInt());
- if (choice_set) {
- for (uint32_t j = 0; j < (*choice_set)[strings::choice_set].length();
+ if (smart_objects::SmartType_Null != choice_set.getType()) {
+ for (uint32_t j = 0; j < choice_set[strings::choice_set].length();
++j) {
smart_objects::SmartObject& vr_commands =
- (*choice_set)[strings::choice_set][j][strings::vr_commands];
+ choice_set[strings::choice_set][j][strings::vr_commands];
if (0 < vr_commands.length()) {
// copy only first synonym
smart_objects::SmartObject item(smart_objects::SmartType_Map);
@@ -635,7 +633,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
}
}
} else {
- LOG4CXX_ERROR(logger_, "Can't found choiceSet!");
+ SDL_LOG_ERROR("Can't found choiceSet!");
}
}
}
@@ -648,8 +646,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
timeout_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("timeout_prompt");
} else {
@@ -669,8 +667,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
initial_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("initial_prompt");
} else {
@@ -703,18 +701,18 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
bool PerformInteractionRequest::CheckChoiceSetMenuNames(
application_manager::ApplicationSharedPtr const app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& choice_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
for (size_t i = 0; i < choice_list.length(); ++i) {
// choice_set contains SmartObject msg_params
- smart_objects::SmartObject* i_choice_set =
+ smart_objects::SmartObject i_choice_set =
app->FindChoiceSet(choice_list[i].asInt());
for (size_t j = 0; j < choice_list.length(); ++j) {
- smart_objects::SmartObject* j_choice_set =
+ smart_objects::SmartObject j_choice_set =
app->FindChoiceSet(choice_list[j].asInt());
if (i == j) {
@@ -722,25 +720,26 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames(
continue;
}
- if (!i_choice_set || !j_choice_set) {
- LOG4CXX_ERROR(logger_, "Invalid ID");
+ if ((smart_objects::SmartType_Null == i_choice_set.getType()) ||
+ (smart_objects::SmartType_Null == j_choice_set.getType())) {
+ SDL_LOG_ERROR("Invalid ID");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return false;
}
size_t ii = 0;
size_t jj = 0;
- for (; ii < (*i_choice_set)[strings::choice_set].length(); ++ii) {
- for (; jj < (*j_choice_set)[strings::choice_set].length(); ++jj) {
+ for (; ii < i_choice_set[strings::choice_set].length(); ++ii) {
+ for (; jj < j_choice_set[strings::choice_set].length(); ++jj) {
const std::string& ii_menu_name =
- (*i_choice_set)[strings::choice_set][ii][strings::menu_name]
+ i_choice_set[strings::choice_set][ii][strings::menu_name]
.asString();
const std::string& jj_menu_name =
- (*j_choice_set)[strings::choice_set][jj][strings::menu_name]
+ j_choice_set[strings::choice_set][jj][strings::menu_name]
.asString();
if (ii_menu_name == jj_menu_name) {
- LOG4CXX_ERROR(logger_, "Choice set has duplicated menu name");
+ SDL_LOG_ERROR("Choice set has duplicated menu name");
SendResponse(false,
mobile_apis::Result::DUPLICATE_NAME,
"Choice set has duplicated menu name");
@@ -756,18 +755,18 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames(
bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
application_manager::ApplicationSharedPtr const app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& choice_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
for (size_t i = 0; i < choice_list.length(); ++i) {
// choice_set contains SmartObject msg_params
- smart_objects::SmartObject* i_choice_set =
+ smart_objects::SmartObject i_choice_set =
app->FindChoiceSet(choice_list[i].asInt());
for (size_t j = 0; j < choice_list.length(); ++j) {
- smart_objects::SmartObject* j_choice_set =
+ smart_objects::SmartObject j_choice_set =
app->FindChoiceSet(choice_list[j].asInt());
if (i == j) {
@@ -775,31 +774,32 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
continue;
}
- if ((!i_choice_set) || (!j_choice_set)) {
- LOG4CXX_ERROR(logger_, "Invalid ID");
+ if ((smart_objects::SmartType_Null == i_choice_set.getType()) ||
+ (smart_objects::SmartType_Null == j_choice_set.getType())) {
+ SDL_LOG_ERROR("Invalid ID");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return false;
}
size_t ii = 0;
size_t jj = 0;
- for (; ii < (*i_choice_set)[strings::choice_set].length(); ++ii) {
- for (; jj < (*j_choice_set)[strings::choice_set].length(); ++jj) {
- if (!((*i_choice_set)[strings::choice_set][ii].keyExists(
+ for (; ii < i_choice_set[strings::choice_set].length(); ++ii) {
+ for (; jj < j_choice_set[strings::choice_set].length(); ++jj) {
+ if (!(i_choice_set[strings::choice_set][ii].keyExists(
strings::vr_commands) &&
- (*j_choice_set)[strings::choice_set][jj].keyExists(
+ j_choice_set[strings::choice_set][jj].keyExists(
strings::vr_commands))) {
- LOG4CXX_DEBUG(logger_,
- "One or both sets has missing vr commands, skipping "
- "synonym check");
+ SDL_LOG_DEBUG(
+ "One or both sets has missing vr commands, skipping "
+ "synonym check");
return true;
}
// choice_set pointer contains SmartObject msg_params
smart_objects::SmartObject& ii_vr_commands =
- (*i_choice_set)[strings::choice_set][ii][strings::vr_commands];
+ i_choice_set[strings::choice_set][ii][strings::vr_commands];
smart_objects::SmartObject& jj_vr_commands =
- (*j_choice_set)[strings::choice_set][jj][strings::vr_commands];
+ j_choice_set[strings::choice_set][jj][strings::vr_commands];
for (size_t iii = 0; iii < ii_vr_commands.length(); ++iii) {
for (size_t jjj = 0; jjj < jj_vr_commands.length(); ++jjj) {
@@ -808,7 +808,7 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
const custom_str::CustomString& vr_cmd_j =
jj_vr_commands[jjj].asCustomString();
if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) {
- LOG4CXX_ERROR(logger_, "Choice set has duplicated VR synonym");
+ SDL_LOG_ERROR("Choice set has duplicated VR synonym");
SendResponse(false,
mobile_apis::Result::DUPLICATE_NAME,
"Choice set has duplicated VR synonym");
@@ -825,10 +825,10 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
bool PerformInteractionRequest::CheckVrHelpItemPositions(
application_manager::ApplicationSharedPtr const app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!(*message_)[strings::msg_params].keyExists(strings::vr_help)) {
- LOG4CXX_DEBUG(logger_, strings::vr_help << " is omitted.");
+ SDL_LOG_DEBUG(strings::vr_help << " is omitted.");
return true;
}
@@ -838,7 +838,7 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions(
int32_t position = 1;
for (size_t i = 0; i < vr_help.length(); ++i) {
if (position != vr_help[i][strings::position].asInt()) {
- LOG4CXX_ERROR(logger_, "Non-sequential vrHelp item position");
+ SDL_LOG_ERROR("Non-sequential vrHelp item position");
SendResponse(false,
mobile_apis::Result::REJECTED,
"Non-sequential vrHelp item position");
@@ -850,11 +850,11 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions(
}
void PerformInteractionRequest::DisablePerformInteraction() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -870,12 +870,12 @@ void PerformInteractionRequest::DisablePerformInteraction() {
}
bool PerformInteractionRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::initial_text].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid initial_text syntax check failed");
+ SDL_LOG_ERROR("Invalid initial_text syntax check failed");
return true;
}
@@ -889,7 +889,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
for (; it_ip != it_ip_end; ++it_ip) {
str = (*it_ip)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed");
+ SDL_LOG_ERROR("Invalid initial_prompt syntax check failed");
return true;
}
}
@@ -905,7 +905,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
for (; it_hp != it_hp_end; ++it_hp) {
str = (*it_hp)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed");
+ SDL_LOG_ERROR("Invalid help_prompt syntax check failed");
return true;
}
}
@@ -921,7 +921,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
for (; it_tp != it_tp_end; ++it_tp) {
str = (*it_tp)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed");
+ SDL_LOG_ERROR("Invalid timeout_prompt syntax check failed");
return true;
}
}
@@ -937,15 +937,14 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
for (; it_vh != it_vh_end; ++it_vh) {
str = (*it_vh)[strings::text].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_help syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_help syntax check failed");
return true;
}
if ((*it_vh).keyExists(strings::image)) {
str = (*it_vh)[strings::image][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid vr_help image value syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_help image value syntax check failed");
return true;
}
}
@@ -955,7 +954,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
}
void PerformInteractionRequest::TerminatePerformInteraction() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendClosePopupRequestToHMI();
DisablePerformInteraction();
@@ -970,7 +969,7 @@ void PerformInteractionRequest::SendClosePopupRequestToHMI() {
bool PerformInteractionRequest::CheckChoiceIDFromResponse(
ApplicationSharedPtr app, const int32_t choice_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const DataAccessor<PerformChoiceSetMap> accessor =
app->performinteraction_choice_set_map();
const PerformChoiceSetMap& choice_set_map = accessor.GetData();
@@ -998,34 +997,32 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse(
bool PerformInteractionRequest::CheckChoiceSetListVRCommands(
ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& choice_set_id_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
- smart_objects::SmartObject* choice_set = nullptr;
-
for (size_t i = 0; i < choice_set_id_list.length(); ++i) {
- choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt());
+ auto choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt());
// this should never ever happen since this was already checked
- if (choice_set == nullptr) {
- LOG4CXX_ERROR(
- logger_,
+ if (smart_objects::SmartType_Null == choice_set.getType()) {
+ SDL_LOG_ERROR(
+
"Couldn't find choiceset_id = " << choice_set_id_list[i].asInt());
SendResponse(false, mobile_apis::Result::INVALID_ID);
return false;
}
const smart_objects::SmartObject& choices_list =
- (*choice_set)[strings::choice_set];
+ choice_set[strings::choice_set];
auto vr_status = MessageHelper::CheckChoiceSetVRCommands(choices_list);
// if not all choices have vr commands
if (vr_status != MessageHelper::ChoiceSetVRCommandsStatus::ALL) {
- LOG4CXX_ERROR(logger_,
- "PerformInteraction has choice sets with "
- "missing vrCommands, not in MANUAL_ONLY mode");
+ SDL_LOG_ERROR(
+ "PerformInteraction has choice sets with "
+ "missing vrCommands, not in MANUAL_ONLY mode");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Some choices don't contain VR commands.");
@@ -1039,33 +1036,31 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest(
ApplicationSharedPtr app,
const size_t choice_set_id_list_length,
const smart_objects::SmartObject& choice_set_id_list) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
size_t choice_list_length = 0;
std::set<uint32_t> choice_id_set;
- smart_objects::SmartObject* choice_set = 0;
std::pair<std::set<uint32_t>::iterator, bool> ins_res;
for (size_t i = 0; i < choice_set_id_list_length; ++i) {
- choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt());
- if (!choice_set) {
- LOG4CXX_ERROR(
- logger_,
+ auto choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt());
+ if (smart_objects::SmartType_Null == choice_set.getType()) {
+ SDL_LOG_ERROR(
+
"Couldn't find choiceset_id = " << choice_set_id_list[i].asInt());
return false;
}
- choice_list_length = (*choice_set)[strings::choice_set].length();
+ choice_list_length = choice_set[strings::choice_set].length();
const smart_objects::SmartObject& choices_list =
- (*choice_set)[strings::choice_set];
+ choice_set[strings::choice_set];
for (size_t k = 0; k < choice_list_length; ++k) {
ins_res =
choice_id_set.insert(choices_list[k][strings::choice_id].asInt());
if (!ins_res.second) {
- LOG4CXX_ERROR(logger_,
- "choice with ID "
- << choices_list[k][strings::choice_id].asInt()
- << " already exists");
+ SDL_LOG_ERROR("choice with ID "
+ << choices_list[k][strings::choice_id].asInt()
+ << " already exists");
return false;
}
}
@@ -1074,13 +1069,13 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest(
}
const bool PerformInteractionRequest::HasHMIResponsesToWait() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return !ui_response_received_ || !vr_response_received_;
}
void PerformInteractionRequest::SendBothModeResponse(
const smart_objects::SmartObject& msg_param) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::Result::eType perform_interaction_result_code =
mobile_apis::Result::INVALID_ENUM;
app_mngr::commands::ResponseInfo ui_perform_info(
@@ -1108,8 +1103,8 @@ mobile_apis::Result::eType
PerformInteractionRequest::PrepareResultCodeForResponse(
const app_mngr::commands::ResponseInfo& ui_response,
const app_mngr::commands::ResponseInfo& vr_response) {
- LOG4CXX_DEBUG(
- logger_, "InteractionMode = " << static_cast<int32_t>(interaction_mode_));
+ SDL_LOG_DEBUG(
+ "InteractionMode = " << static_cast<int32_t>(interaction_mode_));
auto mobile_vr_result_code =
MessageHelper::HMIToMobileResult(vr_result_code_);
@@ -1159,7 +1154,7 @@ bool PerformInteractionRequest::PrepareResultForMobileResponse(
bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
ns_smart_device_link::ns_smart_objects::SmartObject& msg_param) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool ui_choice_id_valid = INVALID_CHOICE_ID != ui_choice_id_received_;
const bool vr_choice_id_valid = INVALID_CHOICE_ID != vr_choice_id_received_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc
index fa02641c2b..c72d851b0e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PerformInteractionResponse::PerformInteractionResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ PerformInteractionResponse::PerformInteractionResponse(
PerformInteractionResponse::~PerformInteractionResponse() {}
void PerformInteractionResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
index e25215fb48..50ff392e33 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
@@ -61,6 +61,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PutFileRequest::PutFileRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -81,7 +83,7 @@ PutFileRequest::PutFileRequest(
PutFileRequest::~PutFileRequest() {}
void PutFileRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
@@ -89,7 +91,7 @@ void PutFileRequest::Run() {
smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -101,8 +103,7 @@ void PutFileRequest::Run() {
application->put_file_in_none_count()) {
// If application is in the HMI_NONE level the quantity of allowed
// PutFile request is limited by the configuration profile
- LOG4CXX_ERROR(logger_,
- "Too many requests from the app with HMILevel HMI_NONE ");
+ SDL_LOG_ERROR("Too many requests from the app with HMILevel HMI_NONE ");
SendResponse(false,
mobile_apis::Result::REJECTED,
"Too many requests from the app with HMILevel HMI_NONE",
@@ -111,7 +112,7 @@ void PutFileRequest::Run() {
}
if (!(*message_)[strings::params].keyExists(strings::binary_data)) {
- LOG4CXX_ERROR(logger_, "Binary data empty");
+ SDL_LOG_ERROR("Binary data empty");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Binary data empty",
@@ -120,7 +121,7 @@ void PutFileRequest::Run() {
}
if (!(*message_)[strings::msg_params].keyExists(strings::sync_file_name)) {
- LOG4CXX_ERROR(logger_, "No file name");
+ SDL_LOG_ERROR("No file name");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"No file name",
@@ -129,7 +130,7 @@ void PutFileRequest::Run() {
}
if (!(*message_)[strings::msg_params].keyExists(strings::file_type)) {
- LOG4CXX_ERROR(logger_, "No file type");
+ SDL_LOG_ERROR("No file type");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"No file type",
@@ -141,7 +142,7 @@ void PutFileRequest::Run() {
if (!file_system::IsFileNameValid(sync_file_name_)) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
- LOG4CXX_ERROR(logger_, err_msg);
+ SDL_LOG_ERROR(err_msg);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
err_msg.c_str(),
@@ -196,7 +197,7 @@ void PutFileRequest::Run() {
response_params[strings::space_available] =
static_cast<uint32_t>(space_available);
- LOG4CXX_ERROR(logger_, "Out of memory");
+ SDL_LOG_ERROR("Out of memory");
SendResponse(false,
mobile_apis::Result::OUT_OF_MEMORY,
"Out of memory",
@@ -206,7 +207,7 @@ void PutFileRequest::Run() {
}
if (!file_system::CreateDirectoryRecursively(file_path)) {
- LOG4CXX_ERROR(logger_, "Can't create folder");
+ SDL_LOG_ERROR("Can't create folder");
SendResponse(false,
mobile_apis::Result::GENERIC_ERROR,
"Can't create folder.",
@@ -216,12 +217,12 @@ void PutFileRequest::Run() {
const std::string full_path = file_path + "/" + sync_file_name_;
if ((*message_)[strings::msg_params].keyExists(strings::crc32_check_sum)) {
- LOG4CXX_TRACE(logger_, "Binary Data Size: " << binary_data.size());
+ SDL_LOG_TRACE("Binary Data Size: " << binary_data.size());
const uint32_t crc_received =
(*message_)[strings::msg_params][strings::crc32_check_sum].asUInt();
- LOG4CXX_TRACE(logger_, "CRC32 SUM Received: " << crc_received);
+ SDL_LOG_TRACE("CRC32 SUM Received: " << crc_received);
const uint32_t crc_calculated = GetCrc32CheckSum(binary_data);
- LOG4CXX_TRACE(logger_, "CRC32 SUM Calculated: " << crc_calculated);
+ SDL_LOG_TRACE("CRC32 SUM Calculated: " << crc_calculated);
if (crc_calculated != crc_received) {
SendResponse(false,
mobile_apis::Result::CORRUPTED_DATA,
@@ -232,16 +233,14 @@ void PutFileRequest::Run() {
}
}
- LOG4CXX_DEBUG(logger_,
- "Writing " << binary_data.size() << " bytes to " << full_path
+ SDL_LOG_DEBUG("Writing " << binary_data.size() << " bytes to " << full_path
<< " (current size is"
<< file_system::FileSize(full_path) << ")");
mobile_apis::Result::eType save_result = application_manager_.SaveBinary(
binary_data, file_path, sync_file_name_, offset_);
- LOG4CXX_DEBUG(logger_,
- "New size of " << full_path << " is "
+ SDL_LOG_DEBUG("New size of " << full_path << " is "
<< file_system::FileSize(full_path) << " bytes");
if (!is_system_file) {
response_params[strings::space_available] =
@@ -251,7 +250,7 @@ void PutFileRequest::Run() {
sync_file_name_ = file_path + "/" + sync_file_name_;
switch (save_result) {
case mobile_apis::Result::SUCCESS: {
- LOG4CXX_INFO(logger_, "PutFile is successful");
+ SDL_LOG_INFO("PutFile is successful");
if (!is_system_file) {
AppFile file(sync_file_name_,
is_persistent_file_,
@@ -259,15 +258,14 @@ void PutFileRequest::Run() {
file_type_);
if (0 == offset_) {
- LOG4CXX_INFO(logger_, "New file downloading");
+ SDL_LOG_INFO("New file downloading");
if (!application->AddFile(file)) {
- LOG4CXX_INFO(logger_,
- "Couldn't add file to application (File already Exist"
- << " in application and was rewritten on FS)");
+ SDL_LOG_INFO("Couldn't add file to application (File already Exist"
+ << " in application and was rewritten on FS)");
/* It can be first part of new big file, so we need to update
information about it's downloading status and persistence */
if (!application->UpdateFile(file)) {
- LOG4CXX_ERROR(logger_, "Couldn't update file");
+ SDL_LOG_ERROR("Couldn't update file");
/* If it is impossible to update file, application doesn't
know about existing this file */
SendResponse(false,
@@ -290,15 +288,14 @@ void PutFileRequest::Run() {
break;
}
default:
- LOG4CXX_WARN(logger_,
- "PutFile is unsuccessful. Result = " << save_result);
+ SDL_LOG_WARN("PutFile is unsuccessful. Result = " << save_result);
SendResponse(false, save_result, "Can't save file", &response_params);
break;
}
}
void PutFileRequest::SendOnPutFileNotification(bool is_system_file) {
- LOG4CXX_INFO(logger_, "SendOnPutFileNotification");
+ SDL_LOG_INFO("SendOnPutFileNotification");
smart_objects::SmartObjectSPtr notification =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc
index f9ddbf7717..493efbd11c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
PutFileResponse::PutFileResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,12 +57,12 @@ PutFileResponse::PutFileResponse(
PutFileResponse::~PutFileResponse() {}
void PutFileResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id =
(*message_)[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application not registered");
+ SDL_LOG_ERROR("Application not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 7fabae7443..658723981e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -126,6 +126,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -137,44 +139,359 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
rpc_service,
hmi_capabilities,
policy_handler)
- , result_code_(mobile_apis::Result::INVALID_ENUM)
+ , are_tts_chunks_invalid_(false)
+ , are_hmi_types_invalid_(false)
+ , is_resumption_failed_(false)
+ , is_wrong_language_(false)
, device_handle_(0) {}
RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {}
bool RegisterAppInterfaceRequest::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return true;
}
-void RegisterAppInterfaceRequest::Run() {
- using namespace helpers;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Connection key is " << connection_key());
-
- // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA.
- // Flag conditional compilation specific to customer is used in order to
- // exclude hit code
- // to RTC
- // FIXME(EZamakhov): on shutdown - get freez
+uint32_t RegisterAppInterfaceRequest::default_timeout() const {
+ // As RAI request does not depend on any HMI response there is no need to
+ // track any timeout for it. RAI request will be removed from
+ // RequestController queue upon RAI response which will be sent anyway
+ return 0;
+}
- // wait till HMI started
+void RegisterAppInterfaceRequest::WaitForHMIIsReady() {
while (!application_manager_.IsStopping() &&
!application_manager_.IsHMICooperating()) {
- LOG4CXX_DEBUG(logger_,
- "Waiting for the HMI... conn_key="
- << connection_key()
- << ", correlation_id=" << correlation_id()
- << ", default_timeout=" << default_timeout()
- << ", thread=" << pthread_self());
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
+ SDL_LOG_DEBUG("Waiting for the HMI... conn_key="
+ << connection_key() << ", correlation_id=" << correlation_id()
+ << ", default_timeout=" << default_timeout()
+ << ", thread=" << pthread_self());
sleep(1);
// TODO(DK): timer_->StartWait(1);
}
+}
+
+void RegisterAppInterfaceRequest::FillApplicationParams(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+ const auto& msg_params = (*message_)[strings::msg_params];
+ application->set_is_media_application(
+ msg_params[strings::is_media_application].asBool());
+
+ if (msg_params.keyExists(strings::vr_synonyms)) {
+ application->set_vr_synonyms(msg_params[strings::vr_synonyms]);
+ }
+
+ if (msg_params.keyExists(strings::ngn_media_screen_app_name)) {
+ application->set_ngn_media_screen_name(
+ msg_params[strings::ngn_media_screen_app_name]);
+ }
+
+ if (msg_params.keyExists(strings::tts_name)) {
+ smart_objects::SmartObject& tts_name =
+ (*message_)[strings::msg_params][strings::tts_name];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(
+ tts_name, application, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ SDL_LOG_WARN("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ response_info_ = "One or more files needed for tts_name are not present";
+ are_tts_chunks_invalid_ = true;
+ }
+ application->set_tts_name(tts_name);
+ }
+
+ if (msg_params.keyExists(strings::app_hmi_type)) {
+ application->set_app_types(msg_params[strings::app_hmi_type]);
+
+ // check app type
+ const smart_objects::SmartObject& app_type =
+ msg_params.getElement(strings::app_hmi_type);
+
+ for (size_t i = 0; i < app_type.length(); ++i) {
+ mobile_apis::AppHMIType::eType current_app_type =
+ static_cast<mobile_apis::AppHMIType::eType>(
+ app_type.getElement(i).asUInt());
+
+ switch (current_app_type) {
+ case mobile_apis::AppHMIType::NAVIGATION: {
+ application->set_is_navi(true);
+ break;
+ }
+ case mobile_apis::AppHMIType::COMMUNICATION: {
+ application->set_voice_communication_supported(true);
+ break;
+ }
+ case mobile_apis::AppHMIType::PROJECTION: {
+ application->set_mobile_projection_enabled(true);
+ break;
+ }
+ case mobile_apis::AppHMIType::REMOTE_CONTROL: {
+ application->set_remote_control_supported(true);
+ break;
+ }
+ case mobile_apis::AppHMIType::WEB_VIEW: {
+ application->set_webengine_projection_enabled(true);
+ break;
+ }
+ default: {}
+ }
+ }
+ }
+
+ if (msg_params.keyExists(strings::day_color_scheme)) {
+ application->set_day_color_scheme(msg_params[strings::day_color_scheme]);
+ }
+
+ if (msg_params.keyExists(strings::night_color_scheme)) {
+ application->set_night_color_scheme(
+ msg_params[strings::night_color_scheme]);
+ }
+}
+
+void RegisterAppInterfaceRequest::SetupAppDeviceInfo(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+ const auto& msg_params = (*message_)[strings::msg_params];
+
+ policy::DeviceParams dev_params;
+ if (-1 == application_manager_.connection_handler()
+ .get_session_observer()
+ .GetDataOnDeviceID(application->device(),
+ &dev_params.device_name,
+ NULL,
+ &dev_params.device_mac_address,
+ &dev_params.device_connection_type)) {
+ SDL_LOG_ERROR("Failed to extract information for device "
+ << application->device());
+ }
+ policy::DeviceInfo device_info;
+ device_info.AdoptDeviceType(dev_params.device_connection_type);
+ if (msg_params.keyExists(strings::device_info)) {
+ FillDeviceInfo(&device_info);
+ }
+ const std::string& device_mac = application->mac_address();
+ GetPolicyHandler().SetDeviceInfo(device_mac, device_info);
+}
+
+bool RegisterAppInterfaceRequest::ApplicationDataShouldBeResumed(
+ std::string& add_info) {
+ SDL_LOG_AUTO_TRACE();
+ const auto& msg_params = (*message_)[strings::msg_params];
+ resumption::ResumeCtrl& resumer = application_manager_.resume_controller();
+
+ const uint32_t key = connection_key();
+ ApplicationSharedPtr application = application_manager_.application(key);
+
+ const bool hash_id_present = msg_params.keyExists(strings::hash_id);
+ const std::string hash_id = msg_params[strings::hash_id].asString();
+ const bool resumption = hash_id_present && !hash_id.empty();
+
+ if (!resumption) {
+ SDL_LOG_DEBUG("Hash id is missing, no resumption required");
+ return false;
+ }
+
+ if (!resumer.CheckApplicationHash(application, hash_id)) {
+ add_info = "Hash from RAI does not match to saved resume data.";
+ SDL_LOG_WARN(add_info);
+ is_resumption_failed_ = true;
+ return false;
+ }
+
+ if (!resumer.CheckPersistenceFilesForResumption(application)) {
+ add_info = "Persistent data is missing.";
+ SDL_LOG_WARN(add_info);
+ is_resumption_failed_ = true;
+ return false;
+ }
+
+ add_info = "Resume succeeded.";
+ SDL_LOG_DEBUG(add_info);
+ application->set_app_data_resumption_allowance(true);
+ application->set_is_resuming(true);
+
+ return true;
+}
+
+mobile_apis::Result::eType
+RegisterAppInterfaceRequest::CalculateFinalResultCode() const {
+ if (is_wrong_language_) {
+ SDL_LOG_DEBUG("Language was wrong");
+ return mobile_apis::Result::WRONG_LANGUAGE;
+ }
+
+ if (are_hmi_types_invalid_ || are_tts_chunks_invalid_) {
+ SDL_LOG_DEBUG("HMI types or TTS chunks are invalid");
+ return mobile_apis::Result::WARNINGS;
+ }
+
+ if (is_resumption_failed_) {
+ SDL_LOG_DEBUG("Resumption has been failed");
+ return mobile_apis::Result::RESUME_FAILED;
+ }
+
+ return mobile_apis::Result::SUCCESS;
+}
+
+policy::StatusNotifier RegisterAppInterfaceRequest::AddApplicationDataToPolicy(
+ application_manager::ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+
+ AppHmiTypes hmi_types;
+ if ((*message_)[strings::msg_params].keyExists(strings::app_hmi_type)) {
+ smart_objects::SmartArray* hmi_types_ptr =
+ (*message_)[strings::msg_params][strings::app_hmi_type].asArray();
+ if (hmi_types_ptr) {
+ SmartArrayValueExtractor extractor;
+ if (hmi_types_ptr && 0 < hmi_types_ptr->size()) {
+ std::transform(hmi_types_ptr->begin(),
+ hmi_types_ptr->end(),
+ std::back_inserter(hmi_types),
+ extractor);
+ }
+ }
+ }
+
+ return policy_handler_.AddApplication(
+ application->mac_address(), application->policy_app_id(), hmi_types);
+}
+
+void RegisterAppInterfaceRequest::CheckLanguage() {
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+ DCHECK_OR_RETURN_VOID(application);
+ const auto& msg_params = (*message_)[strings::msg_params];
+ if (msg_params[strings::language_desired].asInt() !=
+ hmi_capabilities_.active_vr_language() ||
+ msg_params[strings::hmi_display_language_desired].asInt() !=
+ hmi_capabilities_.active_ui_language()) {
+ SDL_LOG_WARN("Wrong language on registering application "
+ << application->name().c_str());
+
+ SDL_LOG_ERROR("VR language desired code is "
+ << msg_params[strings::language_desired].asInt()
+ << " , active VR language code is "
+ << hmi_capabilities_.active_vr_language()
+ << ", UI language desired code is "
+ << msg_params[strings::hmi_display_language_desired].asInt()
+ << " , active UI language code is "
+ << hmi_capabilities_.active_ui_language());
+
+ is_wrong_language_ = true;
+ }
+}
+
+smart_objects::SmartObjectSPtr GetLockScreenIconUrlNotification(
+ policy::PolicyHandlerInterface& policy_handler,
+ const uint32_t connection_key,
+ ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN(app.get(), smart_objects::SmartObjectSPtr());
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<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] =
+ application_manager::commands::CommandImpl::mobile_protocol_type_;
+ (*message)[strings::params][strings::protocol_version] =
+ app->protocol_version();
+ (*message)[strings::msg_params][strings::request_type] =
+ mobile_apis::RequestType::LOCK_SCREEN_ICON_URL;
+ (*message)[strings::msg_params][strings::url] =
+ policy_handler.GetLockScreenIconUrl(app->policy_app_id());
+ return message;
+}
+
+void SendDriverDistractionAndIconUrlNotifications(
+ ApplicationManager& app_manager,
+ const uint32_t connection_key,
+ ApplicationSharedPtr app) {
+ policy::PolicyHandlerInterface& policy_handler =
+ app_manager.GetPolicyHandler();
+ smart_objects::SmartObjectSPtr so =
+ GetLockScreenIconUrlNotification(policy_handler, connection_key, app);
+ app_manager.GetRPCService().ManageMobileCommand(
+ so, app_mngr::commands::Command::SOURCE_SDL);
+ app_manager.SendDriverDistractionState(app);
+ // Create onSystemRequest to mobile to obtain cloud app icons
+ app_manager.SendGetIconUrlNotifications(connection_key, app);
+}
+
+/**
+ * @brief FinishSendingResponseToMobile is needed because by the time
+ SendRegisterAppInterfaceResponseToMobile() is called from callback
+ in Run(), request object is deleted, which results in SDL crash. This function
+ is intended to prevent that, safely conclude sending response to mobile and
+ perform other related operations (sending notifications, setting HMI level
+ etc.)
+ * @param msg_params copy of request object
+ * @param app_manager reference to application manager
+ * @param connection_key connection key
+ * @param notify_upd_manager pointer to status notifier callback function
+ */
+void FinishSendingResponseToMobile(const smart_objects::SmartObject& msg_params,
+ ApplicationManager& app_manager,
+ const uint32_t connection_key,
+ policy::StatusNotifier notify_upd_manager) {
+ resumption::ResumeCtrl& resume_ctrl = app_manager.resume_controller();
+ auto application = app_manager.application(connection_key);
+
+ policy::PolicyHandlerInterface& policy_handler =
+ app_manager.GetPolicyHandler();
+
+ if (msg_params.keyExists(strings::app_hmi_type)) {
+ policy_handler.SetDefaultHmiTypes(application->device(),
+ application->policy_app_id(),
+ &(msg_params[strings::app_hmi_type]));
+ }
+
+ // Default HMI level should be set before any permissions validation, since
+ // it relies on HMI level.
+ app_manager.OnApplicationRegistered(application);
+
+ // Once HMI level is set we can safely forward system capabilities for the
+ // main window and it won't be blocked by policies
+ application->display_capabilities_builder().StopWaitingForWindow(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+
+ if (notify_upd_manager) {
+ (*notify_upd_manager)();
+ }
+
+ auto send_rc_status = [application](plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kRCStatusChanged, application);
+ };
+ app_manager.ApplyFunctorForEachPlugin(send_rc_status);
+
+ // Start PTU after successful registration
+ // Sends OnPermissionChange notification to mobile right after RAI response
+ // and HMI level set-up
+ policy_handler.OnAppRegisteredOnMobile(application->mac_address(),
+ application->policy_app_id());
+ SendDriverDistractionAndIconUrlNotifications(
+ app_manager, connection_key, application);
+ const bool is_app_saved_in_resumption = resume_ctrl.IsApplicationSaved(
+ application->policy_app_id(), application->mac_address());
+ if (is_app_saved_in_resumption) {
+ resume_ctrl.StartResumptionOnlyHMILevel(application);
+ }
+}
+
+void RegisterAppInterfaceRequest::Run() {
+ using namespace helpers;
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Connection key is " << connection_key());
+
+ WaitForHMIIsReady();
if (application_manager_.IsStopping()) {
- LOG4CXX_WARN(logger_, "The ApplicationManager is stopping!");
+ SDL_LOG_WARN("The ApplicationManager is stopping!");
return;
}
@@ -195,9 +512,8 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- LOG4CXX_DEBUG(
- logger_,
- "device_handle: " << device_handle_ << " device_id: " << device_id_);
+ SDL_LOG_DEBUG("device_handle: " << device_handle_
+ << " device_id: " << device_id_);
if (IsApplicationSwitched()) {
return;
@@ -244,7 +560,7 @@ void RegisterAppInterfaceRequest::Run() {
policy_result,
mobile_apis::Result::SUCCESS,
mobile_apis::Result::WARNINGS)) {
- SendResponse(false, policy_result);
+ SendResponse(false, policy_result, response_info_.c_str());
return;
}
@@ -252,8 +568,7 @@ void RegisterAppInterfaceRequest::Run() {
std::vector<ApplicationSharedPtr> duplicate_apps;
if (GetDuplicateNames(duplicate_apps)) {
- LOG4CXX_ERROR(logger_,
- "Found duplicate app names, checking for hybrid apps.");
+ SDL_LOG_ERROR("Found duplicate app names, checking for hybrid apps.");
// Default preference to BOTH
mobile_apis::HybridAppPreference::eType preference =
mobile_apis::HybridAppPreference::BOTH;
@@ -292,8 +607,7 @@ void RegisterAppInterfaceRequest::Run() {
preference == mobile_apis::HybridAppPreference::CLOUD) {
// Unregister mobile application and allow cloud application to
// register in it's place
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Unregistering app because a preferred version is registered.");
application_manager_.UnregisterApplication(
duplicate_app->app_id(),
@@ -319,14 +633,13 @@ void RegisterAppInterfaceRequest::Run() {
}
if (mobile_apis::Result::SUCCESS != coincidence_result) {
- LOG4CXX_ERROR(logger_, "Coincidence check failed.");
+ SDL_LOG_ERROR("Coincidence check failed.");
SendResponse(false, coincidence_result);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_INFO(logger_,
- "Incoming register app interface has contains \t\n \\t \\n");
+ SDL_LOG_INFO("Incoming register app interface has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -347,15 +660,14 @@ void RegisterAppInterfaceRequest::Run() {
minimum_major_version, minimum_minor_version, minimum_patch_version);
if (mobile_version < min_module_version) {
- LOG4CXX_WARN(logger_,
- "Application RPC Version does not meet minimum requirement");
+ SDL_LOG_WARN("Application RPC Version does not meet minimum requirement");
SendResponse(false, mobile_apis::Result::REJECTED);
}
application = application_manager_.RegisterApplication(message_);
if (!application) {
- LOG4CXX_ERROR(logger_, "Application hasn't been registered!");
+ SDL_LOG_ERROR("Application hasn't been registered!");
return;
}
@@ -374,68 +686,29 @@ void RegisterAppInterfaceRequest::Run() {
application->set_msg_version(module_version);
}
- application->set_is_media_application(
- msg_params[strings::is_media_application].asBool());
-
- if (msg_params.keyExists(strings::vr_synonyms)) {
- application->set_vr_synonyms(msg_params[strings::vr_synonyms]);
- }
+ FillApplicationParams(application);
+ SetupAppDeviceInfo(application);
+ auto status_notifier = AddApplicationDataToPolicy(application);
- if (msg_params.keyExists(strings::ngn_media_screen_app_name)) {
- application->set_ngn_media_screen_name(
- msg_params[strings::ngn_media_screen_app_name]);
- }
-
- if (msg_params.keyExists(strings::tts_name)) {
- smart_objects::SmartObject& tts_name =
- (*message_)[strings::msg_params][strings::tts_name];
- mobile_apis::Result::eType verification_result =
- MessageHelper::VerifyTtsFiles(
- tts_name, application, application_manager_);
+ std::string add_info;
+ const auto is_resumption_required = ApplicationDataShouldBeResumed(add_info);
- if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
- response_info_ = "One or more files needed for tts_name are not present";
- result_code_ = mobile_apis::Result::WARNINGS;
- }
- application->set_tts_name(tts_name);
- }
+ auto& resume_ctrl = application_manager_.resume_controller();
- if (msg_params.keyExists(strings::app_hmi_type)) {
- application->set_app_types(msg_params[strings::app_hmi_type]);
-
- // check app type
- const smart_objects::SmartObject& app_type =
- msg_params.getElement(strings::app_hmi_type);
+ // DisplayCapabilitiesBuilder has to collect all the information
+ // from incoming HMI notifications and send only one notification
+ // to mobile app, even if hash does not match, which means that app data
+ // will not be resumed, notification should be sent for default window as
+ // it will be resumed in any case
+ resume_ctrl.StartWaitingForDisplayCapabilitiesUpdate(application,
+ is_resumption_required);
- for (size_t i = 0; i < app_type.length(); ++i) {
- mobile_apis::AppHMIType::eType current_app_type =
- static_cast<mobile_apis::AppHMIType::eType>(
- app_type.getElement(i).asUInt());
+ SendOnAppRegisteredNotificationToHMI(
+ application, is_resumption_required && !is_resumption_failed_);
- switch (current_app_type) {
- case mobile_apis::AppHMIType::NAVIGATION: {
- application->set_is_navi(true);
- break;
- }
- case mobile_apis::AppHMIType::COMMUNICATION: {
- application->set_voice_communication_supported(true);
- break;
- }
- case mobile_apis::AppHMIType::PROJECTION: {
- application->set_mobile_projection_enabled(true);
- break;
- }
- case mobile_apis::AppHMIType::REMOTE_CONTROL: {
- application->set_remote_control_supported(true);
- break;
- }
- default: {}
- }
- }
- }
+ // By default app subscribed to CUSTOM_BUTTON
+ SendSubscribeCustomButtonNotification();
+ SendChangeRegistrationOnHMI(application);
auto on_app_registered = [application](plugin_manager::RPCPlugin& plugin) {
plugin.OnApplicationEvent(plugin_manager::kApplicationRegistered,
@@ -443,67 +716,31 @@ void RegisterAppInterfaceRequest::Run() {
};
application_manager_.ApplyFunctorForEachPlugin(on_app_registered);
- if (msg_params.keyExists(strings::day_color_scheme)) {
- application->set_day_color_scheme(msg_params[strings::day_color_scheme]);
- }
+ if (is_resumption_required) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ const auto& hash_id = msg_params[strings::hash_id].asString();
+ SDL_LOG_WARN("Start Data Resumption");
+ auto send_response = [this, application, status_notifier](
+ mobile_apis::Result::eType result_code,
+ const std::string info) {
+ SDL_LOG_DEBUG("Invoking lambda callback for: " << this);
+ if (result_code != mobile_apis::Result::SUCCESS) {
+ is_resumption_failed_ = true;
+ }
- if (msg_params.keyExists(strings::night_color_scheme)) {
- application->set_night_color_scheme(
- msg_params[strings::night_color_scheme]);
- }
+ SendRegisterAppInterfaceResponseToMobile(
+ ApplicationType::kNewApplication, status_notifier, info);
+ application->UpdateHash();
+ };
+ resume_ctrl.StartResumption(application, hash_id, send_response);
- // Add device to policy table and set device info, if any
- policy::DeviceParams dev_params;
- if (-1 == application_manager_.connection_handler()
- .get_session_observer()
- .GetDataOnDeviceID(application->device(),
- &dev_params.device_name,
- NULL,
- &dev_params.device_mac_address,
- &dev_params.device_connection_type)) {
- LOG4CXX_ERROR(
- logger_,
- "Failed to extract information for device " << application->device());
- }
- policy::DeviceInfo device_info;
- device_info.AdoptDeviceType(dev_params.device_connection_type);
- if (msg_params.keyExists(strings::device_info)) {
- FillDeviceInfo(&device_info);
+ return;
}
- const std::string& device_mac = application->mac_address();
-
- GetPolicyHandler().SetDeviceInfo(device_mac, device_info);
+ CheckLanguage();
- SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication);
- smart_objects::SmartObjectSPtr so =
- GetLockScreenIconUrlNotification(connection_key(), application);
- rpc_service_.ManageMobileCommand(so, SOURCE_SDL);
- application_manager_.SendDriverDistractionState(application);
- // Create onSystemRequest to mobile to obtain cloud app icons
- application_manager_.SendGetIconUrlNotifications(connection_key(),
- application);
-}
-
-smart_objects::SmartObjectSPtr
-RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification(
- const uint32_t connection_key, ApplicationSharedPtr app) {
- DCHECK_OR_RETURN(app.get(), smart_objects::SmartObjectSPtr());
- smart_objects::SmartObjectSPtr message =
- std::make_shared<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] = mobile_protocol_type_;
- (*message)[strings::params][strings::protocol_version] = protocol_version_;
- (*message)[strings::msg_params][strings::request_type] =
- mobile_apis::RequestType::LOCK_SCREEN_ICON_URL;
- (*message)[strings::msg_params][strings::url] =
- GetPolicyHandler().GetLockScreenIconUrl(app->policy_app_id());
- return message;
+ SendRegisterAppInterfaceResponseToMobile(
+ ApplicationType::kNewApplication, status_notifier, add_info);
}
void FillVRRelatedFields(smart_objects::SmartObject& response_params,
@@ -633,27 +870,16 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params,
}
void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
- ApplicationType app_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationType app_type,
+ policy::StatusNotifier status_notifier,
+ const std::string& add_info) {
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
- mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
-
const HMICapabilities& hmi_capabilities = hmi_capabilities_;
const uint32_t key = connection_key();
ApplicationSharedPtr application = application_manager_.application(key);
-
- resumption::ResumeCtrl& resumer = application_manager_.resume_controller();
-
- if (!application) {
- LOG4CXX_ERROR(logger_,
- "There is no application for such connection key" << key);
- LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer");
- resumer.OnAppRegistrationEnd();
- return;
- }
-
utils::SemanticVersion negotiated_version = application->msg_version();
response_params[strings::sync_msg_version][strings::major_version] =
@@ -666,27 +892,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- if (msg_params[strings::language_desired].asInt() !=
- hmi_capabilities.active_vr_language() ||
- msg_params[strings::hmi_display_language_desired].asInt() !=
- hmi_capabilities.active_ui_language()) {
- LOG4CXX_WARN(logger_,
- "Wrong language on registering application "
- << application->name().c_str());
-
- LOG4CXX_ERROR(
- logger_,
- "VR language desired code is "
- << msg_params[strings::language_desired].asInt()
- << " , active VR language code is "
- << hmi_capabilities.active_vr_language() << ", UI language code is "
- << msg_params[strings::hmi_display_language_desired].asInt()
- << " , active UI language code is "
- << hmi_capabilities.active_ui_language());
-
- result_code = mobile_apis::Result::WRONG_LANGUAGE;
- }
-
if (HmiInterfaces::STATE_NOT_AVAILABLE !=
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_TTS)) {
@@ -711,39 +916,36 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
FillVIRelatedFields(response_params, hmi_capabilities);
}
- auto button_capabilities = hmi_capabilities.button_capabilities();
- if (button_capabilities) {
- response_params[hmi_response::button_capabilities] = *button_capabilities;
+ if (hmi_capabilities.button_capabilities()) {
+ response_params[hmi_response::button_capabilities] =
+ *hmi_capabilities.button_capabilities();
}
- auto soft_button_capabilities = hmi_capabilities.soft_button_capabilities();
- if (soft_button_capabilities) {
+ if (hmi_capabilities.soft_button_capabilities()) {
response_params[hmi_response::soft_button_capabilities] =
- *soft_button_capabilities;
+ *hmi_capabilities.soft_button_capabilities();
}
- auto preset_bank_capabilities = hmi_capabilities.preset_bank_capabilities();
- if (preset_bank_capabilities) {
+ if (hmi_capabilities.preset_bank_capabilities()) {
response_params[hmi_response::preset_bank_capabilities] =
- *preset_bank_capabilities;
+ *hmi_capabilities.preset_bank_capabilities();
}
- auto hmi_zone_capabilities = hmi_capabilities.hmi_zone_capabilities();
- if (hmi_zone_capabilities) {
- if (smart_objects::SmartType_Array == hmi_zone_capabilities->getType()) {
+ if (hmi_capabilities.hmi_zone_capabilities()) {
+ if (smart_objects::SmartType_Array ==
+ hmi_capabilities.hmi_zone_capabilities()->getType()) {
// hmi_capabilities json contains array and HMI response object
response_params[hmi_response::hmi_zone_capabilities] =
- *hmi_zone_capabilities;
+ *hmi_capabilities.hmi_zone_capabilities();
} else {
response_params[hmi_response::hmi_zone_capabilities][0] =
- *hmi_zone_capabilities;
+ *hmi_capabilities.hmi_zone_capabilities();
}
}
- auto pcm_stream_capabilities = hmi_capabilities.pcm_stream_capabilities();
- if (pcm_stream_capabilities) {
+ if (hmi_capabilities.pcm_stream_capabilities()) {
response_params[strings::pcm_stream_capabilities] =
- *pcm_stream_capabilities;
+ *hmi_capabilities.pcm_stream_capabilities();
}
const std::vector<uint32_t>& diag_modes =
@@ -765,9 +967,9 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
if (ApplicationType::kSwitchedApplicationWrongHashId == app_type) {
- LOG4CXX_DEBUG(logger_,
- "Application has been switched from another transport, "
- "but doesn't have correct hashID.");
+ SDL_LOG_DEBUG(
+ "Application has been switched from another transport, "
+ "but doesn't have correct hashID.");
application_manager::DeleteApplicationData(application,
application_manager_);
@@ -778,115 +980,25 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
if (ApplicationType::kSwitchedApplicationHashOk == app_type) {
- LOG4CXX_DEBUG(logger_,
- "Application has been switched from another transport "
- "and has correct hashID.");
+ SDL_LOG_DEBUG(
+ "Application has been switched from another transport "
+ "and has correct hashID.");
SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
return;
}
- const bool hash_id_present =
- (*message_)[strings::msg_params].keyExists(strings::hash_id);
- const std::string hash_id =
- (*message_)[strings::msg_params][strings::hash_id].asString();
-
- const bool resumption = hash_id_present && !hash_id.empty();
- bool need_restore_vr = resumption;
-
- std::string add_info;
- if (resumption) {
- if (!resumer.CheckApplicationHash(application, hash_id)) {
- LOG4CXX_WARN(logger_,
- "Hash from RAI does not match to saved resume data.");
- result_code = mobile_apis::Result::RESUME_FAILED;
- add_info = "Hash from RAI does not match to saved resume data.";
- need_restore_vr = false;
- } else if (!resumer.CheckPersistenceFilesForResumption(application)) {
- LOG4CXX_WARN(logger_, "Persistent data is missing.");
- result_code = mobile_apis::Result::RESUME_FAILED;
- add_info = "Persistent data is missing.";
- need_restore_vr = false;
- } else {
- add_info = "Resume succeeded.";
- application->set_app_data_resumption_allowance(true);
- application->set_is_resuming(true);
- }
- }
- if ((mobile_apis::Result::SUCCESS == result_code) &&
- (mobile_apis::Result::INVALID_ENUM != result_code_)) {
- add_info += response_info_;
- result_code = result_code_;
- }
-
- // In case application exist in resumption we need to send resumeVrgrammars
- const bool is_app_saved_in_resumption = resumer.IsApplicationSaved(
- application->policy_app_id(), application->mac_address());
-
- // If app is in resuming state
- // DisplayCapabilitiesBuilder has to collect all the information
- // from incoming HMI notifications and send only one notification
- // to mobile app, even if hash does not match, which means that app data
- // will not be resumed, notification should be sent for default window as
- // it will be resumed in any case
- if (resumption || is_app_saved_in_resumption) {
- resumer.StartWaitingForDisplayCapabilitiesUpdate(application);
- }
-
- AppHmiTypes hmi_types;
- if ((*message_)[strings::msg_params].keyExists(strings::app_hmi_type)) {
- smart_objects::SmartArray* hmi_types_ptr =
- (*message_)[strings::msg_params][strings::app_hmi_type].asArray();
- DCHECK_OR_RETURN_VOID(hmi_types_ptr);
- SmartArrayValueExtractor extractor;
- if (hmi_types_ptr && 0 < hmi_types_ptr->size()) {
- std::transform(hmi_types_ptr->begin(),
- hmi_types_ptr->end(),
- std::back_inserter(hmi_types),
- extractor);
- }
- }
- policy::StatusNotifier notify_upd_manager = GetPolicyHandler().AddApplication(
- application->mac_address(), application->policy_app_id(), hmi_types);
+ response_info_ += add_info;
response_params[strings::icon_resumed] =
file_system::FileExists(application->app_icon_path());
- SendResponse(true, result_code, add_info.c_str(), &response_params);
- if (msg_params.keyExists(strings::app_hmi_type)) {
- GetPolicyHandler().SetDefaultHmiTypes(application->device(),
- application->policy_app_id(),
- &(msg_params[strings::app_hmi_type]));
- }
-
- // Default HMI level should be set before any permissions validation, since it
- // relies on HMI level.
- application_manager_.OnApplicationRegistered(application);
-
- auto send_rc_status = [application](plugin_manager::RPCPlugin& plugin) {
- plugin.OnApplicationEvent(plugin_manager::kRCStatusChanged, application);
- };
- application_manager_.ApplyFunctorForEachPlugin(send_rc_status);
-
- SendOnAppRegisteredNotificationToHMI(
- application, resumption, need_restore_vr);
- (*notify_upd_manager)();
-
- // Start PTU after successfull registration
- // Sends OnPermissionChange notification to mobile right after RAI response
- // and HMI level set-up
- GetPolicyHandler().OnAppRegisteredOnMobile(application->mac_address(),
- application->policy_app_id());
+ smart_objects::SmartObject msg_params_copy = msg_params;
+ const auto result_code = CalculateFinalResultCode();
- if (result_code != mobile_apis::Result::RESUME_FAILED &&
- application->is_app_data_resumption_allowed()) {
- resumer.StartResumption(application, hash_id);
- } else if (is_app_saved_in_resumption) {
- resumer.StartResumptionOnlyHMILevel(application);
- }
+ SendResponse(true, result_code, response_info_.c_str(), &response_params);
- // By default app subscribed to CUSTOM_BUTTON
- SendSubscribeCustomButtonNotification();
- SendChangeRegistrationOnHMI(application);
+ FinishSendingResponseToMobile(
+ msg_params_copy, application_manager_, key, status_notifier);
}
void RegisterAppInterfaceRequest::SendChangeRegistration(
@@ -906,7 +1018,7 @@ void RegisterAppInterfaceRequest::SendChangeRegistration(
msg_params[strings::app_id] = app_id;
SendHMIRequest(function_id, &msg_params);
} else {
- LOG4CXX_DEBUG(logger_, "Interface " << interface << "is not avaliable");
+ SDL_LOG_DEBUG("Interface " << interface << " is not available");
}
}
@@ -922,11 +1034,11 @@ void RegisterAppInterfaceRequest::SendChangeRegistrationOnHMI(
}
void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
- ApplicationConstSharedPtr app, bool resumption, bool need_restore_vr) {
+ ApplicationConstSharedPtr app, bool resumption) {
using namespace smart_objects;
SmartObjectSPtr notification = std::make_shared<SmartObject>(SmartType_Map);
if (!notification) {
- LOG4CXX_ERROR(logger_, "Failed to create smart object");
+ SDL_LOG_ERROR("Failed to create smart object");
return;
}
@@ -943,7 +1055,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
// Due to current requirements in case when we're in resumption mode
// we have to always send resumeVRGrammar field.
if (resumption) {
- msg_params[strings::resume_vr_grammars] = need_restore_vr;
+ msg_params[strings::resume_vr_grammars] = resumption;
}
if (app->vr_synonyms()) {
@@ -976,7 +1088,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
}
mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -998,7 +1110,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
// Name check
const auto& cur_name = app->name();
if (app_name.CompareIgnoreCase(cur_name)) {
- LOG4CXX_ERROR(logger_, "Application name is known already.");
+ SDL_LOG_ERROR("Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
const auto vr = app->vr_synonyms();
@@ -1007,7 +1119,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
CoincidencePredicateVR v(app_name);
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
- LOG4CXX_ERROR(logger_, "Application name is known already.");
+ SDL_LOG_ERROR("Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
}
@@ -1018,7 +1130,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
- LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
+ SDL_LOG_ERROR("vr_synonyms duplicated with app_name .");
return mobile_apis::Result::DUPLICATE_NAME;
}
} // End vr check
@@ -1033,11 +1145,9 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
tts_curr->end(),
compare_tts_name);
if (it_tts != tts_array->end()) {
- LOG4CXX_ERROR(
- logger_,
- "TTS name: "
- << (*it_tts)[strings::text].asCustomString().AsMBString()
- << " is known already");
+ SDL_LOG_ERROR("TTS name: "
+ << (*it_tts)[strings::text].asCustomString().AsMBString()
+ << " is known already");
return mobile_apis::Result::DUPLICATE_NAME;
}
} // End tts check
@@ -1049,7 +1159,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
bool RegisterAppInterfaceRequest::GetDuplicateNames(
std::vector<ApplicationSharedPtr>& out_duplicate_apps) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -1083,7 +1193,7 @@ bool RegisterAppInterfaceRequest::GetDuplicateNames(
}
mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(AOleynik): Check is necessary to allow register application in case
// of disabled policy
// Remove this check, when HMI will support policy
@@ -1091,17 +1201,17 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
return mobile_apis::Result::WARNINGS;
}
- smart_objects::SmartObject& message = *message_;
+ auto& message = *message_;
policy::StringArray app_nicknames;
- policy::StringArray app_hmi_types;
+ policy::StringArray app_hmi_types_in_policy;
const std::string mobile_app_id =
application_manager_.GetCorrectMobileIDFromMessage(message_);
const bool init_result = GetPolicyHandler().GetInitialAppData(
- mobile_app_id, &app_nicknames, &app_hmi_types);
+ mobile_app_id, &app_nicknames, &app_hmi_types_in_policy);
if (!init_result) {
- LOG4CXX_ERROR(logger_, "Error during initial application data check.");
+ SDL_LOG_ERROR("Error during initial application data check.");
return mobile_apis::Result::INVALID_DATA;
}
@@ -1111,8 +1221,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
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.");
+ SDL_LOG_WARN("Application name was not found in nicknames list.");
// App should be unregistered, if its name is not present in nicknames
// list
usage_statistics::AppCounter count_of_rejections_nickname_mismatch(
@@ -1124,36 +1233,20 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
}
}
- mobile_apis::Result::eType result = mobile_apis::Result::SUCCESS;
+ auto result = mobile_apis::Result::SUCCESS;
// If AppHMIType is not included in policy - allow any type
- if (!app_hmi_types.empty()) {
- if (message[strings::msg_params].keyExists(strings::app_hmi_type)) {
- // If AppHmiTypes are partially same, the system should allow those listed
- // in the policy table and send warning info on missed values
- smart_objects::SmartArray app_types =
- *(message[strings::msg_params][strings::app_hmi_type].asArray());
-
- std::string log;
- CheckMissedTypes checker(app_hmi_types, log);
- std::for_each(app_types.begin(), app_types.end(), checker);
- if (!log.empty()) {
- response_info_ =
- "Following AppHmiTypes are not present in policy "
- "table:" +
- log;
- result_code_ = mobile_apis::Result::WARNINGS;
- }
+ if (!app_hmi_types_in_policy.empty()) {
+ result = ProcessingAppHMITypesPolicies(message, app_hmi_types_in_policy);
+ } else {
+ result = ProcessingAppHMITypesInMessage(message);
+ if (mobile_apis::Result::DISALLOWED == result) {
+ response_info_ =
+ "WEB_VIEW AppHmiType is absent in application policies, because they "
+ "are empty";
+ SDL_LOG_DEBUG(response_info_);
+ return result;
}
- // Replace AppHmiTypes in request with values allowed by policy table
- message[strings::msg_params][strings::app_hmi_type] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
-
- smart_objects::SmartObject& app_hmi_type =
- message[strings::msg_params][strings::app_hmi_type];
-
- AppHMITypeInserter inserter(app_hmi_type);
- std::for_each(app_hmi_types.begin(), app_hmi_types.end(), inserter);
}
return result;
@@ -1198,7 +1291,7 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
}
bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const custom_string::CustomString mobile_app_id(
application_manager_.GetCorrectMobileIDFromMessage(message_));
@@ -1208,12 +1301,11 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
for (const auto& app : applications) {
if (mobile_app_id.CompareIgnoreCase(app->policy_app_id().c_str())) {
if (app->device() != device_handle_) {
- LOG4CXX_DEBUG(logger_,
- "These policy_app_id equal, but applications have "
- "different device id"
- << " mobile_app_id: " << mobile_app_id.c_str()
- << " device_handle: " << device_handle_
- << " device_handle: " << app->device());
+ SDL_LOG_DEBUG(
+ "These policy_app_id equal, but applications have "
+ "different device id"
+ << " mobile_app_id: " << mobile_app_id.c_str() << " device_handle: "
+ << device_handle_ << " device_handle: " << app->device());
continue;
}
return true;
@@ -1224,12 +1316,12 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
}
bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::app_name].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed");
+ SDL_LOG_ERROR("Invalid app_name syntax check failed");
return true;
}
@@ -1243,7 +1335,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
for (; it_tn != it_tn_end; ++it_tn) {
str = (*it_tn)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_name syntax check failed");
return true;
}
}
@@ -1254,8 +1346,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid ngn_media_screen_app_name syntax check failed");
+ SDL_LOG_ERROR("Invalid ngn_media_screen_app_name syntax check failed");
return true;
}
}
@@ -1270,7 +1361,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
for (; it_vs != it_vs_end; ++it_vs) {
str = (*it_vs).asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_synonyms syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_synonyms syntax check failed");
return true;
}
}
@@ -1279,7 +1370,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) {
str = (*message_)[strings::msg_params][strings::hash_id].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid hash_id syntax check failed");
+ SDL_LOG_ERROR("Invalid hash_id syntax check failed");
return true;
}
}
@@ -1291,8 +1382,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
[strings::hardware]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid device_info hardware syntax check failed");
+ SDL_LOG_ERROR("Invalid device_info hardware syntax check failed");
return true;
}
}
@@ -1303,8 +1393,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
[strings::firmware_rev]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid device_info firmware_rev syntax check failed");
+ SDL_LOG_ERROR("Invalid device_info firmware_rev syntax check failed");
return true;
}
}
@@ -1314,7 +1403,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::device_info][strings::os]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid device_info os syntax check failed");
+ SDL_LOG_ERROR("Invalid device_info os syntax check failed");
return true;
}
}
@@ -1325,8 +1414,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
[strings::os_version]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid device_info os_version syntax check failed");
+ SDL_LOG_ERROR("Invalid device_info os_version syntax check failed");
return true;
}
}
@@ -1337,8 +1425,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
[strings::carrier]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid device_info carrier syntax check failed");
+ SDL_LOG_ERROR("Invalid device_info carrier syntax check failed");
return true;
}
}
@@ -1347,7 +1434,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
str = (*message_)[strings::msg_params][strings::app_id].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid app_id syntax check failed");
+ SDL_LOG_ERROR("Invalid app_id syntax check failed");
return true;
}
}
@@ -1357,7 +1444,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
str =
(*message_)[strings::msg_params][strings::full_app_id].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid app_id syntax check failed");
+ SDL_LOG_ERROR("Invalid app_id syntax check failed");
return true;
}
}
@@ -1373,8 +1460,7 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam(
using namespace hmi_response;
if (!vehicle_type.keyExists(param) || vehicle_type[param].empty()) {
if (!backup_value.empty()) {
- LOG4CXX_DEBUG(logger_,
- param << " is missing."
+ SDL_LOG_DEBUG(param << " is missing."
"Will be replaced with policy table value.");
vehicle_type[param] = backup_value;
} else {
@@ -1397,30 +1483,27 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
const std::string& policy_app_id =
application_manager_.GetCorrectMobileIDFromMessage(message_);
- LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id);
+ SDL_LOG_DEBUG("Looking for application id " << policy_app_id);
auto app =
application_manager_.reregister_application_by_policy_id(policy_app_id);
if (!app) {
- LOG4CXX_DEBUG(
- logger_,
- "Application with policy id " << policy_app_id << " is not found.");
+ SDL_LOG_DEBUG("Application with policy id " << policy_app_id
+ << " is not found.");
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Application with policy id " << policy_app_id << " is found.");
+ SDL_LOG_DEBUG("Application with policy id " << policy_app_id << " is found.");
const auto app_device_handle = app->device();
if (app_device_handle == device_handle_) {
- LOG4CXX_DEBUG(logger_,
- "Application " << policy_app_id
+ SDL_LOG_DEBUG("Application " << policy_app_id
<< " is already registered from this device.");
SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY);
return true;
}
- LOG4CXX_DEBUG(logger_, "Application is found in reconnection list.");
+ SDL_LOG_DEBUG("Application is found in reconnection list.");
auto app_type = ApplicationType::kSwitchedApplicationWrongHashId;
if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) {
@@ -1434,12 +1517,15 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
}
application_manager_.ProcessReconnection(app, connection_key());
- SendRegisterAppInterfaceResponseToMobile(app_type);
- MessageHelper::SendHMIStatusNotification(
- app,
- mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
- application_manager_);
+ const std::string additional_info;
+ SendRegisterAppInterfaceResponseToMobile(
+ app_type, policy::StatusNotifier(), additional_info);
+
+ auto notification = MessageHelper::CreateHMIStatusNotification(
+ app, mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ application_manager_.GetRPCService().ManageMobileCommand(notification,
+ SOURCE_SDL);
application_manager_.OnApplicationSwitched(app);
@@ -1450,12 +1536,12 @@ bool RegisterAppInterfaceRequest::GetDataOnSessionKey(
const uint32_t key,
connection_handler::DeviceHandle* device_id,
std::string* mac_address) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if ((nullptr == mac_address) && (nullptr == device_id)) {
- LOG4CXX_ERROR(logger_,
- "Can't get data on session key because device id and mac "
- "address are empty.");
+ SDL_LOG_ERROR(
+ "Can't get data on session key because device id and mac "
+ "address are empty.");
return false;
}
@@ -1466,8 +1552,7 @@ bool RegisterAppInterfaceRequest::GetDataOnSessionKey(
connection_key(), nullptr, nullptr, &device_handle);
if (result) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Failed to get device info for connection key: " << connection_key());
return false;
}
@@ -1478,9 +1563,8 @@ bool RegisterAppInterfaceRequest::GetDataOnSessionKey(
}
if (result) {
- LOG4CXX_DEBUG(logger_,
- "Failed get unique address info for connection key: "
- << connection_key());
+ SDL_LOG_DEBUG("Failed get unique address info for connection key: "
+ << connection_key());
return false;
}
@@ -1491,6 +1575,82 @@ bool RegisterAppInterfaceRequest::GetDataOnSessionKey(
return true;
}
+mobile_apis::Result::eType
+RegisterAppInterfaceRequest::ProcessingAppHMITypesInMessage(
+ const smart_objects::SmartObject& message) {
+ const bool app_hmi_types_exist =
+ message[strings::msg_params].keyExists(strings::app_hmi_type);
+
+ const auto result = mobile_apis::Result::SUCCESS;
+
+ if (!app_hmi_types_exist) {
+ return result;
+ }
+
+ auto app_types_in_message =
+ *(message[strings::msg_params][strings::app_hmi_type].asArray());
+
+ auto it = std::find(app_types_in_message.begin(),
+ app_types_in_message.end(),
+ mobile_apis::AppHMIType::WEB_VIEW);
+ if (app_types_in_message.end() != it) {
+ return mobile_apis::Result::DISALLOWED;
+ }
+
+ return result;
+}
+
+mobile_apis::Result::eType
+RegisterAppInterfaceRequest::ProcessingAppHMITypesPolicies(
+ smart_objects::SmartObject& message,
+ policy::StringArray& app_hmi_types_in_policy) {
+ auto result = mobile_apis::Result::SUCCESS;
+ const bool app_hmi_types_exist =
+ message[strings::msg_params].keyExists(strings::app_hmi_type);
+
+ if (app_hmi_types_exist) {
+ // If AppHmiTypes are partially same, the system should allow those listed
+ // in the policy table and send warning info on missed values
+ auto app_types_in_message =
+ *(message[strings::msg_params][strings::app_hmi_type].asArray());
+
+ std::string log;
+ CheckMissedTypes checker(app_hmi_types_in_policy, log);
+ std::for_each(
+ app_types_in_message.begin(), app_types_in_message.end(), checker);
+ if (!log.empty()) {
+ result = log.find("WEB_VIEW") != std::string::npos
+ ? mobile_apis::Result::DISALLOWED
+ : mobile_apis::Result::WARNINGS;
+
+ if (mobile_apis::Result::DISALLOWED == result) {
+ response_info_ =
+ "WEB_VIEW AppHmiType is absent in application policies";
+ SDL_LOG_DEBUG(response_info_);
+ return result;
+ }
+
+ response_info_ =
+ "Following AppHmiTypes are not present in policy "
+ "table:" +
+ log;
+ are_hmi_types_invalid_ = true;
+ result = mobile_apis::Result::WARNINGS;
+ }
+ }
+ // Replace AppHmiTypes in request with values allowed by policy table
+ message[strings::msg_params][strings::app_hmi_type] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ auto& app_hmi_type = message[strings::msg_params][strings::app_hmi_type];
+
+ AppHMITypeInserter inserter(app_hmi_type);
+ std::for_each(
+ app_hmi_types_in_policy.begin(), app_hmi_types_in_policy.end(), inserter);
+
+ return result;
+}
+
policy::PolicyHandlerInterface&
RegisterAppInterfaceRequest::GetPolicyHandler() {
return policy_handler_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
index b5683c62cb..f0e885f54c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
@@ -42,8 +42,10 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
void RegisterAppInterfaceResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
bool success = (*message_)[strings::msg_params][strings::success].asBool();
@@ -102,8 +104,7 @@ void RegisterAppInterfaceResponse::Run() {
// Add registered application to the policy db right after response sent to
// mobile to be able to check all other API according to app permissions
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Application with connection key " << connection_key()
+ SDL_LOG_ERROR("Application with connection key " << connection_key()
<< " is not registered.");
return;
}
@@ -113,7 +114,7 @@ void RegisterAppInterfaceResponse::Run() {
void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
uint32_t connection_key, const std::string& mobile_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy::PolicyHandlerInterface& policy_handler = policy_handler_;
if (policy_handler.PolicyEnabled()) {
const uint32_t timeout = policy_handler.HeartBeatTimeout(mobile_app_id);
@@ -122,7 +123,7 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
connection_key, timeout);
}
} else {
- LOG4CXX_INFO(logger_, "Policy is turn off");
+ SDL_LOG_INFO("Policy is turn off");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
index a0e178d0e2..40302e51d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
@@ -44,6 +44,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -61,217 +63,62 @@ ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest(
ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {}
void ResetGlobalPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id =
(*message_)[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- size_t obj_length =
- (*message_)[strings::msg_params][strings::properties].length();
- // if application waits for sending ttsGlobalProperties need to remove this
- // application from tts_global_properties_app_list_
- LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList");
- application_manager_.RemoveAppFromTTSGlobalPropertiesList(app_id);
-
- bool helpt_promt = false;
- bool timeout_prompt = false;
- bool vr_help_title_items = false;
- bool menu_name = false;
- bool menu_icon = false;
- bool is_key_board_properties = false;
- int number_of_reset_vr = 0;
- mobile_apis::GlobalProperty::eType global_property =
- mobile_apis::GlobalProperty::INVALID_ENUM;
-
- for (size_t i = 0; i < obj_length; ++i) {
- global_property = static_cast<mobile_apis::GlobalProperty::eType>(
- (*message_)[strings::msg_params][strings::properties][i].asInt());
-
- if (mobile_apis::GlobalProperty::HELPPROMPT == global_property) {
- helpt_promt = ResetHelpPromt(app);
- } else if (mobile_apis::GlobalProperty::TIMEOUTPROMPT == global_property) {
- timeout_prompt = ResetTimeoutPromt(app);
- } else if (((mobile_apis::GlobalProperty::VRHELPTITLE == global_property) ||
- (mobile_apis::GlobalProperty::VRHELPITEMS ==
- global_property)) &&
- (0 == number_of_reset_vr)) {
- ++number_of_reset_vr;
- vr_help_title_items = ResetVrHelpTitleItems(app);
- } else if (mobile_apis::GlobalProperty::MENUNAME == global_property) {
- menu_name = true;
- } else if (mobile_apis::GlobalProperty::MENUICON == global_property) {
- menu_icon = true;
- } else if (mobile_apis::GlobalProperty::KEYBOARDPROPERTIES ==
- global_property) {
- is_key_board_properties = true;
- }
- }
+ const auto& global_properties =
+ (*message_)[strings::msg_params][strings::properties];
- if (vr_help_title_items || menu_name || menu_icon ||
- is_key_board_properties) {
+ auto reset_global_props_result =
+ application_manager_.ResetGlobalProperties(global_properties, app_id);
+
+ if (reset_global_props_result.HasUIPropertiesReset()) {
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
}
- if (timeout_prompt || helpt_promt) {
+ if (reset_global_props_result.HasTTSPropertiesReset()) {
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
}
app->set_reset_global_properties_active(true);
- if (vr_help_title_items || menu_name || menu_icon ||
- is_key_board_properties) {
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- if (vr_help_title_items) {
- smart_objects::SmartObjectSPtr vr_help =
- MessageHelper::CreateAppVrHelp(app);
- if (!vr_help) {
- return;
- }
- msg_params = *vr_help;
- }
- if (menu_name) {
- msg_params[hmi_request::menu_title] = "";
- app->set_menu_title(msg_params[hmi_request::menu_title]);
- }
- // TODO(DT): clarify the sending parameter menuIcon
- // if (menu_icon) {
- //}
- if (is_key_board_properties) {
- smart_objects::SmartObject key_board_properties =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- key_board_properties[strings::language] =
- static_cast<int32_t>(hmi_apis::Common_Language::EN_US);
- key_board_properties[hmi_request::keyboard_layout] =
- static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY);
-
- // Look for APPLINK-4432 for details.
- /*smart_objects::SmartObject limited_character_list =
- smart_objects::SmartObject(
- smart_objects::SmartType_Array);
- limited_character_list[0] = "";
- key_board_properties[hmi_request::limited_character_list] =
- limited_character_list;*/
-
- key_board_properties[hmi_request::auto_complete_list] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
- msg_params[hmi_request::keyboard_properties] = key_board_properties;
- }
-
- msg_params[strings::app_id] = app->app_id();
- SendHMIRequest(
- hmi_apis::FunctionID::UI_SetGlobalProperties, &msg_params, true);
- }
-
- if (timeout_prompt || helpt_promt) {
+ if (reset_global_props_result.HasUIPropertiesReset()) {
// create ui request
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- if (helpt_promt) {
- msg_params[strings::help_prompt] = (*app->help_prompt());
- }
-
- if (timeout_prompt) {
- msg_params[strings::timeout_prompt] = (*app->timeout_prompt());
+ smart_objects::SmartObjectSPtr msg_params =
+ MessageHelper::CreateUIResetGlobalPropertiesRequest(
+ reset_global_props_result, app);
+ if (msg_params.get()) {
+ SendHMIRequest(
+ hmi_apis::FunctionID::UI_SetGlobalProperties, msg_params.get(), true);
}
-
- msg_params[strings::app_id] = app->app_id();
-
- SendHMIRequest(
- hmi_apis::FunctionID::TTS_SetGlobalProperties, &msg_params, true);
- }
-}
-
-bool ResetGlobalPropertiesRequest::ResetHelpPromt(
- application_manager::ApplicationSharedPtr app) {
- if (!app) {
- LOG4CXX_ERROR(logger_, "Null pointer");
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- return false;
}
- const std::vector<std::string>& help_prompt =
- application_manager_.get_settings().help_prompt();
-
- smart_objects::SmartObject so_help_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
-
- for (size_t i = 0; i < help_prompt.size(); ++i) {
- smart_objects::SmartObject help_prompt_item =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- help_prompt_item[strings::text] = help_prompt[i];
- help_prompt_item[strings::type] =
- hmi_apis::Common_SpeechCapabilities::SC_TEXT;
- so_help_prompt[i] = help_prompt_item;
- }
-
- app->set_help_prompt(so_help_prompt);
- return true;
-}
-
-bool ResetGlobalPropertiesRequest::ResetTimeoutPromt(
- application_manager::ApplicationSharedPtr const app) {
- if (!app) {
- LOG4CXX_ERROR(logger_, "Null pointer");
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- return false;
- }
-
- const std::vector<std::string>& time_out_promt =
- application_manager_.get_settings().time_out_promt();
-
- smart_objects::SmartObject so_time_out_promt =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
-
- for (size_t i = 0; i < time_out_promt.size(); ++i) {
- smart_objects::SmartObject timeoutPrompt =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- timeoutPrompt[strings::text] = time_out_promt[i];
- timeoutPrompt[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT;
- so_time_out_promt[i] = timeoutPrompt;
- }
-
- app->set_timeout_prompt(so_time_out_promt);
- return true;
-}
+ if (reset_global_props_result.HasTTSPropertiesReset()) {
+ smart_objects::SmartObjectSPtr msg_params =
+ MessageHelper::CreateTTSResetGlobalPropertiesRequest(
+ reset_global_props_result, app);
-bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems(
- application_manager::ApplicationSharedPtr const app) {
- if (!app) {
- LOG4CXX_ERROR(logger_, "Null pointer");
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- return false;
+ SendHMIRequest(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties, msg_params.get(), true);
}
-
- const std::string& vr_help_title =
- application_manager_.get_settings().vr_help_title();
- smart_objects::SmartObject so_vr_help_title =
- smart_objects::SmartObject(smart_objects::SmartType_String);
- so_vr_help_title = vr_help_title;
-
- app->reset_vr_help_title();
- app->reset_vr_help();
- app->set_vr_help_title(so_vr_help_title);
-
- return true;
}
void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
+ SDL_LOG_INFO("Received UI_SetGlobalProperties event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -279,7 +126,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
+ SDL_LOG_INFO("Received TTS_SetGlobalProperties event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -287,13 +134,13 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
if (IsPendingResponseExist()) {
- LOG4CXX_DEBUG(logger_, "Waiting for remaining responses");
+ SDL_LOG_DEBUG("Waiting for remaining responses");
return;
}
@@ -315,7 +162,7 @@ bool ResetGlobalPropertiesRequest::Init() {
bool ResetGlobalPropertiesRequest::PrepareResponseParameters(
mobile_apis::Result::eType& out_result_code,
std::string& out_response_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
bool result = false;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc
index 07aa23d9c9..ef1ba4f77a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse(
ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {}
void ResetGlobalPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
index 90dbb91b5f..89e77d9d19 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
@@ -46,6 +46,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ScrollableMessageRequest::ScrollableMessageRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -73,12 +75,12 @@ bool ScrollableMessageRequest::Init() {
}
void ScrollableMessageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -92,7 +94,7 @@ void ScrollableMessageRequest::Run() {
application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!");
+ SDL_LOG_ERROR("Wrong soft buttons parameters!");
SendResponse(false, processing_result);
return;
}
@@ -125,18 +127,18 @@ void ScrollableMessageRequest::Run() {
}
void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event");
+ SDL_LOG_INFO("Received UI_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::UI_ScrollableMessage: {
- LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event");
+ SDL_LOG_INFO("Received UI_ScrollableMessage event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
@@ -155,7 +157,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
index 6236506c00..a6f980b9ba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ScrollableMessageResponse::ScrollableMessageResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ ScrollableMessageResponse::ScrollableMessageResponse(
policy_handler) {}
void ScrollableMessageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::Result::eType result_code =
static_cast<mobile_apis::Result::eType>(
(*message_)[strings::msg_params][strings::result_code].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
index 6e745fe0db..aa5e1077ca 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace custom_str = utils::custom_string;
SendHapticDataRequest::SendHapticDataRequest(
@@ -55,14 +57,14 @@ SendHapticDataRequest::SendHapticDataRequest(
SendHapticDataRequest::~SendHapticDataRequest() {}
void SendHapticDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -77,7 +79,7 @@ void SendHapticDataRequest::Run() {
}
void SendHapticDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
@@ -97,7 +99,7 @@ void SendHapticDataRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc
index 79a0516928..57e63dbb7c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SendHapticDataResponse::SendHapticDataResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,7 +55,7 @@ SendHapticDataResponse::SendHapticDataResponse(
SendHapticDataResponse::~SendHapticDataResponse() {}
void SendHapticDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
index 805c0f0e41..37d43a354b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SendLocationRequest::SendLocationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -57,14 +59,13 @@ SendLocationRequest::~SendLocationRequest() {}
void SendLocationRequest::Run() {
using namespace hmi_apis;
using smart_objects::SmartObject;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "An application with connection key "
- << connection_key() << " is not registered.");
+ SDL_LOG_ERROR("An application with connection key "
+ << connection_key() << " is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -98,7 +99,7 @@ void SendLocationRequest::Run() {
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_, "Strings contain invalid characters");
+ SDL_LOG_ERROR("Strings contain invalid characters");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -112,7 +113,7 @@ void SendLocationRequest::Run() {
}
if (!CheckFieldsCompatibility()) {
- LOG4CXX_ERROR(logger_, "CheckFieldsCompatibility failed");
+ SDL_LOG_ERROR("CheckFieldsCompatibility failed");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -125,7 +126,7 @@ void SendLocationRequest::Run() {
app,
application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ SDL_LOG_ERROR("VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
}
@@ -140,11 +141,11 @@ void SendLocationRequest::Run() {
}
void SendLocationRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
const smart_objects::SmartObject& message = event.smart_object();
if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) {
- LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event");
+ SDL_LOG_INFO("Received Navigation_SendLocation event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -158,7 +159,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) {
&(message[strings::params]));
return;
}
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
}
bool SendLocationRequest::CheckFieldsCompatibility() {
@@ -172,14 +173,12 @@ bool SendLocationRequest::CheckFieldsCompatibility() {
const bool address_exist = msg_params.keyExists(strings::address);
if (latitude_degrees_exist ^ longitude_degrees_exist) {
- LOG4CXX_DEBUG(logger_,
- "latitude and longitude should be provided only in pair");
+ SDL_LOG_DEBUG("latitude and longitude should be provided only in pair");
return false;
}
if (!address_exist && !longitude_degrees_exist && !latitude_degrees_exist) {
- LOG4CXX_DEBUG(logger_,
- "address or latitude/longtitude should should be provided");
+ SDL_LOG_DEBUG("address or latitude/longtitude should should be provided");
return false;
}
return true;
@@ -194,7 +193,7 @@ void insert_if_contains(
}
bool SendLocationRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<utils::custom_string::CustomString> fields_to_check;
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -232,8 +231,7 @@ bool SendLocationRequest::IsWhiteSpaceExist() {
for (; it != fields_to_check.end(); ++it) {
const std::string& str = it->AsMBString();
if (!CheckSyntax(str, false)) {
- LOG4CXX_ERROR(logger_,
- "string '" << str << "'' contains invalid characters");
+ SDL_LOG_ERROR("string '" << str << "'' contains invalid characters");
return true;
}
}
@@ -250,7 +248,7 @@ bool SendLocationRequest::CheckHMICapabilities(
const HMICapabilities& hmi_capabilities = hmi_capabilities_;
if (!hmi_capabilities.is_ui_cooperating()) {
- LOG4CXX_ERROR(logger_, "UI is not supported.");
+ SDL_LOG_ERROR("UI is not supported.");
return false;
}
@@ -273,7 +271,7 @@ bool SendLocationRequest::CheckHMICapabilities(
}
if (!fields_names.empty()) {
- LOG4CXX_ERROR(logger_, "Some fields are not supported by capabilities");
+ SDL_LOG_ERROR("Some fields are not supported by capabilities");
return false;
}
return true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc
index 934008b816..fcf1a0f406 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SendLocationResponse::SendLocationResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ SendLocationResponse::SendLocationResponse(
SendLocationResponse::~SendLocationResponse() {}
void SendLocationResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
index ed77d8a550..9f30478111 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
@@ -46,6 +46,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetAppIconRequest::SetAppIconRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -62,9 +64,9 @@ SetAppIconRequest::SetAppIconRequest(
application_manager_.get_settings().app_icons_folder();
if (!file_system::DirectoryExists(path)) {
- LOG4CXX_WARN(logger_, "App icons folder doesn't exist.");
+ SDL_LOG_WARN("App icons folder doesn't exist.");
if (!file_system::CreateDirectoryRecursively(path)) {
- LOG4CXX_ERROR(logger_, "Unable to create app icons directory: " << path);
+ SDL_LOG_ERROR("Unable to create app icons directory: " << path);
}
}
@@ -75,12 +77,12 @@ SetAppIconRequest::SetAppIconRequest(
SetAppIconRequest::~SetAppIconRequest() {}
void SetAppIconRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -90,7 +92,7 @@ void SetAppIconRequest::Run() {
if (!file_system::IsFileNameValid(sync_file_name)) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
- LOG4CXX_ERROR(logger_, err_msg);
+ SDL_LOG_ERROR(err_msg);
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
return;
}
@@ -102,7 +104,7 @@ void SetAppIconRequest::Run() {
full_file_path += sync_file_name;
if (!file_system::FileExists(full_file_path)) {
- LOG4CXX_ERROR(logger_, "No such file " << full_file_path);
+ SDL_LOG_ERROR("No such file " << full_file_path);
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -129,19 +131,18 @@ void SetAppIconRequest::Run() {
void SetAppIconRequest::CopyToIconStorage(
const std::string& policy_app_id, const std::string& path_to_file) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!(application_manager_.protocol_handler()
.get_settings()
.max_supported_protocol_version() >=
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4)) {
- LOG4CXX_WARN(logger_,
- "Icon copying skipped, since protocol ver. 4 is not enabled.");
+ SDL_LOG_WARN("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);
+ SDL_LOG_ERROR("Can't read icon file: " << path_to_file);
return;
}
@@ -152,13 +153,12 @@ void SetAppIconRequest::CopyToIconStorage(
const uint64_t file_size = file_system::FileSize(path_to_file);
if (0 == file_size) {
- LOG4CXX_ERROR(logger_, "Can't get the icon file size: " << path_to_file);
+ SDL_LOG_ERROR("Can't get the icon file size: " << path_to_file);
return;
}
if (storage_max_size < file_size) {
- LOG4CXX_ERROR(logger_,
- "Icon size (" << file_size
+ SDL_LOG_ERROR("Icon size (" << file_size
<< ") is bigger, than "
" icons storage maximum size ("
<< storage_max_size
@@ -175,9 +175,9 @@ void SetAppIconRequest::CopyToIconStorage(
application_manager_.get_settings().app_icons_amount_to_remove();
if (!icons_amount) {
- LOG4CXX_DEBUG(logger_,
- "No icons will be deleted, since amount icons to remove "
- "is zero. Icon saving skipped.");
+ SDL_LOG_DEBUG(
+ "No icons will be deleted, since amount icons to remove "
+ "is zero. Icon saving skipped.");
return;
}
@@ -189,17 +189,16 @@ void SetAppIconRequest::CopyToIconStorage(
const std::string icon_path = icon_storage + "/" + policy_app_id;
if (!file_system::CreateFile(icon_path)) {
- LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path);
+ SDL_LOG_ERROR("Can't create icon: " << icon_path);
return;
}
if (!file_system::WriteBinaryFile(icon_path, file_content)) {
- LOG4CXX_ERROR(logger_, "Can't write icon: " << icon_path);
+ SDL_LOG_ERROR("Can't write icon: " << icon_path);
return;
}
- LOG4CXX_DEBUG(logger_,
- "Icon was successfully copied from :" << path_to_file << " to "
+ SDL_LOG_DEBUG("Icon was successfully copied from :" << path_to_file << " to "
<< icon_path);
return;
@@ -227,17 +226,16 @@ void SetAppIconRequest::RemoveOldestIcons(const std::string& storage,
for (size_t counter = 0; counter < icons_amount; ++counter) {
if (!icon_modification_time.size()) {
- LOG4CXX_ERROR(logger_, "No more icons left for deletion.");
+ SDL_LOG_ERROR("No more icons left for deletion.");
return;
}
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);
+ SDL_LOG_DEBUG("Error while deleting icon " << file_path);
}
icon_modification_time.erase(icon_modification_time.begin());
- LOG4CXX_DEBUG(logger_,
- "Old icon " << file_path << " was deleted successfully.");
+ SDL_LOG_DEBUG("Old icon " << file_path << " was deleted successfully.");
}
}
@@ -252,7 +250,7 @@ bool SetAppIconRequest::IsEnoughSpaceForIcon(const uint64_t icon_size) const {
}
void SetAppIconRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -270,8 +268,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Can't get application for connection key: " << connection_key());
return;
}
@@ -283,8 +280,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) {
app->set_app_icon_path(full_file_path_for_hmi_);
- LOG4CXX_INFO(logger_,
- "Icon path was set to '" << app->app_icon_path() << "'");
+ SDL_LOG_INFO("Icon path was set to '" << app->app_icon_path() << "'");
}
SendResponse(result,
@@ -294,7 +290,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc
index 55255920d0..350d120f10 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetAppIconResponse::SetAppIconResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SetAppIconResponse::SetAppIconResponse(
SetAppIconResponse::~SetAppIconResponse() {}
void SetAppIconResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
index 680429d3b6..45ff0078fb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
@@ -7,6 +7,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -22,11 +24,11 @@ SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {}
void SetCloudAppPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -58,7 +60,7 @@ void SetCloudAppPropertiesRequest::Run() {
void SetCloudAppPropertiesRequest::on_event(
const app_mngr::event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event");
+ SDL_LOG_INFO("SetCloudAppPropertiesRequest on_event");
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
index 39d2ea7f90..1529788544 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
@@ -7,6 +7,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -22,7 +24,7 @@ SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse(
SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {}
void SetCloudAppPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
index 0cd9f6635c..b2ca3e6cfa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetDisplayLayoutRequest::SetDisplayLayoutRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,11 +58,11 @@ SetDisplayLayoutRequest::SetDisplayLayoutRequest(
SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {}
void SetDisplayLayoutRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -77,11 +79,10 @@ void SetDisplayLayoutRequest::Run() {
if (new_layout != old_layout && !new_layout.empty()) {
// Template switched, hence allow any color change
- LOG4CXX_DEBUG(logger_,
- "SetDisplayLayoutRequest New Layout: " << new_layout);
+ SDL_LOG_DEBUG("SetDisplayLayoutRequest New Layout: " << new_layout);
app->set_display_layout(new_layout);
} else {
- LOG4CXX_DEBUG(logger_, "SetDisplayLayoutRequest No Layout Change");
+ SDL_LOG_DEBUG("SetDisplayLayoutRequest No Layout Change");
// Template layout is the same as previous layout
// Reject message if colors are set
if (msg_params.keyExists(strings::day_color_scheme) &&
@@ -89,7 +90,7 @@ void SetDisplayLayoutRequest::Run() {
msg_params[strings::day_color_scheme] != app->day_color_scheme()) {
// Color scheme param exists and has been previously set,
// hence do not allow color change
- LOG4CXX_DEBUG(logger_, "Reject Day Color Scheme Change");
+ SDL_LOG_DEBUG("Reject Day Color Scheme Change");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -99,19 +100,19 @@ void SetDisplayLayoutRequest::Run() {
msg_params[strings::night_color_scheme] != app->night_color_scheme()) {
// Color scheme param exists and has been previously set,
// hence do not allow color change
- LOG4CXX_DEBUG(logger_, "Reject Night Color Scheme Change");
+ SDL_LOG_DEBUG("Reject Night Color Scheme Change");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
}
if (msg_params.keyExists(strings::day_color_scheme)) {
- LOG4CXX_DEBUG(logger_, "Allow Day Color Scheme Change");
+ SDL_LOG_DEBUG("Allow Day Color Scheme Change");
app->set_day_color_scheme(msg_params[strings::day_color_scheme]);
}
if (msg_params.keyExists(strings::night_color_scheme)) {
- LOG4CXX_DEBUG(logger_, "Allow Night Color Scheme Change");
+ SDL_LOG_DEBUG("Allow Night Color Scheme Change");
app->set_night_color_scheme(msg_params[strings::night_color_scheme]);
}
@@ -123,12 +124,12 @@ void SetDisplayLayoutRequest::Run() {
}
void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -136,7 +137,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetDisplayLayout: {
- LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event");
+ SDL_LOG_INFO("Received UI_SetDisplayLayout event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -182,7 +183,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc
index 0999b596b5..8a5367ecd4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetDisplayLayoutResponse::SetDisplayLayoutResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ SetDisplayLayoutResponse::SetDisplayLayoutResponse(
SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {}
void SetDisplayLayoutResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
index a567d1b32f..922a45ebdb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
@@ -34,6 +34,7 @@
#include <string.h>
#include <algorithm>
#include <numeric>
+#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
@@ -46,6 +47,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace {
bool IsResultCodeWarning(const app_mngr::commands::ResponseInfo& first,
const app_mngr::commands::ResponseInfo& second,
@@ -88,16 +91,15 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest(
SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {}
void SetGlobalPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
- "No application associated with connection key " << connection_key());
+ SDL_LOG_ERROR("No application associated with connection key "
+ << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -115,8 +117,8 @@ void SetGlobalPropertiesRequest::Run() {
verification_result = MessageHelper::VerifyImage(
msg_params[strings::menu_icon], app, application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(
- logger_, "MessageHelper::VerifyImage return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyImage return "
+ << verification_result);
SendResponse(false, verification_result);
return;
}
@@ -126,7 +128,7 @@ void SetGlobalPropertiesRequest::Run() {
if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
msg_params[strings::vr_help], app, application_manager_)) {
- LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!");
+ SDL_LOG_ERROR("MessageHelper::VerifyImage return INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -137,7 +139,7 @@ void SetGlobalPropertiesRequest::Run() {
strings::auto_complete_list) &&
msg_params[strings::keyboard_properties].keyExists(
strings::auto_complete_text)) {
- LOG4CXX_ERROR(logger_, "Replacing deprecated autoCompleteText property");
+ SDL_LOG_ERROR("Replacing deprecated autoCompleteText property");
msg_params[strings::keyboard_properties][strings::auto_complete_list][0] =
msg_params[strings::keyboard_properties][strings::auto_complete_text]
.asString();
@@ -146,7 +148,7 @@ void SetGlobalPropertiesRequest::Run() {
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_, "White spaces found");
+ SDL_LOG_ERROR("White spaces found");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -162,8 +164,7 @@ void SetGlobalPropertiesRequest::Run() {
// check VR params
if (is_vr_help_title_present ^ is_vr_help_present) {
- LOG4CXX_ERROR(logger_,
- "Reject because of vr_help or vr_help_title only provided");
+ SDL_LOG_ERROR("Reject because of vr_help or vr_help_title only provided");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -187,12 +188,11 @@ void SetGlobalPropertiesRequest::Run() {
is_tts_send_ = true;
}
if (is_vr_help_title_present && is_vr_help_present) {
- LOG4CXX_DEBUG(logger_, "VRHelp params presents");
+ SDL_LOG_DEBUG("VRHelp params presents");
if (!CheckVrHelpItemsOrder(msg_params[strings::vr_help])) {
- LOG4CXX_ERROR(logger_,
- "VR Help Items contains nonsequential positions"
- << " (e.g. [1,2,4]) or not started from 1");
+ SDL_LOG_ERROR("VR Help Items contains nonsequential positions"
+ << " (e.g. [1,2,4]) or not started from 1");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -206,14 +206,14 @@ void SetGlobalPropertiesRequest::Run() {
auto& help_prompt_manager = app->help_prompt_manager();
help_prompt_manager.OnSetGlobalPropertiesReceived(params, false);
} else {
- LOG4CXX_DEBUG(logger_, "VRHelp params does not present");
+ SDL_LOG_DEBUG("VRHelp params does not present");
DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present);
PrepareUIRequestMenuAndKeyboardData(app, msg_params, params);
// Preparing data
if (params.empty()) {
- LOG4CXX_DEBUG(logger_, "No UI info provided");
+ SDL_LOG_DEBUG("No UI info provided");
} else {
params[strings::app_id] = app->app_id();
SendUIRequest(params, true);
@@ -229,7 +229,7 @@ void SetGlobalPropertiesRequest::Run() {
false, mobile_apis::Result::INVALID_DATA, "UserLocation is empty");
return;
}
- LOG4CXX_DEBUG(logger_, "Userlocation params presents");
+ SDL_LOG_DEBUG("Userlocation params presents");
const auto& user_location = msg_params[strings::user_location];
app->set_user_location(user_location);
@@ -250,7 +250,7 @@ void SetGlobalPropertiesRequest::Run() {
// check TTS params
if (is_help_prompt_present || is_timeout_prompt_present) {
- LOG4CXX_DEBUG(logger_, "TTS params presents");
+ SDL_LOG_DEBUG("TTS params presents");
auto tts_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
std::vector<std::string> invalid_params;
@@ -261,9 +261,8 @@ void SetGlobalPropertiesRequest::Run() {
MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
invalid_params.push_back("help_prompt");
} else {
app->set_help_prompt(help_prompt);
@@ -278,9 +277,8 @@ void SetGlobalPropertiesRequest::Run() {
timeout_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
invalid_params.push_back("timeout_prompt");
} else {
app->set_timeout_prompt(timeout_prompt);
@@ -319,7 +317,7 @@ void SetGlobalPropertiesRequest::Run() {
bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder(
const smart_objects::SmartObject& vr_help) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(vr_help.getType() == smart_objects::SmartType_Array, false);
const size_t vr_help_length = vr_help.length();
DCHECK_OR_RETURN(vr_help_length > 0, false);
@@ -329,9 +327,8 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder(
vr_help.getElement(j).getElement(strings::position).asUInt();
// Elements shall start from 1 and increment one by one
if (position != (j + 1)) {
- LOG4CXX_ERROR(logger_,
- "VR help items order is wrong"
- << " at " << j << ", position value:" << position);
+ SDL_LOG_ERROR("VR help items order is wrong"
+ << " at " << j << ", position value:" << position);
return false;
}
}
@@ -339,7 +336,7 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder(
}
void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
@@ -348,7 +345,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetGlobalProperties: {
- LOG4CXX_DEBUG(logger_, "Received UI_SetGlobalProperties event");
+ SDL_LOG_DEBUG("Received UI_SetGlobalProperties event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -361,7 +358,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
- LOG4CXX_DEBUG(logger_, "Received TTS_SetGlobalProperties event");
+ SDL_LOG_DEBUG("Received TTS_SetGlobalProperties event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
is_tts_received_ = true;
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -374,7 +371,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::RC_SetGlobalProperties: {
- LOG4CXX_DEBUG(logger_, "Received RC_SetGlobalProperties event");
+ SDL_LOG_DEBUG("Received RC_SetGlobalProperties event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC);
is_rc_received_ = true;
rc_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -383,13 +380,13 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
if (IsPendingResponseExist()) {
- LOG4CXX_DEBUG(logger_, "Continue waiting for response");
+ SDL_LOG_DEBUG("Continue waiting for response");
return;
}
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
@@ -418,9 +415,21 @@ bool SetGlobalPropertiesRequest::Init() {
return true;
}
+void SetGlobalPropertiesRequest::onTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+
+ CommandRequestImpl::onTimeOut();
+
+ auto& resume_ctrl = application_manager_.resume_controller();
+
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
bool SetGlobalPropertiesRequest::PrepareResponseParameters(
mobile_apis::Result::eType& result_code, std::string& info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
app_mngr::commands::ResponseInfo ui_properties_info(
@@ -475,7 +484,7 @@ bool SetGlobalPropertiesRequest::PrepareResultForMobileResponse(
const app_mngr::commands::ResponseInfo& first,
const app_mngr::commands::ResponseInfo& second,
const app_mngr::commands::ResponseInfo& third) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::commands::ResponseInfo both_info;
std::vector<hmi_apis::Common_Result::eType> success_result_codes{
@@ -508,7 +517,7 @@ SetGlobalPropertiesRequest::PrepareResultCodeForResponse(
const app_mngr::commands::ResponseInfo& first,
const app_mngr::commands::ResponseInfo& second,
const app_mngr::commands::ResponseInfo& third) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
if (IsResultCodeUnsupported(first, second, third) ||
IsResultCodeUnsupported(second, third, first) ||
@@ -599,7 +608,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData(
const ApplicationSharedPtr app,
const smart_objects::SmartObject& msg_params,
smart_objects::SmartObject& out_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
app->set_vr_help_title(msg_params.getElement(strings::vr_help_title));
@@ -613,7 +622,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData(
const ApplicationSharedPtr app,
const smart_objects::SmartObject& msg_params,
smart_objects::SmartObject& out_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
const bool is_menu_title_present =
@@ -641,7 +650,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData(
void SetGlobalPropertiesRequest::SendTTSRequest(
const smart_objects::SmartObject& params, bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_tts_send_ = true;
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
SendHMIRequest(
@@ -650,7 +659,7 @@ void SetGlobalPropertiesRequest::SendTTSRequest(
void SetGlobalPropertiesRequest::SendUIRequest(
const smart_objects::SmartObject& params, bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_ui_send_ = true;
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(
@@ -660,7 +669,7 @@ void SetGlobalPropertiesRequest::SendUIRequest(
void SetGlobalPropertiesRequest::SendRCRequest(
const ns_smart_device_link::ns_smart_objects::SmartObject& params,
bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_rc_send_ = true;
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC);
SendHMIRequest(
@@ -674,7 +683,7 @@ bool SetGlobalPropertiesRequest::IsPendingResponseExist() {
bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters(
const smart_objects::SmartObject& params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return params.keyExists(strings::help_prompt) ||
params.keyExists(strings::timeout_prompt) ||
params.keyExists(strings::vr_help_title) ||
@@ -687,7 +696,7 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters(
}
bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str;
const smart_objects::SmartObject& msg_params =
@@ -703,7 +712,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
for (; it_hp != it_hp_end; ++it_hp) {
str = (*it_hp)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed");
+ SDL_LOG_ERROR("Invalid help_prompt syntax check failed");
return true;
}
}
@@ -719,7 +728,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
for (; it_tp != it_tp_end; ++it_tp) {
str = (*it_tp)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed");
+ SDL_LOG_ERROR("Invalid timeout_prompt syntax check failed");
return true;
}
}
@@ -735,15 +744,14 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
for (; it_vh != it_vh_end; ++it_vh) {
str = (*it_vh)[strings::text].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_help text syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_help text syntax check failed");
return true;
}
if ((*it_vh).keyExists(strings::image)) {
str = (*it_vh)[strings::image][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid vr_help image value syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_help image value syntax check failed");
return true;
}
} // if image exists
@@ -753,7 +761,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
if (msg_params.keyExists(strings::menu_icon)) {
str = msg_params[strings::menu_icon][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid menu_icon value syntax check failed");
+ SDL_LOG_ERROR("Invalid menu_icon value syntax check failed");
return true;
}
}
@@ -761,7 +769,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
if (msg_params.keyExists(strings::vr_help_title)) {
str = msg_params[strings::vr_help_title].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_help_title value syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_help_title value syntax check failed");
return true;
}
}
@@ -769,7 +777,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
if (msg_params.keyExists(strings::menu_title)) {
str = msg_params[strings::menu_title].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid menu_title value syntax check failed");
+ SDL_LOG_ERROR("Invalid menu_title value syntax check failed");
return true;
}
}
@@ -788,9 +796,9 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
for (; it_lcl != it_lcl_end; ++it_lcl) {
str = (*it_lcl).asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid keyboard_properties "
- "limited_character_list syntax check failed");
+ SDL_LOG_ERROR(
+ "Invalid keyboard_properties "
+ "limited_character_list syntax check failed");
return true;
}
}
@@ -807,9 +815,9 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
for (; it != acl_array->end(); ++it) {
str = it->asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid keyboard_properties "
- "auto_complete_list syntax check failed");
+ SDL_LOG_ERROR(
+ "Invalid keyboard_properties "
+ "auto_complete_list syntax check failed");
return true;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc
index 1de2b97d3a..03c649a02d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetGlobalPropertiesResponse::SetGlobalPropertiesResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SetGlobalPropertiesResponse::SetGlobalPropertiesResponse(
SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {}
void SetGlobalPropertiesResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
index d610090aa4..b7b8fc27ad 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetMediaClockRequest::SetMediaClockRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,18 +60,18 @@ SetMediaClockRequest::SetMediaClockRequest(
SetMediaClockRequest::~SetMediaClockRequest() {}
void SetMediaClockRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
if (!app->is_media_application()) {
- LOG4CXX_ERROR(logger_, "Application is not media application");
+ SDL_LOG_ERROR("Application is not media application");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -90,7 +92,7 @@ void SetMediaClockRequest::Run() {
}
void SetMediaClockRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -111,7 +113,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
@@ -126,7 +128,7 @@ bool SetMediaClockRequest::isDataValid() {
if (update_mode == mobile_apis::UpdateMode::COUNTUP ||
update_mode == mobile_apis::UpdateMode::COUNTDOWN) {
if (!msg_params.keyExists(strings::start_time)) {
- LOG4CXX_INFO(logger_, "Invalid data");
+ SDL_LOG_INFO("Invalid data");
return false;
}
@@ -151,13 +153,13 @@ bool SetMediaClockRequest::isDataValid() {
(update_mode == mobile_apis::UpdateMode::COUNTDOWN)) ||
((end_time_in_seconds < start_time_in_seconds) &&
(update_mode == mobile_apis::UpdateMode::COUNTUP))) {
- LOG4CXX_INFO(logger_, "Invalid data");
+ SDL_LOG_INFO("Invalid data");
return false;
}
}
}
- LOG4CXX_INFO(logger_, "Data is valid");
+ SDL_LOG_INFO("Data is valid");
return true;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc
index 948ff84156..0208741795 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SetMediaClockTimerResponse::SetMediaClockTimerResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SetMediaClockTimerResponse::SetMediaClockTimerResponse(
SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {}
void SetMediaClockTimerResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
index 36278168dc..7d2751ed0d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
@@ -39,6 +39,7 @@ namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
ShowAppMenuRequest::ShowAppMenuRequest(
const app_mngr::commands::MessageSharedPtr& message,
@@ -56,13 +57,13 @@ ShowAppMenuRequest::~ShowAppMenuRequest() {}
void ShowAppMenuRequest::Run() {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Application with id " << connection_key() << " is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
@@ -76,8 +77,8 @@ void ShowAppMenuRequest::Run() {
app->system_context(mobile_apis::PredefinedWindows::DEFAULT_WINDOW),
mobile_apis::SystemContext::SYSCTXT_MAIN,
mobile_apis::SystemContext::SYSCTXT_MENU)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Application with id " << connection_key() << " is not activated.");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
@@ -89,8 +90,11 @@ void ShowAppMenuRequest::Run() {
const auto& received_msg_params = (*message_)[strings::msg_params];
if (received_msg_params.keyExists(strings::menu_id)) {
const int32_t menu_id = received_msg_params[strings::menu_id].asInt();
- if (!app->FindSubMenu(menu_id)) {
- LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found.");
+
+ const auto sub_menu = app->FindSubMenu(menu_id);
+
+ if (smart_objects::SmartType_Null == sub_menu.getType()) {
+ SDL_LOG_ERROR("Menu with id " << menu_id << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -103,7 +107,7 @@ void ShowAppMenuRequest::Run() {
void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -120,8 +124,7 @@ void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) {
application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Application with id " << connection_key()
+ SDL_LOG_ERROR("Application with id " << connection_key()
<< " is not registered.");
return;
}
@@ -133,7 +136,7 @@ void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event: " << event.id());
+ SDL_LOG_ERROR("Received unknown event: " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc
index 2b952ea9ac..e93e7b3d4e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc
@@ -39,6 +39,8 @@ namespace app_mngr = application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ShowAppMenuResponse::ShowAppMenuResponse(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ ShowAppMenuResponse::ShowAppMenuResponse(
ShowAppMenuResponse::~ShowAppMenuResponse() {}
void ShowAppMenuResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
index b439c1cb16..04310bcd58 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
@@ -46,6 +46,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ShowConstantTBTRequest::ShowConstantTBTRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -61,19 +63,19 @@ ShowConstantTBTRequest::ShowConstantTBTRequest(
ShowConstantTBTRequest::~ShowConstantTBTRequest() {}
void ShowConstantTBTRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
// SDLAQ-CRS-664, VC3.1
if ((*message_)[strings::msg_params].empty()) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -83,8 +85,7 @@ void ShowConstantTBTRequest::Run() {
msg_params = (*message_)[strings::msg_params];
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming show constant TBT has contains \t\n \\t \\n");
+ SDL_LOG_ERROR("Incoming show constant TBT has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -96,7 +97,7 @@ void ShowConstantTBTRequest::Run() {
msg_params, app, policy_handler_, application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, processing_result);
return;
}
@@ -106,7 +107,7 @@ void ShowConstantTBTRequest::Run() {
verification_result = MessageHelper::VerifyImage(
msg_params[strings::turn_icon], app, application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ SDL_LOG_ERROR("VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
}
@@ -116,7 +117,7 @@ void ShowConstantTBTRequest::Run() {
verification_result = MessageHelper::VerifyImage(
msg_params[strings::next_turn_icon], app, application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ SDL_LOG_ERROR("VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
}
@@ -185,13 +186,13 @@ void ShowConstantTBTRequest::Run() {
}
void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_ShowConstantTBT: {
- LOG4CXX_INFO(logger_, "Received Navigation_ShowConstantTBT event");
+ SDL_LOG_INFO("Received Navigation_ShowConstantTBT event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const Common_Result::eType result_code =
static_cast<Common_Result::eType>(
@@ -207,21 +208,21 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
}
bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) {
str = (*message_)[strings::msg_params][strings::turn_icon][strings::value]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid turn_icon value syntax check failed");
+ SDL_LOG_ERROR("Invalid turn_icon value syntax check failed");
return true;
}
}
@@ -231,8 +232,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
[strings::value]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid next_turn_icon value syntax check failed");
+ SDL_LOG_ERROR("Invalid next_turn_icon value syntax check failed");
return true;
}
}
@@ -241,8 +241,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::navigation_text_1]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid navigation_text_1 value syntax check failed");
+ SDL_LOG_ERROR("Invalid navigation_text_1 value syntax check failed");
return true;
}
}
@@ -251,8 +250,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::navigation_text_2]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid navigation_text_2 value syntax check failed");
+ SDL_LOG_ERROR("Invalid navigation_text_2 value syntax check failed");
return true;
}
}
@@ -260,7 +258,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::eta)) {
str = (*message_)[strings::msg_params][strings::eta].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid eta value syntax check failed");
+ SDL_LOG_ERROR("Invalid eta value syntax check failed");
return true;
}
}
@@ -269,8 +267,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
str =
(*message_)[strings::msg_params][strings::total_distance].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid total_distance value syntax check failed");
+ SDL_LOG_ERROR("Invalid total_distance value syntax check failed");
return true;
}
}
@@ -280,8 +277,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::time_to_destination]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid time_to_destination value syntax check failed");
+ SDL_LOG_ERROR("Invalid time_to_destination value syntax check failed");
return true;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
index d027daf77d..7d546079e8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ShowConstantTBTResponse::ShowConstantTBTResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ ShowConstantTBTResponse::ShowConstantTBTResponse(
ShowConstantTBTResponse::~ShowConstantTBTResponse() {}
void ShowConstantTBTResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
index 84d11f8e09..910ab9ef23 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
@@ -44,6 +44,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ShowRequest::ShowRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -83,9 +85,8 @@ void ShowRequest::HandleMetadata(const char* field_id,
[hmi_request::field_types][i] = current_tag;
}
} else {
- LOG4CXX_INFO(logger_,
- "metadata tag provided with no item for "
- << field_id << ", ignoring with warning");
+ SDL_LOG_INFO("metadata tag provided with no item for "
+ << field_id << ", ignoring with warning");
// tag provided with no item, ignore with warning
if (mobile_apis::Result::INVALID_ENUM == core_result_code_) {
core_result_code_ = mobile_apis::Result::WARNINGS;
@@ -94,14 +95,13 @@ void ShowRequest::HandleMetadata(const char* field_id,
}
}
} else {
- LOG4CXX_INFO(logger_,
- "No metadata tagging provided for field: " << field_id);
+ SDL_LOG_INFO("No metadata tagging provided for field: " << field_id);
}
}
bool ShowRequest::CheckTemplateConfigurationForApp(
application_manager::Application& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
current_window_id_ =
@@ -112,21 +112,20 @@ bool ShowRequest::CheckTemplateConfigurationForApp(
const auto new_template_layout =
template_config_[strings::template_layout].asString();
const auto old_template_layout = app.window_layout(current_window_id_);
- LOG4CXX_DEBUG(logger_, "New layout: " << new_template_layout);
- LOG4CXX_DEBUG(logger_, "Old layout: " << old_template_layout);
+ SDL_LOG_DEBUG("New layout: " << new_template_layout);
+ SDL_LOG_DEBUG("Old layout: " << old_template_layout);
const bool layouts_equal = (new_template_layout == old_template_layout);
if (!new_template_layout.empty() && !layouts_equal) {
// Template switched, hence allow any color change
- LOG4CXX_DEBUG(logger_,
- "Show Request: Setting new Layout: " << new_template_layout
+ SDL_LOG_DEBUG("Show Request: Setting new Layout: " << new_template_layout
<< " for window ID: "
<< current_window_id_);
layout_change_required_ = true;
return true;
}
- LOG4CXX_DEBUG(logger_, "Show Request: No Layout Change");
+ SDL_LOG_DEBUG("Show Request: No Layout Change");
return false;
};
@@ -140,10 +139,10 @@ bool ShowRequest::CheckTemplateConfigurationForApp(
app.day_color_scheme(current_window_id_)) {
// Color scheme param exists and has been previously set,
// hence do not allow color change
- LOG4CXX_DEBUG(logger_, "Day Color Scheme change is rejected");
+ SDL_LOG_DEBUG("Day Color Scheme change is rejected");
return false;
}
- LOG4CXX_DEBUG(logger_, "Day Color Scheme change is allowed");
+ SDL_LOG_DEBUG("Day Color Scheme change is allowed");
dcs_change_required_ = true;
return true;
@@ -159,10 +158,10 @@ bool ShowRequest::CheckTemplateConfigurationForApp(
app.night_color_scheme(current_window_id_)) {
// Color scheme param exists and has been previously set,
// hence do not allow color change
- LOG4CXX_DEBUG(logger_, "Night Color Scheme change is rejected");
+ SDL_LOG_DEBUG("Night Color Scheme change is rejected");
return false;
}
- LOG4CXX_DEBUG(logger_, "Night Color Scheme Change is allowed");
+ SDL_LOG_DEBUG("Night Color Scheme Change is allowed");
ncs_change_required_ = true;
return true;
@@ -192,7 +191,7 @@ bool ShowRequest::CheckTemplateConfigurationForApp(
void ShowRequest::ApplyTemplateConfigurationForApp(
mobile_apis::Result::eType result, application_manager::Application& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (helpers::Compare<mobile_apis::Result::eType, helpers::EQ, helpers::ONE>(
result,
mobile_apis::Result::SUCCESS,
@@ -200,7 +199,7 @@ void ShowRequest::ApplyTemplateConfigurationForApp(
if (layout_change_required_) {
const std::string new_layout =
template_config_[strings::template_layout].asString();
- LOG4CXX_DEBUG(logger_, "New layout : " << new_layout << " is applied");
+ SDL_LOG_DEBUG("New layout : " << new_layout << " is applied");
app.set_window_layout(current_window_id_, new_layout);
if (template_config_.keyExists(strings::day_color_scheme)) {
@@ -217,13 +216,13 @@ void ShowRequest::ApplyTemplateConfigurationForApp(
}
if (dcs_change_required_) {
- LOG4CXX_DEBUG(logger_, "New day color scheme is applied");
+ SDL_LOG_DEBUG("New day color scheme is applied");
app.set_day_color_scheme(current_window_id_,
template_config_[strings::day_color_scheme]);
}
if (ncs_change_required_) {
- LOG4CXX_DEBUG(logger_, "New night color scheme is applied");
+ SDL_LOG_DEBUG("New night color scheme is applied");
app.set_night_color_scheme(current_window_id_,
template_config_[strings::night_color_scheme]);
}
@@ -231,24 +230,24 @@ void ShowRequest::ApplyTemplateConfigurationForApp(
}
void ShowRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
// SDLAQ-CRS-494, VC3.1
if ((*message_)[strings::msg_params].empty()) {
- LOG4CXX_ERROR(logger_, strings::msg_params << " is empty.");
+ SDL_LOG_ERROR(strings::msg_params << " is empty.");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
if (!CheckStringsOfShowRequest()) {
- LOG4CXX_ERROR(logger_, "Incorrect characters in string");
+ SDL_LOG_ERROR("Incorrect characters in string");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -266,7 +265,7 @@ void ShowRequest::Run() {
}
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "Processing of soft buttons failed.");
+ SDL_LOG_ERROR("Processing of soft buttons failed.");
SendResponse(false, processing_result);
return;
}
@@ -281,7 +280,7 @@ void ShowRequest::Run() {
app,
application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SDL_LOG_ERROR("Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -293,7 +292,7 @@ void ShowRequest::Run() {
app,
application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SDL_LOG_ERROR("Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -421,8 +420,7 @@ void ShowRequest::Run() {
const auto window_id =
(*message_)[strings::msg_params][strings::window_id].asInt();
if (!app->WindowIdExists(window_id)) {
- LOG4CXX_ERROR(logger_,
- "Window with id #" << window_id << " does not exist");
+ SDL_LOG_ERROR("Window with id #" << window_id << " does not exist");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
@@ -453,21 +451,21 @@ void ShowRequest::Run() {
}
void ShowRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
switch (event.id()) {
case hmi_apis::FunctionID::UI_Show: {
- LOG4CXX_DEBUG(logger_, "Received UI_Show event.");
+ SDL_LOG_DEBUG("Received UI_Show event.");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
std::string response_info;
hmi_apis::Common_Result::eType result_code =
@@ -498,41 +496,41 @@ void ShowRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event " << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
}
bool ShowRequest::CheckStringsOfShowRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str;
if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) {
str = (*message_)[strings::msg_params][strings::main_field_4].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid main_field_4 syntax check failed");
+ SDL_LOG_ERROR("Invalid main_field_4 syntax check failed");
return false;
}
}
if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) {
str = (*message_)[strings::msg_params][strings::main_field_3].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid main_field_3 syntax check failed");
+ SDL_LOG_ERROR("Invalid main_field_3 syntax check failed");
return false;
}
}
if ((*message_)[strings::msg_params].keyExists(strings::main_field_2)) {
str = (*message_)[strings::msg_params][strings::main_field_2].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid main_field_2 syntax check failed");
+ SDL_LOG_ERROR("Invalid main_field_2 syntax check failed");
return false;
}
}
if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) {
str = (*message_)[strings::msg_params][strings::main_field_1].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid main_field_1 syntax check failed");
+ SDL_LOG_ERROR("Invalid main_field_1 syntax check failed");
return false;
}
}
@@ -540,28 +538,28 @@ bool ShowRequest::CheckStringsOfShowRequest() {
str =
(*message_)[strings::msg_params][strings::template_title].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid templateTitle syntax check failed");
+ SDL_LOG_ERROR("Invalid templateTitle syntax check failed");
return false;
}
}
if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) {
str = (*message_)[strings::msg_params][strings::status_bar].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid status_bar syntax check failed");
+ SDL_LOG_ERROR("Invalid status_bar syntax check failed");
return false;
}
}
if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) {
str = (*message_)[strings::msg_params][strings::media_clock].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid media_clock syntax check failed");
+ SDL_LOG_ERROR("Invalid media_clock syntax check failed");
return false;
}
}
if ((*message_)[strings::msg_params].keyExists(strings::media_track)) {
str = (*message_)[strings::msg_params][strings::media_track].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid media_track syntax check failed");
+ SDL_LOG_ERROR("Invalid media_track syntax check failed");
return false;
}
}
@@ -571,7 +569,7 @@ bool ShowRequest::CheckStringsOfShowRequest() {
for (size_t i = 0; i < custom_presets_array.length(); ++i) {
str = custom_presets_array[i].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid custom_presets syntax check failed");
+ SDL_LOG_ERROR("Invalid custom_presets syntax check failed");
return false;
}
}
@@ -581,7 +579,7 @@ bool ShowRequest::CheckStringsOfShowRequest() {
str = (*message_)[strings::msg_params][strings::graphic][strings::value]
.asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid graphic value syntax check failed");
+ SDL_LOG_ERROR("Invalid graphic value syntax check failed");
return false;
}
}
@@ -591,8 +589,7 @@ bool ShowRequest::CheckStringsOfShowRequest() {
[strings::value]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid secondary_graphic value syntax check failed");
+ SDL_LOG_ERROR("Invalid secondary_graphic value syntax check failed");
return false;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc
index f5667189b7..074fcabc7a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ShowResponse::ShowResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ ShowResponse::ShowResponse(
ShowResponse::~ShowResponse() {}
void ShowResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
index dd7b426b40..15ced6d5a1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SliderRequest::SliderRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -72,20 +74,20 @@ bool SliderRequest::Init() {
}
void SliderRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!application) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if ((*message_)[strings::msg_params][strings::num_ticks].asInt() <
(*message_)[strings::msg_params][strings::position].asInt()) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA");
+ SDL_LOG_ERROR("INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -94,7 +96,7 @@ void SliderRequest::Run() {
if (1 < (*message_)[strings::msg_params][strings::slider_footer].length()) {
if ((*message_)[strings::msg_params][strings::num_ticks].asUInt() !=
(*message_)[strings::msg_params][strings::slider_footer].length()) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA");
+ SDL_LOG_ERROR("INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -102,7 +104,7 @@ void SliderRequest::Run() {
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_, "Incoming slider has contains \t\n \\t \\n");
+ SDL_LOG_ERROR("Incoming slider has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -126,7 +128,7 @@ void SliderRequest::Run() {
}
void SliderRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
using namespace smart_objects;
using namespace hmi_apis;
@@ -135,18 +137,18 @@ void SliderRequest::on_event(const event_engine::Event& event) {
const event_engine::Event::EventID event_id = event.id();
if (event_id == FunctionID::UI_OnResetTimeout) {
- LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event");
+ SDL_LOG_INFO("Received UI_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
return;
}
if (event_id != FunctionID::UI_Slider) {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
- LOG4CXX_DEBUG(logger_, "Received UI_Slider event");
+ SDL_LOG_DEBUG("Received UI_Slider event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
const Common_Result::eType response_code = static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -163,8 +165,7 @@ void SliderRequest::on_event(const event_engine::Event& event) {
response_msg_params[strings::slider_position] =
message[strings::params][strings::data][strings::slider_position];
} else {
- LOG4CXX_ERROR(logger_,
- strings::slider_position << " field is absent"
+ SDL_LOG_ERROR(strings::slider_position << " field is absent"
" in response.");
response_msg_params[strings::slider_position] = 0;
}
@@ -181,12 +182,12 @@ void SliderRequest::on_event(const event_engine::Event& event) {
}
bool SliderRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::slider_header].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid slider_header value syntax check failed");
+ SDL_LOG_ERROR("Invalid slider_header value syntax check failed");
return true;
}
@@ -200,7 +201,7 @@ bool SliderRequest::IsWhiteSpaceExist() {
for (; it_sf != it_sf_end; ++it_sf) {
str = (*it_sf).asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid slider_footer syntax check failed");
+ SDL_LOG_ERROR("Invalid slider_footer syntax check failed");
return true;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc
index 4ac96a272e..72b0003d8d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SliderResponse::SliderResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SliderResponse::SliderResponse(
SliderResponse::~SliderResponse() {}
void SliderResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
index 0730a8730f..b8de053853 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SpeakRequest::SpeakRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -60,20 +62,20 @@ SpeakRequest::SpeakRequest(
SpeakRequest::~SpeakRequest() {}
void SpeakRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming speak has contains \\t\\n \\\\t \\\\n "
- " text contains only whitespace in ttsChunks");
+ SDL_LOG_ERROR(
+ "Incoming speak has contains \\t\\n \\\\t \\\\n "
+ " text contains only whitespace in ttsChunks");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -84,9 +86,8 @@ void SpeakRequest::Run() {
MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_chunks are not present");
@@ -103,23 +104,23 @@ void SpeakRequest::Run() {
}
void SpeakRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (event.id()) {
case hmi_apis::FunctionID::TTS_Speak: {
- LOG4CXX_INFO(logger_, "Received TTS_Speak event");
+ SDL_LOG_INFO("Received TTS_Speak event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
ProcessTTSSpeakResponse(event.smart_object());
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event");
+ SDL_LOG_INFO("Received TTS_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
@@ -127,14 +128,14 @@ void SpeakRequest::on_event(const event_engine::Event& event) {
void SpeakRequest::ProcessTTSSpeakResponse(
const smart_objects::SmartObject& message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -158,7 +159,7 @@ void SpeakRequest::ProcessTTSSpeakResponse(
}
bool SpeakRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
@@ -171,7 +172,7 @@ bool SpeakRequest::IsWhiteSpaceExist() {
for (; it_tc != it_tc_end; ++it_tc) {
str = (*it_tc)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_chunks syntax check failed");
return true;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc
index 69b04977ef..3f9c49ac50 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SpeakResponse::SpeakResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,7 +58,7 @@ SpeakResponse::SpeakResponse(
SpeakResponse::~SpeakResponse() {}
void SpeakResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
index 3797913f5b..42cb3c60c9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
@@ -41,6 +41,8 @@ namespace commands {
namespace str = strings;
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubscribeButtonRequest::SubscribeButtonRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -56,12 +58,12 @@ SubscribeButtonRequest::SubscribeButtonRequest(
SubscribeButtonRequest::~SubscribeButtonRequest() {}
void SubscribeButtonRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED");
+ SDL_LOG_ERROR("APPLICATION_NOT_REGISTERED");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -71,8 +73,7 @@ void SubscribeButtonRequest::Run() {
(*message_)[str::msg_params][str::button_name].asInt());
if (!IsSubscriptionAllowed(app, btn_id)) {
- LOG4CXX_ERROR(logger_,
- "Subscribe on button " << btn_id << " isn't allowed");
+ SDL_LOG_ERROR("Subscribe on button " << btn_id << " isn't allowed");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
@@ -83,23 +84,22 @@ void SubscribeButtonRequest::Run() {
bool play_pause_supported =
CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE);
if (play_pause_supported) {
- LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE");
+ SDL_LOG_DEBUG("Converting Legacy OK button to PLAY_PAUSE");
btn_id = mobile_apis::ButtonName::PLAY_PAUSE;
(*message_)[str::msg_params][str::button_name] = btn_id;
} else if (!ok_supported) {
- LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities");
+ SDL_LOG_ERROR("OK button isn't allowed by HMI capabilities");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
}
} else if (!CheckHMICapabilities(btn_id)) {
- LOG4CXX_ERROR(logger_,
- "Subscribe on button "
- << btn_id << " isn't allowed by HMI capabilities");
+ SDL_LOG_ERROR("Subscribe on button "
+ << btn_id << " isn't allowed by HMI capabilities");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
if (app->IsSubscribedToButton(btn_id)) {
- LOG4CXX_ERROR(logger_, "Already subscribed to button " << btn_id);
+ SDL_LOG_ERROR("Already subscribed to button " << btn_id);
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc
index e584f84f4c..216d1e186d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubscribeButtonResponse::SubscribeButtonResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -53,12 +55,12 @@ SubscribeButtonResponse::SubscribeButtonResponse(
SubscribeButtonResponse::~SubscribeButtonResponse() {}
void SubscribeButtonResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
if ((*message_)[strings::msg_params][strings::success].asBool() == false) {
- LOG4CXX_ERROR(logger_, "Success = false");
+ SDL_LOG_ERROR("Success = false");
SendResponse(false);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
index 2ee7771833..6e8ad05a74 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubscribeWayPointsRequest::SubscribeWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,19 +56,18 @@ SubscribeWayPointsRequest::SubscribeWayPointsRequest(
SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {}
void SubscribeWayPointsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "An application with connection key "
- << connection_key() << " is not registered.");
+ SDL_LOG_ERROR("An application with connection key "
+ << connection_key() << " is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- if (application_manager_.IsAppSubscribedForWayPoints(app)) {
+ if (application_manager_.IsAppSubscribedForWayPoints(*app)) {
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
@@ -83,12 +84,12 @@ void SubscribeWayPointsRequest::Run() {
}
void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: {
- LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints event");
+ SDL_LOG_INFO("Received Navigation_SubscribeWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -107,7 +108,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc
index 45486792d7..ab3fc0a4b8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubscribeWayPointsResponse::SubscribeWayPointsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SubscribeWayPointsResponse::SubscribeWayPointsResponse(
SubscribeWayPointsResponse::~SubscribeWayPointsResponse() {}
void SubscribeWayPointsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
index 23604a6b93..502290328a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubtleAlertRequest::SubtleAlertRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -75,9 +77,9 @@ bool SubtleAlertRequest::Init() {
// If soft buttons are present, SDL will not use initiate timeout tracking for
// response.
if (msg_params.keyExists(strings::soft_buttons)) {
- LOG4CXX_INFO(logger_,
- "Request contains soft buttons - request timeout "
- "will be set to 0.");
+ SDL_LOG_INFO(
+ "Request contains soft buttons - request timeout "
+ "will be set to 0.");
default_timeout_ = 0;
}
@@ -85,7 +87,7 @@ bool SubtleAlertRequest::Init() {
}
void SubtleAlertRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id =
(*message_)[strings::params][strings::connection_key].asInt();
@@ -112,24 +114,24 @@ void SubtleAlertRequest::Run() {
}
void SubtleAlertRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::TTS_OnResetTimeout:
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_INFO(logger_,
- "Received UI_OnResetTimeout event "
- " or TTS_OnResetTimeout event"
- << awaiting_tts_speak_response_ << " "
- << awaiting_tts_stop_speaking_response_ << " "
- << awaiting_ui_subtle_alert_response_);
+ SDL_LOG_INFO(
+ "Received UI_OnResetTimeout event "
+ " or TTS_OnResetTimeout event"
+ << awaiting_tts_speak_response_ << " "
+ << awaiting_tts_stop_speaking_response_ << " "
+ << awaiting_ui_subtle_alert_response_);
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::UI_SubtleAlert: {
- LOG4CXX_INFO(logger_, "Received UI_SubtleAlert event");
+ SDL_LOG_INFO("Received UI_SubtleAlert event");
// Unsubscribe from event to avoid unwanted messages
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
unsubscribe_from_event(hmi_apis::FunctionID::UI_SubtleAlert);
@@ -154,7 +156,7 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
- LOG4CXX_INFO(logger_, "Received TTS_Speak event");
+ SDL_LOG_INFO("Received TTS_Speak event");
// Unsubscribe from event to avoid unwanted messages
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak);
@@ -165,7 +167,7 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_StopSpeaking: {
- LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event");
+ SDL_LOG_INFO("Received TTS_StopSpeaking event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
// Unsubscribe from event to avoid unwanted messages
unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking);
@@ -173,7 +175,7 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event" << event.id());
return;
}
}
@@ -249,11 +251,11 @@ bool SubtleAlertRequest::PrepareResponseParameters(
}
bool SubtleAlertRequest::Validate(uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
@@ -263,7 +265,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) {
app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::POLICY_TABLE)) {
- LOG4CXX_ERROR(logger_, "SubtleAlert frequency is too high.");
+ SDL_LOG_ERROR("SubtleAlert frequency is too high.");
SendResponse(false,
mobile_apis::Result::REJECTED,
"SubtleAlert frequency is too high.");
@@ -284,7 +286,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) {
application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, processing_result);
return false;
}
@@ -293,7 +295,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) {
if ((!(*message_)[strings::msg_params].keyExists(strings::alert_text1)) &&
(!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) &&
(!(*message_)[strings::msg_params].keyExists(strings::tts_chunks))) {
- LOG4CXX_ERROR(logger_, "Mandatory parameters are missing");
+ SDL_LOG_ERROR("Mandatory parameters are missing");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Mandatory parameters are missing");
@@ -307,9 +309,8 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) {
MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_chunks are not present");
@@ -321,7 +322,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) {
}
void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(app_id);
smart_objects::SmartObject msg_params =
@@ -369,7 +370,7 @@ void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) {
application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SDL_LOG_ERROR("Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -400,7 +401,7 @@ void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) {
void SubtleAlertRequest::SendSpeakRequest(int32_t app_id,
bool tts_chunks_exists,
size_t length_tts_chunks) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace smart_objects;
// crate HMI speak request
@@ -418,13 +419,13 @@ void SubtleAlertRequest::SendSpeakRequest(int32_t app_id,
}
bool SubtleAlertRequest::CheckStrings() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) {
str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_1 syntax check failed");
return false;
}
}
@@ -432,7 +433,7 @@ bool SubtleAlertRequest::CheckStrings() {
if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) {
str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_2 syntax check failed");
return false;
}
}
@@ -443,7 +444,7 @@ bool SubtleAlertRequest::CheckStrings() {
for (size_t i = 0; i < tts_chunks_array.length(); ++i) {
str = tts_chunks_array[i][strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_chunks text syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_chunks text syntax check failed");
return false;
}
}
@@ -452,7 +453,7 @@ bool SubtleAlertRequest::CheckStrings() {
}
bool SubtleAlertRequest::HasHmiResponsesToWait() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return awaiting_ui_subtle_alert_response_ || awaiting_tts_speak_response_ ||
awaiting_tts_stop_speaking_response_;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc
index ad9252997b..594a967877 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubtleAlertResponse::SubtleAlertResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ SubtleAlertResponse::SubtleAlertResponse(
SubtleAlertResponse::~SubtleAlertResponse() {}
void SubtleAlertResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index 033e70a29c..17e295304c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -51,7 +51,7 @@ Copyright (c) 2018, Ford Motor Company
namespace sdl_rpc_plugin {
using namespace application_manager;
-CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("Commands")
namespace {
#ifdef ENABLE_LOG
@@ -80,11 +80,10 @@ class QueryAppsDataValidator {
: data_(object), manager_(manager) {}
bool Validate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!data_.isValid()) {
- LOG4CXX_ERROR(logger_,
- kQueryAppsValidationFailedPrefix
- << "QueryApps response is not valid.");
+ SDL_LOG_ERROR(kQueryAppsValidationFailedPrefix
+ << "QueryApps response is not valid.");
return false;
}
if (!HasResponseKey()) {
@@ -96,10 +95,9 @@ class QueryAppsDataValidator {
private:
bool HasResponseKey() const {
if (!data_.keyExists(json::response)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "QueryApps response does not contain '"
- << json::response << "' parameter.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "QueryApps response does not contain '" << json::response
+ << "' parameter.");
return false;
}
return true;
@@ -109,9 +107,8 @@ class QueryAppsDataValidator {
smart_objects::SmartArray* objects_array = data_[json::response].asArray();
if (!objects_array) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "QueryApps response is not array.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "QueryApps response is not array.");
return false;
}
@@ -125,16 +122,15 @@ class QueryAppsDataValidator {
const smart_objects::SmartObject& app_data = *applications_iterator;
if (!app_data.isValid()) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Wrong application data in json file.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "Wrong application data in json file.");
return false;
}
if (!CheckMandatoryParametersPresent(app_data)) {
- LOG4CXX_WARN(logger_,
- "Application hasn`t some of mandatory parameters. "
- "Application will be skipped.");
+ SDL_LOG_WARN(
+ "Application hasn`t some of mandatory parameters. "
+ "Application will be skipped.");
applications_iterator = objects_array->erase(applications_iterator);
continue;
@@ -153,12 +149,11 @@ class QueryAppsDataValidator {
if (json::ios == os_type) {
if (app_data[json::ios][json::urlScheme].asString().length() >
kUrlSchemaLengthMax) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
kQueryAppsValidationFailedPrefix
- << "An urlscheme length exceeds maximum allowed ["
- << app_data[json::ios][json::urlScheme].asString().length()
- << "]>[" << kUrlSchemaLengthMax << "]");
+ << "An urlscheme length exceeds maximum allowed ["
+ << app_data[json::ios][json::urlScheme].asString().length()
+ << "]>[" << kUrlSchemaLengthMax << "]");
return false;
}
}
@@ -166,23 +161,20 @@ class QueryAppsDataValidator {
if (json::android == os_type) {
if (app_data[json::android][json::packageName].asString().length() >
kPackageNameLengthMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Package name length ["
- << app_data[json::android][json::packageName]
- .asString()
- .length()
- << "] exceeds max length [" << kPackageNameLengthMax
- << "]in json file.");
+ SDL_LOG_WARN(
+ kQueryAppsValidationFailedPrefix
+ << "Package name length ["
+ << app_data[json::android][json::packageName].asString().length()
+ << "] exceeds max length [" << kPackageNameLengthMax
+ << "]in json file.");
return false;
}
}
// Languages verification
if (!app_data[os_type].keyExists(json::languages)) {
- LOG4CXX_WARN(
- logger_,
- kQueryAppsValidationFailedPrefix << "'languages' doesn't exist");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "'languages' doesn't exist");
return false;
}
if (!ValidateLanguages(app_data[os_type][json::languages],
@@ -199,18 +191,16 @@ class QueryAppsDataValidator {
// Verify appid length
const std::string app_id(app_data[json::appId].asString());
if (app_id.length() > kAppIdLengthMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "An Object ID length exceeds maximum allowed ["
- << app_id.length() << "]>[" << kAppIdLengthMax << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "An Object ID length exceeds maximum allowed ["
+ << app_id.length() << "]>[" << kAppIdLengthMax << "]");
return false;
}
// Verify that appid is unique
if (applications_id_set_.find(app_id) != applications_id_set_.end()) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "An Object ID is not unigue [" << app_id << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "An Object ID is not unigue [" << app_id << "]");
return false;
}
applications_id_set_.insert(app_id);
@@ -219,18 +209,15 @@ class QueryAppsDataValidator {
ApplicationSharedPtr registered_app =
manager_.application_by_policy_id(app_id);
if (registered_app) {
- LOG4CXX_INFO(
- logger_,
- "Application with the id: " << app_id << " is already registered.");
+ SDL_LOG_INFO("Application with the id: " << app_id
+ << " is already registered.");
}
// And app name length
const std::string appName(app_data[json::name].asString());
if (appName.length() > kAppNameLengthMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "Name of application exceeds maximum allowed ["
- << appName.length() << "]>[" << kAppNameLengthMax
- << "].");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "Name of application exceeds maximum allowed ["
+ << appName.length() << "]>[" << kAppNameLengthMax << "].");
return false;
}
return true;
@@ -241,33 +228,29 @@ class QueryAppsDataValidator {
bool default_language_found = false;
const size_t languages_array_size = languages.length();
if (languages_array_size > kLanguageArraySizeMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "'languages' array exceeds max size ["
- << languages_array_size << "]>[" << kLanguageArraySizeMax
- << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "'languages' array exceeds max size ["
+ << languages_array_size << "]>[" << kLanguageArraySizeMax
+ << "]");
return false;
}
// Every language has ttsname string and vrsynonyms array
for (size_t idx = 0; idx < languages_array_size; ++idx) {
const smart_objects::SmartObject& language = languages.getElement(idx);
if (smart_objects::SmartType_Map != language.getType()) {
- LOG4CXX_WARN(
- logger_,
- kQueryAppsValidationFailedPrefix << "language is not a map.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "language is not a map.");
return false;
}
if (language.length() != 1) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "language map size is not equal 1.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "language map size is not equal 1.");
return false;
}
const std::string language_name = (*language.map_begin()).first;
if (!language_name.length()) {
- LOG4CXX_WARN(
- logger_,
- kQueryAppsValidationFailedPrefix << "language name is empty");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "language name is empty");
return false;
}
// Verify default language defined
@@ -280,9 +263,8 @@ class QueryAppsDataValidator {
}
// ttsName verification
if (!language[language_name].keyExists(json::ttsName)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "'languages.ttsName' doesn't exist");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "'languages.ttsName' doesn't exist");
return false;
}
const smart_objects::SmartObject& ttsNameObject =
@@ -292,17 +274,15 @@ class QueryAppsDataValidator {
const std::string ttsName =
language[language_name][json::ttsName].asString();
if (ttsName.length() > kTtsNameLengthMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "ttsName string exceeds max length ["
- << ttsName.length() << "]>[" << kTtsNameLengthMax
- << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "ttsName string exceeds max length ["
+ << ttsName.length() << "]>[" << kTtsNameLengthMax
+ << "]");
return false;
}
} else {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "ttsName is not the string type.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "ttsName is not the string type.");
return false;
}
@@ -311,9 +291,8 @@ class QueryAppsDataValidator {
}
}
if (!default_language_found) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << " 'languages'.default' doesn't exist");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << " 'languages'.default' doesn't exist");
return false;
}
return true;
@@ -323,34 +302,29 @@ class QueryAppsDataValidator {
const std::string& language_name,
SynonymsMap& synonyms_map) const {
if (!language[language_name].keyExists(json::vrSynonyms)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "'languages.vrSynonyms' doesn't exist");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "'languages.vrSynonyms' doesn't exist");
return false;
}
const smart_objects::SmartArray* synonyms_array =
language[language_name][json::vrSynonyms].asArray();
if (!synonyms_array) {
- LOG4CXX_WARN(
- logger_,
- kQueryAppsValidationFailedPrefix << "vrSynonyms is not array.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "vrSynonyms is not array.");
return false;
}
const size_t synonyms_array_size = synonyms_array->size();
if (synonyms_array_size < kVrArraySizeMin) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "vrSynomyms array has [" << synonyms_array_size
- << "] size < allowed min size [" << kVrArraySizeMin
- << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "vrSynomyms array has [" << synonyms_array_size
+ << "] size < allowed min size [" << kVrArraySizeMin << "]");
return false;
}
if (synonyms_array_size > kVrArraySizeMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "vrSynomyms array size [" << synonyms_array_size
- << "] exceeds maximum allowed size [" << kVrArraySizeMax
- << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "vrSynomyms array size [" << synonyms_array_size
+ << "] exceeds maximum allowed size [" << kVrArraySizeMax
+ << "]");
return false;
}
@@ -358,19 +332,17 @@ class QueryAppsDataValidator {
const smart_objects::SmartObject& synonym = (*synonyms_array)[idx];
const std::string vrSynonym = synonym.asString();
if (vrSynonym.length() > kVrSynonymLengthMax) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "vrSYnomym item [" << idx
- << "] exceeds max length [" << vrSynonym.length()
- << "]>[" << kVrSynonymLengthMax << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "vrSYnomym item [" << idx << "] exceeds max length ["
+ << vrSynonym.length() << "]>[" << kVrSynonymLengthMax
+ << "]");
return false;
}
if (vrSynonym.length() < kVrSynonymLengthMin) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "vrSYnomym item [" << idx << "] length ["
- << vrSynonym.length() << "] is less then min length ["
- << kVrSynonymLengthMin << "] allowed.");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "vrSYnomym item [" << idx << "] length ["
+ << vrSynonym.length() << "] is less then min length ["
+ << kVrSynonymLengthMin << "] allowed.");
return false;
}
// Verify duplicates
@@ -378,11 +350,10 @@ class QueryAppsDataValidator {
synonyms_map.find(language_name);
if (synonyms_map_iter != synonyms_map.end()) {
if (!(*synonyms_map_iter).second.insert(vrSynonym).second) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "vrSYnomym item already defined ["
- << vrSynonym.c_str() << "] for language ["
- << language_name << "]");
+ SDL_LOG_WARN(kQueryAppsValidationFailedPrefix
+ << "vrSYnomym item already defined ["
+ << vrSynonym.c_str() << "] for language ["
+ << language_name << "]");
return false;
}
}
@@ -449,13 +420,13 @@ SystemRequest::SystemRequest(
SystemRequest::~SystemRequest() {}
void SystemRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (application.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -473,14 +444,12 @@ void SystemRequest::Run() {
if (!policy_handler.IsRequestTypeAllowed(
application->device(), application->policy_app_id(), request_type)) {
- LOG4CXX_ERROR(logger_,
- "RequestType " << stringified_request_type
+ SDL_LOG_ERROR("RequestType " << stringified_request_type
<< " is DISALLOWED by policies");
SendResponse(false, mobile_apis::Result::DISALLOWED);
return;
}
- LOG4CXX_TRACE(logger_,
- "RequestType " << stringified_request_type << " is ALLOWED");
+ SDL_LOG_TRACE("RequestType " << stringified_request_type << " is ALLOWED");
const bool request_subtype_present =
(*message_)[strings::msg_params].keyExists(strings::request_subtype);
@@ -489,14 +458,12 @@ void SystemRequest::Run() {
(*message_)[strings::msg_params][strings::request_subtype].asString();
if (!policy_handler.IsRequestSubTypeAllowed(application->policy_app_id(),
request_subtype)) {
- LOG4CXX_ERROR(logger_,
- "Request subtype: " << request_subtype
+ SDL_LOG_ERROR("Request subtype: " << request_subtype
<< " is DISALLOWED by policies");
SendResponse(false, mobile_apis::Result::DISALLOWED);
return;
}
- LOG4CXX_TRACE(logger_,
- "Request subtype: " << request_subtype << " is ALLOWED");
+ SDL_LOG_TRACE("Request subtype: " << request_subtype << " is ALLOWED");
}
std::string file_name = kSYNC;
@@ -507,8 +474,7 @@ void SystemRequest::Run() {
}
if (!CheckSyntax(file_name)) {
- LOG4CXX_ERROR(logger_,
- "Incoming request contains \t\n \\t \\n or whitespace");
+ SDL_LOG_ERROR("Incoming request contains \t\n \\t \\n or whitespace");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -516,7 +482,7 @@ void SystemRequest::Run() {
if (!file_system::IsFileNameValid(file_name) &&
mobile_apis::RequestType::ICON_URL != request_type) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
- LOG4CXX_ERROR(logger_, err_msg);
+ SDL_LOG_ERROR(err_msg);
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
return;
}
@@ -547,7 +513,7 @@ void SystemRequest::Run() {
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
return;
}
- LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name);
+ SDL_LOG_DEBUG("Got ICON_URL Request. File name: " << file_name);
} else {
binary_data_folder =
application_manager_.get_settings().system_files_path();
@@ -566,13 +532,12 @@ void SystemRequest::Run() {
file_dst_path += file_name;
if ((*message_)[strings::params].keyExists(strings::binary_data)) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Binary data is present. Trying to save it to: " << binary_data_folder);
if (mobile_apis::Result::SUCCESS !=
(application_manager_.SaveBinary(
binary_data, binary_data_folder, file_name, 0))) {
- LOG4CXX_DEBUG(logger_, "Binary data can't be saved.");
+ SDL_LOG_DEBUG("Binary data can't be saved.");
SendResponse(false, mobile_apis::Result::GENERIC_ERROR);
return;
}
@@ -580,23 +545,22 @@ void SystemRequest::Run() {
std::string app_full_file_path = binary_data_folder;
app_full_file_path += file_name;
- LOG4CXX_DEBUG(logger_,
- "Binary data is not present. Trying to find file "
- << file_name << " within previously saved app file in "
- << binary_data_folder);
+ SDL_LOG_DEBUG("Binary data is not present. Trying to find file "
+ << file_name << " within previously saved app file in "
+ << binary_data_folder);
const application_manager::AppFile* file =
application->GetFile(app_full_file_path);
if (!file || !file->is_download_complete ||
!file_system::MoveFile(app_full_file_path, file_dst_path)) {
- LOG4CXX_DEBUG(logger_, "Binary data not found.");
+ SDL_LOG_DEBUG("Binary data not found.");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
processing_file_ = file_dst_path;
}
- LOG4CXX_DEBUG(logger_, "Binary data ok.");
+ SDL_LOG_DEBUG("Binary data ok.");
if (mobile_apis::RequestType::ICON_URL == request_type) {
application_manager_.SetIconFileFromSystemRequest(file_name);
@@ -620,7 +584,7 @@ void SystemRequest::Run() {
Json::Value root;
if (!reader.parse(json, &root)) {
- LOG4CXX_DEBUG(logger_, "Unable to parse query_app json file. ");
+ SDL_LOG_DEBUG("Unable to parse query_app json file. ");
return;
}
@@ -662,7 +626,7 @@ void SystemRequest::Run() {
}
void SystemRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
@@ -683,7 +647,7 @@ void SystemRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (application.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -696,7 +660,7 @@ void SystemRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
@@ -705,16 +669,14 @@ void SystemRequest::on_event(const event_engine::Event& event) {
bool SystemRequest::ValidateQueryAppData(
smart_objects::SmartObject& data) const {
if (!data.isValid()) {
- LOG4CXX_ERROR(
- logger_,
- kQueryAppsValidationFailedPrefix << "QueryApps response is not valid.");
+ SDL_LOG_ERROR(kQueryAppsValidationFailedPrefix
+ << "QueryApps response is not valid.");
return false;
}
if (!data.keyExists(json::response)) {
- LOG4CXX_ERROR(logger_,
- kQueryAppsValidationFailedPrefix
- << "QueryApps response does not contain '"
- << json::response << "' parameter.");
+ SDL_LOG_ERROR(kQueryAppsValidationFailedPrefix
+ << "QueryApps response does not contain '" << json::response
+ << "' parameter.");
return false;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc
index 428901a1c5..00b0cd3b5e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SystemResponse::SystemResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ SystemResponse::SystemResponse(
SystemResponse::~SystemResponse() {}
void SystemResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc
index 3ba0513aeb..10f808b771 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc
@@ -40,12 +40,14 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
void UnregisterAppInterfaceRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!application_manager_.application(connection_key())) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc
index 7c90639968..28d05bef73 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc
@@ -38,8 +38,10 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
void UnregisterAppInterfaceResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendResponse((*message_)[strings::msg_params][strings::success].asBool());
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
index ec8de68c9e..69f85568eb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
@@ -41,6 +41,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace str = strings;
UnsubscribeButtonRequest::UnsubscribeButtonRequest(
@@ -58,12 +60,12 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest(
UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {}
void UnsubscribeButtonRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED");
+ SDL_LOG_ERROR("APPLICATION_NOT_REGISTERED");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -78,23 +80,22 @@ void UnsubscribeButtonRequest::Run() {
bool play_pause_supported =
CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE);
if (play_pause_supported) {
- LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE");
+ SDL_LOG_DEBUG("Converting Legacy OK button to PLAY_PAUSE");
btn_id = mobile_apis::ButtonName::PLAY_PAUSE;
(*message_)[str::msg_params][str::button_name] = btn_id;
} else if (!ok_supported) {
- LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities");
+ SDL_LOG_ERROR("OK button isn't allowed by HMI capabilities");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
}
} else if (!CheckHMICapabilities(btn_id)) {
- LOG4CXX_ERROR(logger_,
- "Button " << btn_id << " isn't allowed by HMI capabilities");
+ SDL_LOG_ERROR("Button " << btn_id << " isn't allowed by HMI capabilities");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
if (!app->UnsubscribeFromButton(
static_cast<mobile_apis::ButtonName::eType>(btn_id))) {
- LOG4CXX_ERROR(logger_, "App doesn't subscribe to button " << btn_id);
+ SDL_LOG_ERROR("App doesn't subscribe to button " << btn_id);
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc
index c69d49bca1..8321840899 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UnsubscribeButtonResponse::UnsubscribeButtonResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,12 +56,12 @@ UnsubscribeButtonResponse::UnsubscribeButtonResponse(
UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {}
void UnsubscribeButtonResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
if ((*message_)[strings::msg_params][strings::success].asBool() == false) {
- LOG4CXX_ERROR(logger_, "Success = false");
+ SDL_LOG_ERROR("Success = false");
SendResponse(false);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
index 17326a99a0..545a36def8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,19 +56,18 @@ UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest(
UnsubscribeWayPointsRequest::~UnsubscribeWayPointsRequest() {}
void UnsubscribeWayPointsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "An application with connection key "
- << connection_key() << " is not registered.");
+ SDL_LOG_ERROR("An application with connection key "
+ << connection_key() << " is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- if (!application_manager_.IsAppSubscribedForWayPoints(app)) {
+ if (!application_manager_.IsAppSubscribedForWayPoints(*app)) {
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
@@ -88,12 +89,12 @@ void UnsubscribeWayPointsRequest::Run() {
}
void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
- LOG4CXX_INFO(logger_, "Received Navigation_UnsubscribeWayPoints event");
+ SDL_LOG_INFO("Received Navigation_UnsubscribeWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -112,7 +113,7 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc
index a7a180fb46..beb7ef695d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,7 +56,7 @@ UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse(
UnsubscribeWayPointsResponse::~UnsubscribeWayPointsResponse() {}
void UnsubscribeWayPointsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
index 8c2cce9765..824d1150b3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
@@ -46,6 +46,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace custom_str = utils::custom_string;
UpdateTurnListRequest::UpdateTurnListRequest(
@@ -63,20 +65,19 @@ UpdateTurnListRequest::UpdateTurnListRequest(
UpdateTurnListRequest::~UpdateTurnListRequest() {}
void UpdateTurnListRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- LOG4CXX_ERROR(logger_, "Application is not registered");
+ SDL_LOG_ERROR("Application is not registered");
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming update turn list has contains \t\n \\t \\n");
+ SDL_LOG_ERROR("Incoming update turn list has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -90,7 +91,7 @@ void UpdateTurnListRequest::Run() {
application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, processing_result);
return;
}
@@ -104,8 +105,7 @@ void UpdateTurnListRequest::Run() {
MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon],
app,
application_manager_))) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyImage return INVALID_DATA");
+ SDL_LOG_ERROR("MessageHelper::VerifyImage return INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -118,7 +118,7 @@ void UpdateTurnListRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) {
if (!CheckTurnListArray()) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -152,18 +152,18 @@ void UpdateTurnListRequest::Run() {
hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params, true);
} else {
// conditional mandatory
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
}
}
void UpdateTurnListRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_UpdateTurnList: {
- LOG4CXX_INFO(logger_, "Received Navigation_UpdateTurnList event");
+ SDL_LOG_INFO("Received Navigation_UpdateTurnList event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -179,7 +179,7 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
break;
}
}
@@ -204,7 +204,7 @@ bool UpdateTurnListRequest::CheckTurnListArray() {
}
bool UpdateTurnListRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) {
@@ -218,8 +218,7 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() {
if ((*it_tl).keyExists(strings::navigation_text)) {
str = (*it_tl)[strings::navigation_text].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Invalid turn_list navigation_text text syntax check failed");
return true;
}
@@ -228,8 +227,8 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() {
if ((*it_tl).keyExists(strings::turn_icon)) {
str = (*it_tl)[strings::turn_icon][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(
- logger_, "Invalid turn_list turn_icon value syntax check failed");
+ SDL_LOG_ERROR(
+ "Invalid turn_list turn_icon value syntax check failed");
return true;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
index eca9e3703c..bedf91b45c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UpdateTurnListResponse::UpdateTurnListResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -55,7 +57,7 @@ UpdateTurnListResponse::UpdateTurnListResponse(
UpdateTurnListResponse::~UpdateTurnListResponse() {}
void UpdateTurnListResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc
index 5ffbbd83bb..311ba5d4aa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc
@@ -1,9 +1,12 @@
#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "application_manager/smart_object_keys.h"
namespace sdl_rpc_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "GetSystemCapabilitiesAppExtension")
+SDL_CREATE_LOG_VARIABLE("GetSystemCapabilitiesAppExtension")
namespace app_mngr_ = application_manager;
+namespace strings = app_mngr::strings;
+
const app_mngr_::AppExtensionUID
SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID = 200;
@@ -18,16 +21,14 @@ SystemCapabilityAppExtension::~SystemCapabilityAppExtension() {}
bool SystemCapabilityAppExtension::SubscribeTo(
const SystemCapabilityType system_capability_type) {
- LOG4CXX_INFO(logger_,
- "Subscribing to System Capability " << system_capability_type);
+ SDL_LOG_INFO("Subscribing to System Capability " << system_capability_type);
return subscribed_data_.insert(system_capability_type).second;
}
bool SystemCapabilityAppExtension::UnsubscribeFrom(
const SystemCapabilityType system_capability_type) {
- LOG4CXX_INFO(
- logger_,
- "Unsubscribing from System Capability " << system_capability_type);
+ SDL_LOG_INFO("Unsubscribing from System Capability "
+ << system_capability_type);
auto it = subscribed_data_.find(system_capability_type);
if (it != subscribed_data_.end()) {
subscribed_data_.erase(it);
@@ -37,13 +38,13 @@ bool SystemCapabilityAppExtension::UnsubscribeFrom(
}
void SystemCapabilityAppExtension::UnsubscribeFromAll() {
- LOG4CXX_INFO(logger_, "Unsubscribing from ALL System Capabilities");
+ SDL_LOG_INFO("Unsubscribing from ALL System Capabilities");
subscribed_data_.clear();
}
bool SystemCapabilityAppExtension::IsSubscribedTo(
const SystemCapabilityType system_capability_type) const {
- LOG4CXX_DEBUG(logger_, system_capability_type);
+ SDL_LOG_DEBUG(system_capability_type);
return subscribed_data_.find(system_capability_type) !=
subscribed_data_.end();
}
@@ -53,39 +54,49 @@ SystemCapabilitySubscriptions SystemCapabilityAppExtension::Subscriptions() {
}
void SystemCapabilityAppExtension::SaveResumptionData(
- ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) {
- LOG4CXX_AUTO_TRACE(logger_);
- const char* application_system_capability = "systemCapability";
+ smart_objects::SmartObject& resumption_data) {
+ SDL_LOG_AUTO_TRACE();
- resumption_data[application_system_capability] =
+ resumption_data[strings::system_capability] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
int i = 0;
for (const auto& subscription : subscribed_data_) {
- resumption_data[application_system_capability][i] = subscription;
+ resumption_data[strings::system_capability][i] = subscription;
i++;
}
}
void SystemCapabilityAppExtension::ProcessResumption(
- const smart_objects::SmartObject& resumption_data) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- const char* application_system_capability = "systemCapability";
- if (resumption_data.keyExists(application_system_capability)) {
- const smart_objects::SmartObject& subscriptions =
- resumption_data[application_system_capability];
- for (size_t i = 0; i < subscriptions.length(); ++i) {
- SystemCapabilityType capability_type =
- static_cast<SystemCapabilityType>((resumption_data[i]).asInt());
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ const smart_objects::SmartObject& subscriptions =
+ saved_app[strings::application_subscriptions];
+
+ if (saved_app.keyExists(strings::system_capability)) {
+ const auto& system_capability_subscriptions =
+ subscriptions[strings::system_capability];
+ for (size_t i = 0; i < system_capability_subscriptions.length(); ++i) {
+ SystemCapabilityType capability_type = static_cast<SystemCapabilityType>(
+ (system_capability_subscriptions[i]).asInt());
SubscribeTo(capability_type);
}
}
}
+void SystemCapabilityAppExtension::RevertResumption(
+ const smart_objects::SmartObject& subscriptions) {
+ SDL_LOG_AUTO_TRACE();
+
+ // No need to revert subscriptions here when an app gets RESUME_FAILED
+ // System capability subscriptions should still be active
+ UNUSED(subscriptions);
+}
+
SystemCapabilityAppExtension& SystemCapabilityAppExtension::ExtractExtension(
app_mngr_::Application& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto ext_ptr = app.QueryInterface(
SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID);
DCHECK(ext_ptr);
@@ -95,4 +106,4 @@ SystemCapabilityAppExtension& SystemCapabilityAppExtension::ExtractExtension(
DCHECK(app_extension);
return *app_extension;
}
-} // namespace sdl_rpc_plugin \ No newline at end of file
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
index 0289a92290..570a4ce12e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
@@ -233,6 +233,8 @@
#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_subtle_alert_pressed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_update_sub_menu_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h"
@@ -268,7 +270,7 @@
namespace sdl_rpc_plugin {
using namespace application_manager;
-CREATE_LOGGERPTR_GLOBAL(logger_, "HMICommandFactory")
+SDL_CREATE_LOG_VARIABLE("HMICommandFactory")
HMICommandFactory::HMICommandFactory(
ApplicationManager& application_manager,
@@ -286,20 +288,20 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
const hmi_apis::FunctionID::eType function_id =
static_cast<hmi_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asInt());
- LOG4CXX_DEBUG(
- logger_, "HMICommandFactory::CreateCommand function_id: " << function_id);
+ SDL_LOG_DEBUG(
+ "HMICommandFactory::CreateCommand function_id: " << function_id);
const hmi_apis::messageType::eType message_type =
static_cast<hmi_apis::messageType::eType>(
(*message)[strings::params][strings::message_type].asInt());
if (hmi_apis::messageType::response == message_type) {
- LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand response");
+ SDL_LOG_DEBUG("HMICommandFactory::CreateCommand response");
} else if ((*message)[strings::params][strings::message_type] ==
hmi_apis::messageType::error_response) {
- LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand error response");
+ SDL_LOG_DEBUG("HMICommandFactory::CreateCommand error response");
} else {
- LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand request");
+ SDL_LOG_DEBUG("HMICommandFactory::CreateCommand request");
}
return get_creator_factory(function_id, message_type, source).create(message);
@@ -931,6 +933,12 @@ CommandCreator& HMICommandFactory::get_creator_factory(
case hmi_apis::FunctionID::BasicCommunication_OnAppPropertiesChange: {
return factory.GetCreator<commands::OnAppPropertiesChangeNotification>();
}
+ case hmi_apis::FunctionID::UI_OnUpdateFile: {
+ return factory.GetCreator<commands::OnUIUpdateFileNotification>();
+ }
+ case hmi_apis::FunctionID::UI_OnUpdateSubMenu: {
+ return factory.GetCreator<commands::OnUIUpdateSubMenuNotification>();
+ }
case hmi_apis::FunctionID::UI_OnSubtleAlertPressed: {
return factory.GetCreator<commands::OnUISubtleAlertPressedNotification>();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index 5855309f80..d2f1325c82 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -93,6 +93,8 @@
#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_update_file_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h"
@@ -147,7 +149,7 @@
#include "sdl_rpc_plugin/commands/mobile/update_turn_list_request.h"
#include "sdl_rpc_plugin/commands/mobile/update_turn_list_response.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -467,6 +469,12 @@ CommandCreator& MobileCommandFactory::get_notification_creator(
case mobile_apis::FunctionID::OnWayPointChangeID: {
return factory.GetCreator<commands::OnWayPointChangeNotification>();
}
+ case mobile_apis::FunctionID::OnUpdateFileID: {
+ return factory.GetCreator<commands::OnUpdateFileNotification>();
+ }
+ case mobile_apis::FunctionID::OnUpdateSubMenuID: {
+ return factory.GetCreator<commands::OnUpdateSubMenuNotification>();
+ }
case mobile_apis::FunctionID::OnSubtleAlertPressedID: {
return factory.GetCreator<commands::OnSubtleAlertPressedNotification>();
}
@@ -552,8 +560,7 @@ CommandSharedPtr MobileCommandFactory::CreateCommand(
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asInt());
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"MobileCommandFactory::CreateCommand function_id: " << function_id);
return get_creator_factory(function_id, message_type, source).create(message);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
index 2a1261f643..e01165269a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
@@ -31,15 +31,21 @@
*/
#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+#include "application_manager/message_helper.h"
#include "application_manager/plugin_manager/plugin_keys.h"
#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
#include "sdl_rpc_plugin/sdl_command_factory.h"
+#include "sdl_rpc_plugin/waypoints_app_extension.h"
+#include "sdl_rpc_plugin/waypoints_pending_resumption_handler.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
-CREATE_LOGGERPTR_GLOBAL(logger_, "SdlRPCPlugin")
+SDL_CREATE_LOG_VARIABLE("SdlRPCPlugin")
+
+SDLRPCPlugin::SDLRPCPlugin()
+ : application_manager_(nullptr), pending_resumption_handler_(nullptr) {}
bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -47,6 +53,9 @@ bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager,
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state) {
UNUSED(last_state);
+ application_manager_ = &app_manager;
+ pending_resumption_handler_ =
+ std::make_shared<WayPointsPendingResumptionHandler>(app_manager);
command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory(
app_manager, rpc_service, hmi_capabilities, policy_handler));
return true;
@@ -83,20 +92,64 @@ void SDLRPCPlugin::OnPolicyEvent(plugins::PolicyEvent event) {}
void SDLRPCPlugin::OnApplicationEvent(
plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
if (plugins::ApplicationEvent::kApplicationRegistered == event) {
+ application->AddExtension(
+ std::make_shared<WayPointsAppExtension>(*this, *application));
+
auto sys_cap_ext_ptr =
std::make_shared<SystemCapabilityAppExtension>(*this, *application);
application->AddExtension(sys_cap_ext_ptr);
// Processing automatic subscription to SystemCapabilities for DISPLAY type
const auto capability_type =
mobile_apis::SystemCapabilityType::eType::DISPLAYS;
- LOG4CXX_DEBUG(logger_, "Subscription to DISPLAYS capability is enabled");
+ SDL_LOG_DEBUG("Subscription to DISPLAYS capability is enabled");
sys_cap_ext_ptr->SubscribeTo(capability_type);
+
} else if (plugins::ApplicationEvent::kDeleteApplicationData == event) {
ClearSubscriptions(application);
}
}
+void SDLRPCPlugin::ProcessResumptionSubscription(
+ application_manager::Application& app, WayPointsAppExtension& ext) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (application_manager_->IsAnyAppSubscribedForWayPoints()) {
+ SDL_LOG_DEBUG(
+ "Subscription to waypoint already exist, no need to send "
+ "request to HMI");
+ application_manager_->SubscribeAppForWayPoints(app.app_id());
+ return;
+ }
+
+ pending_resumption_handler_->HandleResumptionSubscriptionRequest(ext, app);
+}
+
+void SDLRPCPlugin::SaveResumptionData(
+ application_manager::Application& app,
+ smart_objects::SmartObject& resumption_data) {
+ resumption_data[application_manager::strings::subscribed_for_way_points] =
+ application_manager_->IsAppSubscribedForWayPoints(app);
+}
+
+void SDLRPCPlugin::RevertResumption(application_manager::Application& app) {
+ SDL_LOG_AUTO_TRACE();
+
+ pending_resumption_handler_->OnResumptionRevert();
+
+ if (application_manager_->IsAppSubscribedForWayPoints(app)) {
+ application_manager_->UnsubscribeAppFromWayPoints(app.app_id());
+ if (!application_manager_->IsAnyAppSubscribedForWayPoints()) {
+ SDL_LOG_DEBUG("Send UnsubscribeWayPoints");
+ auto request =
+ application_manager::MessageHelper::CreateUnsubscribeWayPointsRequest(
+ application_manager_->GetNextHMICorrelationID());
+ application_manager_->GetRPCService().ManageHMICommand(request);
+ }
+ }
+}
+
void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) {
auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
ext.UnsubscribeFromAll();
@@ -106,12 +159,12 @@ void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) {
extern "C" __attribute__((visibility("default")))
application_manager::plugin_manager::RPCPlugin*
-Create() {
+Create(logger::Logger* logger_instance) {
+ logger::Logger::instance(logger_instance);
return new sdl_rpc_plugin::SDLRPCPlugin();
}
extern "C" __attribute__((visibility("default"))) void Delete(
application_manager::plugin_manager::RPCPlugin* data) {
delete data;
- DELETE_THREAD_LOGGER(sdl_rpc_plugin::logger_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc
new file mode 100644
index 0000000000..ed8283e1f9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc
@@ -0,0 +1,76 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/waypoints_app_extension.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+SDL_CREATE_LOG_VARIABLE("WayPointsAppExtension")
+
+namespace sdl_rpc_plugin {
+namespace strings = application_manager::strings;
+unsigned WayPointsAppExtension::WayPointsAppExtensionUID = 138;
+
+WayPointsAppExtension::WayPointsAppExtension(
+ SDLRPCPlugin& plugin, application_manager::Application& app)
+ : app_mngr::AppExtension(WayPointsAppExtension::WayPointsAppExtensionUID)
+ , plugin_(plugin)
+ , app_(app) {
+ SDL_LOG_AUTO_TRACE();
+}
+
+WayPointsAppExtension::~WayPointsAppExtension() {
+ SDL_LOG_AUTO_TRACE();
+}
+
+void WayPointsAppExtension::SaveResumptionData(
+ smart_objects::SmartObject& resumption_data) {
+ plugin_.SaveResumptionData(app_, resumption_data);
+}
+
+void WayPointsAppExtension::ProcessResumption(
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!saved_app.keyExists(strings::subscribed_for_way_points)) {
+ SDL_LOG_ERROR("subscribed_for_way_points section does not exist");
+ return;
+ }
+ const bool subscribed_for_way_points =
+ saved_app[strings::subscribed_for_way_points].asBool();
+ if (subscribed_for_way_points) {
+ plugin_.ProcessResumptionSubscription(app_, *this);
+ }
+}
+
+void WayPointsAppExtension::RevertResumption(
+ const smart_objects::SmartObject& resumption_data) {
+ SDL_LOG_AUTO_TRACE();
+ UNUSED(resumption_data);
+
+ plugin_.RevertResumption(app_);
+}
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
new file mode 100644
index 0000000000..8b5d117f54
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
@@ -0,0 +1,209 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/waypoints_pending_resumption_handler.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+#include "utils/helpers.h"
+
+namespace sdl_rpc_plugin {
+
+SDL_CREATE_LOG_VARIABLE("SdlRPCPlugin")
+
+WayPointsPendingResumptionHandler::WayPointsPendingResumptionHandler(
+ application_manager::ApplicationManager& application_manager)
+ : PendingResumptionHandler(application_manager) {}
+
+smart_objects::SmartObjectSPtr
+WayPointsPendingResumptionHandler::CreateSubscriptionRequest() {
+ SDL_LOG_AUTO_TRACE();
+ auto subscribe_waypoints_msg =
+ application_manager::MessageHelper::CreateMessageForHMI(
+ hmi_apis::FunctionID::Navigation_SubscribeWayPoints,
+ application_manager_.GetNextHMICorrelationID());
+ (*subscribe_waypoints_msg)[application_manager::strings::params]
+ [application_manager::strings::message_type] =
+ hmi_apis::messageType::request;
+ return subscribe_waypoints_msg;
+}
+
+void WayPointsPendingResumptionHandler::HandleResumptionSubscriptionRequest(
+ application_manager::AppExtension& extension,
+ application_manager::Application& app) {
+ SDL_LOG_AUTO_TRACE();
+ WayPointsAppExtension& ext = dynamic_cast<WayPointsAppExtension&>(extension);
+ smart_objects::SmartObjectSPtr request = CreateSubscriptionRequest();
+ smart_objects::SmartObject& request_ref = *request;
+ const auto function_id = static_cast<hmi_apis::FunctionID::eType>(
+ request_ref[application_manager::strings::params]
+ [application_manager::strings::function_id]
+ .asInt());
+ const uint32_t corr_id =
+ request_ref[application_manager::strings::params]
+ [application_manager::strings::correlation_id]
+ .asUInt();
+
+ auto resumption_request =
+ MakeResumptionRequest(corr_id, function_id, *request);
+ app_ids_.push(app.app_id());
+
+ if (pending_requests_.empty()) {
+ SDL_LOG_DEBUG("There are no pending requests for app_id: " << app.app_id());
+ pending_requests_[corr_id] = request_ref;
+ subscribe_on_event(function_id, corr_id);
+ SDL_LOG_DEBUG("Sending request with function id: "
+ << function_id << " and correlation_id: " << corr_id);
+
+ application_manager_.GetRPCService().ManageHMICommand(request);
+ } else {
+ SDL_LOG_DEBUG("There are pending requests. Frozen resumption for app id "
+ << app.app_id() << " corr id = " << corr_id);
+ ResumptionAwaitingHandling frozen_res{
+ app.app_id(), ext, resumption_request};
+ frozen_resumptions_.push_back(frozen_res);
+ }
+ resumption_data_processor().SubscribeToResponse(app.app_id(),
+ resumption_request);
+}
+
+void WayPointsPendingResumptionHandler::OnResumptionRevert() {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager;
+
+ if (!pending_requests_.empty()) {
+ SDL_LOG_DEBUG("Still waiting for some response");
+ return;
+ }
+
+ if (!frozen_resumptions_.empty()) {
+ ResumptionAwaitingHandling frozen_resumption = frozen_resumptions_.back();
+ frozen_resumptions_.pop_back();
+
+ auto request = std::make_shared<smart_objects::SmartObject>(
+ frozen_resumption.request_to_send_.message);
+ const uint32_t cid =
+ (*request)[strings::params][strings::correlation_id].asUInt();
+ const auto fid = static_cast<hmi_apis::FunctionID::eType>(
+ (*request)[strings::params][strings::function_id].asInt());
+
+ SDL_LOG_DEBUG("Subscribing for event with function id: "
+ << fid << " correlation id: " << cid);
+ subscribe_on_event(fid, cid);
+ pending_requests_[cid] = *request;
+ SDL_LOG_DEBUG("Sending request with fid: " << fid << " and cid: " << cid);
+ application_manager_.GetRPCService().ManageHMICommand(request);
+ }
+}
+
+void WayPointsPendingResumptionHandler::RaiseFakeSuccessfulResponse(
+ ns_smart_device_link::ns_smart_objects::SmartObject response,
+ const int32_t corr_id) {
+ using namespace application_manager;
+ response[strings::params][strings::correlation_id] = corr_id;
+ auto fid = static_cast<hmi_apis::FunctionID::eType>(
+ response[strings::params][strings::function_id].asInt());
+ event_engine::Event event(fid);
+ event.set_smart_object(response);
+
+ SDL_LOG_TRACE("Raise fake response for subscriber. corr_id : " << corr_id);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+void WayPointsPendingResumptionHandler::on_event(
+ const application_manager::event_engine::Event& event) {
+ using namespace application_manager;
+ SDL_LOG_AUTO_TRACE();
+
+ const smart_objects::SmartObject& response = event.smart_object();
+ const uint32_t corr_id = event.smart_object_correlation_id();
+
+ SDL_LOG_TRACE("Received event with function id: "
+ << event.id() << " and correlation id: " << corr_id);
+
+ smart_objects::SmartObject pending_request;
+ if (pending_requests_.find(corr_id) == pending_requests_.end()) {
+ SDL_LOG_ERROR("corr id " << corr_id << " NOT found");
+ return;
+ }
+ pending_request = pending_requests_[corr_id];
+ pending_requests_.erase(corr_id);
+ if (app_ids_.empty()) {
+ SDL_LOG_ERROR("app_ids is empty");
+ return;
+ }
+ uint32_t app_id = app_ids_.front();
+ app_ids_.pop();
+ auto app = application_manager_.application(app_id);
+ if (!app) {
+ SDL_LOG_ERROR("Application not found " << app_id);
+ return;
+ }
+
+ if (resumption::IsResponseSuccessful(response)) {
+ SDL_LOG_DEBUG("Resumption of subscriptions is successful");
+
+ application_manager_.SubscribeAppForWayPoints(app);
+
+ for (auto& frozen_resumption : frozen_resumptions_) {
+ auto corr_id = frozen_resumption.request_to_send_
+ .message[strings::params][strings::correlation_id]
+ .asInt();
+ RaiseFakeSuccessfulResponse(response, corr_id);
+ application_manager_.SubscribeAppForWayPoints(frozen_resumption.app_id);
+ }
+ frozen_resumptions_.clear();
+ } else {
+ SDL_LOG_DEBUG("Resumption of subscriptions is NOT successful");
+
+ if (frozen_resumptions_.empty()) {
+ SDL_LOG_DEBUG("frozen resumptions list is empty");
+ return;
+ }
+
+ ResumptionAwaitingHandling frozen_resumption = frozen_resumptions_.back();
+ frozen_resumptions_.pop_back();
+ auto resumption_req = frozen_resumption.request_to_send_;
+ const uint32_t cid =
+ resumption_req.message[strings::params][strings::correlation_id]
+ .asInt();
+ const hmi_apis::FunctionID::eType fid =
+ static_cast<hmi_apis::FunctionID::eType>(
+ resumption_req.message[strings::params][strings::function_id]
+ .asInt());
+ subscribe_on_event(fid, cid);
+ auto request =
+ std::make_shared<smart_objects::SmartObject>(resumption_req.message);
+ SDL_LOG_DEBUG("Subscribing for event with function id: "
+ << fid << " correlation id: " << cid);
+ pending_requests_[cid] = *request;
+ SDL_LOG_DEBUG("Sending request with fid: " << fid << " and cid: " << cid);
+ application_manager_.GetRPCService().ManageHMICommand(request);
+ }
+}
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
index 937e056e7c..3efdee405a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
@@ -101,6 +101,7 @@
#include "application_manager/mock_rpc_plugin_manager.h"
#include "application_manager/mock_state_controller.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "application_manager/smart_object_keys.h"
#include "connection_handler/mock_connection_handler.h"
#include "connection_handler/mock_connection_handler_settings.h"
@@ -255,6 +256,8 @@ class HMICommandsNotificationsTest
ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_));
ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_));
+ ON_CALL(app_mngr_, connection_handler())
+ .WillByDefault(ReturnRef(mock_connection_handler_));
}
am::ApplicationSharedPtr ConfigureApp(NiceMock<MockApplication>** app_mock,
@@ -970,7 +973,7 @@ TEST_F(HMICommandsNotificationsTest,
kCorrelationId_;
MessageSharedPtr temp_message = CreateMessage();
- resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
EXPECT_CALL(app_mngr_, resume_controller())
.WillOnce(ReturnRef(mock_resume_ctrl));
EXPECT_CALL(mock_resume_ctrl, OnSuspend());
@@ -1022,18 +1025,17 @@ TEST_F(HMICommandsNotificationsTest,
static_cast<int32_t>(am::MessageType::kNotification);
(*notification)[am::strings::params][am::strings::connection_key] = kAppId_;
- std::vector<hmi_apis::Common_ApplicationExitReason::eType> reason_list;
- reason_list.push_back(hmi_apis::Common_ApplicationExitReason::
- UNAUTHORIZED_TRANSPORT_REGISTRATION);
- reason_list.push_back(
- hmi_apis::Common_ApplicationExitReason::UNSUPPORTED_HMI_RESOURCE);
-
- std::vector<mobile_apis::AppInterfaceUnregisteredReason::eType>
- mobile_reason_list;
- mobile_reason_list.push_back(
- mobile_apis::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED);
- mobile_reason_list.push_back(
- mobile_apis::AppInterfaceUnregisteredReason::UNSUPPORTED_HMI_RESOURCE);
+ using ExitReason = hmi_apis::Common_ApplicationExitReason::eType;
+ std::vector<ExitReason> reason_list = {
+ ExitReason::UNAUTHORIZED_TRANSPORT_REGISTRATION,
+ ExitReason::UNSUPPORTED_HMI_RESOURCE,
+ ExitReason::RESOURCE_CONSTRAINT};
+
+ using UnregisteredReason = mobile_apis::AppInterfaceUnregisteredReason::eType;
+ std::vector<UnregisteredReason> mobile_reason_list = {
+ UnregisteredReason::APP_UNAUTHORIZED,
+ UnregisteredReason::UNSUPPORTED_HMI_RESOURCE,
+ UnregisteredReason::RESOURCE_CONSTRAINT};
std::vector<mobile_apis::AppInterfaceUnregisteredReason::eType>::iterator
it_mobile_reason = mobile_reason_list.begin();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
index f3ed480180..ae2a544cc9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
@@ -137,6 +137,9 @@ TEST_F(
(*message_)[strings::msg_params][strings::app_id] = kAppId;
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
EXPECT_CALL(*mock_app_,
set_display_capabilities(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
index b569ecb83f..cb90859018 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
@@ -56,7 +56,6 @@ namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
using sdl_rpc_plugin::commands::RCIsReadyRequest;
-
typedef std::shared_ptr<RCIsReadyRequest> RCIsReadyRequestPtr;
class RCIsReadyRequestTest
@@ -102,15 +101,23 @@ class RCIsReadyRequestTest
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _));
}
- void PrepareEvent(bool is_message_contain_param,
- Event& event,
- bool is_rc_cooperating_available = false) {
+ MessageSharedPtr CreateResultMessage(
+ bool is_rc_cooperating_available,
+ hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::INVALID_ENUM) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- if (is_message_contain_param) {
- (*msg)[am::strings::msg_params][am::strings::available] =
- is_rc_cooperating_available;
+ (*msg)[am::strings::msg_params][am::strings::available] =
+ is_rc_cooperating_available;
+ if (hmi_apis::Common_Result::INVALID_ENUM != result_code) {
+ (*msg)[am::strings::params][am::hmi_response::code] = result_code;
}
- event.set_smart_object(*msg);
+ return msg;
+ }
+
+ MessageSharedPtr CreateErrorMessage() {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[am::strings::params][am::strings::error_msg] = true;
+ return msg;
}
void HMICapabilitiesExpectations() {
@@ -128,8 +135,11 @@ TEST_F(RCIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) {
const bool is_send_message_to_hmi = true;
const bool is_message_contain_param = false;
Event event(hmi_apis::FunctionID::RC_IsReady);
- PrepareEvent(is_message_contain_param, event);
+
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ event.set_smart_object(*msg);
HMICapabilitiesExpectations();
+
SetUpExpectations(is_rc_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -142,7 +152,8 @@ TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToFalse_StateNotAvailable) {
const bool is_send_message_to_hmi = false;
const bool is_message_contain_param = true;
Event event(hmi_apis::FunctionID::RC_IsReady);
- PrepareEvent(is_message_contain_param, event);
+ MessageSharedPtr msg = CreateResultMessage(is_rc_cooperating_available);
+ event.set_smart_object(*msg);
SetUpExpectations(is_rc_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -150,13 +161,20 @@ TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToFalse_StateNotAvailable) {
command_->on_event(event);
}
-TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) {
+TEST_F(RCIsReadyRequestTest,
+ Run_KeyAvailableEqualToTrueResultCodeSuccess_StateAvailable) {
const bool is_rc_cooperating_available = true;
const bool is_send_message_to_hmi = true;
const bool is_message_contain_param = true;
+ const hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::SUCCESS;
Event event(hmi_apis::FunctionID::RC_IsReady);
- PrepareEvent(is_message_contain_param, event, is_rc_cooperating_available);
+
+ MessageSharedPtr msg =
+ CreateResultMessage(is_rc_cooperating_available, result_code);
+ event.set_smart_object(*msg);
HMICapabilitiesExpectations();
+
SetUpExpectations(is_rc_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -164,6 +182,38 @@ TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) {
command_->on_event(event);
}
+TEST_F(RCIsReadyRequestTest,
+ Run_KeyAvailableEqualToTrueResultCodeUnsuccess_StateNotAvailable) {
+ const bool is_rc_cooperating_available = false;
+ const bool is_send_message_to_hmi = false;
+ const bool is_message_contain_param = true;
+ const hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+ Event event(hmi_apis::FunctionID::RC_IsReady);
+ MessageSharedPtr msg =
+ CreateResultMessage(is_rc_cooperating_available, result_code);
+ event.set_smart_object(*msg);
+ SetUpExpectations(is_rc_cooperating_available,
+ is_send_message_to_hmi,
+ is_message_contain_param,
+ am::HmiInterfaces::STATE_NOT_AVAILABLE);
+ command_->on_event(event);
+}
+
+TEST_F(RCIsReadyRequestTest, Run_ErrorMessage_StateNotAvailable) {
+ const bool is_rc_cooperating_available = false;
+ const bool is_send_message_to_hmi = false;
+ const bool is_message_contain_param = true;
+ Event event(hmi_apis::FunctionID::RC_IsReady);
+ MessageSharedPtr msg = CreateErrorMessage();
+ event.set_smart_object(*msg);
+ SetUpExpectations(is_rc_cooperating_available,
+ is_send_message_to_hmi,
+ is_message_contain_param,
+ am::HmiInterfaces::STATE_NOT_AVAILABLE);
+ command_->on_event(event);
+}
+
TEST_F(RCIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) {
HMICapabilitiesExpectations();
ExpectSendMessagesToHMI();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
index b11312eb33..aa199bd112 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
@@ -48,6 +48,8 @@
#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "application_manager/smart_object_keys.h"
#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
@@ -104,6 +106,7 @@ class AddCommandRequestTest
public:
AddCommandRequestTest()
: msg_(CreateMessage())
+ , smart_obj_(smart_objects::SmartType_Null)
, default_app_name_("test_default_app_name_")
, lock_ptr_(std::make_shared<sync_primitives::Lock>())
, mock_help_prompt_manager_(
@@ -124,8 +127,7 @@ class AddCommandRequestTest
void InitGetters() {
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
- ON_CALL(*mock_app_, FindCommand(kCmdId))
- .WillByDefault(Return(so_ptr_.get()));
+ ON_CALL(*mock_app_, FindCommand(kCmdId)).WillByDefault(Return(smart_obj_));
}
void CreateBasicParamsUIRequest() {
@@ -173,8 +175,7 @@ class AddCommandRequestTest
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId))
- .WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
SmartObject first_command = SmartObject(SmartType_Map);
SmartObject second_command = SmartObject(SmartType_Map);
const am::CommandsMap commands_map =
@@ -182,9 +183,9 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject sub_menu(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
- .WillOnce(Return(so_ptr_.get()));
+ .WillOnce(Return(sub_menu));
{
InSequence dummy;
@@ -221,13 +222,14 @@ class AddCommandRequestTest
mock_rpc_service_,
ManageMobileCommand(response,
am::commands::Command::CommandSource::SOURCE_SDL));
+
std::shared_ptr<CommandRequestImpl> base_class_request =
static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr);
base_class_request->onTimeOut();
}
MessageSharedPtr msg_;
- SmartObjectSPtr so_ptr_;
+ smart_objects::SmartObject smart_obj_;
const utils::custom_string::CustomString default_app_name_;
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
std::shared_ptr<am_test::MockHelpPromptManager> mock_help_prompt_manager_;
@@ -292,14 +294,13 @@ TEST_F(AddCommandRequestTest, Run_MenuNameHasSyntaxError_EXPECT_INVALID_DATA) {
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
am::CommandsMap commands_map;
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
SmartObject parent = SmartObject(SmartType_Map);
- EXPECT_CALL(*mock_app_, FindSubMenu(kFirstParentId))
- .WillOnce(Return(&parent));
+ EXPECT_CALL(*mock_app_, FindSubMenu(kFirstParentId)).WillOnce(Return(parent));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -314,7 +315,7 @@ TEST_F(AddCommandRequestTest,
CreateBasicParamsVRRequest();
SmartObject& msg_params = (*msg_)[strings::msg_params];
msg_params[vr_commands][0] = kErroredVRCommand;
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
am::CommandsMap commands_map;
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
@@ -340,7 +341,7 @@ TEST_F(AddCommandRequestTest, Run_CMDIconHasError_EXPECT_INVALID_DATA) {
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
am::CommandsMap commands_map;
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
@@ -360,8 +361,9 @@ TEST_F(AddCommandRequestTest, Run_CommandIDAlreadyExists_EXPECT_INVALID_ID) {
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ SmartObject existing_cmd_so(smart_objects::SmartType_Map);
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId))
+ .WillOnce(Return(existing_cmd_so));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -379,7 +381,7 @@ TEST_F(AddCommandRequestTest,
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
SmartObject first_command = SmartObject(SmartType_Map);
SmartObject second_command = SmartObject(SmartType_Map);
const am::CommandsMap commands_map =
@@ -404,7 +406,7 @@ TEST_F(AddCommandRequestTest,
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
SmartObject first_command = SmartObject(SmartType_Map);
SmartObject second_command = SmartObject(SmartType_Map);
const am::CommandsMap commands_map =
@@ -412,8 +414,10 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
+
+ SmartObject invalid_command(SmartType_Null);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
- .WillOnce(Return(so_ptr_.get()));
+ .WillOnce(Return(invalid_command));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -432,7 +436,7 @@ TEST_F(AddCommandRequestTest,
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
SmartObject first_command = SmartObject(SmartType_Map);
SmartObject second_command = SmartObject(SmartType_Map);
@@ -441,9 +445,9 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject sub_menu(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
- .WillOnce(Return(so_ptr_.get()));
+ .WillOnce(Return(sub_menu));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -459,7 +463,7 @@ TEST_F(AddCommandRequestTest, Run_MsgDataEmpty_EXPECT_INVALID_DATA) {
SmartObject& msg_params = (*msg)[strings::msg_params];
msg_params[app_id] = kAppId;
msg_params[cmd_id] = kCmdId;
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -478,7 +482,7 @@ TEST_F(AddCommandRequestTest,
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
SmartObject first_command = SmartObject(SmartType_Map);
SmartObject second_command = SmartObject(SmartType_Map);
const am::CommandsMap commands_map =
@@ -486,9 +490,9 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject sub_menu(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
- .WillOnce(Return(so_ptr_.get()));
+ .WillOnce(Return(sub_menu));
{
InSequence dummy;
@@ -512,7 +516,7 @@ TEST_F(AddCommandRequestTest, GetRunMethods_SUCCESS) {
SmartObject& image = (*msg_)[msg_params][cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
EXPECT_CALL(*mock_app_, AddCommand(kCmdId, (*msg_)[msg_params]));
am::CommandsMap commands_map;
@@ -1092,6 +1096,7 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
+
std::shared_ptr<CommandRequestImpl> base_class_request =
static_cast<std::shared_ptr<CommandRequestImpl> >(
CreateCommand<AddCommandRequest>(msg_));
@@ -1106,7 +1111,7 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
msg_params[menu_params][hmi_request::parent_id] = kSecondParentId;
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
+ EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
SmartObject first_command = SmartObject(SmartType_Map);
SmartObject second_command = SmartObject(SmartType_Map);
const am::CommandsMap commands_map =
@@ -1114,9 +1119,9 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject sub_menu(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
- .WillOnce(Return(so_ptr_.get()));
+ .WillOnce(Return(sub_menu));
{
InSequence dummy;
EXPECT_CALL(mock_rpc_service_,
@@ -1142,6 +1147,7 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
+
std::shared_ptr<CommandRequestImpl> base_class_request =
static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr);
base_class_request->onTimeOut();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
index 73a0008624..80abfec61d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -44,6 +44,8 @@
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "application_manager/smart_object_keys.h"
#include "gtest/gtest.h"
#include "smart_objects/smart_object.h"
@@ -184,6 +186,11 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) {
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true)));
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(app_mngr_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
+
req_vr->onTimeOut();
EXPECT_EQ(
(*vr_command_result)[strings::msg_params][strings::success].asBool(),
@@ -207,7 +214,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- smart_objects::SmartObject* null_obj = NULL;
+ smart_objects::SmartObject null_obj(smart_objects::SmartType_Null);
ON_CALL(*mock_app_, FindChoiceSet(_)).WillByDefault(Return(null_obj));
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -219,9 +226,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
am::event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*msg);
- smart_objects::SmartObject* ptr = NULL;
- ON_CALL(*mock_app_, FindCommand(kCmdId)).WillByDefault(Return(ptr));
- EXPECT_EQ(NULL, ptr);
+ smart_objects::SmartObject invalid_command(smart_objects::SmartType_Null);
+ ON_CALL(*mock_app_, FindCommand(kCmdId))
+ .WillByDefault(Return(invalid_command));
am::CommandsMap commands_map;
ON_CALL(*mock_app_, commands_map())
@@ -293,9 +300,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) {
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* invalid_choice_set_id =
- &((*message_)[am::strings::msg_params]
- [am::strings::interaction_choice_set_id]);
+ smart_objects::SmartObject invalid_choice_set_id =
+ (*message_)[am::strings::msg_params]
+ [am::strings::interaction_choice_set_id];
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(invalid_choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
@@ -329,7 +336,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -358,7 +365,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillRepeatedly(Return(choice_set_id));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
@@ -435,7 +442,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -478,7 +485,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -511,7 +518,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_WithoutVrCommands_SUCCESS) {
EXPECT_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
.WillOnce(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::NONE));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -549,7 +556,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
.WillOnce(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::MIXED));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -598,7 +605,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) {
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -635,7 +642,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -673,7 +680,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -704,7 +711,12 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR),
am::commands::Command::SOURCE_SDL));
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(app_mngr_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
+
command_->onTimeOut();
}
@@ -724,7 +736,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -748,7 +760,12 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(*mock_app_, RemoveChoiceSet(kChoiceSetId));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(app_mngr_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
+
command_->onTimeOut();
}
@@ -769,7 +786,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -794,6 +811,11 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(invalid_app));
EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)).Times(0);
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(app_mngr_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
+
command_->onTimeOut();
}
@@ -813,7 +835,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -833,6 +855,10 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(app_mngr_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
Event event(hmi_apis::FunctionID::VR_AddCommand);
@@ -889,7 +915,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillRepeatedly(Return(choice_set_id));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
index 081058f05a..b8ae3af7fd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
@@ -152,9 +152,10 @@ TEST_F(DeleteCommandRequestTest,
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- MessageSharedPtr test_msg(CreateMessage(smart_objects::SmartType_Map));
- (*test_msg)[am::strings::vr_commands] = 0;
- (*test_msg)[am::strings::menu_params] = 0;
+ smart_objects::SmartObject test_msg(
+ *CreateMessage(smart_objects::SmartType_Map));
+ test_msg[am::strings::vr_commands] = 0;
+ test_msg[am::strings::menu_params] = 0;
ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
@@ -164,8 +165,7 @@ TEST_F(DeleteCommandRequestTest,
ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- ON_CALL(*mock_app_, FindCommand(kCommandId))
- .WillByDefault(Return(test_msg.get()));
+ ON_CALL(*mock_app_, FindCommand(kCommandId)).WillByDefault(Return(test_msg));
ON_CALL(*mock_app_, get_grammar_id()).WillByDefault(Return(kConnectionKey));
MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
(*msg)[am::strings::params][am::hmi_response::code] =
@@ -216,9 +216,10 @@ TEST_F(DeleteCommandRequestTest,
MockAppPtr app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- MessageSharedPtr test_msg(CreateMessage(smart_objects::SmartType_Map));
- (*test_msg)[am::strings::vr_commands] = 0;
- (*test_msg)[am::strings::menu_params] = 0;
+ smart_objects::SmartObject test_msg(
+ *CreateMessage(smart_objects::SmartType_Map));
+ test_msg[am::strings::vr_commands] = 0;
+ test_msg[am::strings::menu_params] = 0;
ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
@@ -228,7 +229,7 @@ TEST_F(DeleteCommandRequestTest,
ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- ON_CALL(*app, FindCommand(kCommandId)).WillByDefault(Return(test_msg.get()));
+ ON_CALL(*app, FindCommand(kCommandId)).WillByDefault(Return(test_msg));
ON_CALL(*app, get_grammar_id()).WillByDefault(Return(kConnectionKey));
MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
(*msg)[am::strings::params][am::hmi_response::code] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
index fa96b21ca7..dd4c6fd526 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -142,7 +142,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
- smart_objects::SmartObject* choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id(smart_objects::SmartType_Null);
EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -161,9 +161,9 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_ChoiceSetInUse_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
- smart_objects::SmartObject* choice_set_id =
- &((*message_)[am::strings::msg_params]
- [am::strings::interaction_choice_set_id]);
+ smart_objects::SmartObject choice_set_id =
+ (*message_)[am::strings::msg_params]
+ [am::strings::interaction_choice_set_id];
choice_set_map_[0].insert(
std::make_pair(kChoiceSetId,
@@ -189,10 +189,11 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
kConnectionKey;
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- smart_objects::SmartObject* choice_set_id =
- &((*message_)[am::strings::msg_params]
- [am::strings::interaction_choice_set_id]);
- smart_objects::SmartObject* invalid_choice_set_id = NULL;
+ smart_objects::SmartObject choice_set_id =
+ (*message_)[am::strings::msg_params]
+ [am::strings::interaction_choice_set_id];
+ smart_objects::SmartObject invalid_choice_set_id(
+ smart_objects::SmartType_Null);
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(app_));
@@ -228,8 +229,8 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
(*message_)[am::strings::msg_params][am::strings::grammar_id] = kGrammarId;
(*message_)[am::strings::msg_params][am::strings::choice_set][0]
[am::strings::choice_id] = kChoiceId;
- smart_objects::SmartObject* choice_set_id =
- &((*message_)[am::strings::msg_params]);
+ smart_objects::SmartObject choice_set_id =
+ (*message_)[am::strings::msg_params];
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(app_));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
index cd832d3122..f5856a8eda 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
@@ -203,7 +203,7 @@ TEST_F(DeleteSubMenuRequestTest, Run_FindSubMenuFalse_UNSUCCESS) {
(*message_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- smart_objects::SmartObject* invalid_sub_menu = NULL;
+ smart_objects::SmartObject invalid_sub_menu(smart_objects::SmartType_Null);
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
EXPECT_CALL(*app_, FindSubMenu(kMenuId)).WillOnce(Return(invalid_sub_menu));
@@ -220,8 +220,8 @@ TEST_F(DeleteSubMenuRequestTest, Run_SendHMIRequest_SUCCESS) {
(*message_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- smart_objects::SmartObject* sub_menu =
- &((*message_)[am::strings::msg_params][am::strings::menu_id]);
+ smart_objects::SmartObject sub_menu =
+ (*message_)[am::strings::msg_params][am::strings::menu_id];
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
EXPECT_CALL(*app_, FindSubMenu(kMenuId)).WillOnce(Return(sub_menu));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_app_interface_unregistered_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_app_interface_unregistered_notification_test.cc
new file mode 100644
index 0000000000..64dcec2e0a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_app_interface_unregistered_notification_test.cc
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mobile/on_app_interface_unregistered_notification.h"
+
+#include <utility>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace on_app_interface_unregistered_notification_test {
+
+namespace am = ::application_manager;
+
+using sdl_rpc_plugin::commands::OnAppInterfaceUnregisteredNotification;
+using Reason = mobile_apis::AppInterfaceUnregisteredReason::eType;
+using ::testing::Return;
+
+namespace {
+const uint32_t kAppId = 1u;
+typedef std::shared_ptr<MockApplication> MockAppPtr;
+} // namespace
+
+const auto retrieve_data_to_check = [](const smart_objects::SmartObject& so) {
+ return std::make_pair(
+ so[am::strings::params][am::strings::connection_key].asUInt(),
+ so[am::strings::msg_params][am::strings::reason].asInt());
+};
+
+MATCHER_P(CheckMessageData, initial_data, "") {
+ return retrieve_data_to_check(*arg) == initial_data;
+}
+
+class OnAppInterfaceUnregisteredNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnAppInterfaceUnregisteredNotificationTest()
+ : message_(CreateMessage()), command_(), mock_app_(CreateMockApp()) {
+ (*message_)[am::strings::params][am::strings::connection_key] = kAppId;
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+ CommandsTest<CommandsTestMocks::kIsNice>::InitCommand(kDefaultTimeout_);
+ command_.reset(
+ new OnAppInterfaceUnregisteredNotification(message_,
+ app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_));
+ }
+
+ void CheckResponseParameters(const bool is_wep_mode_enabled,
+ const bool is_final_message) {
+ ON_CALL(*mock_app_, webengine_projection_enabled())
+ .WillByDefault(Return(is_wep_mode_enabled));
+
+ const auto initial_data = retrieve_data_to_check(*message_);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToMobile(CheckMessageData(initial_data), is_final_message));
+ }
+
+ am::commands::MessageSharedPtr message_;
+ std::unique_ptr<OnAppInterfaceUnregisteredNotification> command_;
+ MockAppPtr mock_app_;
+};
+
+TEST_F(OnAppInterfaceUnregisteredNotificationTest,
+ Run_AnyReasonButResourceConstraint_NonFinalMessageSent) {
+ (*message_)[am::strings::msg_params][am::strings::reason] =
+ Reason::IGNITION_OFF;
+
+ CheckResponseParameters(true, false);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnAppInterfaceUnregisteredNotificationTest,
+ Run_ResourceConstraintForNonWebApp_NonFinalMessageSent) {
+ (*message_)[am::strings::msg_params][am::strings::reason] =
+ Reason::RESOURCE_CONSTRAINT;
+
+ CheckResponseParameters(false, true);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnAppInterfaceUnregisteredNotificationTest,
+ Run_ResourceConstraintForWebApp_FinalMessageSent) {
+ (*message_)[am::strings::msg_params][am::strings::reason] =
+ Reason::RESOURCE_CONSTRAINT;
+
+ CheckResponseParameters(true, true);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_app_interface_unregistered_notification_test
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
index 1356b1c5fa..10a84452e9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
@@ -86,8 +86,10 @@ TEST_F(OnCommandNotificationTest, Run_NoAppsForTheCommand_UNSUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+ smart_objects::SmartObject invalid_command(smart_objects::SmartType_Null);
+
EXPECT_CALL(*mock_app, FindCommand(kCommandId))
- .WillOnce(Return(static_cast<SmartObject*>(NULL)));
+ .WillOnce(Return(invalid_command));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
@@ -121,9 +123,9 @@ TEST_F(OnCommandNotificationTest, Run_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
- MessageSharedPtr dummy_msg(CreateMessage());
+ smart_objects::SmartObject empty_command(smart_objects::SmartType_Map);
EXPECT_CALL(*mock_app, FindCommand(kCommandId))
- .WillOnce(Return(dummy_msg.get()));
+ .WillOnce(Return(empty_command));
EXPECT_CALL(mock_rpc_service_,
SendMessageToMobile(CheckNotificationMessage(), _));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
index 349ada66a2..7e7b16aa89 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
@@ -183,6 +183,10 @@ TEST_F(
ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
.WillByDefault(Return(system_display_capabilities));
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
@@ -197,7 +201,7 @@ TEST_F(
DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
- ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
ON_CALL(*mock_app_,
QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
index a42aa61400..33771f6c3d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
@@ -43,7 +43,9 @@
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/mock_rpc_plugin_manager.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "application_manager/smart_object_keys.h"
#include "connection_handler/mock_connection_handler.h"
#include "gtest/gtest.h"
@@ -73,11 +75,13 @@ using ::testing::SetArgPointee;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
+using am::plugin_manager::MockRPCPluginManager;
using sdl_rpc_plugin::commands::RegisterAppInterfaceRequest;
namespace {
const uint32_t kConnectionKey = 1u;
const uint32_t kConnectionKey2 = 2u;
+const uint32_t kDefaultTimeout = 0u;
const connection_handler::DeviceHandle kDeviceHandle = 3u;
const hmi_apis::Common_Language::eType kHmiLanguage =
hmi_apis::Common_Language::EN_US;
@@ -93,6 +97,7 @@ const std::string kFullAppId = "test_app_id_long";
const std::string kDummyString = "test_string";
const std::vector<uint32_t> kDummyDiagModes;
const utils::SemanticVersion mock_semantic_version(1, 0, 0);
+const connection_handler::DeviceHandle kHandle = 1;
} // namespace
class RegisterAppInterfaceRequestTest
@@ -107,17 +112,33 @@ class RegisterAppInterfaceRequestTest
, pending_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, mock_application_helper_(
application_manager_test::MockApplicationHelper::
- application_helper_mock()) {
+ application_helper_mock())
+ , mock_rpc_plugin_manager_(
+ std::make_shared<NiceMock<MockRPCPluginManager> >())
+ , message_helper_mock_(
+ *application_manager::MockMessageHelper::message_helper_mock())
+ , notify_upd_manager_(std::make_shared<utils::CallNothing>()) {
InitGetters();
InitLanguage();
}
void SetUp() OVERRIDE {
testing::Mock::VerifyAndClearExpectations(&mock_application_helper_);
+ testing::Mock::VerifyAndClearExpectations(&message_helper_mock_);
+
+ ON_CALL(app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(*mock_rpc_plugin_manager_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+
+ ON_CALL(app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
}
void TearDown() OVERRIDE {
testing::Mock::VerifyAndClearExpectations(&mock_application_helper_);
+ testing::Mock::VerifyAndClearExpectations(&message_helper_mock_);
}
void InitBasicMessage() {
@@ -150,6 +171,15 @@ class RegisterAppInterfaceRequestTest
ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId1));
ON_CALL(*mock_app, msg_version())
.WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*mock_app, protocol_version())
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
+
+ capabilities_builder_ptr_.reset(
+ new application_manager::DisplayCapabilitiesBuilder(*mock_app));
+ ON_CALL(*mock_app, display_capabilities_builder())
+ .WillByDefault(ReturnRef(*capabilities_builder_ptr_));
+
return mock_app;
}
@@ -279,12 +309,62 @@ class RegisterAppInterfaceRequestTest
HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
.Times(0);
+ auto notification = std::make_shared<smart_objects::SmartObject>();
+ ON_CALL(message_helper_mock_, CreateHMIStatusNotification(_, _))
+ .WillByDefault(Return(notification));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(notification, _));
+
EXPECT_CALL(app_mngr_,
OnApplicationSwitched(
std::static_pointer_cast<application_manager::Application>(
mock_app)));
}
+ void SetCommonPreconditionsToRegisterApplication() {
+ ON_CALL(app_mngr_, IsApplicationForbidden(_, _))
+ .WillByDefault(Return(false));
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kDeviceHandle), Return(0)));
+ ON_CALL(mock_session_observer_,
+ GetDataOnDeviceID(kDeviceHandle, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+ ON_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillByDefault(Return(ApplicationSharedPtr()));
+ ON_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillByDefault(Return(ApplicationSharedPtr()));
+ ON_CALL(app_mngr_, applications())
+ .WillByDefault(
+ Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+ ON_CALL(app_mngr_, pending_applications())
+ .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>(
+ pending_app_set_, pending_lock_ptr_)));
+ ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _))
+ .WillByDefault(Return(true));
+ ON_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _))
+ .WillByDefault(Return(true));
+ }
+
+ void SetCommonPreconditionsToCheckWithPolicyData(MockAppPtr mock_app) {
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
+ .WillByDefault(Return(notify_upd_manager_));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+ ON_CALL(app_mngr_, RegisterApplication(msg_))
+ .WillByDefault(Return(mock_app));
+ }
+
MessageSharedPtr msg_;
std::shared_ptr<RegisterAppInterfaceRequest> command_;
@@ -298,7 +378,7 @@ class RegisterAppInterfaceRequestTest
typedef IsNiceMock<policy_test::MockPolicyHandlerInterface,
kMocksAreNice>::Result MockPolicyHandlerInterface;
- typedef IsNiceMock<resumprion_test::MockResumeCtrl, kMocksAreNice>::Result
+ typedef IsNiceMock<resumption_test::MockResumeCtrl, kMocksAreNice>::Result
MockResumeCtrl;
typedef IsNiceMock<connection_handler_test::MockConnectionHandler,
@@ -314,12 +394,23 @@ class RegisterAppInterfaceRequestTest
MockConnectionHandler mock_connection_handler_;
MockSessionObserver mock_session_observer_;
application_manager_test::MockApplicationHelper& mock_application_helper_;
+ std::shared_ptr<am::plugin_manager::MockRPCPluginManager>
+ mock_rpc_plugin_manager_;
+ application_manager::MockMessageHelper& message_helper_mock_;
+ policy::StatusNotifier notify_upd_manager_;
+ std::unique_ptr<application_manager::DisplayCapabilitiesBuilder>
+ capabilities_builder_ptr_;
};
TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) {
EXPECT_TRUE(command_->Init());
}
+TEST_F(RegisterAppInterfaceRequestTest, DefaultTimeout_CheckIfZero_SUCCESS) {
+ command_->Init();
+ EXPECT_EQ(command_->default_timeout(), kDefaultTimeout);
+}
+
TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
InitBasicMessage();
(*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId1;
@@ -328,14 +419,12 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
.WillOnce(Return(true))
.WillOnce(Return(false));
ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
- connection_handler::DeviceHandle handle = 1;
ON_CALL(mock_connection_handler_,
GetDataOnSessionKey(kConnectionKey, _, _, _))
- .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
- ON_CALL(mock_session_observer_, GetDataOnDeviceID(handle, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kHandle), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(kHandle, _, _, _, _))
.WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
MockAppPtr mock_app = CreateBasicMockedApp();
@@ -351,16 +440,14 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
.WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>(
pending_app_set_, pending_lock_ptr_)));
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
- policy::StatusNotifier notify_upd_manager =
- std::make_shared<utils::CallNothing>();
ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
- .WillByDefault(Return(notify_upd_manager));
+ .WillByDefault(Return(notify_upd_manager_));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
@@ -376,6 +463,11 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
_))
.WillOnce(Return(true));
+
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app);
+ ON_CALL(*mock_app, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
@@ -415,13 +507,11 @@ TEST_F(RegisterAppInterfaceRequestTest,
.WillOnce(Return(true))
.WillOnce(Return(false));
ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
- connection_handler::DeviceHandle handle = 1;
ON_CALL(mock_connection_handler_,
GetDataOnSessionKey(kConnectionKey, _, _, _))
- .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
+ .WillByDefault(DoAll(SetArgPointee<3>(kHandle), Return(0)));
ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, _, _, _, _))
.WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
@@ -431,8 +521,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
.WillRepeatedly(Return(ApplicationSharedPtr()));
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
MessageSharedPtr expected_message =
CreateMessage(smart_objects::SmartType_Map);
@@ -480,10 +570,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
- policy::StatusNotifier notify_upd_manager =
- std::make_shared<utils::CallNothing>();
ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
- .WillByDefault(Return(notify_upd_manager));
+ .WillByDefault(Return(notify_upd_manager_));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
@@ -517,6 +605,11 @@ TEST_F(RegisterAppInterfaceRequestTest,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
.WillOnce(Return(true));
+
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app);
+ ON_CALL(*mock_app, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
@@ -562,8 +655,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(mock_application_helper_, RecallApplicationData(_, _)).Times(0);
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillRepeatedly(Return(mock_app));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::SUCCESS);
@@ -609,8 +702,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0);
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillRepeatedly(Return(mock_app));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
@@ -645,8 +738,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0);
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillRepeatedly(Return(mock_app));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
@@ -718,7 +811,6 @@ TEST_F(RegisterAppInterfaceRequestTest,
.WillOnce(Return(true))
.WillOnce(Return(false));
ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
- EXPECT_CALL(app_mngr_, updateRequestTimeout(kConnectionKey2, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(kConnectionKey2, kAppId1))
.WillOnce(Return(false));
@@ -739,16 +831,14 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
.WillOnce(Return(ApplicationSharedPtr()));
- EXPECT_CALL(app_mngr_, application(kConnectionKey2))
- .WillOnce(Return(mock_app2));
+ ON_CALL(app_mngr_, application(kConnectionKey2))
+ .WillByDefault(Return(mock_app2));
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
- policy::StatusNotifier notify_upd_manager =
- std::make_shared<utils::CallNothing>();
ON_CALL(mock_policy_handler_, AddApplication(kMacAddress2, kAppId1, _))
- .WillByDefault(Return(notify_upd_manager));
+ .WillByDefault(Return(notify_upd_manager_));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app2));
@@ -782,6 +872,11 @@ TEST_F(RegisterAppInterfaceRequestTest,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
.WillOnce(Return(true));
+
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app2);
+ ON_CALL(*mock_app2, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
@@ -791,6 +886,264 @@ TEST_F(RegisterAppInterfaceRequestTest,
command_->Run();
}
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterAppWith_WEB_VIEW_HMITypeSuccess) {
+ SetCommonPreconditionsToRegisterApplication();
+
+ InitBasicMessage();
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][0] =
+ mobile_apis::AppHMIType::WEB_VIEW;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ SetCommonPreconditionsToCheckWithPolicyData(mock_app);
+ std::vector<std::string> present_hmi_types_in_policy{"WEB_VIEW"};
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(
+ DoAll(SetArgPointee<2>(present_hmi_types_in_policy), Return(true)));
+
+ auto app = std::static_pointer_cast<am::Application>(mock_app);
+
+ EXPECT_CALL(*mock_app, set_webengine_projection_enabled(true));
+ EXPECT_CALL(app_mngr_, OnApplicationRegistered(app));
+ EXPECT_CALL(mock_policy_handler_,
+ OnAppRegisteredOnMobile(kMacAddress1, kAppId1));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
+ .Times(2);
+ EXPECT_CALL(app_mngr_, SendDriverDistractionState(app));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterApp_WithoutAppHMITypes_SuccessfulRegistration) {
+ SetCommonPreconditionsToRegisterApplication();
+ InitBasicMessage();
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ SetCommonPreconditionsToCheckWithPolicyData(mock_app);
+ std::vector<std::string> present_hmi_types_in_policy{"NAVIGATION"};
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(
+ DoAll(SetArgPointee<2>(present_hmi_types_in_policy), Return(true)));
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, result_code);
+}
+
+TEST_F(
+ RegisterAppInterfaceRequestTest,
+ RegisterAppInterface_AppHMITypesDontExistInPTForSpecifiedApp_SuccessfulRegistration) {
+ SetCommonPreconditionsToRegisterApplication();
+ InitBasicMessage();
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][0] =
+ mobile_apis::AppHMIType::PROJECTION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][1] =
+ mobile_apis::AppHMIType::INFORMATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][2] =
+ mobile_apis::AppHMIType::COMMUNICATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][3] =
+ mobile_apis::AppHMIType::NAVIGATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][4] =
+ mobile_apis::AppHMIType::MESSAGING;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ SetCommonPreconditionsToCheckWithPolicyData(mock_app);
+ std::vector<std::string> present_hmi_types_in_policy;
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(
+ DoAll(SetArgPointee<2>(present_hmi_types_in_policy), Return(true)));
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, result_code);
+}
+
+TEST_F(
+ RegisterAppInterfaceRequestTest,
+ RegisterApp_AppHMITypeNotCoincidedWithCurrentNonEmptyDataStoredInPT_SuccessfulRegistrationWithWarning) {
+ SetCommonPreconditionsToRegisterApplication();
+ InitBasicMessage();
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][0] =
+ mobile_apis::AppHMIType::PROJECTION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][1] =
+ mobile_apis::AppHMIType::INFORMATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][2] =
+ mobile_apis::AppHMIType::COMMUNICATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][3] =
+ mobile_apis::AppHMIType::NAVIGATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][4] =
+ mobile_apis::AppHMIType::MESSAGING;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ SetCommonPreconditionsToCheckWithPolicyData(mock_app);
+ std::vector<std::string> present_hmi_types_in_policy{"NAVIGATION"};
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(
+ DoAll(SetArgPointee<2>(present_hmi_types_in_policy), Return(true)));
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+ EXPECT_EQ(mobile_apis::Result::WARNINGS, result_code);
+
+ // Regarding to requairements, response info string should contain all
+ // AppHMITypes that are not contained in the policy table.
+ std::vector<std::string> expected_app_hmi_types_in_info_string{
+ "PROJECTION", "INFORMATION", "COMMUNICATION", "MESSAGING"};
+
+ const std::string info_string_in_response =
+ (*response_to_mobile)[am::strings::msg_params][am::strings::info]
+ .asString();
+
+ for (const auto& app_hmi_type : expected_app_hmi_types_in_info_string) {
+ EXPECT_TRUE(info_string_in_response.find(app_hmi_type) != std::string::npos)
+ << "AppHMItype absent in the response string: " << app_hmi_type;
+ }
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterAppWithWebView_WebViewNotAllowedInPT_RejectRegistration) {
+ SetCommonPreconditionsToRegisterApplication();
+ InitBasicMessage();
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][0] =
+ mobile_apis::AppHMIType::WEB_VIEW;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][1] =
+ mobile_apis::AppHMIType::INFORMATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][2] =
+ mobile_apis::AppHMIType::COMMUNICATION;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ SetCommonPreconditionsToCheckWithPolicyData(mock_app);
+ std::vector<std::string> present_hmi_types_in_policy{"INFORMATION",
+ "COMMUNICATION"};
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(
+ DoAll(SetArgPointee<2>(present_hmi_types_in_policy), Return(true)));
+
+ EXPECT_CALL(*mock_app, set_webengine_projection_enabled(true)).Times(0);
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::DISALLOWED, result_code);
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterAppWithWebView_EmptyPT_RejectRegistration) {
+ SetCommonPreconditionsToRegisterApplication();
+ InitBasicMessage();
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][0] =
+ mobile_apis::AppHMIType::PROJECTION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][1] =
+ mobile_apis::AppHMIType::INFORMATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][2] =
+ mobile_apis::AppHMIType::WEB_VIEW;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][3] =
+ mobile_apis::AppHMIType::NAVIGATION;
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][4] =
+ mobile_apis::AppHMIType::MESSAGING;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ SetCommonPreconditionsToCheckWithPolicyData(mock_app);
+ std::vector<std::string> present_hmi_types_in_policy;
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(
+ DoAll(SetArgPointee<2>(present_hmi_types_in_policy), Return(true)));
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+ EXPECT_EQ(mobile_apis::Result::DISALLOWED, result_code);
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterAppWithWebViewOnly_WebViewNotAllowedInPT_RejectRegistration) {
+ SetCommonPreconditionsToRegisterApplication();
+ InitBasicMessage();
+ (*msg_)[am::strings::msg_params][am::strings::app_hmi_type][0] =
+ mobile_apis::AppHMIType::WEB_VIEW;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ SetCommonPreconditionsToCheckWithPolicyData(mock_app);
+ std::vector<std::string> present_hmi_types_in_policy{"INFORMATION",
+ "COMMUNICATION"};
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(
+ DoAll(SetArgPointee<2>(present_hmi_types_in_policy), Return(true)));
+
+ EXPECT_CALL(*mock_app, set_webengine_projection_enabled(true)).Times(0);
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::DISALLOWED, result_code);
+}
+
} // namespace register_app_interface_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
index 4b43c302e4..8ca15f39fe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
@@ -125,157 +125,50 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidApp_UNSUCCESS) {
}
TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
- (*msg_)[am::strings::msg_params][am::strings::properties][0] =
- mobile_apis::GlobalProperty::HELPPROMPT;
- (*msg_)[am::strings::msg_params][am::strings::properties][1] =
- mobile_apis::GlobalProperty::TIMEOUTPROMPT;
- (*msg_)[am::strings::msg_params][am::strings::properties][2] =
- mobile_apis::GlobalProperty::VRHELPTITLE;
- (*msg_)[am::strings::msg_params][am::strings::properties][3] =
- mobile_apis::GlobalProperty::MENUNAME;
- (*msg_)[am::strings::msg_params][am::strings::properties][4] =
- mobile_apis::GlobalProperty::MENUICON;
- (*msg_)[am::strings::msg_params][am::strings::properties][5] =
- mobile_apis::GlobalProperty::KEYBOARDPROPERTIES;
-
- EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- std::vector<std::string> help_prompt = {"help_prompt"};
-
- EXPECT_CALL(app_mngr_settings_, help_prompt())
- .WillOnce(ReturnRef(help_prompt));
-
- smart_objects::SmartObject so_help_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- so_help_prompt[am::strings::text] = help_prompt[0];
- so_help_prompt[am::strings::type] =
- hmi_apis::Common_SpeechCapabilities::SC_TEXT;
-
- smart_objects::SmartObject so_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
- so_prompt[0] = so_help_prompt;
-
- EXPECT_CALL(*mock_app_, set_help_prompt(so_prompt));
-
- std::vector<std::string> time_out_prompt;
- time_out_prompt.push_back("time_out");
- EXPECT_CALL(app_mngr_settings_, time_out_promt())
- .WillOnce(ReturnRef(time_out_prompt));
-
- smart_objects::SmartObject timeout_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- timeout_prompt[am::strings::text] = time_out_prompt[0];
- timeout_prompt[am::strings::type] =
- hmi_apis::Common_SpeechCapabilities::SC_TEXT;
-
- smart_objects::SmartObject so_time_out_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
-
- so_time_out_prompt[0] = timeout_prompt;
-
- EXPECT_CALL(*mock_app_, set_timeout_prompt(so_time_out_prompt));
-
- std::string vr_help_title("vr_help_title");
- EXPECT_CALL(app_mngr_settings_, vr_help_title())
- .WillOnce(ReturnRef(vr_help_title));
-
- smart_objects::SmartObject so_vr_help_title =
- smart_objects::SmartObject(smart_objects::SmartType_String);
- so_vr_help_title = vr_help_title;
- EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
+ am::ResetGlobalPropertiesResult result;
+ result.help_prompt = true;
+ result.timeout_prompt = true;
+ result.vr_help_title_items = true;
+ result.menu_name = true;
+ result.menu_icon = true;
+ result.keyboard_properties = true;
- EXPECT_CALL(*mock_app_, reset_vr_help_title());
- EXPECT_CALL(*mock_app_, reset_vr_help());
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
- EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(smart_objects::SmartObjectSPtr()));
- smart_objects::SmartObjectSPtr vr_help; // = NULL;
- EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
- .WillOnce(Return(vr_help));
+ ON_CALL(mock_message_helper_, CreateTTSResetGlobalPropertiesRequest(_, _))
+ .WillByDefault(Return(std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map)));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
command_->Run();
}
TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
- (*msg_)[am::strings::msg_params][am::strings::properties][0] =
- mobile_apis::GlobalProperty::HELPPROMPT;
- (*msg_)[am::strings::msg_params][am::strings::properties][1] =
- mobile_apis::GlobalProperty::TIMEOUTPROMPT;
- (*msg_)[am::strings::msg_params][am::strings::properties][2] =
- mobile_apis::GlobalProperty::VRHELPTITLE;
- (*msg_)[am::strings::msg_params][am::strings::properties][3] =
- mobile_apis::GlobalProperty::MENUNAME;
- (*msg_)[am::strings::msg_params][am::strings::properties][4] =
- mobile_apis::GlobalProperty::MENUICON;
- (*msg_)[am::strings::msg_params][am::strings::properties][5] =
- mobile_apis::GlobalProperty::KEYBOARDPROPERTIES;
-
- EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
-
- std::vector<std::string> help_prompt = {"help_prompt"};
-
- EXPECT_CALL(app_mngr_settings_, help_prompt())
- .WillOnce(ReturnRef(help_prompt));
-
- smart_objects::SmartObject so_help_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- so_help_prompt[am::strings::text] = help_prompt[0];
- so_help_prompt[am::strings::type] =
- hmi_apis::Common_SpeechCapabilities::SC_TEXT;
-
- smart_objects::SmartObject so_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
- so_prompt[0] = so_help_prompt;
- EXPECT_CALL(*mock_app_, set_help_prompt(so_prompt));
-
- std::vector<std::string> time_out_prompt;
- time_out_prompt.push_back("time_out");
- EXPECT_CALL(app_mngr_settings_, time_out_promt())
- .WillOnce(ReturnRef(time_out_prompt));
-
- smart_objects::SmartObject timeout_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- timeout_prompt[am::strings::text] = time_out_prompt[0];
- timeout_prompt[am::strings::type] =
- hmi_apis::Common_SpeechCapabilities::SC_TEXT;
-
- smart_objects::SmartObject so_time_out_prompt =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
-
- so_time_out_prompt[0] = timeout_prompt;
-
- EXPECT_CALL(*mock_app_, set_timeout_prompt(so_time_out_prompt));
-
- std::string vr_help_title("vr_help_title");
- EXPECT_CALL(app_mngr_settings_, vr_help_title())
- .WillOnce(ReturnRef(vr_help_title));
+ am::ResetGlobalPropertiesResult result;
+ result.help_prompt = true;
+ result.timeout_prompt = true;
+ result.vr_help_title_items = true;
+ result.menu_name = true;
+ result.menu_icon = true;
+ result.keyboard_properties = true;
+ result.vr_has_been_reset = true;
- smart_objects::SmartObject so_vr_help_title =
- smart_objects::SmartObject(smart_objects::SmartType_String);
- so_vr_help_title = vr_help_title;
- EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
-
- EXPECT_CALL(*mock_app_, reset_vr_help_title());
- EXPECT_CALL(*mock_app_, reset_vr_help());
+ ON_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillByDefault(Return(result));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- smart_objects::SmartObjectSPtr vr_help =
+ smart_objects::SmartObjectSPtr msg_params =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
- .WillOnce(Return(vr_help));
-
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_params[am::hmi_request::menu_title] = "";
- EXPECT_CALL(*mock_app_,
- set_menu_title(msg_params[am::hmi_request::menu_title]));
-
- EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&so_help_prompt));
- EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(&so_help_prompt));
+ EXPECT_CALL(mock_message_helper_, CreateTTSResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
EXPECT_CALL(
mock_rpc_service_,
@@ -304,27 +197,18 @@ TEST_F(ResetGlobalPropertiesRequestTest,
hmi_apis::Common_Result::SUCCESS;
(*msg_)[am::strings::params][am::hmi_response::code] = result_code;
- (*msg_)[am::strings::msg_params][am::strings::properties][0] =
- mobile_apis::GlobalProperty::VRHELPTITLE;
-
- std::string vr_help_title("vr_help_title");
- EXPECT_CALL(app_mngr_settings_, vr_help_title())
- .WillOnce(ReturnRef(vr_help_title));
+ am::ResetGlobalPropertiesResult result;
+ result.vr_help_title_items = true;
- smart_objects::SmartObject so_vr_help_title =
- smart_objects::SmartObject(smart_objects::SmartType_String);
- so_vr_help_title = vr_help_title;
- EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
-
- EXPECT_CALL(*mock_app_, reset_vr_help_title());
- EXPECT_CALL(*mock_app_, reset_vr_help());
- EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
- smart_objects::SmartObjectSPtr vr_help =
+ smart_objects::SmartObjectSPtr msg_params =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
- .WillOnce(Return(vr_help));
+
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
@@ -353,20 +237,22 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*msg_)[am::strings::msg_params][am::strings::properties][1] =
mobile_apis::GlobalProperty::MENUICON;
- std::vector<std::string> time_out_prompt;
- time_out_prompt.push_back("time_out");
- EXPECT_CALL(app_mngr_settings_, time_out_promt())
- .WillOnce(ReturnRef(time_out_prompt));
+ am::ResetGlobalPropertiesResult result;
+ result.timeout_prompt = true;
+ result.menu_icon = true;
- EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
- smart_objects::SmartObjectSPtr prompt =
- std::make_shared<smart_objects::SmartObject>();
- *prompt = "prompt";
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+ smart_objects::SmartObjectSPtr msg_params =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+ EXPECT_CALL(mock_message_helper_, CreateTTSResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
MessageSharedPtr ui_msg = CreateMessage();
(*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
@@ -412,19 +298,22 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
(*msg_)[am::strings::msg_params][am::strings::properties][0] =
mobile_apis::GlobalProperty::VRHELPTITLE;
- std::string vr_help_title("vr_help_title");
- EXPECT_CALL(app_mngr_settings_, vr_help_title())
- .WillOnce(ReturnRef(vr_help_title));
+ am::ResetGlobalPropertiesResult result;
+ result.vr_help_title_items = true;
- smart_objects::SmartObject so_vr_help_title =
- smart_objects::SmartObject(smart_objects::SmartType_String);
- so_vr_help_title = vr_help_title;
- EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
-
- EXPECT_CALL(*mock_app_, reset_vr_help_title());
- EXPECT_CALL(*mock_app_, reset_vr_help());
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+
+ smart_objects::SmartObjectSPtr msg_params =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ EXPECT_CALL(mock_message_helper_, CreateTTSResetGlobalPropertiesRequest(_, _))
+ .Times(0);
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
@@ -433,8 +322,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
smart_objects::SmartObjectSPtr vr_help =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
- .WillOnce(Return(vr_help));
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
@@ -461,20 +348,22 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*msg_)[am::strings::msg_params][am::strings::properties][1] =
mobile_apis::GlobalProperty::MENUICON;
- std::vector<std::string> time_out_prompt;
- time_out_prompt.push_back("time_out");
- EXPECT_CALL(app_mngr_settings_, time_out_promt())
- .WillOnce(ReturnRef(time_out_prompt));
+ am::ResetGlobalPropertiesResult result;
+ result.timeout_prompt = true;
+ result.menu_icon = true;
- EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
- smart_objects::SmartObjectSPtr prompt =
- std::make_shared<smart_objects::SmartObject>();
- *prompt = "prompt";
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+ smart_objects::SmartObjectSPtr msg_params =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+ EXPECT_CALL(mock_message_helper_, CreateTTSResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
EXPECT_CALL(
mock_rpc_service_,
@@ -528,18 +417,20 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*msg_)[am::strings::msg_params][am::strings::properties][1] =
mobile_apis::GlobalProperty::MENUICON;
- std::vector<std::string> time_out_prompt;
- time_out_prompt.push_back("time_out");
- EXPECT_CALL(app_mngr_settings_, time_out_promt())
- .WillOnce(ReturnRef(time_out_prompt));
+ am::ResetGlobalPropertiesResult result;
+ result.timeout_prompt = true;
+ result.menu_icon = true;
- EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
- smart_objects::SmartObjectSPtr prompt =
- std::make_shared<smart_objects::SmartObject>();
- *prompt = "prompt";
+ smart_objects::SmartObjectSPtr msg_params =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+ EXPECT_CALL(mock_message_helper_, CreateTTSResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
@@ -594,18 +485,20 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*msg_)[am::strings::msg_params][am::strings::properties][1] =
mobile_apis::GlobalProperty::MENUICON;
- std::vector<std::string> time_out_prompt;
- time_out_prompt.push_back("time_out");
- EXPECT_CALL(app_mngr_settings_, time_out_promt())
- .WillOnce(ReturnRef(time_out_prompt));
+ am::ResetGlobalPropertiesResult result;
+ result.timeout_prompt = true;
+ result.menu_icon = true;
- EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
- smart_objects::SmartObjectSPtr prompt =
- std::make_shared<smart_objects::SmartObject>();
- *prompt = "prompt";
+ smart_objects::SmartObjectSPtr msg_params =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+ EXPECT_CALL(mock_message_helper_, CreateTTSResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+ EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
index 6e85aff281..e31f6d209d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
@@ -39,7 +39,6 @@
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/smart_object_keys.h"
-#include "mobile/on_app_interface_unregistered_notification.h"
#include "mobile/on_audio_pass_thru_notification.h"
#include "mobile/on_driver_distraction_notification.h"
#include "mobile/on_language_change_notification.h"
@@ -66,8 +65,7 @@ class MobileNotificationCommandsTest
typedef Command CommandType;
};
-typedef Types<commands::OnAppInterfaceUnregisteredNotification,
- commands::OnAudioPassThruNotification,
+typedef Types<commands::OnAudioPassThruNotification,
commands::OnLanguageChangeNotification,
commands::OnPermissionsChangeNotification,
commands::mobile::OnDriverDistractionNotification>
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
index 56e4e05d48..528f8a0700 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -71,7 +71,7 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(A<am::ApplicationSharedPtr>()))
+ ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*app)))
.WillByDefault(Return(false));
ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
.WillByDefault(Return(true));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
index 3165d57d44..ec4d2420d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -100,9 +100,7 @@ TEST_F(UnsubscribeWayPointsRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- EXPECT_CALL(app_mngr_,
- IsAppSubscribedForWayPoints(
- ::testing::Matcher<am::ApplicationSharedPtr>(mock_app)))
+ EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app)))
.WillOnce(Return(false));
EXPECT_CALL(
@@ -117,9 +115,7 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- EXPECT_CALL(app_mngr_,
- IsAppSubscribedForWayPoints(
- ::testing::Matcher<am::ApplicationSharedPtr>(mock_app)))
+ EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app)))
.WillOnce(Return(true));
const std::set<uint32_t> subscribed_apps{kConnectionKey};
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
index 0e91006e52..7fc84b7986 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
@@ -66,6 +66,8 @@ class VISubscribeVehicleDataRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
+ void onTimeOut() OVERRIDE;
+
private:
CustomVehicleDataManager& custom_vehicle_data_manager_;
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
index fb7c2b0f82..7e3eabb6a1 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
@@ -58,6 +58,8 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
*/
VehicleInfoAppExtension(VehicleInfoPlugin& plugin,
app_mngr::Application& app);
+ VehicleInfoAppExtension(const VehicleInfoAppExtension&) = delete;
+ VehicleInfoAppExtension& operator=(const VehicleInfoAppExtension&) = delete;
virtual ~VehicleInfoAppExtension();
/**
@@ -90,24 +92,60 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
bool isSubscribedToVehicleInfo(const std::string& vehicle_data_type) const;
/**
+ * @brief isPendingSubscriptionToVehicleInfo checks if there any extension
+ * with pending subscription to vehicle data
+ * @param vehicle_data vehicle data to check
+ * @return true if extension is subscribed to this vehicle_data, otherwise
+ * returns false
+ */
+ bool isPendingSubscriptionToVehicleInfo(
+ const std::string& vehicle_data) const;
+
+ /**
* @brief Subscriptions get list of subscriptions for application extension
* @return list of subscriptions for application extension
*/
- VehicleInfoSubscriptions Subscriptions();
+ const DataAccessor<VehicleInfoSubscriptions> Subscriptions();
/**
- * @brief SaveResumptionData saves vehicle info data
- * @param resumption_data plase to store resumption data
+ * @brief AddPendingSubscription add pending subscription
+ * @param vehicle_data subscription to add
+ * @return
*/
- void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
- resumption_data) OVERRIDE;
+ bool AddPendingSubscription(const std::string& vehicle_data);
/**
- * @brief ProcessResumption load resumtion data back to plugin during
- * resumption
- * @param resumption_data resumption data
+ * @brief RemovePendingSubscription remove some paticular pending subscription
+ * @param vehicle_data subscription to remove
+ * @return
*/
- void ProcessResumption(
+ bool RemovePendingSubscription(const std::string& vehicle_data);
+
+ /**
+ * @brief RemovePendingSubscriptions removed all pending subscriptions
+ * @return
+ */
+ void RemovePendingSubscriptions();
+
+ /**
+ * @brief PendingSubscriptions list of preliminary subscriptoins
+ * That will be moved to subscriptions as soon as HMI will respond with
+ * success.
+ * Used for resumption to keep list of preliminary subcriptions and wait for
+ * HMI response
+ * @return
+ */
+ const DataAccessor<VehicleInfoSubscriptions> PendingSubscriptions();
+
+ /**
+ * @brief SaveResumptionData saves vehicle info data
+ * @param resumption_data plase to store resumption data
+ */
+ void SaveResumptionData(smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ void ProcessResumption(const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ void RevertResumption(
const smart_objects::SmartObject& resumption_data) OVERRIDE;
/**
@@ -126,7 +164,11 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
application_manager::Application& app);
private:
+ mutable std::shared_ptr<sync_primitives::Lock> subscribed_data_lock_;
VehicleInfoSubscriptions subscribed_data_;
+
+ mutable std::shared_ptr<sync_primitives::Lock> pending_subscriptions_lock_;
+ VehicleInfoSubscriptions pending_subscriptions_;
VehicleInfoPlugin& plugin_;
app_mngr::Application& app_;
};
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h
new file mode 100644
index 0000000000..78f8f685cc
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h
@@ -0,0 +1,150 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PENDING_RESUMPTION_HANDLER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PENDING_RESUMPTION_HANDLER_H_
+#include <queue>
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/resumption/pending_resumption_handler.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+
+#include "utils/optional.h"
+#include "vehicle_info_app_extension.h"
+namespace vehicle_info_plugin {
+class CustomVehicleDataManager;
+
+namespace app_mngr = application_manager;
+
+class VehicleInfoPendingResumptionHandler
+ : public resumption::PendingResumptionHandler {
+ public:
+ typedef std::set<std::string> VehicleDataList;
+ VehicleInfoPendingResumptionHandler(
+ app_mngr::ApplicationManager& application_manager,
+ CustomVehicleDataManager& custom_vehicle_data_manager);
+
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ void HandleResumptionSubscriptionRequest(app_mngr::AppExtension& extension,
+ app_mngr::Application& app) OVERRIDE;
+ void OnResumptionRevert() OVERRIDE;
+
+ smart_objects::SmartObjectSPtr CreateSubscribeRequestToHMI(
+ const VehicleDataList& subscriptions);
+
+ ns_smart_device_link::ns_smart_objects::SmartObject CreateFakeResponseFromHMI(
+ const std::map<std::string, smart_objects::SmartObject>& subscriptions,
+ const uint32_t fake_corrlation_id);
+
+ private:
+ void ProcessNextPendingResumption(
+ const smart_objects::SmartObject& response_message);
+ void TriggerPendingResumption();
+
+ struct PendingSubscriptionsResumption {
+ PendingSubscriptionsResumption(
+ const uint32_t app_id,
+ const uint32_t corr_id,
+ const VehicleDataList& requested_vehicle_data)
+ : app_id_(app_id)
+ , fake_corr_id_(corr_id)
+ , waiting_for_hmi_response_(false)
+ , requested_vehicle_data_(requested_vehicle_data) {}
+
+ PendingSubscriptionsResumption(const PendingSubscriptionsResumption& copy) =
+ default;
+
+ /**
+ * @brief IsSuccessfullyDone check if SDL restored all required data or not
+ * @return
+ */
+ bool IsSuccessfullyDone() const;
+ bool DataWasRequested(const std::string& vd) const;
+ VehicleDataList NotSubscribedData() const;
+
+ /**
+ * @brief FillSubscriptionResults fill subscription results based on
+ * response message
+ * @param response
+ */
+ void FillSubscriptionResults(const smart_objects::SmartObject& response);
+
+ /**
+ * @brief FillSubscriptionResults fill subscription results based on list of
+ * requested data and list of restored data
+ *
+ */
+ void FillSubscriptionResults();
+
+ void FillRestoredData(const VehicleDataList& successful_subscriptions);
+
+ uint32_t app_id_;
+ uint32_t fake_corr_id_;
+ bool waiting_for_hmi_response_;
+ VehicleDataList requested_vehicle_data_;
+ VehicleDataList restored_vehicle_data_;
+ std::map<std::string, smart_objects::SmartObject> subscription_results_;
+ };
+
+ void SendHMIRequestForNotSubscribed(
+ const PendingSubscriptionsResumption& pending_resumption);
+ void RaiseFinishedPendingResumption(
+ const PendingSubscriptionsResumption& pending_resumption);
+ /**
+ * @brief SubscribeToFakeRequest will create fake subscription for subscriber
+ * ( resumption_data_processor)
+ * Fake request is required only for subscriber subscription.
+ * This request will not be sen't to HMI so it named as fake request.
+ * Fake request contains all data that need to be resumed for the application
+ * When HMI will respond for any VehicleData request,
+ * PendingSubscriptionsResumption will go through all pending resumptions and
+ * fill them with received subscriptions. If certain pending resumption will
+ * take all requested subscriptions PendingSubscriptionsResumption will take
+ * this fake request correaltion id and create fake response based on it.
+ * Within fake response it will notify subscriber about resumption status.
+ *
+ * @param app_id applicaiton to pass into subscriber
+ * @param subscriptions list of requested subscriptions
+ * @param subscriber function to subscribe caller for finished resumption
+ * @return pending_resumption with information about fake correlation id for
+ * subscriber, list of vehicle data to subscribe
+ */
+ PendingSubscriptionsResumption SubscribeToFakeRequest(
+ const uint32_t app, const VehicleDataList& subscriptions);
+
+ std::deque<PendingSubscriptionsResumption> pending_requests_;
+
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+ sync_primitives::RecursiveLock pending_resumption_lock_;
+};
+} // namespace vehicle_info_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PENDING_RESUMPTION_HANDLER_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
index 80336b6967..5b597cfcab 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PLUGIN_H
#include "application_manager/command_factory.h"
+#include "application_manager/resumption/pending_resumption_handler.h"
#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
namespace vehicle_info_plugin {
@@ -41,6 +42,8 @@ class VehicleInfoAppExtension;
namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
+enum SubscribeStatus { SUBSCRIBE, UNSUBSCRIBE };
+
class VehicleInfoPlugin : public plugins::RPCPlugin {
public:
VehicleInfoPlugin();
@@ -74,22 +77,42 @@ class VehicleInfoPlugin : public plugins::RPCPlugin {
* to HMI
* @param app application for subscription
* @param ext application extension
+ * @param subscriber callback for subscription
*/
void ProcessResumptionSubscription(app_mngr::Application& app,
VehicleInfoAppExtension& ext);
+ /**
+ * @brief Revert the data to the state before Resumption.
+ * @param subscriptions Subscriptions to be returned
+ **/
+ void RevertResumption(app_mngr::Application& app,
+ const std::set<std::string>& list_of_subscriptions);
+
+ smart_objects::SmartObjectSPtr CreateSubscriptionRequest(
+ const std::set<std::string>& list_of_subscriptions);
+
+ smart_objects::SmartObjectSPtr CreateUnsubscriptionRequest(
+ const std::set<std::string>& list_of_subscriptions);
+
private:
+ bool IsSubscribedAppExist(const std::string& ivi);
+ bool IsAnyPendingSubscriptionExist(const std::string& ivi);
void UnsubscribeFromRemovedVDItems();
smart_objects::SmartObjectSPtr GetUnsubscribeIVIRequest(
const std::vector<std::string>& ivi_names);
void DeleteSubscriptions(app_mngr::ApplicationSharedPtr app);
std::unique_ptr<app_mngr::CommandFactory> command_factory_;
- std::unique_ptr<CustomVehicleDataManager> custom_vehicle_data_manager_;
+ typedef std::shared_ptr<resumption::PendingResumptionHandler>
+ PendingResumptionHandlerSPtr;
app_mngr::ApplicationManager* application_manager_;
+ std::unique_ptr<CustomVehicleDataManager> custom_vehicle_data_manager_;
+ PendingResumptionHandlerSPtr pending_resumption_handler_;
};
} // namespace vehicle_info_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create();
+extern "C" application_manager::plugin_manager::RPCPlugin* Create(
+ logger::Logger* logger_instances);
extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc
index b8d1b3a100..88884e365a 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVIVehicleDataNotification::OnVIVehicleDataNotification(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -50,7 +52,7 @@ OnVIVehicleDataNotification::OnVIVehicleDataNotification(
OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {}
void OnVIVehicleDataNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc
index ae64c74f26..95999c76f9 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIDiagnosticMessageRequest::VIDiagnosticMessageRequest(
const app_mngr::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -49,7 +51,7 @@ VIDiagnosticMessageRequest::VIDiagnosticMessageRequest(
VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {}
void VIDiagnosticMessageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc
index 6482d97d10..4ee6e1e495 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIDiagnosticMessageResponse::VIDiagnosticMessageResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -50,7 +52,7 @@ VIDiagnosticMessageResponse::VIDiagnosticMessageResponse(
VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {}
void VIDiagnosticMessageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc
index 620ee4c3e4..6b312c826d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIGetDTCsRequest::VIGetDTCsRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -49,7 +51,7 @@ VIGetDTCsRequest::VIGetDTCsRequest(
VIGetDTCsRequest::~VIGetDTCsRequest() {}
void VIGetDTCsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc
index 64e948a4e1..b84e67d7c5 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIGetDTCsResponse::VIGetDTCsResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -50,7 +52,7 @@ VIGetDTCsResponse::VIGetDTCsResponse(
VIGetDTCsResponse::~VIGetDTCsResponse() {}
void VIGetDTCsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc
index eded6c685b..a3e3a83f62 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIGetVehicleDataRequest::VIGetVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -51,7 +53,7 @@ VIGetVehicleDataRequest::VIGetVehicleDataRequest(
VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {}
void VIGetVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
auto& msg_params = (*message_)[strings::msg_params];
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc
index 763ddf1cfa..0ef6a97e91 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc
@@ -39,6 +39,8 @@ namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIGetVehicleDataResponse::VIGetVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -51,7 +53,7 @@ VIGetVehicleDataResponse::VIGetVehicleDataResponse(
VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {}
void VIGetVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
index e8df12ca5c..26a9990079 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIGetVehicleTypeRequest::VIGetVehicleTypeRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -49,13 +51,13 @@ VIGetVehicleTypeRequest::VIGetVehicleTypeRequest(
VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {}
void VIGetVehicleTypeRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
void VIGetVehicleTypeRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
index dcc73d26f3..dbd1b48033 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIGetVehicleTypeResponse::VIGetVehicleTypeResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -48,7 +50,7 @@ VIGetVehicleTypeResponse::VIGetVehicleTypeResponse(
VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {}
void VIGetVehicleTypeResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
@@ -57,8 +59,7 @@ void VIGetVehicleTypeResponse::Run() {
hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
if (hmi_apis::Common_Result::SUCCESS != result_code) {
- LOG4CXX_DEBUG(logger_,
- "Request was not successful. Don't change HMI capabilities");
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
return;
}
@@ -70,8 +71,8 @@ void VIGetVehicleTypeResponse::Run() {
hmi_interface::vehicle_info,
sections_to_update,
message_->getSchema())) {
- LOG4CXX_ERROR(
- logger_, "Failed to save VehicleInfo.GetVehicleType response to cache");
+ SDL_LOG_ERROR(
+ "Failed to save VehicleInfo.GetVehicleType response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
index 3525be059d..578f650e98 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIIsReadyRequest::VIIsReadyRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -55,18 +57,18 @@ VIIsReadyRequest::VIIsReadyRequest(
VIIsReadyRequest::~VIIsReadyRequest() {}
void VIIsReadyRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribe_on_event(hmi_apis::FunctionID::VehicleInfo_IsReady,
correlation_id());
SendRequest();
}
void VIIsReadyRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_IsReady: {
- LOG4CXX_DEBUG(logger_, "VehicleInfo_IsReady event");
+ SDL_LOG_DEBUG("VehicleInfo_IsReady event");
unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_IsReady);
const bool is_available = app_mngr::commands::ChangeInterfaceState(
application_manager_,
@@ -78,8 +80,7 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) {
policy_handler_.OnVIIsReady();
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_VehicleInfo)) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
"HmiInterfaces::HMI_INTERFACE_VehicleInfo isn't available");
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
@@ -90,7 +91,7 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc
index 349a1137ce..b40ecc51db 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc
@@ -36,6 +36,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIIsReadyResponse::VIIsReadyResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -48,7 +50,7 @@ VIIsReadyResponse::VIIsReadyResponse(
VIIsReadyResponse::~VIIsReadyResponse() {}
void VIIsReadyResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_IsReady);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc
index 47373bb4bf..529ed248d0 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIReadDIDRequest::VIReadDIDRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -49,7 +51,7 @@ VIReadDIDRequest::VIReadDIDRequest(
VIReadDIDRequest::~VIReadDIDRequest() {}
void VIReadDIDRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendRequest();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc
index 7c2db1e875..09abb3c9fc 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc
@@ -37,6 +37,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIReadDIDResponse::VIReadDIDResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -49,7 +51,7 @@ VIReadDIDResponse::VIReadDIDResponse(
VIReadDIDResponse::~VIReadDIDResponse() {}
void VIReadDIDResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_ReadDID);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
index 4c5f067d0d..0863dc875a 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
@@ -32,12 +32,15 @@
#include "vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h"
#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -51,7 +54,7 @@ VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest(
VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {}
void VISubscribeVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
auto& msg_params = (*message_)[strings::msg_params];
@@ -74,5 +77,18 @@ void VISubscribeVehicleDataRequest::Run() {
SendRequest();
}
+void VISubscribeVehicleDataRequest::onTimeOut() {
+ event_engine::Event timeout_event(
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
+
+ auto error_response = MessageHelper::CreateNegativeResponseFromHmi(
+ function_id(),
+ correlation_id(),
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ std::string("Timed out"));
+ timeout_event.set_smart_object(*error_response);
+ timeout_event.raise(application_manager_.event_dispatcher());
+}
+
} // namespace commands
} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
index 061e13c766..5fbd9a7f82 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
@@ -37,6 +37,8 @@ namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -49,7 +51,7 @@ VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse(
VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {}
void VISubscribeVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
index aa24ac7375..d9c9b0729a 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
@@ -38,6 +38,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -51,7 +53,7 @@ VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest(
VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {}
void VIUnsubscribeVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
auto& msg_params = (*message_)[strings::msg_params];
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
index 01fc521b10..ea1ab16d0d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
@@ -37,6 +37,8 @@ namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -49,7 +51,7 @@ VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse(
VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {}
void VIUnsubscribeVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
event_engine::Event event(
hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
index ef6c284faf..762528c51b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
@@ -44,6 +44,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DiagnosticMessageRequest::DiagnosticMessageRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -56,12 +58,12 @@ DiagnosticMessageRequest::DiagnosticMessageRequest(
DiagnosticMessageRequest::~DiagnosticMessageRequest() {}
void DiagnosticMessageRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered.");
+ SDL_LOG_ERROR("Application is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -77,8 +79,7 @@ void DiagnosticMessageRequest::Run() {
if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(),
supported_diag_modes.end(),
msg_diagnostic_mode)) {
- LOG4CXX_ERROR(logger_,
- "Received diagnostic mode " << msg_diagnostic_mode
+ SDL_LOG_ERROR("Received diagnostic mode " << msg_diagnostic_mode
<< " is not supported.");
SendResponse(false,
mobile_apis::Result::REJECTED,
@@ -96,7 +97,7 @@ void DiagnosticMessageRequest::Run() {
}
void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -116,7 +117,7 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc
index f5ccc4d0a7..5448d8c48b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
DiagnosticMessageResponse::DiagnosticMessageResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -51,7 +53,7 @@ DiagnosticMessageResponse::DiagnosticMessageResponse(
DiagnosticMessageResponse::~DiagnosticMessageResponse() {}
void DiagnosticMessageResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
index dfa1cf305b..2f236dd8b2 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
@@ -42,6 +42,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetDTCsRequest::GetDTCsRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -54,13 +56,13 @@ GetDTCsRequest::GetDTCsRequest(
GetDTCsRequest::~GetDTCsRequest() {}
void GetDTCsRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -83,7 +85,7 @@ void GetDTCsRequest::Run() {
}
void GetDTCsRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -105,7 +107,7 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc
index 33945a2f00..6631274c0d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetDTCsResponse::GetDTCsResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -51,7 +53,7 @@ GetDTCsResponse::GetDTCsResponse(
GetDTCsResponse::~GetDTCsResponse() {}
void GetDTCsResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
index d15cf6a580..e5656d60c5 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
@@ -47,6 +47,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace str = strings;
GetVehicleDataRequest::GetVehicleDataRequest(
@@ -62,12 +64,12 @@ GetVehicleDataRequest::GetVehicleDataRequest(
GetVehicleDataRequest::~GetVehicleDataRequest() {}
void GetVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "No such application : " << connection_key());
+ SDL_LOG_ERROR("No such application : " << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -110,7 +112,7 @@ void GetVehicleDataRequest::Run() {
}
void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject message = event.smart_object();
switch (event.id()) {
@@ -178,7 +180,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
@@ -188,7 +190,7 @@ bool GetVehicleDataRequest::CheckFrequency(Application& app) {
if (app.AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::CONFIG_FILE)) {
- LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high.");
+ SDL_LOG_ERROR("GetVehicleData frequency is too high.");
return false;
}
return true;
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc
index 60a44745a5..c263acd33f 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc
@@ -40,6 +40,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
GetVehicleDataResponse::GetVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -52,7 +54,7 @@ GetVehicleDataResponse::GetVehicleDataResponse(
GetVehicleDataResponse::~GetVehicleDataResponse() {}
void GetVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
index 79134cae40..e336b778ff 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
@@ -45,6 +45,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
OnVehicleDataNotification::OnVehicleDataNotification(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -58,7 +60,7 @@ OnVehicleDataNotification::OnVehicleDataNotification(
OnVehicleDataNotification::~OnVehicleDataNotification() {}
void OnVehicleDataNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<ApplicationSharedPtr> notify_apps;
std::vector<ApplicationSharedPtr>::iterator notified_app_it =
@@ -70,7 +72,7 @@ void OnVehicleDataNotification::Run() {
const auto& param_names = (*message_)[strings::msg_params].enumerate();
for (const auto& name : param_names) {
- LOG4CXX_DEBUG(logger_, "vehicle_data name: " << name);
+ SDL_LOG_DEBUG("vehicle_data name: " << name);
auto vehicle_data_value = (*message_)[strings::msg_params][name].asInt();
application_manager_.IviInfoUpdated(name, vehicle_data_value);
@@ -84,7 +86,7 @@ void OnVehicleDataNotification::Run() {
application_manager_.applications(), subscribed_to_ivi_predicate);
for (const auto& app : applications) {
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
continue;
}
notified_app_it = find(notify_apps.begin(), notify_apps.end(), app);
@@ -101,14 +103,12 @@ void OnVehicleDataNotification::Run() {
}
}
- LOG4CXX_DEBUG(logger_,
- "Number of Notifications to be send: " << notify_apps.size());
+ SDL_LOG_DEBUG("Number of Notifications to be send: " << notify_apps.size());
for (size_t idx = 0; idx < notify_apps.size(); idx++) {
- LOG4CXX_INFO(logger_,
- "Send OnVehicleData PRNDL notification to "
- << notify_apps[idx]->name().c_str() << " application id "
- << notify_apps[idx]->app_id());
+ SDL_LOG_INFO("Send OnVehicleData PRNDL notification to "
+ << notify_apps[idx]->name().c_str() << " application id "
+ << notify_apps[idx]->app_id());
(*message_)[strings::params][strings::connection_key] =
notify_apps[idx]->app_id();
(*message_)[strings::msg_params] = appSO[idx];
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
index c090df7852..c718d18965 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ReadDIDRequest::ReadDIDRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -55,19 +57,18 @@ ReadDIDRequest::ReadDIDRequest(
ReadDIDRequest::~ReadDIDRequest() {}
void ReadDIDRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id =
(*message_)[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = application_manager_.application(app_id);
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
"Correlation_id :"
- << (*message_)[strings::params][strings::correlation_id].asUInt());
+ << (*message_)[strings::params][strings::correlation_id].asUInt());
if (!app) {
- LOG4CXX_ERROR(logger_, "An application is not registered.");
+ SDL_LOG_ERROR("An application is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -75,13 +76,13 @@ void ReadDIDRequest::Run() {
if (app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::CONFIG_FILE)) {
- LOG4CXX_ERROR(logger_, "ReadDID frequency is too high.");
+ SDL_LOG_ERROR("ReadDID frequency is too high.");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
if ((*message_)[strings::msg_params][strings::did_location].empty()) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA");
+ SDL_LOG_ERROR("INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -99,7 +100,7 @@ void ReadDIDRequest::Run() {
}
void ReadDIDRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -120,7 +121,7 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc
index 42e7fc1ba9..806aeb611c 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc
@@ -39,6 +39,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ReadDIDResponse::ReadDIDResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -51,7 +53,7 @@ ReadDIDResponse::ReadDIDResponse(
ReadDIDResponse::~ReadDIDResponse() {}
void ReadDIDResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
index 36d972d5fd..d51790ea55 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -42,6 +42,8 @@ namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubscribeVehicleDataRequest::SubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
VehicleInfoCommandParams params)
@@ -55,12 +57,12 @@ SubscribeVehicleDataRequest::SubscribeVehicleDataRequest(
SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {}
void SubscribeVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -90,13 +92,13 @@ void SubscribeVehicleDataRequest::Run() {
}
void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
if (hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData != event.id()) {
- LOG4CXX_ERROR(logger_, "Received unknown event.");
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
@@ -104,7 +106,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
application_manager_.application(CommandRequestImpl::connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
+ SDL_LOG_ERROR("NULL pointer.");
return;
}
@@ -134,7 +136,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
const auto& converted_name = ConvertResponseToRequestName(param);
if (vi_waiting_for_subscribe_.end() ==
vi_waiting_for_subscribe_.find(converted_name)) {
- LOG4CXX_DEBUG(logger_, "erase " << converted_name);
+ SDL_LOG_DEBUG("erase " << converted_name);
converted_msg_params.erase(param);
}
}
@@ -184,8 +186,7 @@ bool SubscribeVehicleDataRequest::CheckSubscriptionStatus(
std::string vi_name, const smart_objects::SmartObject& msg_params) {
const auto subscribed_items = msg_params.enumerate();
if (subscribed_items.end() == subscribed_items.find(vi_name)) {
- LOG4CXX_WARN(logger_,
- vi_name << " is waiting to be subscribed, but missing in "
+ SDL_LOG_WARN(vi_name << " is waiting to be subscribed, but missing in "
"vehicle response.");
return false;
}
@@ -193,8 +194,7 @@ bool SubscribeVehicleDataRequest::CheckSubscriptionStatus(
auto res_code = msg_params[vi_name][strings::result_code].asInt();
if (VD_ResultCode::VDRC_SUCCESS != res_code &&
VD_ResultCode::VDRC_DATA_ALREADY_SUBSCRIBED != res_code) {
- LOG4CXX_WARN(logger_,
- "Subscription to " << vi_name << " for " << connection_key()
+ SDL_LOG_WARN("Subscription to " << vi_name << " for " << connection_key()
<< " failed.");
return false;
}
@@ -203,7 +203,7 @@ bool SubscribeVehicleDataRequest::CheckSubscriptionStatus(
bool SubscribeVehicleDataRequest::SubscribePendingVehicleData(
ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) {
- LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData");
+ SDL_LOG_DEBUG("Subscribing to all pending VehicleData");
std::set<hmi_apis::Common_VehicleDataResultCode::eType> skiped_result_codes(
{VD_ResultCode::VDRC_TRUNCATED_DATA,
@@ -245,7 +245,7 @@ bool SubscribeVehicleDataRequest::Init() {
void SubscribeVehicleDataRequest::AddAlreadySubscribedVI(
smart_objects::SmartObject& msg_params) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
for (const auto& item : vi_already_subscribed_by_this_app_) {
@@ -272,7 +272,7 @@ struct SubscribedToIVIPredicate {
bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
const std::string& param_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SubscribedToIVIPredicate finder(param_name);
DataAccessor<ApplicationSet> accessor = application_manager_.applications();
ApplicationSetConstIt it = std::find_if(
@@ -287,8 +287,8 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
smart_objects::SmartObject& out_response_params,
smart_objects::SmartObject& out_request_params,
bool& out_result) {
- const bool is_interface_not_available =
- (HmiInterfaces::STATE_NOT_AVAILABLE ==
+ const bool is_interface_available =
+ (HmiInterfaces::STATE_NOT_AVAILABLE !=
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_VehicleInfo));
@@ -298,11 +298,10 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
[this, &out_response_params](
const std::string& key_name,
const mobile_apis::VehicleDataType::eType vd_type) {
- LOG4CXX_DEBUG(
- logger_,
- "App with connection key "
- << connection_key()
- << " is subscribed already for VehicleData: " << key_name);
+ SDL_LOG_DEBUG("App with connection key "
+ << connection_key()
+ << " is subscribed already for VehicleData: "
+ << key_name);
vi_already_subscribed_by_this_app_.insert(key_name);
out_response_params[key_name][strings::data_type] = vd_type;
out_response_params[key_name][strings::result_code] =
@@ -314,21 +313,20 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
const std::string& key_name,
const mobile_apis::VehicleDataType::eType vd_type,
vehicle_info_plugin::VehicleInfoAppExtension& ext) {
- LOG4CXX_DEBUG(logger_,
- "There are apps subscribed already for "
- "VehicleDataType: "
- << key_name);
+ SDL_LOG_DEBUG(
+ "There are apps subscribed already for "
+ "VehicleDataType: "
+ << key_name);
if (!ext.subscribeToVehicleInfo(key_name)) {
- LOG4CXX_ERROR(
- logger_, "Unable to subscribe for VehicleDataType: " << key_name);
+ SDL_LOG_ERROR(
+ "Unable to subscribe for VehicleDataType: " << key_name);
return;
}
- LOG4CXX_DEBUG(
- logger_,
- "App with connection key "
- << connection_key()
- << " have been subscribed for VehicleDataType: " << key_name);
+ SDL_LOG_DEBUG("App with connection key "
+ << connection_key()
+ << " have been subscribed for VehicleDataType: "
+ << key_name);
vi_already_subscribed_by_another_apps_.insert(key_name);
out_response_params[key_name][strings::data_type] = vd_type;
out_response_params[key_name][strings::result_code] =
@@ -341,11 +339,9 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
out_request_params[vi_name] = (*message_)[strings::msg_params][vi_name];
vi_waiting_for_subscribe_.insert(vi_name);
- LOG4CXX_DEBUG(
- logger_,
- "App with connection key "
- << connection_key()
- << " will be subscribed for VehicleDataType: " << vi_name);
+ SDL_LOG_DEBUG("App with connection key "
+ << connection_key()
+ << " will be subscribed for VehicleDataType: " << vi_name);
++subscribed_items;
return true;
};
@@ -355,7 +351,7 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
VehicleInfoSubscriptions::size_type items_to_subscribe = 0;
auto item_names = (*message_)[strings::msg_params].enumerate();
- if (!is_interface_not_available) {
+ if (is_interface_available) {
for (const auto& name : item_names) {
auto enabled = (*message_)[strings::msg_params][name].asBool();
if (!enabled) {
@@ -386,6 +382,9 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
if (0 == items_to_subscribe) {
if (HasDisallowedParams()) {
out_result_code = mobile_apis::Result::DISALLOWED;
+ } else if (!is_interface_available) {
+ out_result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ out_info = "VehicleInfo is not supported by system";
} else {
out_result_code = mobile_apis::Result::INVALID_DATA;
out_info = "No data in the request";
@@ -394,7 +393,7 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
return;
}
- if (0 == subscribed_items && !is_interface_not_available) {
+ if (0 == subscribed_items && is_interface_available) {
out_result_code = mobile_apis::Result::IGNORED;
out_info = "Already subscribed on provided VehicleData.";
out_result = false;
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc
index 8330176af6..0527532acc 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc
@@ -40,6 +40,8 @@ namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
SubscribeVehicleDataResponse::SubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -52,7 +54,7 @@ SubscribeVehicleDataResponse::SubscribeVehicleDataResponse(
SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {}
void SubscribeVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
index 32d63f0c35..8ffeaf922a 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
@@ -47,6 +47,8 @@ namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -60,12 +62,12 @@ UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest(
UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {}
void UnsubscribeVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -82,20 +84,19 @@ void UnsubscribeVehicleDataRequest::Run() {
std::set<std::string> custom_vehicle_data;
auto app_not_subscribed_response = [this](const std::string& key_name) {
- LOG4CXX_DEBUG(logger_,
- "App with connection key "
- << connection_key()
- << " is not subscribed for VehicleData: " << key_name);
+ SDL_LOG_DEBUG("App with connection key "
+ << connection_key()
+ << " is not subscribed for VehicleData: " << key_name);
vi_already_unsubscribed_by_this_app_.insert(key_name);
response_params_[key_name][strings::result_code] =
mobile_apis::VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED;
};
auto other_app_subscribed_response = [this](const std::string& key_name) {
- LOG4CXX_DEBUG(logger_,
- "There are apps still subscribed for "
- "VehicleDataType: "
- << key_name);
+ SDL_LOG_DEBUG(
+ "There are apps still subscribed for "
+ "VehicleDataType: "
+ << key_name);
vi_still_subscribed_by_another_apps_.insert(key_name);
response_params_[key_name][strings::result_code] =
mobile_apis::VehicleDataResultCode::VDRC_SUCCESS;
@@ -117,9 +118,8 @@ void UnsubscribeVehicleDataRequest::Run() {
continue;
}
- LOG4CXX_DEBUG(logger_,
- "Unsubscribed app with connection key "
- << connection_key() << " from VehicleDataType: " << name);
+ SDL_LOG_DEBUG("Unsubscribed app with connection key "
+ << connection_key() << " from VehicleDataType: " << name);
++unsubscribed_items;
@@ -153,7 +153,7 @@ void UnsubscribeVehicleDataRequest::Run() {
if (0 == unsubscribed_items) {
SendResponse(false,
mobile_apis::Result::IGNORED,
- "Was not subscribed on any VehicleData.",
+ "Some provided VehicleData was not subscribed.",
&response_params_);
return;
}
@@ -177,13 +177,13 @@ void UnsubscribeVehicleDataRequest::Run() {
}
void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
if (hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData != event.id()) {
- LOG4CXX_ERROR(logger_, "Received unknown event.");
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
@@ -192,7 +192,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
application_manager_.application(CommandRequestImpl::connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
+ SDL_LOG_ERROR("NULL pointer.");
return;
}
@@ -260,7 +260,7 @@ bool UnsubscribeVehicleDataRequest::Init() {
bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
const std::string& param_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto conn_key = connection_key();
auto subscribed_to_ivi = [&param_name,
&conn_key](const ApplicationSharedPtr app) {
@@ -280,7 +280,7 @@ bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI(
smart_objects::SmartObject& response) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
for (const auto& item : vi_already_unsubscribed_by_this_app_) {
@@ -297,16 +297,14 @@ bool UnsubscribeVehicleDataRequest::CheckSubscriptionStatus(
std::string key, const smart_objects::SmartObject& msg_params) {
const auto unsubscribed_items = msg_params.enumerate();
if (unsubscribed_items.end() == unsubscribed_items.find(key)) {
- LOG4CXX_WARN(logger_,
- key << " is waiting to be unsubscribed, but missing in "
+ SDL_LOG_WARN(key << " is waiting to be unsubscribed, but missing in "
"vehicle response.");
return false;
}
auto res_code = msg_params[key][strings::result_code].asInt();
if (hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS != res_code) {
- LOG4CXX_WARN(logger_,
- "Unubscribing from " << key << " for " << connection_key()
+ SDL_LOG_WARN("Unubscribing from " << key << " for " << connection_key()
<< " failed.");
return false;
}
@@ -315,7 +313,7 @@ bool UnsubscribeVehicleDataRequest::CheckSubscriptionStatus(
bool UnsubscribeVehicleDataRequest::UnsubscribePendingVehicleData(
ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params) {
- LOG4CXX_DEBUG(logger_, "Unsubscribing from all pending VehicleData");
+ SDL_LOG_DEBUG("Unsubscribing from all pending VehicleData");
for (const auto& vi_name : vi_waiting_for_unsubscribe_) {
const auto converted_item = ConvertRequestToResponseName(vi_name);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc
index 352239c331..89b5261938 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc
@@ -38,6 +38,8 @@ namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
@@ -50,12 +52,12 @@ UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse(
UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {}
void UnsubscribeVehicleDataResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// check if response false
if (true == (*message_)[strings::msg_params].keyExists(strings::success)) {
if ((*message_)[strings::msg_params][strings::success].asBool() == false) {
- LOG4CXX_ERROR(logger_, "Success = false");
+ SDL_LOG_ERROR("Success = false");
SendResponse(false);
return;
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
index 9df6d922aa..b85fd5aaaf 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
@@ -45,7 +45,7 @@
#include "utils/helpers.h"
#include "utils/optional.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
+SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
namespace vehicle_info_plugin {
@@ -64,7 +64,7 @@ CustomVehicleDataManagerImpl::CustomVehicleDataManagerImpl(
std::string CustomVehicleDataManagerImpl::GetVehicleDataItemType(
const std::string& vehicle_data_item_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& schema = FindSchemaByNameNonRecursive(vehicle_data_item_name);
return schema.is_initialized() ? std::string(schema->type)
@@ -86,7 +86,7 @@ bool CustomVehicleDataManagerImpl::IsRemovedCustomVehicleDataName(
void CustomVehicleDataManagerImpl::CreateMobileMessageParams(
smart_objects::SmartObject& msg_params) {
using namespace application_manager;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
typedef std::function<smart_objects::SmartObject(
const smart_objects::SmartObject& input_params,
@@ -105,7 +105,7 @@ void CustomVehicleDataManagerImpl::CreateMobileMessageParams(
? FindSchemaByKeyRecursive(key)
: FindSchemaByKeyNonRecursive(key);
if (!schema.is_initialized()) {
- LOG4CXX_DEBUG(logger_, "Schema for: " << key << " cannot be found");
+ SDL_LOG_DEBUG("Schema for: " << key << " cannot be found");
continue;
}
@@ -208,7 +208,7 @@ const OptionalDataItem FindSchema(
const std::vector<policy_table::VehicleDataItem>& oem_items,
SearchMethod search_method,
Comparer comparer) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<policy_table::VehicleDataItem> items;
for (const auto& item : oem_items) {
@@ -495,7 +495,7 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
void CustomVehicleDataManagerImpl::OnPolicyEvent(
plugin_manager::PolicyEvent policy_event) {
using namespace plugin_manager;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (policy_event) {
case kApplicationPolicyUpdated:
@@ -510,7 +510,7 @@ void CustomVehicleDataManagerImpl::OnPolicyEvent(
const OptionalDataItem
CustomVehicleDataManagerImpl::FindSchemaByNameNonRecursive(
const std::string& name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
auto compare_by_name = [&name](const policy_table::VehicleDataItem& item) {
@@ -523,7 +523,7 @@ CustomVehicleDataManagerImpl::FindSchemaByNameNonRecursive(
const OptionalDataItem
CustomVehicleDataManagerImpl::FindRemovedSchemaByNameNonRecursive(
const std::string& name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& removed_oem_items =
vehicle_data_provider_.GetRemovedVehicleDataItems();
@@ -537,7 +537,7 @@ CustomVehicleDataManagerImpl::FindRemovedSchemaByNameNonRecursive(
const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByNameRecursive(
const std::string& name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
auto compare_by_name = [&name](const policy_table::VehicleDataItem& item) {
@@ -550,7 +550,7 @@ const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByNameRecursive(
const OptionalDataItem
CustomVehicleDataManagerImpl::FindSchemaByKeyNonRecursive(
const std::string& key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
auto compare_by_key = [&key](const policy_table::VehicleDataItem& item) {
@@ -562,7 +562,7 @@ CustomVehicleDataManagerImpl::FindSchemaByKeyNonRecursive(
const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByKeyRecursive(
const std::string& key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
auto compare_by_key = [&key](const policy_table::VehicleDataItem& item) {
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc
index 750da9fa6e..b4ae7aca45 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc
@@ -4,7 +4,7 @@
namespace vehicle_info_plugin {
#ifdef ENABLE_LOG
-CREATE_LOGGERPTR_LOCAL(vehicle_data_logger, "VehicleDataItemSchema");
+SDL_CREATE_LOG_VARIABLE("VehicleDataItemSchema");
#endif // ENABLE_LOG
VehicleDataItemSchema::VehicleDataItemSchema(PolicyDataItem& policy_item,
@@ -153,7 +153,7 @@ smart_objects::ISchemaItemPtr VehicleDataItemSchema::GetPODTypeSchema(
std::string error_msg = std::string("Invalid POD type provided: ") +
std::string(policy_item.type);
- LOG4CXX_ERROR(vehicle_data_logger, error_msg.c_str());
+ SDL_LOG_ERROR(error_msg.c_str());
return nullptr;
}
@@ -168,7 +168,7 @@ smart_objects::ISchemaItemPtr VehicleDataItemSchema::getEnumSchema(
const std::string& type_name) const {
auto enum_schema = policy_table::EnumSchemaItemFactory::Get(type_name);
if (!enum_schema) {
- LOG4CXX_ERROR(vehicle_data_logger, "NULL pointer: " << type_name);
+ SDL_LOG_ERROR("NULL pointer: " << type_name);
}
return enum_schema;
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
index 149299d3bb..dd6d797e39 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
@@ -33,9 +33,10 @@
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
#include "vehicle_info_plugin/vehicle_info_plugin.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
+SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
namespace vehicle_info_plugin {
+namespace strings = application_manager::strings;
unsigned VehicleInfoAppExtension::VehicleInfoAppExtensionUID = 146;
@@ -43,24 +44,28 @@ VehicleInfoAppExtension::VehicleInfoAppExtension(
VehicleInfoPlugin& plugin, application_manager::Application& app)
: app_mngr::AppExtension(
VehicleInfoAppExtension::VehicleInfoAppExtensionUID)
+ , subscribed_data_lock_(std::make_shared<sync_primitives::Lock>())
+ , pending_subscriptions_lock_(std::make_shared<sync_primitives::Lock>())
, plugin_(plugin)
, app_(app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
VehicleInfoAppExtension::~VehicleInfoAppExtension() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool VehicleInfoAppExtension::subscribeToVehicleInfo(
const std::string& vehicle_data) {
- LOG4CXX_DEBUG(logger_, vehicle_data);
+ SDL_LOG_DEBUG(vehicle_data);
+ sync_primitives::AutoLock lock(*subscribed_data_lock_);
return subscribed_data_.insert(vehicle_data).second;
}
bool VehicleInfoAppExtension::unsubscribeFromVehicleInfo(
const std::string& vehicle_data) {
- LOG4CXX_DEBUG(logger_, vehicle_data);
+ SDL_LOG_DEBUG(vehicle_data);
+ sync_primitives::AutoLock lock(*subscribed_data_lock_);
auto it = subscribed_data_.find(vehicle_data);
if (it != subscribed_data_.end()) {
subscribed_data_.erase(it);
@@ -70,44 +75,126 @@ bool VehicleInfoAppExtension::unsubscribeFromVehicleInfo(
}
void VehicleInfoAppExtension::unsubscribeFromVehicleInfo() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(*subscribed_data_lock_);
subscribed_data_.clear();
}
bool VehicleInfoAppExtension::isSubscribedToVehicleInfo(
const std::string& vehicle_data) const {
- LOG4CXX_DEBUG(logger_, vehicle_data);
+ SDL_LOG_DEBUG(vehicle_data);
+ sync_primitives::AutoLock lock(*subscribed_data_lock_);
return subscribed_data_.find(vehicle_data) != subscribed_data_.end();
}
-VehicleInfoSubscriptions VehicleInfoAppExtension::Subscriptions() {
- return subscribed_data_;
+bool VehicleInfoAppExtension::isPendingSubscriptionToVehicleInfo(
+ const std::string& vehicle_data) const {
+ SDL_LOG_DEBUG(vehicle_data);
+ sync_primitives::AutoLock lock(*pending_subscriptions_lock_);
+ return pending_subscriptions_.find(vehicle_data) !=
+ pending_subscriptions_.end();
+}
+
+const DataAccessor<VehicleInfoSubscriptions>
+VehicleInfoAppExtension::Subscriptions() {
+ DataAccessor<VehicleInfoSubscriptions> data_accessor(subscribed_data_,
+ subscribed_data_lock_);
+ return data_accessor;
+}
+
+bool VehicleInfoAppExtension::AddPendingSubscription(
+ const std::string& vehicle_data) {
+ sync_primitives::AutoLock lock(*pending_subscriptions_lock_);
+ return pending_subscriptions_.insert(vehicle_data).second;
+}
+
+bool VehicleInfoAppExtension::RemovePendingSubscription(
+ const std::string& vehicle_data) {
+ SDL_LOG_DEBUG(vehicle_data);
+ sync_primitives::AutoLock lock(*pending_subscriptions_lock_);
+ auto it = pending_subscriptions_.find(vehicle_data);
+ if (it != pending_subscriptions_.end()) {
+ pending_subscriptions_.erase(it);
+ return true;
+ }
+ return false;
+}
+
+void VehicleInfoAppExtension::RemovePendingSubscriptions() {
+ sync_primitives::AutoLock lock(*pending_subscriptions_lock_);
+ pending_subscriptions_.clear();
+}
+
+const DataAccessor<VehicleInfoSubscriptions>
+VehicleInfoAppExtension::PendingSubscriptions() {
+ return DataAccessor<VehicleInfoSubscriptions>(pending_subscriptions_,
+ pending_subscriptions_lock_);
}
void VehicleInfoAppExtension::SaveResumptionData(
smart_objects::SmartObject& resumption_data) {
- const char* application_vehicle_info = "vehicleInfo";
- resumption_data[application_vehicle_info] =
+ resumption_data[strings::application_vehicle_info] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
int i = 0;
+ sync_primitives::AutoLock lock(*subscribed_data_lock_);
for (const auto& subscription : subscribed_data_) {
- resumption_data[application_vehicle_info][i++] = subscription;
+ resumption_data[strings::application_vehicle_info][i++] = subscription;
}
}
void VehicleInfoAppExtension::ProcessResumption(
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!saved_app.keyExists(strings::application_subscriptions)) {
+ SDL_LOG_DEBUG("application_subscriptions section is not exists");
+ return;
+ }
+
+ const smart_objects::SmartObject& resumption_data =
+ saved_app[strings::application_subscriptions];
+
+ if (!resumption_data.keyExists(strings::application_vehicle_info)) {
+ SDL_LOG_DEBUG("application_vehicle_info section is not exists");
+ return;
+ }
+
+ const auto subscriptions_ivi =
+ resumption_data[strings::application_vehicle_info].asArray();
+ for (const auto& ivi : *subscriptions_ivi) {
+ AddPendingSubscription(ivi.asString());
+ }
+ if (!subscriptions_ivi->empty()) {
+ plugin_.ProcessResumptionSubscription(app_, *this);
+ }
+}
+
+void VehicleInfoAppExtension::RevertResumption(
const smart_objects::SmartObject& resumption_data) {
- const char* application_vehicle_info = "vehicleInfo";
- if (resumption_data.keyExists(application_vehicle_info)) {
- const auto* subscriptions_ivi =
- resumption_data[application_vehicle_info].asArray();
- if (subscriptions_ivi) {
- for (const auto& ivi : (*subscriptions_ivi)) {
- subscribeToVehicleInfo(ivi.asString());
- }
+ SDL_LOG_AUTO_TRACE();
+
+ unsubscribeFromVehicleInfo();
+
+ if (!resumption_data.keyExists(
+ application_manager::hmi_interface::vehicle_info)) {
+ SDL_LOG_DEBUG("No resumption vahicle data subscription to revert");
+ return;
+ }
+ const auto& resumption_vd_data =
+ resumption_data[application_manager::hmi_interface::vehicle_info];
+
+ std::set<std::string> ivi_subscriptions_to_revert;
+ const auto ivi_subscriptions_keys = resumption_vd_data.enumerate();
+ for (const auto& key : ivi_subscriptions_keys) {
+ // Only boolean keys in subscriptions list are true vehicle data
+ // subscriptions
+ if (smart_objects::SmartType::SmartType_Boolean ==
+ resumption_vd_data.getElement(key).getType()) {
+ ivi_subscriptions_to_revert.insert(key);
}
- plugin_.ProcessResumptionSubscription(app_, *this);
}
+
+ plugin_.RevertResumption(app_, ivi_subscriptions_to_revert);
}
VehicleInfoAppExtension& VehicleInfoAppExtension::ExtractVIExtension(
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
index 52ee9f476d..5bebdf8e2a 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
@@ -32,7 +32,7 @@
#include "vehicle_info_plugin/vehicle_info_command_factory.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
+SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
namespace vehicle_info_plugin {
@@ -57,7 +57,7 @@ VehicleInfoCommandFactory::VehicleInfoCommandFactory(
hmi_capabilities,
policy_handler,
custom_vehicle_data_manager)) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
VehicleInfoCommandFactory::~VehicleInfoCommandFactory() {}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc
index e8d852b612..3687245066 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc
@@ -52,7 +52,7 @@
#include "vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h"
#include "vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
+SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
namespace vehicle_info_plugin {
namespace strings = app_mngr::strings;
@@ -108,7 +108,7 @@ struct VehicleInfoCommandCreatorFactory {
template <typename VehicleInfoCommandType>
application_manager::CommandCreator& GetCreator() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
static VehicleInfoCommandCreator<VehicleInfoCommandType> res(params_);
return res;
}
@@ -126,7 +126,7 @@ VehicleInfoHmiCommandFactory::VehicleInfoHmiCommandFactory(
, hmi_capabilities_(hmi_capabilities)
, policy_handler_(policy_handler)
, custom_vehicle_data_manager_(custom_vehicle_data_manager) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
app_mngr::CommandSharedPtr VehicleInfoHmiCommandFactory::CreateCommand(
@@ -150,9 +150,8 @@ app_mngr::CommandSharedPtr VehicleInfoHmiCommandFactory::CreateCommand(
}
UNUSED(message_type_str);
- LOG4CXX_DEBUG(logger_,
- "HMICommandFactory::CreateCommand function_id: "
- << function_id << ", message type: " << message_type_str);
+ SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
return buildCommandCreator(function_id, message_type).create(message);
}
@@ -212,7 +211,7 @@ app_mngr::CommandCreator& VehicleInfoHmiCommandFactory::buildCommandCreator(
? factory.GetCreator<commands::VIDiagnosticMessageRequest>()
: factory.GetCreator<commands::VIDiagnosticMessageResponse>();
default:
- LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
+ SDL_LOG_WARN("Unsupported function_id: " << function_id);
return factory.GetCreator<VehicleInfoInvalidCommand>();
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
index c3c8d9c8d7..b2d7df5d28 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
@@ -52,7 +52,7 @@
#include "vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h"
#include "vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_response.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
+SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
namespace vehicle_info_plugin {
namespace strings = app_mngr::strings;
@@ -108,7 +108,7 @@ struct VehicleInfoCommandCreatorFactory {
template <typename VehicleInfoCommandType>
application_manager::CommandCreator& GetCreator() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
static VehicleInfoCommandCreator<VehicleInfoCommandType> res(params_);
return res;
}
@@ -126,7 +126,7 @@ VehicleInfoMobileCommandFactory::VehicleInfoMobileCommandFactory(
, hmi_capabilities_(hmi_capabilities)
, policy_handler_(policy_handler)
, custom_vehicle_data_manager_(custom_vehicle_data_manager) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand(
@@ -150,9 +150,8 @@ app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand(
}
UNUSED(message_type_str);
- LOG4CXX_DEBUG(logger_,
- "HMICommandFactory::CreateCommand function_id: "
- << function_id << ", message type: " << message_type_str);
+ SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
return get_creator_factory(function_id, message_type, source).create(message);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc
new file mode 100644
index 0000000000..a6e6148793
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc
@@ -0,0 +1,409 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "vehicle_info_plugin/vehicle_info_pending_resumption_handler.h"
+#include <boost/range/algorithm/set_algorithm.hpp>
+#include <functional>
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+#include "utils/helpers.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+
+namespace vehicle_info_plugin {
+SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
+
+using hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData;
+
+uint32_t get_corr_id_from_message(const smart_objects::SmartObject& message) {
+ using namespace application_manager;
+ return message[strings::params][strings::correlation_id].asInt();
+}
+
+template <class T>
+std::string Stringify(const T& container) {
+ std::stringstream ss;
+ for (const auto& val : container) {
+ ss << val << " ";
+ }
+ return ss.str();
+}
+
+VehicleInfoPendingResumptionHandler::VehicleDataList SubscriptionsFromResponse(
+ const smart_objects::SmartObject& response,
+ std::function<bool(const smart_objects::SmartObject& vehicle_data)>
+ vehicle_data_check) {
+ namespace strings = application_manager::strings;
+ VehicleInfoPendingResumptionHandler::VehicleDataList result;
+ const auto response_params = response[strings::msg_params];
+ const auto response_keys = response_params.enumerate();
+ for (auto key : response_keys) {
+ if (vehicle_data_check(response_params[key])) {
+ result.insert(key);
+ }
+ }
+ return result;
+}
+
+void FillResponseWithMissedVD(
+ const VehicleInfoPendingResumptionHandler::VehicleDataList& vehicle_data,
+ smart_objects::SmartObject* response) {
+ DCHECK(response)
+ namespace strings = application_manager::strings;
+ auto& msg_params = (*response)[strings::msg_params];
+ for (const auto& vd : vehicle_data) {
+ smart_objects::SmartObject vd_result(smart_objects::SmartType_Map);
+ vd_result[strings::result_code] =
+ hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS;
+ msg_params[vd] = vd_result;
+ }
+}
+
+VehicleInfoPendingResumptionHandler::VehicleDataList
+SuccessfulSubscriptionsFromResponse(
+ const smart_objects::SmartObject& response) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager;
+
+ VehicleInfoPendingResumptionHandler::VehicleDataList result;
+ if (!resumption::IsResponseSuccessful(response)) {
+ return result;
+ }
+
+ auto successful_vehicle_data =
+ [](const smart_objects::SmartObject& vehicle_data) {
+ constexpr auto kSuccess =
+ hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS;
+ const auto vd_result_code = vehicle_data[strings::result_code].asInt();
+ return kSuccess == vd_result_code;
+ };
+ return SubscriptionsFromResponse(response, successful_vehicle_data);
+}
+
+VehicleInfoPendingResumptionHandler::VehicleInfoPendingResumptionHandler(
+ application_manager::ApplicationManager& application_manager,
+ CustomVehicleDataManager& custom_vehicle_data_manager)
+ : PendingResumptionHandler(application_manager)
+ , custom_vehicle_data_manager_(custom_vehicle_data_manager) {}
+
+void VehicleInfoPendingResumptionHandler::OnResumptionRevert() {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(pending_resumption_lock_);
+ TriggerPendingResumption();
+}
+
+void VehicleInfoPendingResumptionHandler::RaiseFinishedPendingResumption(
+ const PendingSubscriptionsResumption& pending_resumption) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager;
+
+ auto app = application_manager_.application(pending_resumption.app_id_);
+ if (!app) {
+ SDL_LOG_DEBUG("Application not found " << pending_resumption.app_id_);
+ return;
+ }
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ ext.RemovePendingSubscriptions();
+ for (const auto& subscription : pending_resumption.restored_vehicle_data_) {
+ SDL_LOG_DEBUG("Subscribe " << app->app_id() << " to " << subscription);
+ ext.subscribeToVehicleInfo(subscription);
+ }
+
+ auto fake_response =
+ CreateFakeResponseFromHMI(pending_resumption.subscription_results_,
+ pending_resumption.fake_corr_id_);
+ event_engine::Event event(VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(fake_response);
+ SDL_LOG_DEBUG("Raise fake response for resumption data processor");
+ event.raise(application_manager_.event_dispatcher());
+}
+
+void VehicleInfoPendingResumptionHandler::SendHMIRequestForNotSubscribed(
+ const PendingSubscriptionsResumption& pending_resumption) {
+ SDL_LOG_AUTO_TRACE();
+ const auto remaining_subscriptions = pending_resumption.NotSubscribedData();
+ auto request = CreateSubscribeRequestToHMI(remaining_subscriptions);
+ const auto corr_id = get_corr_id_from_message(*request);
+ subscribe_on_event(VehicleInfo_SubscribeVehicleData, corr_id);
+ application_manager_.GetRPCService().ManageHMICommand(request);
+}
+
+void VehicleInfoPendingResumptionHandler::ProcessNextPendingResumption(
+ const smart_objects::SmartObject& response_message) {
+ SDL_LOG_AUTO_TRACE();
+ if (pending_requests_.empty()) {
+ SDL_LOG_DEBUG("No more pending resumptions");
+ return;
+ }
+ auto& pending = pending_requests_.front();
+ if (pending.waiting_for_hmi_response_) {
+ SDL_LOG_DEBUG("Requests was already sent to HMI for " << pending.app_id_);
+ return;
+ }
+ const auto successful_subscriptions =
+ SuccessfulSubscriptionsFromResponse(response_message);
+ pending.FillRestoredData(successful_subscriptions);
+
+ if (!pending.IsSuccessfullyDone()) {
+ SendHMIRequestForNotSubscribed(pending);
+ pending.waiting_for_hmi_response_ = true;
+ return;
+ }
+ auto pending_copy = pending;
+ pending_requests_.pop_front();
+ RaiseFinishedPendingResumption(pending_copy);
+ ProcessNextPendingResumption(response_message);
+}
+
+void VehicleInfoPendingResumptionHandler::TriggerPendingResumption() {
+ SDL_LOG_AUTO_TRACE();
+ if (pending_requests_.empty()) {
+ SDL_LOG_DEBUG("No pending resumptions");
+ return;
+ }
+ auto& pending_resumption = pending_requests_.front();
+ if (pending_resumption.waiting_for_hmi_response_) {
+ SDL_LOG_DEBUG("Pending resumption for "
+ << pending_resumption.app_id_
+ << " is already waiting for HMI response");
+ return;
+ }
+ SendHMIRequestForNotSubscribed(pending_resumption);
+ pending_resumption.waiting_for_hmi_response_ = true;
+}
+
+void VehicleInfoPendingResumptionHandler::on_event(
+ const application_manager::event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(pending_resumption_lock_);
+ using namespace application_manager;
+ if (pending_requests_.empty()) {
+ SDL_LOG_DEBUG("Not waiting for any response");
+ return;
+ }
+
+ auto response_message = event.smart_object();
+ smart_objects::SmartObject converted_msg_params(
+ response_message[strings::msg_params]);
+
+ custom_vehicle_data_manager_.CreateMobileMessageParams(converted_msg_params);
+ response_message[strings::msg_params] = converted_msg_params;
+
+ const auto vs_count_in_response =
+ response_message[application_manager::strings::msg_params].length();
+
+ if (resumption::IsResponseSuccessful(response_message) &&
+ vs_count_in_response == 0) {
+ const auto& requested_vd =
+ pending_requests_.front().requested_vehicle_data_;
+ FillResponseWithMissedVD(requested_vd, &response_message);
+ }
+
+ for (auto& pending : pending_requests_) {
+ pending.FillSubscriptionResults(response_message);
+ }
+
+ auto current_pending = pending_requests_.front();
+ pending_requests_.pop_front();
+
+ RaiseFinishedPendingResumption(current_pending);
+
+ ProcessNextPendingResumption(response_message);
+}
+
+VehicleInfoPendingResumptionHandler::PendingSubscriptionsResumption
+VehicleInfoPendingResumptionHandler::SubscribeToFakeRequest(
+ const uint32_t app_id, const VehicleDataList& subscriptions) {
+ SDL_LOG_AUTO_TRACE();
+ const auto fake_request = CreateSubscribeRequestToHMI(subscriptions);
+ const auto fake_corr_id = get_corr_id_from_message(*fake_request);
+ auto resumption_request = MakeResumptionRequest(
+ fake_corr_id,
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
+ *fake_request);
+ SDL_LOG_DEBUG("Subscribe subscriber "
+ << app_id
+ << " to fake request with corr id = " << fake_corr_id);
+ resumption_data_processor().SubscribeToResponse(app_id, resumption_request);
+ PendingSubscriptionsResumption pending_request(
+ app_id, fake_corr_id, subscriptions);
+ return pending_request;
+}
+
+void VehicleInfoPendingResumptionHandler::HandleResumptionSubscriptionRequest(
+ application_manager::AppExtension& extension,
+ application_manager::Application& app) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(pending_resumption_lock_);
+ SDL_LOG_TRACE("app id " << app.app_id());
+ auto& ext = dynamic_cast<VehicleInfoAppExtension&>(extension);
+
+ const auto subscriptions = ext.PendingSubscriptions().GetData();
+ if (subscriptions.empty()) {
+ SDL_LOG_DEBUG("Subscriptions is empty");
+ return;
+ }
+ SDL_LOG_TRACE("resume subscriptions to : " << Stringify(subscriptions));
+ auto pending_request = SubscribeToFakeRequest(app.app_id(), subscriptions);
+
+ pending_requests_.push_back(pending_request);
+ SDL_LOG_DEBUG(
+ "Add to pending resumptins corr_id = " << pending_request.fake_corr_id_);
+ if (pending_requests_.size() == 1) {
+ TriggerPendingResumption();
+ }
+ // If there was pending resumption before, it will be triggered on HMI
+ // response
+}
+
+smart_objects::SmartObjectSPtr
+VehicleInfoPendingResumptionHandler::CreateSubscribeRequestToHMI(
+ const VehicleDataList& subscriptions) {
+ sync_primitives::AutoLock lock(pending_resumption_lock_);
+ using namespace application_manager;
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ for (const auto& ivi_data : subscriptions) {
+ msg_params[ivi_data] = true;
+ }
+
+ smart_objects::SmartObjectSPtr request =
+ application_manager::MessageHelper::CreateModuleInfoSO(
+ VehicleInfo_SubscribeVehicleData, application_manager_);
+ (*request)[strings::msg_params] = msg_params;
+
+ return request;
+}
+
+smart_objects::SmartObject
+VehicleInfoPendingResumptionHandler::CreateFakeResponseFromHMI(
+ const std::map<std::string, smart_objects::SmartObject>& subscriptions,
+ const uint32_t fake_corrlation_id) {
+ SDL_LOG_AUTO_TRACE();
+ namespace strings = application_manager::strings;
+
+ auto response =
+ application_manager::MessageHelper::CreateResponseMessageFromHmi(
+ VehicleInfo_SubscribeVehicleData,
+ fake_corrlation_id,
+ hmi_apis::Common_Result::SUCCESS);
+ auto& message = *response;
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ for (const auto& subscription : subscriptions) {
+ msg_params[subscription.first] = subscription.second;
+ SDL_LOG_DEBUG("fake response data : "
+ << subscription.first << " result = "
+ << subscription.second[strings::result_code].asInt());
+ }
+
+ message[strings::msg_params] = msg_params;
+ return *response;
+}
+
+bool VehicleInfoPendingResumptionHandler::PendingSubscriptionsResumption::
+ IsSuccessfullyDone() const {
+ return requested_vehicle_data_.size() == restored_vehicle_data_.size();
+}
+
+bool VehicleInfoPendingResumptionHandler::PendingSubscriptionsResumption::
+ DataWasRequested(const std::string& vd) const {
+ bool result =
+ (requested_vehicle_data_.end() != requested_vehicle_data_.find(vd));
+ return result;
+}
+
+VehicleInfoPendingResumptionHandler::VehicleDataList
+VehicleInfoPendingResumptionHandler::PendingSubscriptionsResumption::
+ NotSubscribedData() const {
+ VehicleDataList not_subscribed;
+ boost::set_difference(requested_vehicle_data_,
+ restored_vehicle_data_,
+ std::inserter(not_subscribed, not_subscribed.end()));
+ return not_subscribed;
+}
+
+void VehicleInfoPendingResumptionHandler::PendingSubscriptionsResumption::
+ FillSubscriptionResults() {
+ namespace strings = application_manager::strings;
+ for (const auto& key : restored_vehicle_data_) {
+ smart_objects::SmartObject vd_result(smart_objects::SmartType_Map);
+ vd_result[strings::result_code] =
+ hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS;
+ subscription_results_[key] = vd_result;
+ }
+
+ const auto not_subscribed = NotSubscribedData();
+ for (const auto& key : not_subscribed) {
+ smart_objects::SmartObject vd_result(smart_objects::SmartType_Map);
+ vd_result[strings::result_code] =
+ hmi_apis::Common_VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED;
+ subscription_results_[key] = vd_result;
+ }
+}
+
+void VehicleInfoPendingResumptionHandler::PendingSubscriptionsResumption::
+ FillRestoredData(const VehicleDataList& successful_subscriptions) {
+ for (auto& subscribed : successful_subscriptions) {
+ if (DataWasRequested(subscribed)) {
+ restored_vehicle_data_.insert(subscribed);
+ }
+ }
+}
+
+void VehicleInfoPendingResumptionHandler::PendingSubscriptionsResumption::
+ FillSubscriptionResults(const smart_objects::SmartObject& response) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager;
+
+ auto successful_subscriptions = SuccessfulSubscriptionsFromResponse(response);
+
+ SDL_LOG_DEBUG("Requested data : " << Stringify(requested_vehicle_data_));
+ SDL_LOG_DEBUG("Successful subscription in response : "
+ << Stringify(successful_subscriptions));
+
+ FillRestoredData(successful_subscriptions);
+
+ SDL_LOG_DEBUG("Restored data : " << Stringify(restored_vehicle_data_));
+
+ FillSubscriptionResults();
+
+ auto msg_params = response[strings::msg_params];
+ auto keys = msg_params.enumerate();
+ for (auto key : keys) {
+ if (DataWasRequested(key)) {
+ subscription_results_[key] = msg_params[key];
+ }
+ }
+}
+
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
index 1c553fb84d..718814b201 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
@@ -33,20 +33,23 @@
#include "vehicle_info_plugin/vehicle_info_plugin.h"
#include "application_manager/message_helper.h"
#include "application_manager/plugin_manager/plugin_keys.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "application_manager/rpc_handler.h"
#include "application_manager/smart_object_keys.h"
#include "vehicle_info_plugin/custom_vehicle_data_manager_impl.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
#include "vehicle_info_plugin/vehicle_info_command_factory.h"
+#include "vehicle_info_plugin/vehicle_info_pending_resumption_handler.h"
namespace vehicle_info_plugin {
-CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
+SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
namespace strings = application_manager::strings;
namespace plugins = application_manager::plugin_manager;
namespace commands = application_manager::commands;
-VehicleInfoPlugin::VehicleInfoPlugin() : application_manager_(nullptr) {}
+VehicleInfoPlugin::VehicleInfoPlugin()
+ : application_manager_(nullptr), pending_resumption_handler_(nullptr) {}
bool VehicleInfoPlugin::Init(
application_manager::ApplicationManager& app_manager,
@@ -58,6 +61,9 @@ bool VehicleInfoPlugin::Init(
application_manager_ = &app_manager;
custom_vehicle_data_manager_.reset(
new CustomVehicleDataManagerImpl(policy_handler, rpc_service));
+ pending_resumption_handler_ =
+ std::make_shared<VehicleInfoPendingResumptionHandler>(
+ app_manager, *custom_vehicle_data_manager_);
command_factory_.reset(new vehicle_info_plugin::VehicleInfoCommandFactory(
app_manager,
rpc_service,
@@ -107,6 +113,7 @@ void VehicleInfoPlugin::OnPolicyEvent(plugins::PolicyEvent event) {
void VehicleInfoPlugin::OnApplicationEvent(
plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
if (plugins::ApplicationEvent::kApplicationRegistered == event) {
application->AddExtension(
std::make_shared<VehicleInfoAppExtension>(*this, *application));
@@ -117,7 +124,7 @@ void VehicleInfoPlugin::OnApplicationEvent(
}
void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
typedef std::vector<std::string> StringsVector;
auto get_items_to_unsubscribe = [this]() -> StringsVector {
@@ -125,16 +132,15 @@ void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() {
auto applications = application_manager_->applications();
for (auto& app : applications.GetData()) {
auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- auto subscription_names = ext.Subscriptions();
+ auto subscription_names = ext.Subscriptions().GetData();
for (auto& subscription_name : subscription_names) {
if (custom_vehicle_data_manager_->IsRemovedCustomVehicleDataName(
subscription_name)) {
ext.unsubscribeFromVehicleInfo(subscription_name);
if (!helpers::in_range(output_items_list, subscription_name)) {
- LOG4CXX_DEBUG(logger_,
- "Vehicle data item "
- << subscription_name
- << " has been removed by policy");
+ SDL_LOG_DEBUG("Vehicle data item "
+ << subscription_name
+ << " has been removed by policy");
output_items_list.push_back(subscription_name);
}
}
@@ -146,7 +152,7 @@ void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() {
const StringsVector items_to_unsubscribe = get_items_to_unsubscribe();
if (items_to_unsubscribe.empty()) {
- LOG4CXX_DEBUG(logger_, "There is no data to unsubscribe");
+ SDL_LOG_DEBUG("There is no data to unsubscribe");
return;
}
@@ -154,50 +160,101 @@ void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() {
application_manager_->GetRPCService().ManageHMICommand(message);
}
-bool IsOtherAppAlreadySubscribedFor(
- const std::string& ivi_name,
- const application_manager::ApplicationManager& app_mngr,
- const uint32_t current_app_id) {
- auto applications = app_mngr.applications();
+void VehicleInfoPlugin::ProcessResumptionSubscription(
+ application_manager::Application& app, VehicleInfoAppExtension& ext) {
+ SDL_LOG_AUTO_TRACE();
- for (auto& app : applications.GetData()) {
- auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- if (ext.isSubscribedToVehicleInfo(ivi_name) &&
- (app->app_id() != current_app_id)) {
- return true;
+ auto pending = ext.PendingSubscriptions().GetData();
+ for (const auto& ivi : pending) {
+ if (IsSubscribedAppExist(ivi)) {
+ ext.RemovePendingSubscription(ivi);
+ ext.subscribeToVehicleInfo(ivi);
}
}
- return false;
+ pending_resumption_handler_->HandleResumptionSubscriptionRequest(ext, app);
}
-void VehicleInfoPlugin::ProcessResumptionSubscription(
- application_manager::Application& app, VehicleInfoAppExtension& ext) {
- LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+void VehicleInfoPlugin::RevertResumption(
+ application_manager::Application& app,
+ const std::set<std::string>& list_of_subscriptions) {
+ SDL_LOG_AUTO_TRACE();
+ UNUSED(app);
- const auto& subscriptions = ext.Subscriptions();
+ pending_resumption_handler_->OnResumptionRevert();
- if (subscriptions.empty()) {
- LOG4CXX_DEBUG(logger_, "No vehicle data to subscribe. Exiting");
+ std::set<std::string> subscriptions_to_revert;
+ for (auto& ivi_data : list_of_subscriptions) {
+ if (!IsSubscribedAppExist(ivi_data) &&
+ !IsAnyPendingSubscriptionExist(ivi_data)) {
+ subscriptions_to_revert.insert(ivi_data);
+ }
+ }
+
+ if (subscriptions_to_revert.empty()) {
+ SDL_LOG_DEBUG("No data to unsubscribe");
return;
}
+ const auto request = CreateUnsubscriptionRequest(subscriptions_to_revert);
+ application_manager_->GetRPCService().ManageHMICommand(request);
+}
- for (auto& ivi : subscriptions) {
- if (!IsOtherAppAlreadySubscribedFor(
- ivi, *application_manager_, app.app_id())) {
- msg_params[ivi] = true;
+smart_objects::SmartObjectSPtr VehicleInfoPlugin::CreateSubscriptionRequest(
+ const std::set<std::string>& list_of_subscriptions) {
+ SDL_LOG_AUTO_TRACE();
+ auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
+ for (auto& ivi_data : list_of_subscriptions) {
+ msg_params[ivi_data] = true;
+ }
+
+ auto request = application_manager::MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
+ *application_manager_);
+ (*request)[strings::msg_params] = msg_params;
+ return request;
+}
+
+smart_objects::SmartObjectSPtr VehicleInfoPlugin::CreateUnsubscriptionRequest(
+ const std::set<std::string>& list_of_subscriptions) {
+ SDL_LOG_AUTO_TRACE();
+ auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ for (auto& ivi_data : list_of_subscriptions) {
+ msg_params[ivi_data] = true;
+ }
+
+ auto request = application_manager::MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData,
+ *application_manager_);
+ (*request)[strings::msg_params] = msg_params;
+
+ return request;
+}
+
+bool VehicleInfoPlugin::IsSubscribedAppExist(const std::string& ivi) {
+ SDL_LOG_AUTO_TRACE();
+ auto apps_accessor = application_manager_->applications();
+
+ for (auto& app : apps_accessor.GetData()) {
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ if (ext.isSubscribedToVehicleInfo(ivi)) {
+ return true;
}
}
+ return false;
+}
- if (!msg_params.empty()) {
- auto request = application_manager::MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
- *application_manager_);
- msg_params[strings::app_id] = app.app_id();
- (*request)[strings::msg_params] = msg_params;
- application_manager_->GetRPCService().ManageHMICommand(request);
+bool VehicleInfoPlugin::IsAnyPendingSubscriptionExist(const std::string& ivi) {
+ SDL_LOG_AUTO_TRACE();
+ auto apps_accessor = application_manager_->applications();
+
+ for (auto& app : apps_accessor.GetData()) {
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ if (ext.isPendingSubscriptionToVehicleInfo(ivi)) {
+ return true;
+ }
}
+
+ return false;
}
application_manager::ApplicationSharedPtr FindAppSubscribedToIVI(
@@ -216,7 +273,7 @@ application_manager::ApplicationSharedPtr FindAppSubscribedToIVI(
smart_objects::SmartObjectSPtr VehicleInfoPlugin::GetUnsubscribeIVIRequest(
const std::vector<std::string>& ivi_names) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -264,7 +321,7 @@ smart_objects::SmartObjectSPtr VehicleInfoPlugin::GetUnsubscribeIVIRequest(
void VehicleInfoPlugin::DeleteSubscriptions(
application_manager::ApplicationSharedPtr app) {
auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- auto subscriptions = ext.Subscriptions();
+ auto subscriptions = ext.Subscriptions().GetData();
std::vector<std::string> ivi_to_unsubscribe;
for (auto& ivi : subscriptions) {
ext.unsubscribeFromVehicleInfo(ivi);
@@ -284,12 +341,12 @@ void VehicleInfoPlugin::DeleteSubscriptions(
extern "C" __attribute__((visibility("default")))
application_manager::plugin_manager::RPCPlugin*
-Create() {
+Create(logger::Logger* logger_instance) {
+ logger::Logger::instance(logger_instance);
return new vehicle_info_plugin::VehicleInfoPlugin();
}
extern "C" __attribute__((visibility("default"))) void Delete(
application_manager::plugin_manager::RPCPlugin* data) {
delete data;
- DELETE_THREAD_LOGGER(vehicle_info_plugin::logger_);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
index a8193c17f0..c9697d71f2 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
@@ -52,6 +52,7 @@ file(GLOB SOURCES
${COMMANDS_TEST_DIR}/mobile/*
${CMAKE_CURRENT_SOURCE_DIR}/custom_vehicle_data_manager_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/vehicle_data_item_schema_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/vehicle_info_pending_resumption_test.cc
${COMPONENTS_DIR}/application_manager/src/message.cc
${COMPONENTS_DIR}/application_manager/src/event_engine/*
${COMPONENTS_DIR}/resumption/src/last_state_wrapper_impl.cc
@@ -60,7 +61,6 @@ file(GLOB SOURCES
set(LIBRARIES
gmock
Utils
- SmartObjects
HMI_API
MOBILE_API
connectionHandler
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc
index c559268bfd..0d1b8a74c7 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc
@@ -87,6 +87,8 @@ class SubscribeVehicleRequestTest
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, GetRPCHandler())
.WillByDefault(ReturnRef(mock_rpc_handler_));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
vi_plugin_.Init(app_mngr_,
mock_rpc_service_,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
index 450bb5ac26..d8efb495fc 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -88,6 +88,8 @@ class UnsubscribeVehicleRequestTest
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, GetRPCHandler())
.WillByDefault(ReturnRef(mock_rpc_handler_));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
vi_plugin_.Init(app_mngr_,
mock_rpc_service_,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc
new file mode 100644
index 0000000000..c2af7236f8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc
@@ -0,0 +1,636 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include <boost/range/algorithm/set_algorithm.hpp>
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_event_observer.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/mock_resumption_data_processor.h"
+#include "application_manager/mock_rpc_service.h"
+#include "gtest/gtest.h"
+#include "vehicle_info_plugin/mock_custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_pending_resumption_handler.h"
+#include "vehicle_info_plugin/vehicle_info_plugin.h"
+
+namespace vehicle_info_plugin_test {
+using namespace vehicle_info_plugin;
+
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+
+using application_manager::MockMessageHelper;
+using test::components::resumption_test::MockResumeCtrl;
+using test::components::resumption_test::MockResumptionDataProcessor;
+typedef NiceMock< ::test::components::event_engine_test::MockEventDispatcher>
+ MockEventDispatcher;
+typedef NiceMock< ::test::components::event_engine_test::MockEventObserver>
+ MockEventObserver;
+typedef NiceMock<
+ ::test::components::application_manager_test::MockApplicationManager>
+ MockApplicationManager;
+typedef NiceMock< ::test::components::application_manager_test::MockApplication>
+ MockApplication;
+typedef NiceMock<test::components::application_manager_test::MockRPCService>
+ MockRPCService;
+typedef std::shared_ptr<MockApplication> MockAppPtr;
+typedef std::shared_ptr<vehicle_info_plugin::VehicleInfoAppExtension>
+ VehicleInfoAppExtensionPtr;
+using hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData;
+
+smart_objects::SmartObjectSPtr CreateVDRequest(const uint32_t corr_id) {
+ using namespace application_manager;
+ smart_objects::SmartObjectSPtr request =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject& object = *request;
+ const auto message_type_request = 0;
+ object[strings::params][strings::message_type] = message_type_request;
+ object[strings::params][strings::function_id] =
+ static_cast<int>(VehicleInfo_SubscribeVehicleData);
+
+ object[strings::params][strings::correlation_id] = corr_id;
+ object[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ return request;
+}
+
+mobile_apis::VehicleDataType::eType ToVDType(const std::string& vd) {
+ if ("gps" == vd) {
+ return mobile_apis::VehicleDataType::VEHICLEDATA_GPS;
+ }
+ if ("speed" == vd) {
+ return mobile_apis::VehicleDataType::VEHICLEDATA_SPEED;
+ }
+ return mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA;
+}
+
+smart_objects::SmartObject CreateVDError(const uint32_t correlation_id,
+ const int32_t result_code,
+ const std::string& info) {
+ namespace strings = application_manager::strings;
+ namespace hmi_response = application_manager::hmi_response;
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+
+ message[strings::params][strings::function_id] =
+ VehicleInfo_SubscribeVehicleData;
+ const auto hmi_protocol_type = 1;
+ message[strings::params][strings::protocol_type] = hmi_protocol_type;
+ message[strings::params][strings::correlation_id] = correlation_id;
+
+ const auto message_type_response = 1;
+ message[strings::params][strings::message_type] = message_type_response;
+ message[strings::params][hmi_response::code] = result_code;
+ message[strings::params][strings::error_msg] = info;
+
+ return message;
+}
+
+smart_objects::SmartObjectSPtr CreateHMIResponseMessage(
+ const hmi_apis::Common_Result::eType common_result,
+ uint32_t correlation_id) {
+ namespace strings = application_manager::strings;
+ namespace hmi_response = application_manager::hmi_response;
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+ params[strings::function_id] = VehicleInfo_SubscribeVehicleData;
+ params[strings::message_type] = application_manager::MessageType::kResponse;
+ params[strings::correlation_id] = correlation_id;
+ const auto hmi_protocol_type = 1;
+ params[strings::protocol_type] = hmi_protocol_type;
+ params[hmi_response::code] = common_result;
+
+ smart_objects::SmartObjectSPtr response =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ auto& message = *response;
+ message[strings::params] = params;
+ message[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ return response;
+}
+
+typedef std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ VDResponseMap;
+smart_objects::SmartObject CreateVDResponse(
+ const hmi_apis::Common_Result::eType common_result,
+ const VDResponseMap& subscriptions_result,
+ uint32_t correleation_id) {
+ namespace strings = application_manager::strings;
+ namespace hmi_response = application_manager::hmi_response;
+
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ for (const auto& subscription : subscriptions_result) {
+ smart_objects::SmartObject subscription_result(
+ smart_objects::SmartType_Map);
+ subscription_result[strings::data_type] = ToVDType(subscription.first);
+ subscription_result[strings::result_code] = subscription.second;
+ msg_params[subscription.first] = subscription_result;
+ }
+ auto response = CreateHMIResponseMessage(common_result, correleation_id);
+ (*response)[strings::msg_params] = msg_params;
+ return *response;
+}
+
+enum class ContainsPolicy { Strict, Nice };
+
+bool CheckThatMessageContainsVD(
+ const smart_objects::SmartObject& message,
+ const std::set<std::string>& vehicle_data,
+ ContainsPolicy policy = ContainsPolicy::Strict) {
+ using namespace application_manager;
+ auto& msg_params = message[strings::msg_params];
+ auto keys = msg_params.enumerate();
+ std::set<std::string> missed;
+ boost::set_difference(
+ vehicle_data, keys, std::inserter(missed, missed.end()));
+ if (missed.size() > 0) {
+ return false;
+ }
+ if (ContainsPolicy::Strict == policy) {
+ std::set<std::string> redundant;
+ boost::set_difference(
+ keys, vehicle_data, std::inserter(redundant, redundant.end()));
+ if (redundant.size() > 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+/**
+ * @brief EventCheck check that event contains apropriate vehicle data,
+ * check that is matched correlation id,
+ * check that function id is correct
+ */
+MATCHER_P2(EventCheck, expected_corr_id, vehicle_data, "") {
+ namespace strings = application_manager::strings;
+ const auto& response_message = arg.smart_object();
+ const bool vehicle_data_ok =
+ CheckThatMessageContainsVD(response_message, vehicle_data);
+ const auto cid =
+ response_message[strings::params][strings::correlation_id].asInt();
+ const bool cid_ok = (cid == expected_corr_id);
+ const auto fid =
+ response_message[strings::params][strings::function_id].asInt();
+ const bool fid_ok = (fid == VehicleInfo_SubscribeVehicleData);
+ return fid_ok && cid_ok && vehicle_data_ok;
+}
+
+// Replace correlation id in the message shared pointer with argument specified
+// in template
+ACTION_TEMPLATE(ReplaceCorrelationId,
+ HAS_1_TEMPLATE_PARAMS(int, k),
+ AND_1_VALUE_PARAMS(pointer)) {
+ namespace strings = application_manager::strings;
+ (**pointer)[strings::params][strings::correlation_id] =
+ ::std::tr1::get<k>(args);
+}
+
+class VehicleInfoPendingResumptionHandlerTest : public ::testing::Test {
+ // using namespace vehicle_info_plugin;
+ public:
+ VehicleInfoPendingResumptionHandlerTest()
+ : mock_message_helper_(
+ *application_manager::MockMessageHelper::message_helper_mock())
+
+ {}
+
+ void SetUp() OVERRIDE {
+ ON_CALL(app_manager_mock_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_mock_));
+ ON_CALL(app_manager_mock_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ ON_CALL(app_manager_mock_, resume_controller())
+ .WillByDefault(ReturnRef(resume_ctrl_mock_));
+ ON_CALL(resume_ctrl_mock_, resumption_data_processor())
+ .WillByDefault(ReturnRef(resumption_data_processor_mock_));
+
+ resumption_handler_.reset(
+ new vehicle_info_plugin::VehicleInfoPendingResumptionHandler(
+ app_manager_mock_, custom_vehicle_data_manager_mock_));
+ MessageHelperResponseCreateExpectation();
+ }
+
+ void MessageHelperResponseCreateExpectation() {
+ const int default_corr_id = 0;
+ static auto response = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::SUCCESS, default_corr_id);
+
+ ON_CALL(mock_message_helper_,
+ CreateResponseMessageFromHmi(VehicleInfo_SubscribeVehicleData,
+ _,
+ hmi_apis::Common_Result::SUCCESS))
+ .WillByDefault(
+ DoAll(ReplaceCorrelationId<1>(&response), Return(response)));
+ }
+
+ MockAppPtr CreateApp(uint32_t app_id) {
+ auto mock_app = std::make_shared<MockApplication>();
+
+ ON_CALL(app_manager_mock_, application(app_id))
+ .WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(app_id));
+ return mock_app;
+ }
+
+ VehicleInfoAppExtensionPtr CreateExtension(MockApplication& app) {
+ auto ext_ptr = std::make_shared<VehicleInfoAppExtension>(plugin_, app);
+ ON_CALL(app,
+ QueryInterface(VehicleInfoAppExtension::VehicleInfoAppExtensionUID))
+ .WillByDefault(Return(ext_ptr));
+ return ext_ptr;
+ }
+
+ MockMessageHelper& mock_message_helper_;
+ MockApplicationManager app_manager_mock_;
+ MockResumeCtrl resume_ctrl_mock_;
+ MockResumptionDataProcessor resumption_data_processor_mock_;
+ MockEventDispatcher event_dispatcher_mock_;
+ MockRPCService mock_rpc_service_;
+ NiceMock<MockCustomVehicleDataManager> custom_vehicle_data_manager_mock_;
+ vehicle_info_plugin::VehicleInfoPlugin plugin_;
+
+ std::unique_ptr<vehicle_info_plugin::VehicleInfoPendingResumptionHandler>
+ resumption_handler_;
+};
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest, NoSubscriptionNoAction) {
+ auto mock_app = CreateApp(1);
+ auto ext_ptr = CreateExtension(*mock_app);
+
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .Times(0);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext_ptr, *mock_app);
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest,
+ OneAppSeveralVehicleDataSuccess) {
+ auto mock_app = CreateApp(1);
+ auto ext = CreateExtension(*mock_app);
+ ext->AddPendingSubscription("gps");
+ ext->AddPendingSubscription("speed");
+
+ auto request = CreateVDRequest(1);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ resumption::ResumptionRequest resumption_request;
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .WillOnce(SaveArg<1>(&resumption_request));
+
+ smart_objects::SmartObjectSPtr message_to_hmi;
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+ EXPECT_EQ(resumption_request.request_id.function_id,
+ VehicleInfo_SubscribeVehicleData);
+ EXPECT_TRUE(
+ CheckThatMessageContainsVD(resumption_request.message, {"gps", "speed"}));
+ EXPECT_TRUE(CheckThatMessageContainsVD(*message_to_hmi, {"gps", "speed"}));
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest,
+ OneAppSeveralVehicleDataResponseSuccess) {
+ auto mock_app = CreateApp(1);
+ auto ext = CreateExtension(*mock_app);
+ ext->AddPendingSubscription("gps");
+ ext->AddPendingSubscription("speed");
+
+ uint32_t corr_id = 345;
+ auto request = CreateVDRequest(corr_id);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ resumption::ResumptionRequest resumption_request;
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .WillOnce(SaveArg<1>(&resumption_request));
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+
+ const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ subscriptions_result = {
+ {"gps", hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS},
+ {"speed", hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS},
+ };
+
+ auto response = CreateVDResponse(
+ hmi_apis::Common_Result::SUCCESS, subscriptions_result, corr_id);
+ application_manager::event_engine::Event event(
+ VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(response);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+
+ std::set<std::string> expected_data_in_event = {"gps", "speed"};
+ const auto subscribed_correlation_id =
+ resumption_request.request_id.correlation_id;
+ EXPECT_CALL(event_dispatcher_mock_,
+ raise_event(EventCheck(subscribed_correlation_id,
+ expected_data_in_event)));
+
+ resumption_handler_->on_event(event);
+ EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
+ EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed"));
+ EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest,
+ OneAppSeveralVehicleDataResponseOneFailed) {
+ auto mock_app = CreateApp(1);
+ auto ext = CreateExtension(*mock_app);
+ ext->AddPendingSubscription("gps");
+ ext->AddPendingSubscription("speed");
+
+ uint32_t corr_id = 345;
+ auto request = CreateVDRequest(corr_id);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ resumption::ResumptionRequest resumption_request;
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .WillOnce(SaveArg<1>(&resumption_request));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+ const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ subscriptions_result = {
+ {"gps", hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS},
+ {"speed",
+ hmi_apis::Common_VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED},
+ };
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+
+ auto response = CreateVDResponse(
+ hmi_apis::Common_Result::SUCCESS, subscriptions_result, corr_id);
+ application_manager::event_engine::Event event(
+ VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(response);
+ std::set<std::string> expected_data_in_event = {"gps", "speed"};
+ const auto subscribed_correlation_id =
+ resumption_request.request_id.correlation_id;
+
+ EXPECT_CALL(event_dispatcher_mock_,
+ raise_event(EventCheck(subscribed_correlation_id,
+ expected_data_in_event)));
+
+ // TODO check that raized the same fid and cid as subscribed
+ resumption_handler_->on_event(event);
+ EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
+ EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed"));
+ EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest,
+ OneAppSeveralVehicleDataResponseAllFailed) {
+ auto mock_app = CreateApp(1);
+ auto ext = CreateExtension(*mock_app);
+ ext->AddPendingSubscription("gps");
+ ext->AddPendingSubscription("speed");
+
+ uint32_t corr_id = 345;
+ auto request = CreateVDRequest(corr_id);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ resumption::ResumptionRequest resumption_request;
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .WillOnce(SaveArg<1>(&resumption_request));
+ EXPECT_CALL(event_dispatcher_mock_, raise_event(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+ const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ subscriptions_result = {
+ {"gps",
+ hmi_apis::Common_VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED},
+ {"speed",
+ hmi_apis::Common_VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED},
+ };
+
+ auto response = CreateVDResponse(
+ hmi_apis::Common_Result::SUCCESS, subscriptions_result, corr_id);
+ application_manager::event_engine::Event event(
+ VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(response);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+
+ // TODO check that raized the same fid and cid as subscribed
+ resumption_handler_->on_event(event);
+ EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps"));
+ EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed"));
+ EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest,
+ OneAppSeveralVehicleDataResponseOveralResultFailed) {
+ auto mock_app = CreateApp(1);
+ auto ext = CreateExtension(*mock_app);
+ ext->AddPendingSubscription("gps");
+ ext->AddPendingSubscription("speed");
+
+ uint32_t corr_id = 345;
+ auto request = CreateVDRequest(corr_id);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ resumption::ResumptionRequest resumption_request;
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .WillOnce(SaveArg<1>(&resumption_request));
+
+ EXPECT_CALL(event_dispatcher_mock_, raise_event(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+
+ auto response =
+ CreateVDError(corr_id, hmi_apis::Common_Result::ABORTED, "error message");
+ // TODO use error message type instead of result code
+ application_manager::event_engine::Event event(
+ VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(response);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+
+ // TODO check that raized the same fid and cid as subscribed
+ resumption_handler_->on_event(event);
+ EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps"));
+ EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed"));
+ EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest, TwoAppsOneSharedDataSuccess) {
+ auto mock_app = CreateApp(1);
+ auto mock_app2 = CreateApp(2);
+ auto ext = CreateExtension(*mock_app);
+ auto ext2 = CreateExtension(*mock_app2);
+ ext->AddPendingSubscription("gps");
+ ext2->AddPendingSubscription("gps");
+
+ uint32_t corr_id = 345;
+ auto request = CreateVDRequest(corr_id);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .Times(2);
+
+ // TODO save cid and fid of the subscription
+ EXPECT_CALL(event_dispatcher_mock_, raise_event(_)).Times(2);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+ const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ subscriptions_result = {
+ {"gps", hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS},
+ };
+
+ auto response = CreateVDResponse(
+ hmi_apis::Common_Result::SUCCESS, subscriptions_result, corr_id);
+ // TODO use error message type instead of result code
+ application_manager::event_engine::Event event(
+ VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(response);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2);
+ // TODO check that raized the same fid and cid as subscribed
+ resumption_handler_->on_event(event);
+ EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
+ EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps"));
+ EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
+ EXPECT_EQ(ext2->PendingSubscriptions().GetData().size(), 0u);
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest,
+ TwoAppsMultipleSharedDataSuccessResumption) {
+ auto mock_app = CreateApp(1);
+ auto mock_app2 = CreateApp(2);
+ auto ext = CreateExtension(*mock_app);
+ auto ext2 = CreateExtension(*mock_app2);
+ ext->AddPendingSubscription("gps");
+ ext->AddPendingSubscription("speed");
+ ext2->AddPendingSubscription("gps");
+ ext2->AddPendingSubscription("speed");
+
+ uint32_t corr_id = 345;
+ auto request = CreateVDRequest(corr_id);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .Times(2);
+
+ // TODO save cid and fid of the subscription
+ EXPECT_CALL(event_dispatcher_mock_, raise_event(_)).Times(2);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+ const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ subscriptions_result = {
+ {"gps", hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS},
+ {"speed", hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS},
+ };
+
+ auto response = CreateVDResponse(
+ hmi_apis::Common_Result::SUCCESS, subscriptions_result, corr_id);
+ // TODO use error message type instead of result code
+ application_manager::event_engine::Event event(
+ VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(response);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2);
+ // TODO check that raized the same fid and cid as subscribed
+ resumption_handler_->on_event(event);
+ EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
+ EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed"));
+ EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps"));
+ EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("speed"));
+ EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
+ EXPECT_EQ(ext2->PendingSubscriptions().GetData().size(), 0u);
+}
+
+TEST_F(VehicleInfoPendingResumptionHandlerTest,
+ TwoAppsOneSharedDataFailRetryforSecondApp) {
+ auto mock_app = CreateApp(1);
+ auto mock_app2 = CreateApp(2);
+ auto ext = CreateExtension(*mock_app);
+ auto ext2 = CreateExtension(*mock_app2);
+ ext->AddPendingSubscription("gps");
+ ext2->AddPendingSubscription("gps");
+
+ uint32_t corr_id = 345;
+ auto request = CreateVDRequest(corr_id);
+ ON_CALL(mock_message_helper_,
+ CreateModuleInfoSO(VehicleInfo_SubscribeVehicleData, _))
+ .WillByDefault(Return(request));
+
+ EXPECT_CALL(resumption_data_processor_mock_, SubscribeToResponse(_, _))
+ .Times(2);
+
+ // TODO save cid and fid of the subscription
+ EXPECT_CALL(event_dispatcher_mock_, raise_event(_)).Times(2);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(2);
+ const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ subscriptions_result = {
+ {"gps",
+ hmi_apis::Common_VehicleDataResultCode::VDRC_DATA_NOT_AVAILABLE},
+ };
+
+ auto response = CreateVDResponse(
+ hmi_apis::Common_Result::SUCCESS, subscriptions_result, corr_id);
+ // TODO use error message type instead of result code
+ application_manager::event_engine::Event event(
+ VehicleInfo_SubscribeVehicleData);
+ event.set_smart_object(response);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
+ resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2);
+ // TODO check that raized the same fid and cid as subscribed
+ resumption_handler_->on_event(event);
+
+ const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
+ second_subscriptions_result = {
+ {"gps", hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS},
+ };
+ auto second_response = CreateVDResponse(
+ hmi_apis::Common_Result::SUCCESS, second_subscriptions_result, corr_id);
+ // TODO use error message type instead of result code
+ application_manager::event_engine::Event second_event(
+ VehicleInfo_SubscribeVehicleData);
+ second_event.set_smart_object(second_response);
+
+ resumption_handler_->on_event(second_event);
+ EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps"));
+ EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps"));
+ EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
+ EXPECT_EQ(ext2->PendingSubscriptions().GetData().size(), 0u);
+}
+
+} // namespace vehicle_info_plugin_test
diff --git a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc
index 691f8d3259..4dafe9a8e6 100644
--- a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc
@@ -40,7 +40,7 @@
#include "utils/timer_task_impl.h"
namespace app_launch {
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
+SDL_CREATE_LOG_VARIABLE("AppLaunch")
AppLaunchCtrlImpl::AppLaunchCtrlImpl(
AppLaunchData& data,
@@ -57,7 +57,7 @@ AppLaunchCtrlImpl::AppLaunchCtrlImpl(
void AppLaunchCtrlImpl::OnAppRegistered(
const application_manager::Application& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO (AKutsan) : get device mac
ApplicationDataPtr app_data = std::make_shared<ApplicationData>(
app.policy_app_id(), app.bundle_id(), app.mac_address());
@@ -82,7 +82,7 @@ bool HmiLevelSorter(const std::pair<int32_t, ApplicationDataPtr>& lval,
}
void AppLaunchCtrlImpl::OnDeviceConnected(const std::string& device_mac) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<ApplicationDataPtr> apps_on_device =
app_launch_data_.GetApplicationDataByDevice(device_mac);
std::vector<std::pair<int32_t, ApplicationDataPtr> > apps_hmi_levels;
@@ -104,12 +104,12 @@ void AppLaunchCtrlImpl::OnDeviceConnected(const std::string& device_mac) {
if (apps_on_device.size() > 0) {
device_apps_launcher_.LaunchAppsOnDevice(device_mac, apps_on_device);
} else {
- LOG4CXX_DEBUG(logger_, "No apps in saved for device " << device_mac);
+ SDL_LOG_DEBUG("No apps in saved for device " << device_mac);
}
}
void AppLaunchCtrlImpl::OnMasterReset() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_launch_data_.Clear();
}
} // namespace app_launch
diff --git a/src/components/application_manager/src/app_launch/app_launch_data_db.cc b/src/components/application_manager/src/app_launch/app_launch_data_db.cc
index a931b96fa1..7c015b0707 100644
--- a/src/components/application_manager/src/app_launch/app_launch_data_db.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_data_db.cc
@@ -39,7 +39,7 @@
#include "application_manager/smart_object_keys.h"
namespace app_launch {
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
+SDL_CREATE_LOG_VARIABLE("AppLaunch")
AppLaunchDataDB::AppLaunchDataDB(const AppLaunchSettings& settings,
DbStorage db_storage)
@@ -56,8 +56,8 @@ AppLaunchDataDB::AppLaunchDataDB(const AppLaunchSettings& settings,
#endif // __QNX__
DCHECK(db_.get());
} else {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_ERROR(logger_, "Get not existed type of database storage");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_ERROR("Get not existed type of database storage");
}
// Connect to resumption DB
@@ -69,48 +69,44 @@ AppLaunchDataDB::~AppLaunchDataDB() {
}
bool AppLaunchDataDB::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!db()->Open()) {
- LOG4CXX_ERROR(logger_, "Failed opening database.");
- LOG4CXX_INFO(logger_, "Starting opening retries.");
+ SDL_LOG_ERROR("Failed opening database.");
+ SDL_LOG_INFO("Starting opening retries.");
const uint16_t attempts = settings_.app_launch_max_retry_attempt();
- LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts);
+ SDL_LOG_DEBUG("Total attempts number is: " << attempts);
bool is_opened = false;
const uint16_t open_attempt_timeout_ms =
settings_.app_launch_retry_wait_time();
const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000u;
- LOG4CXX_DEBUG(logger_,
- "Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
+ SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
for (size_t i = 0u; i < attempts; ++i) {
usleep(sleep_interval_mcsec);
- LOG4CXX_INFO(logger_, "Attempt: " << i + 1);
+ SDL_LOG_INFO("Attempt: " << i + 1);
if (db()->Open()) {
- LOG4CXX_INFO(logger_, "Database opened.");
+ SDL_LOG_INFO("Database opened.");
is_opened = true;
break;
}
}
if (!is_opened) {
- LOG4CXX_ERROR(logger_,
- "Open retry sequence failed. Tried "
- << attempts << " attempts with "
- << open_attempt_timeout_ms
- << " open timeout(ms) for each.");
+ SDL_LOG_ERROR("Open retry sequence failed. Tried "
+ << attempts << " attempts with " << open_attempt_timeout_ms
+ << " open timeout(ms) for each.");
return false;
}
}
#ifndef __QNX__
if (!db()->IsReadWrite()) {
- LOG4CXX_ERROR(logger_, "There are no read/write permissions for database");
+ SDL_LOG_ERROR("There are no read/write permissions for database");
return false;
}
#endif // __QNX__
utils::dbms::SQLQuery query(db());
if (!query.Exec(kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Failed creating schema of database: " << query.LastError().text());
return false;
}
@@ -119,20 +115,20 @@ bool AppLaunchDataDB::Init() {
}
bool AppLaunchDataDB::Persist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = false;
if (!init_successeful_) {
- LOG4CXX_ERROR(logger_,
- "AppLaunch data base was not successfully "
- "initialize, AppLaunch won't work!");
+ SDL_LOG_ERROR(
+ "AppLaunch data base was not successfully "
+ "initialize, AppLaunch won't work!");
return retVal;
}
if ((retVal = WriteDb())) {
- LOG4CXX_DEBUG(logger_, "App_lauch had been successfully saved.");
+ SDL_LOG_DEBUG("App_lauch had been successfully saved.");
} else {
- LOG4CXX_WARN(logger_, "Fail to save app_launch data.");
+ SDL_LOG_WARN("Fail to save app_launch data.");
}
return retVal;
@@ -140,21 +136,20 @@ bool AppLaunchDataDB::Persist() {
bool AppLaunchDataDB::IsAppDataAlreadyExisted(
const ApplicationData& app_data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = false;
if (!init_successeful_) {
- LOG4CXX_ERROR(logger_,
- "AppLaunch data base was not successfully "
- "initialize, AppLaunch won't work!");
+ SDL_LOG_ERROR(
+ "AppLaunch data base was not successfully "
+ "initialize, AppLaunch won't work!");
return retVal;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kFindApplicationData)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification queries 'kFindApplicationData'");
+ SDL_LOG_WARN("Problem with verification queries 'kFindApplicationData'");
return retVal;
}
@@ -165,31 +160,30 @@ bool AppLaunchDataDB::IsAppDataAlreadyExisted(
if (query.Exec()) {
retVal = query.GetBoolean(result_query);
} else {
- LOG4CXX_WARN(logger_,
- "Failed execute query 'kGetNumberOfApplicationData'. Reson: "
- << query.LastError().text());
+ SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: "
+ << query.LastError().text());
}
return retVal;
}
bool AppLaunchDataDB::RefreshAppSessionTime(const ApplicationData& app_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = false;
if (!init_successeful_) {
- LOG4CXX_ERROR(logger_,
- "AppLaunch data base was not successfully "
- "initialize, AppLaunch won't work!");
+ SDL_LOG_ERROR(
+ "AppLaunch data base was not successfully "
+ "initialize, AppLaunch won't work!");
return retVal;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kRefreshApplicationDataSessionTime)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification queries "
- "'kRefreshApplicationDataSessionTime'");
+ SDL_LOG_WARN(
+ "Problem with verification queries "
+ "'kRefreshApplicationDataSessionTime'");
return retVal;
}
@@ -198,33 +192,31 @@ bool AppLaunchDataDB::RefreshAppSessionTime(const ApplicationData& app_data) {
query.Bind(bundle_id_index, app_data.bundle_id_);
if (query.Exec()) {
- LOG4CXX_DEBUG(logger_, "Dare&time last session were updated successfully");
+ SDL_LOG_DEBUG("Dare&time last session were updated successfully");
retVal = WriteDb();
} else {
- LOG4CXX_WARN(logger_,
- "Failed execute query 'kGetNumberOfApplicationData'. Reson: "
- << query.LastError().text());
+ SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: "
+ << query.LastError().text());
}
return retVal;
}
bool AppLaunchDataDB::AddNewAppData(const ApplicationData& app_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = false;
if (!init_successeful_) {
- LOG4CXX_ERROR(logger_,
- "AppLaunch data base was not successfully "
- "initialize, AppLaunch won't work!");
+ SDL_LOG_ERROR(
+ "AppLaunch data base was not successfully "
+ "initialize, AppLaunch won't work!");
return retVal;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kAddApplicationData)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification queries 'kAddApplicationData'");
+ SDL_LOG_WARN("Problem with verification queries 'kAddApplicationData'");
return retVal;
}
@@ -234,12 +226,11 @@ bool AppLaunchDataDB::AddNewAppData(const ApplicationData& app_data) {
retVal = query.Exec();
if (retVal) {
- LOG4CXX_DEBUG(logger_, "New application data was added successfully");
+ SDL_LOG_DEBUG("New application data was added successfully");
retVal = WriteDb();
} else {
- LOG4CXX_WARN(logger_,
- "Failed execute query 'kGetNumberOfApplicationData'. Reson: "
- << query.LastError().text());
+ SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: "
+ << query.LastError().text());
}
return retVal;
@@ -247,21 +238,20 @@ bool AppLaunchDataDB::AddNewAppData(const ApplicationData& app_data) {
std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac(
const std::string& dev_mac) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<ApplicationDataPtr> dev_apps;
if (!init_successeful_) {
- LOG4CXX_ERROR(logger_,
- "AppLaunch data base was not successfully "
- "initialize, AppLaunch won't work!");
+ SDL_LOG_ERROR(
+ "AppLaunch data base was not successfully "
+ "initialize, AppLaunch won't work!");
return dev_apps;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kGetApplicationDataByDevID)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Problem with verification queries 'kGetApplicationDataByDevID'");
return dev_apps;
}
@@ -269,8 +259,7 @@ std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac(
query.Bind(device_mac_index, dev_mac);
const bool retVal = query.Exec();
if (retVal) {
- LOG4CXX_INFO(logger_,
- "Values of ignition off counts were updated successfully");
+ SDL_LOG_INFO("Values of ignition off counts were updated successfully");
do {
const std::string device_mac = query.GetString(device_mac_index);
const std::string mobile_app_id = query.GetString(application_id_index);
@@ -278,106 +267,97 @@ std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac(
dev_apps.push_back(std::make_shared<ApplicationData>(
mobile_app_id, bundle_id, device_mac));
} while (query.Next());
- LOG4CXX_DEBUG(logger_, "All application data has been successfully loaded");
+ SDL_LOG_DEBUG("All application data has been successfully loaded");
} else {
- LOG4CXX_WARN(logger_,
- "Failed execute query 'kGetNumberOfApplicationData'. Reson: "
- << query.LastError().text());
+ SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: "
+ << query.LastError().text());
}
return dev_apps;
}
bool AppLaunchDataDB::Clear() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = false;
utils::dbms::SQLQuery query(db());
retVal = query.Exec(kDropSchema);
if (retVal) {
- LOG4CXX_INFO(logger_, "App_Launch table had been cleared successfully");
+ SDL_LOG_INFO("App_Launch table had been cleared successfully");
retVal = WriteDb();
init_successeful_ = false;
} else {
- LOG4CXX_WARN(logger_,
- "Failed dropping database: " << query.LastError().text());
+ SDL_LOG_WARN("Failed dropping database: " << query.LastError().text());
}
return retVal;
}
uint32_t AppLaunchDataDB::GetCurentNumberOfAppData() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t number_of_app_data = 0u;
if (!init_successeful_) {
- LOG4CXX_ERROR(logger_,
- "AppLaunch data base was not successfully "
- "initialize, AppLaunch won't work!");
+ SDL_LOG_ERROR(
+ "AppLaunch data base was not successfully "
+ "initialize, AppLaunch won't work!");
return number_of_app_data;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kGetNumberOfApplicationData)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Problem with verification queries 'kGetNumberOfApplicationData'");
return number_of_app_data;
}
if (query.Exec()) {
- LOG4CXX_INFO(logger_,
- "Values of ignition off counts were updated successfully");
+ SDL_LOG_INFO("Values of ignition off counts were updated successfully");
number_of_app_data = query.GetInteger(result_query);
- LOG4CXX_DEBUG(
- logger_,
- "Total cout saved mobile applications is " << number_of_app_data);
+ SDL_LOG_DEBUG("Total cout saved mobile applications is "
+ << number_of_app_data);
} else {
- LOG4CXX_WARN(logger_,
- "Failed execute query 'kGetNumberOfApplicationData'. Reson: "
- << query.LastError().text());
+ SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: "
+ << query.LastError().text());
}
return number_of_app_data;
}
bool AppLaunchDataDB::DeleteOldestAppData() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = false;
if (!init_successeful_) {
- LOG4CXX_ERROR(logger_,
- "AppLaunch data base was not successfully "
- "initialize, AppLaunch won't work!");
+ SDL_LOG_ERROR(
+ "AppLaunch data base was not successfully "
+ "initialize, AppLaunch won't work!");
return retVal;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kDeleteOldestAppData)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification queries 'kDeleteOldestAppData'");
+ SDL_LOG_WARN("Problem with verification queries 'kDeleteOldestAppData'");
return retVal;
}
if ((retVal = query.Exec())) {
- LOG4CXX_INFO(logger_,
- "Values of ignition off counts were updated successfully");
+ SDL_LOG_INFO("Values of ignition off counts were updated successfully");
retVal = WriteDb();
} else {
- LOG4CXX_WARN(logger_,
- "Failed execute query 'kGetNumberOfApplicationData'. Reson: "
- << query.LastError().text());
+ SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: "
+ << query.LastError().text());
}
return retVal;
}
bool AppLaunchDataDB::WriteDb() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return db_->Backup();
}
diff --git a/src/components/application_manager/src/app_launch/app_launch_data_impl.cc b/src/components/application_manager/src/app_launch/app_launch_data_impl.cc
index c095cc9d94..524c1e393b 100644
--- a/src/components/application_manager/src/app_launch/app_launch_data_impl.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_data_impl.cc
@@ -34,7 +34,7 @@
namespace app_launch {
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
+SDL_CREATE_LOG_VARIABLE("AppLaunch")
AppLaunchDataImpl::AppLaunchDataImpl(const AppLaunchSettings& settings)
: settings_(settings)
@@ -43,24 +43,24 @@ AppLaunchDataImpl::AppLaunchDataImpl(const AppLaunchSettings& settings)
AppLaunchDataImpl::~AppLaunchDataImpl() {}
bool AppLaunchDataImpl::AddApplicationData(const ApplicationData& app_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = true;
if (app_data.device_mac_.empty() == false &&
app_data.mobile_app_id_.empty() == false &&
app_data.bundle_id_.empty() == false) {
if (IsAppDataAlreadyExisted(app_data)) {
- LOG4CXX_INFO(logger_, "This application data already existed");
+ SDL_LOG_INFO("This application data already existed");
retVal &= RefreshAppSessionTime(app_data);
} else {
if (GetCurentNumberOfAppData() >= get_max_number_iOS_devs()) {
- LOG4CXX_INFO(logger_,
- "Max number of application data have. It will be deleted "
- "the oldest one");
+ SDL_LOG_INFO(
+ "Max number of application data have. It will be deleted "
+ "the oldest one");
retVal &= DeleteOldestAppData();
}
retVal &= AddNewAppData(app_data);
- LOG4CXX_INFO(logger_, "Added new application data to DB");
+ SDL_LOG_INFO("Added new application data to DB");
}
} else {
retVal = false;
@@ -70,11 +70,11 @@ bool AppLaunchDataImpl::AddApplicationData(const ApplicationData& app_data) {
std::vector<ApplicationDataPtr> AppLaunchDataImpl::GetApplicationDataByDevice(
const std::string& dev_mac) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<ApplicationDataPtr> apps = GetAppDataByDevMac(dev_mac);
if (apps.empty()) {
- LOG4CXX_DEBUG(logger_, "No application founded by mac" << dev_mac);
+ SDL_LOG_DEBUG("No application found by device mac " << dev_mac);
}
return apps;
diff --git a/src/components/application_manager/src/app_launch/app_launch_data_json.cc b/src/components/application_manager/src/app_launch/app_launch_data_json.cc
index 86d585f215..d618e63e15 100644
--- a/src/components/application_manager/src/app_launch/app_launch_data_json.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_data_json.cc
@@ -38,7 +38,7 @@
namespace app_launch {
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
+SDL_CREATE_LOG_VARIABLE("AppLaunch")
AppLaunchDataJson::AppLaunchDataJson(
const AppLaunchSettings& settings,
@@ -50,16 +50,16 @@ AppLaunchDataJson::~AppLaunchDataJson() {}
Json::Value& AppLaunchDataJson::GetSavedApplicationDataList(
Json::Value& dictionary) const {
using namespace application_manager;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(app_launch_json_lock_);
Json::Value& app_launch = GetApplicationData(dictionary);
if (!app_launch.isMember(strings::app_launch_list)) {
app_launch[strings::app_launch_list] = Json::Value(Json::arrayValue);
- LOG4CXX_WARN(logger_, "app_list section is missed");
+ SDL_LOG_WARN("app_list section is missed");
}
Json::Value& app_launch_list = app_launch[strings::app_launch_list];
if (!app_launch_list.isArray()) {
- LOG4CXX_ERROR(logger_, "app_launch_list type INVALID rewrite");
+ SDL_LOG_ERROR("app_launch_list type INVALID rewrite");
app_launch_list = Json::Value(Json::arrayValue);
}
return app_launch_list;
@@ -68,15 +68,15 @@ Json::Value& AppLaunchDataJson::GetSavedApplicationDataList(
Json::Value& AppLaunchDataJson::GetApplicationData(
Json::Value& dictionary) const {
using namespace application_manager;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(app_launch_json_lock_);
if (!dictionary.isMember(strings::app_launch)) {
dictionary[strings::app_launch] = Json::Value(Json::objectValue);
- LOG4CXX_WARN(logger_, "app_launch section is missed");
+ SDL_LOG_WARN("app_launch section is missed");
}
Json::Value& app_launch = dictionary[strings::app_launch];
if (!app_launch.isObject()) {
- LOG4CXX_ERROR(logger_, "resumption type INVALID rewrite");
+ SDL_LOG_ERROR("resumption type INVALID rewrite");
app_launch = Json::Value(Json::objectValue);
}
return app_launch;
@@ -87,7 +87,7 @@ Json::Value& AppLaunchDataJson::GetApplicationListAndIndex(
int32_t& found_index,
Json::Value& dictionary) const {
using namespace application_manager;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(app_launch_json_lock_);
Json::Value& apps_list = GetSavedApplicationDataList(dictionary);
@@ -116,7 +116,7 @@ Json::Value& AppLaunchDataJson::GetApplicationListAndIndex(
bool AppLaunchDataJson::IsAppDataAlreadyExisted(
const ApplicationData& app_data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
int32_t index = NotFound;
@@ -130,7 +130,7 @@ bool AppLaunchDataJson::IsAppDataAlreadyExisted(
bool AppLaunchDataJson::RefreshAppSessionTime(const ApplicationData& app_data) {
using namespace application_manager;
using namespace date_time;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool retVal = false;
int32_t index = NotFound;
@@ -152,7 +152,7 @@ bool AppLaunchDataJson::RefreshAppSessionTime(const ApplicationData& app_data) {
bool AppLaunchDataJson::AddNewAppData(const ApplicationData& app_data) {
using namespace application_manager;
using namespace date_time;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(app_launch_json_lock_);
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
@@ -166,18 +166,17 @@ bool AppLaunchDataJson::AddNewAppData(const ApplicationData& app_data) {
static_cast<Json::Value::UInt64>(getSecs(getCurrentTime()));
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(logger_,
- "New application data saved. Detatils device_id: "
- << app_data.device_mac_
- << ", app_id: " << app_data.mobile_app_id_
- << ", bundle_id: " << app_data.bundle_id_ << ".");
+ SDL_LOG_DEBUG("New application data saved. Detatils device_id: "
+ << app_data.device_mac_
+ << ", app_id: " << app_data.mobile_app_id_
+ << ", bundle_id: " << app_data.bundle_id_ << ".");
return true;
}
std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac(
const std::string& dev_mac) const {
using namespace application_manager;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(app_launch_json_lock_);
std::vector<ApplicationDataPtr> dev_apps;
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
@@ -207,32 +206,30 @@ std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac(
}
bool AppLaunchDataJson::Clear() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
GetSavedApplicationDataList(dictionary).clear();
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(logger_,
- "Application launch JSON section successfully cleared.");
+ SDL_LOG_DEBUG("Application launch JSON section successfully cleared.");
return true;
}
uint32_t AppLaunchDataJson::GetCurentNumberOfAppData() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
const uint32_t list_size = GetSavedApplicationDataList(dictionary).size();
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(logger_,
- "Successfully was gotten app_launch list. Size: " << list_size);
+ SDL_LOG_DEBUG("Successfully was gotten app_launch list. Size: " << list_size);
return list_size;
}
bool AppLaunchDataJson::DeleteOldestAppData() {
using namespace application_manager;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(app_launch_json_lock_);
std::vector<uint64_t> temp_array;
std::vector<Json::Value> temp_json_list;
@@ -279,14 +276,14 @@ bool AppLaunchDataJson::DeleteOldestAppData() {
GetSavedApplicationDataList(dictionary).append(item);
}
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(
- logger_, "Oldest application launch data had been successfully deleted.");
+ SDL_LOG_DEBUG(
+ "Oldest application launch data had been successfully deleted.");
return true;
}
bool AppLaunchDataJson::Persist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
last_state_wrapper_->get_accessor().GetMutableData().SaveToFileSystem();
return true;
}
diff --git a/src/components/application_manager/src/app_launch/apps_launcher.cc b/src/components/application_manager/src/app_launch/apps_launcher.cc
index 993a57364e..bf1fa2fb5d 100644
--- a/src/components/application_manager/src/app_launch/apps_launcher.cc
+++ b/src/components/application_manager/src/app_launch/apps_launcher.cc
@@ -28,7 +28,7 @@ struct LauncherGenerator {
const uint16_t app_launch_retry_wait_time_;
};
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
+SDL_CREATE_LOG_VARIABLE("AppLaunch")
AppsLauncher::AppsLauncher(
connection_handler::ConnectionHandler& connection_handler,
const uint16_t max_number_of_ios_device,
@@ -45,7 +45,7 @@ AppsLauncher::AppsLauncher(
}
void AppsLauncher::StartLaunching(ApplicationDataPtr app_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(launchers_lock_);
DCHECK_OR_RETURN_VOID(!free_launchers_.empty())
const AppLaunchers::iterator it = free_launchers_.begin();
@@ -75,18 +75,17 @@ void AppsLauncher::StopLaunching(ApplicationDataPtr app_data) {
free_launchers_.push_back(launcher);
works_launchers_.erase(it);
} else {
- LOG4CXX_DEBUG(logger_,
- "Unable to StopLaunching" << app_data->mobile_app_id_);
+ SDL_LOG_DEBUG("Unable to StopLaunching" << app_data->mobile_app_id_);
}
}
void AppsLauncher::OnLaunched(ApplicationDataPtr app_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
StopLaunching(app_data);
}
void AppsLauncher::OnRetryAttemptsExhausted(ApplicationDataPtr app_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
StopLaunching(app_data);
}
@@ -110,8 +109,7 @@ void AppsLauncher::Launcher::PosponedLaunch(
app_data_ = app_data;
retry_index_ = 0;
retry_timer_.Start(app_launch_retry_wait_time_, timer::kPeriodic);
- LOG4CXX_DEBUG(logger_,
- "Applicaiton " << app_data->mobile_app_id_ << " on device "
+ SDL_LOG_DEBUG("Applicaiton " << app_data->mobile_app_id_ << " on device "
<< app_data->device_mac_
<< " will be launched in "
<< app_launch_retry_wait_time_ << " ms");
@@ -125,8 +123,7 @@ void AppsLauncher::Launcher::Clear() {
void AppsLauncher::Launcher::LaunchNow() {
if (retry_index_++ < app_launch_max_retry_attempt_) {
- LOG4CXX_DEBUG(logger_,
- "Run App " << app_data_->mobile_app_id_ << "with bundle "
+ SDL_LOG_DEBUG("Run App " << app_data_->mobile_app_id_ << "with bundle "
<< app_data_->bundle_id_ << " On Device "
<< app_data_->device_mac_);
diff --git a/src/components/application_manager/src/app_launch/device_apps_launcher.cc b/src/components/application_manager/src/app_launch/device_apps_launcher.cc
index 9a7a6658fe..0a1bea3714 100644
--- a/src/components/application_manager/src/app_launch/device_apps_launcher.cc
+++ b/src/components/application_manager/src/app_launch/device_apps_launcher.cc
@@ -12,7 +12,7 @@
#include "utils/timer_task_impl.h"
namespace app_launch {
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
+SDL_CREATE_LOG_VARIABLE("AppLaunch")
typedef std::pair<std::string, std::vector<ApplicationDataPtr> > AppsOnDevice;
typedef std::shared_ptr<AppsOnDevice> AppsOnDevicePtr;
@@ -58,9 +58,8 @@ class Launcher {
device_launcher_.settings().wait_time_between_apps(),
timer::kSingleShot);
} else {
- LOG4CXX_DEBUG(
- logger_,
- "All Apps on " << apps_on_device_->first << " postponed launched");
+ SDL_LOG_DEBUG("All Apps on " << apps_on_device_->first
+ << " postponed launched");
device_launcher_.StopLaunchingAppsOnDevice(apps_on_device_->first);
}
}
@@ -135,9 +134,8 @@ bool DeviceAppsLauncherImpl::LauncherFinder::operator()(
bool DeviceAppsLauncherImpl::LaunchAppsOnDevice(
const std::string& device_mac,
const std::vector<ApplicationDataPtr>& applications_to_launch) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "On Device " << device_mac << " will be launched "
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("On Device " << device_mac << " will be launched "
<< applications_to_launch.size() << " apps");
AppsOnDevicePtr apps_on_device =
std::make_shared<AppsOnDevice>(device_mac, applications_to_launch);
@@ -153,7 +151,7 @@ bool DeviceAppsLauncherImpl::LaunchAppsOnDevice(
bool DeviceAppsLauncherImpl::StopLaunchingAppsOnDevice(
const std::string& device_mac) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(launchers_lock_);
const Launchers::iterator it = std::find_if(works_launchers_.begin(),
works_launchers_.end(),
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index 3e7b4b99fe..6bc970c8a3 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -45,7 +45,7 @@
#include "smart_objects/enum_schema_item.h"
#include "utils/logger.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceManager")
+SDL_CREATE_LOG_VARIABLE("AppServiceManager")
namespace application_manager {
@@ -59,14 +59,14 @@ AppServiceManager::AppServiceManager(ApplicationManager& app_manager,
, rpc_passing_handler_(*this, app_manager_) {}
AppServiceManager::~AppServiceManager() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
smart_objects::SmartObject AppServiceManager::PublishAppService(
const smart_objects::SmartObject& manifest,
const bool mobile_service,
const uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string str_to_hash = "";
std::string service_id = "";
@@ -86,13 +86,12 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
auto found_service_id =
found_service->record[strings::service_id].asString();
if (service_by_name_id != found_service_id) {
- LOG4CXX_WARN(logger_,
- "A service already exists with this name, rejecting");
+ SDL_LOG_WARN("A service already exists with this name, rejecting");
return smart_objects::SmartObject();
}
}
}
- LOG4CXX_WARN(logger_, "Service already exists for this provider, updating");
+ SDL_LOG_WARN("Service already exists for this provider, updating");
published_services_lock_.Acquire();
found_service->record[strings::service_manifest] = manifest;
found_service->record[strings::service_published] = true;
@@ -114,7 +113,7 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
if (manifest.keyExists(strings::service_name) &&
FindServiceByName(manifest[strings::service_name].asString())) {
- LOG4CXX_WARN(logger_, "A service already exists with this name, rejecting");
+ SDL_LOG_WARN("A service already exists with this name, rejecting");
return smart_objects::SmartObject();
}
@@ -183,14 +182,14 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
}
bool AppServiceManager::UnpublishAppService(const std::string service_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ SDL_LOG_ERROR("Service id does not exist in published services");
return false;
}
- LOG4CXX_DEBUG(logger_, "Unpublishing app service: " << service_id);
+ SDL_LOG_DEBUG("Unpublishing app service: " << service_id);
SetServicePublished(service_id, false);
smart_objects::SmartObject msg_params;
@@ -222,8 +221,8 @@ bool AppServiceManager::UnpublishAppService(const std::string service_id) {
}
void AppServiceManager::UnpublishServices(const uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Unpublishing all app services: " << connection_key);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Unpublishing all app services: " << connection_key);
std::list<std::string> app_published_services;
{
@@ -242,7 +241,7 @@ void AppServiceManager::UnpublishServices(const uint32_t connection_key) {
}
void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.begin();
// Activate all services published by the app
@@ -255,7 +254,7 @@ void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) {
std::vector<smart_objects::SmartObject>
AppServiceManager::GetAllServiceRecords() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<smart_objects::SmartObject> services;
sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
@@ -269,16 +268,15 @@ void AppServiceManager::GetProviderByType(const std::string& service_type,
const bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto active_service = ActiveServiceForType(service_type);
if (!active_service) {
- LOG4CXX_ERROR(logger_,
- "There is no active service for the given service type: "
- << service_type);
+ SDL_LOG_ERROR("There is no active service for the given service type: "
+ << service_type);
return;
}
- LOG4CXX_DEBUG(logger_, "Found provider for service type: " << service_type);
+ SDL_LOG_DEBUG("Found provider for service type: " << service_type);
GetProviderFromService(*active_service, mobile_consumer, app, hmi_service);
}
@@ -286,15 +284,15 @@ void AppServiceManager::GetProviderByID(const std::string& service_id,
const bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ SDL_LOG_ERROR("Service id does not exist in published services");
return;
}
- LOG4CXX_DEBUG(logger_, "Found provider with service ID: " << service_id);
+ SDL_LOG_DEBUG("Found provider with service ID: " << service_id);
GetProviderFromService(it->second, mobile_consumer, app, hmi_service);
}
@@ -302,11 +300,11 @@ void AppServiceManager::GetProviderFromService(const AppService& service,
const bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (mobile_consumer &&
!service.record[strings::service_manifest][strings::allow_app_consumers]
.asBool()) {
- LOG4CXX_ERROR(logger_, "Service does not support app consumers");
+ SDL_LOG_ERROR("Service does not support app consumers");
return;
}
bool mobile_service = service.mobile_service;
@@ -319,11 +317,11 @@ void AppServiceManager::GetProviderFromService(const AppService& service,
}
bool AppServiceManager::SetDefaultService(const std::string service_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ SDL_LOG_ERROR("Unable to find published service " << service_id);
return false;
}
AppService& service = it->second;
@@ -350,17 +348,17 @@ bool AppServiceManager::SetDefaultService(const std::string service_id) {
}
bool AppServiceManager::RemoveDefaultService(const std::string service_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ SDL_LOG_ERROR("Unable to find published service " << service_id);
return false;
}
AppService& service = it->second;
if (!service.default_service) {
- LOG4CXX_ERROR(logger_, "Service was not default " << service_id);
+ SDL_LOG_ERROR("Service was not default " << service_id);
return false;
}
service.default_service = false;
@@ -377,17 +375,17 @@ bool AppServiceManager::RemoveDefaultService(const std::string service_id) {
}
bool AppServiceManager::ActivateAppService(const std::string service_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ SDL_LOG_ERROR("Unable to find published service " << service_id);
return false;
}
smart_objects::SmartObject& service = it->second.record;
if (service[strings::service_active].asBool()) {
- LOG4CXX_DEBUG(logger_, "Service was already active " << service_id);
+ SDL_LOG_DEBUG("Service was already active " << service_id);
return true;
}
@@ -424,11 +422,11 @@ bool AppServiceManager::ActivateAppService(const std::string service_id) {
}
bool AppServiceManager::DeactivateAppService(const std::string service_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ SDL_LOG_ERROR("Unable to find published service " << service_id);
return false;
}
smart_objects::SmartObject& service = it->second.record;
@@ -465,7 +463,7 @@ bool AppServiceManager::DeactivateAppService(const std::string service_id) {
AppService* AppServiceManager::ActiveServiceForType(
const std::string service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
@@ -481,7 +479,7 @@ AppService* AppServiceManager::ActiveServiceForType(
AppService* AppServiceManager::EmbeddedServiceForType(
const std::string service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
@@ -496,7 +494,7 @@ AppService* AppServiceManager::EmbeddedServiceForType(
AppService* AppServiceManager::FindServiceByPolicyAppID(
const std::string policy_app_id, const std::string type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
@@ -513,12 +511,12 @@ AppService* AppServiceManager::FindServiceByPolicyAppID(
}
AppService* AppServiceManager::FindServiceByID(const std::string service_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ SDL_LOG_ERROR("Service id does not exist in published services");
return NULL;
}
return &(it->second);
@@ -526,7 +524,7 @@ AppService* AppServiceManager::FindServiceByID(const std::string service_id) {
AppService* AppServiceManager::FindServiceByProvider(
const uint32_t connection_key, const std::string service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
for (auto& service : published_services_) {
if (service.second.connection_key == connection_key &&
@@ -539,7 +537,7 @@ AppService* AppServiceManager::FindServiceByProvider(
}
AppService* AppServiceManager::FindServiceByName(std::string name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
for (auto& service : published_services_) {
if (service.second.record[strings::service_manifest][strings::service_name]
@@ -552,7 +550,7 @@ AppService* AppServiceManager::FindServiceByName(std::string name) {
std::string AppServiceManager::DefaultServiceByType(
const std::string service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto last_state_accessor = last_state_->get_accessor();
Json::Value dictionary = last_state_accessor.GetData().dictionary();
@@ -564,11 +562,11 @@ std::string AppServiceManager::DefaultServiceByType(
void AppServiceManager::SetServicePublished(const std::string service_id,
const bool service_published) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
- LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ SDL_LOG_ERROR("Service id does not exist in published services");
return;
}
it->second.record[strings::service_published] = service_published;
@@ -584,7 +582,7 @@ std::string AppServiceManager::GetPolicyAppID(AppService service) {
bool AppServiceManager::UpdateNavigationCapabilities(
smart_objects::SmartObject& out_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string navi_service_type;
ns_smart_device_link::ns_smart_objects::
EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString(
@@ -623,7 +621,7 @@ void AppServiceManager::AppServiceUpdated(
const smart_objects::SmartObject& service_record,
const mobile_apis::ServiceUpdateReason::eType update_reason,
smart_objects::SmartObject& msg_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& services =
msg_params[strings::system_capability][strings::app_services_capabilities]
[strings::app_services];
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index 0bf992d68b..8f7a1e2815 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -37,7 +37,7 @@
#include "utils/logger.h"
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
namespace {
struct CommandIdComparator {
@@ -207,12 +207,14 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl()
, sub_menu_()
, sub_menu_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>())
, choice_set_map_()
- , choice_set_map_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , choice_set_map_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>())
, performinteraction_choice_set_map_()
, performinteraction_choice_set_lock_ptr_(
std::make_shared<sync_primitives::RecursiveLock>())
, window_params_map_()
- , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , window_params_map_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>())
, is_perform_interaction_active_(false)
, is_reset_global_properties_active_(false)
, perform_interaction_mode_(-1)
@@ -400,29 +402,35 @@ DynamicApplicationDataImpl::display_capabilities() const {
smart_objects::SmartObjectSPtr DynamicApplicationDataImpl::display_capabilities(
const WindowID window_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- auto result_display_caps = std::make_shared<smart_objects::SmartObject>(
- smart_objects::SmartType_Array);
- const auto window_caps =
- (*display_capabilities_)[0][strings::window_capabilities].asArray();
- if (!window_caps) {
- LOG4CXX_WARN(logger_, "Current window capabilities are empty");
+ if (!display_capabilities_) {
+ SDL_LOG_WARN("Current window capabilities are empty");
// SDL still needs to retreive display capabilities
return display_capabilities_;
}
- auto find_res =
- std::find_if(window_caps->begin(),
- window_caps->end(),
- [&window_id](const smart_objects::SmartObject& element) {
- if (window_id == element[strings::window_id].asInt()) {
- return true;
- }
- return false;
- });
+ smart_objects::SmartObject result_window_caps(
+ smart_objects::SmartType::SmartType_Map);
+
+ const auto window_caps =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ if (window_caps) {
+ auto find_res = std::find_if(
+ window_caps->begin(),
+ window_caps->end(),
+ [&window_id](const smart_objects::SmartObject& element) {
+ return (window_id == element[strings::window_id].asInt());
+ });
+
+ if (find_res != window_caps->end()) {
+ result_window_caps = *find_res;
+ }
+ }
+
+ auto result_display_caps = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
- DCHECK(find_res != window_caps->end());
const auto disp_caps_keys = (*display_capabilities_)[0].enumerate();
for (const auto& key : disp_caps_keys) {
if (strings::window_capabilities == key) {
@@ -431,7 +439,8 @@ smart_objects::SmartObjectSPtr DynamicApplicationDataImpl::display_capabilities(
(*result_display_caps)[0][key] = (*display_capabilities_)[0][key];
}
- (*result_display_caps)[0][strings::window_capabilities][0] = *find_res;
+ (*result_display_caps)[0][strings::window_capabilities][0] =
+ result_window_caps;
return result_display_caps;
}
@@ -566,7 +575,7 @@ void DynamicApplicationDataImpl::set_night_color_scheme(
}
void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis::PredefinedWindows;
smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
template_config[strings::template_layout] = layout;
@@ -575,7 +584,7 @@ void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
void DynamicApplicationDataImpl::set_display_capabilities(
const smart_objects::SmartObject& display_capabilities) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& incoming_window_capabilities =
display_capabilities[0][strings::window_capabilities];
@@ -628,7 +637,12 @@ void DynamicApplicationDataImpl::set_display_capabilities(
void DynamicApplicationDataImpl::remove_window_capability(
const WindowID window_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
+
+ if (!display_capabilities_) {
+ SDL_LOG_ERROR("Application display capabilities are not available");
+ return;
+ }
auto window_capabilities =
(*display_capabilities_)[0][strings::window_capabilities].asArray();
@@ -645,9 +659,8 @@ void DynamicApplicationDataImpl::remove_window_capability(
}
}
- LOG4CXX_WARN(
- logger_,
- "No window id " << window_id << " found in display capabilities");
+ SDL_LOG_WARN("No window id " << window_id
+ << " found in display capabilities");
}
bool DynamicApplicationDataImpl::menu_layout_supported(
@@ -682,7 +695,7 @@ bool DynamicApplicationDataImpl::menu_layout_supported(
void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id,
const std::string& layout) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
template_config[strings::template_layout] = layout;
@@ -691,21 +704,21 @@ void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id,
void DynamicApplicationDataImpl::set_day_color_scheme(
const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
window_templates_[window_id][strings::day_color_scheme] = color_scheme;
}
void DynamicApplicationDataImpl::set_night_color_scheme(
const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
window_templates_[window_id][strings::night_color_scheme] = color_scheme;
}
std::string DynamicApplicationDataImpl::window_layout(
const WindowID window_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AppWindowsTemplates::const_iterator window_template_it =
window_templates_.find(window_id);
@@ -722,7 +735,7 @@ std::string DynamicApplicationDataImpl::window_layout(
smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme(
const WindowID window_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AppWindowsTemplates::const_iterator window_template_it =
window_templates_.find(window_id);
@@ -739,7 +752,7 @@ smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme(
smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme(
const WindowID window_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AppWindowsTemplates::const_iterator window_template_it =
window_templates_.find(window_id);
@@ -765,7 +778,7 @@ void DynamicApplicationDataImpl::SetGlobalProperties(
(this->*callback)(param);
}
} else {
- LOG4CXX_WARN(logger_, "Invalid or Null smart object");
+ SDL_LOG_WARN("Invalid or Null smart object");
}
}
@@ -776,11 +789,10 @@ void DynamicApplicationDataImpl::AddCommand(
CommandsMap::const_iterator it = commands_.find(internal_id);
if (commands_.end() == it) {
commands_[internal_id] = new smart_objects::SmartObject(command);
- LOG4CXX_DEBUG(logger_,
- "Command with internal number "
- << internal_id << " and id "
- << (*commands_[internal_id])[strings::cmd_id].asUInt()
- << " is added.");
+ SDL_LOG_DEBUG("Command with internal number "
+ << internal_id << " and id "
+ << (*commands_[internal_id])[strings::cmd_id].asUInt()
+ << " is added.");
}
}
@@ -793,19 +805,17 @@ void DynamicApplicationDataImpl::RemoveCommand(const uint32_t cmd_id) {
if (it != commands_.end()) {
delete it->second;
- LOG4CXX_DEBUG(logger_,
- "Command with internal number " << (it->first) << " and id "
+ SDL_LOG_DEBUG("Command with internal number " << (it->first) << " and id "
<< cmd_id << " is removed.");
commands_.erase(it);
return;
}
- LOG4CXX_WARN(
- logger_,
- "Command with id " << cmd_id << " is not found. Removal skipped.");
+ SDL_LOG_WARN("Command with id " << cmd_id
+ << " is not found. Removal skipped.");
}
-smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand(
+smart_objects::SmartObject DynamicApplicationDataImpl::FindCommand(
const uint32_t cmd_id) {
sync_primitives::AutoLock lock(commands_lock_ptr_);
@@ -814,13 +824,13 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand(
find_if(commands_.begin(), commands_.end(), is_id_equal);
if (it != commands_.end()) {
- LOG4CXX_DEBUG(logger_,
- "Command with internal number " << (it->first) << " and id "
+ SDL_LOG_DEBUG("Command with internal number " << (it->first) << " and id "
<< cmd_id << " is found.");
- return it->second;
+ smart_objects::SmartObject command(*it->second);
+ return command;
}
- return NULL;
+ return smart_objects::SmartObject(smart_objects::SmartType_Null);
}
// TODO(VS): Create common functions for processing collections
@@ -843,15 +853,16 @@ void DynamicApplicationDataImpl::RemoveSubMenu(uint32_t menu_id) {
}
}
-smart_objects::SmartObject* DynamicApplicationDataImpl::FindSubMenu(
+smart_objects::SmartObject DynamicApplicationDataImpl::FindSubMenu(
uint32_t menu_id) const {
sync_primitives::AutoLock lock(sub_menu_lock_ptr_);
SubMenuMap::const_iterator it = sub_menu_.find(menu_id);
if (it != sub_menu_.end()) {
- return it->second;
+ smart_objects::SmartObject sub_menu(*it->second);
+ return sub_menu;
}
- return NULL;
+ return smart_objects::SmartObject(smart_objects::SmartType_Null);
}
bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
@@ -876,7 +887,7 @@ DynamicApplicationDataImpl::window_optional_params_map() const {
void DynamicApplicationDataImpl::SetWindowInfo(
const WindowID window_id, const smart_objects::SmartObject& window_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto it = window_params_map_.find(window_id);
if (window_params_map_.end() == it) {
window_params_map_[window_id] =
@@ -886,12 +897,12 @@ void DynamicApplicationDataImpl::SetWindowInfo(
DisplayCapabilitiesBuilder&
DynamicApplicationDataImpl::display_capabilities_builder() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return display_capabilities_builder_;
}
void DynamicApplicationDataImpl::RemoveWindowInfo(const WindowID window_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
window_params_map_.erase(window_id);
}
@@ -914,15 +925,16 @@ void DynamicApplicationDataImpl::RemoveChoiceSet(uint32_t choice_set_id) {
}
}
-smart_objects::SmartObject* DynamicApplicationDataImpl::FindChoiceSet(
+smart_objects::SmartObject DynamicApplicationDataImpl::FindChoiceSet(
uint32_t choice_set_id) {
sync_primitives::AutoLock lock(choice_set_map_lock_ptr_);
ChoiceSetMap::const_iterator it = choice_set_map_.find(choice_set_id);
if (it != choice_set_map_.end()) {
- return it->second;
+ smart_objects::SmartObject choice_set(*it->second);
+ return choice_set;
}
- return NULL;
+ return smart_objects::SmartObject(smart_objects::SmartType_Null);
}
void DynamicApplicationDataImpl::AddPerformInteractionChoiceSet(
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index c595f8ecf9..60070524a0 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -73,7 +73,7 @@ mobile_apis::FileType::eType StringToFileType(const char* str) {
}
} // namespace
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
namespace application_manager {
@@ -81,7 +81,7 @@ void SwitchApplicationParameters(ApplicationSharedPtr app,
const uint32_t app_id,
const size_t device_id,
const std::string& mac_address) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::shared_ptr<ApplicationImpl> application =
std::dynamic_pointer_cast<ApplicationImpl>(app);
DCHECK_OR_RETURN_VOID(application);
@@ -106,6 +106,7 @@ ApplicationImpl::ApplicationImpl(
, is_navi_(false)
, is_remote_control_supported_(false)
, mobile_projection_enabled_(false)
+ , webengine_projection_enabled_(false)
, video_streaming_approved_(false)
, audio_streaming_approved_(false)
, video_streaming_allowed_(false)
@@ -199,33 +200,39 @@ bool ApplicationImpl::is_audio() const {
}
void ApplicationImpl::ChangeSupportingAppHMIType() {
- is_navi_ = false;
- is_voice_communication_application_ = false;
- mobile_projection_enabled_ = false;
+ set_is_navi(false);
+ set_voice_communication_supported(false);
+ set_mobile_projection_enabled(false);
+ set_webengine_projection_enabled(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;
- }
- if (mobile_apis::AppHMIType::PROJECTION ==
- static_cast<mobile_apis::AppHMIType::eType>(
- array_app_types[i].asUInt())) {
- mobile_projection_enabled_ = true;
+ const auto app_hmi_type = static_cast<mobile_apis::AppHMIType::eType>(
+ array_app_types[i].asUInt());
+
+ switch (app_hmi_type) {
+ case mobile_apis::AppHMIType::NAVIGATION:
+ set_is_navi(true);
+ break;
+ case mobile_apis::AppHMIType::COMMUNICATION:
+ set_voice_communication_supported(true);
+ break;
+ case mobile_apis::AppHMIType::PROJECTION:
+ set_mobile_projection_enabled(true);
+ break;
+ case mobile_apis::AppHMIType::WEB_VIEW:
+ set_webengine_projection_enabled(true);
+ break;
+ default:
+ break;
}
}
}
-void ApplicationImpl::set_is_navi(bool allow) {
- is_navi_ = allow;
+void ApplicationImpl::set_is_navi(bool option) {
+ SDL_LOG_TRACE("option " << std::boolalpha << option);
+ is_navi_ = option;
}
bool ApplicationImpl::is_remote_control_supported() const {
@@ -240,53 +247,51 @@ bool ApplicationImpl::is_voice_communication_supported() const {
return is_voice_communication_application_;
}
-void ApplicationImpl::set_voice_communication_supported(
- bool is_voice_communication_supported) {
- is_voice_communication_application_ = is_voice_communication_supported;
+void ApplicationImpl::set_voice_communication_supported(bool option) {
+ SDL_LOG_TRACE("option " << std::boolalpha << option);
+ is_voice_communication_application_ = option;
}
bool ApplicationImpl::IsAudioApplication() const {
const bool is_audio_app =
is_media_application() || is_voice_communication_supported() || is_navi();
- LOG4CXX_DEBUG(logger_,
- std::boolalpha << "is audio app --> ((is_media_app: "
- << is_media_application() << ")"
- << " || (is_voice_communication_app: "
- << is_voice_communication_supported() << ")"
- << " || (is_navi: " << is_navi() << ")) --> "
- << is_audio_app);
+ SDL_LOG_DEBUG(std::boolalpha
+ << "is audio app --> ((is_media_app: " << is_media_application()
+ << ")"
+ << " || (is_voice_communication_app: "
+ << is_voice_communication_supported() << ")"
+ << " || (is_navi: " << is_navi() << ")) --> " << is_audio_app);
return is_audio_app;
}
bool ApplicationImpl::IsVideoApplication() const {
const bool is_video_app = is_navi() || mobile_projection_enabled();
- LOG4CXX_DEBUG(logger_,
- std::boolalpha
- << "is video app --> ((is_navi: " << is_navi() << ")"
- << " || (mobile_projection: " << mobile_projection_enabled()
- << ")) --> " << is_video_app);
+ SDL_LOG_DEBUG(std::boolalpha
+ << "is video app --> ((is_navi: " << is_navi() << ")"
+ << " || (mobile_projection: " << mobile_projection_enabled()
+ << ")) --> " << is_video_app);
return is_video_app;
}
void ApplicationImpl::SetRegularState(const WindowID window_id,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
state_.AddState(window_id, state);
}
void ApplicationImpl::RemovePostponedState(const WindowID window_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
state_.RemoveState(window_id, HmiState::STATE_ID_POSTPONED);
}
void ApplicationImpl::SetPostponedState(const WindowID window_id,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
state_.AddState(window_id, state);
}
void ApplicationImpl::set_mobile_projection_enabled(bool option) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_TRACE("option " << std::boolalpha << option);
mobile_projection_enabled_ = option;
}
@@ -294,6 +299,15 @@ bool ApplicationImpl::mobile_projection_enabled() const {
return mobile_projection_enabled_;
}
+void ApplicationImpl::set_webengine_projection_enabled(const bool option) {
+ SDL_LOG_TRACE("option " << std::boolalpha << option);
+ webengine_projection_enabled_ = option;
+}
+
+bool ApplicationImpl::webengine_projection_enabled() const {
+ return webengine_projection_enabled_;
+}
+
struct StateIDComparator {
HmiState::StateID state_id_;
StateIDComparator(HmiState::StateID state_id) : state_id_(state_id) {}
@@ -303,13 +317,13 @@ struct StateIDComparator {
};
void ApplicationImpl::AddHMIState(const WindowID window_id, HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
state_.AddState(window_id, state);
}
void ApplicationImpl::RemoveHMIState(const WindowID window_id,
HmiState::StateID state_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
state_.RemoveState(window_id, state_id);
}
@@ -324,8 +338,7 @@ const HmiStatePtr ApplicationImpl::RegularHmiState(
}
WindowNames ApplicationImpl::GetWindowNames() const {
- LOG4CXX_DEBUG(logger_,
- "Collecting window names for application " << app_id());
+ SDL_LOG_DEBUG("Collecting window names for application " << app_id());
WindowNames window_names;
std::string stringified_window_names;
@@ -339,13 +352,12 @@ WindowNames ApplicationImpl::GetWindowNames() const {
(stringified_window_names.empty() ? "" : ",") + window_name;
}
- LOG4CXX_DEBUG(logger_,
- "Existing window names: [" + stringified_window_names + "]");
+ SDL_LOG_DEBUG("Existing window names: [" + stringified_window_names + "]");
return window_names;
}
WindowIds ApplicationImpl::GetWindowIds() const {
- LOG4CXX_DEBUG(logger_, "Collecting window IDs for application " << app_id());
+ SDL_LOG_DEBUG("Collecting window IDs for application " << app_id());
return state_.GetWindowIds();
}
@@ -457,8 +469,9 @@ void ApplicationImpl::set_name(const custom_str::CustomString& name) {
app_name_ = name;
}
-void ApplicationImpl::set_is_media_application(bool is_media) {
- is_media_ = is_media;
+void ApplicationImpl::set_is_media_application(bool option) {
+ SDL_LOG_TRACE("option " << std::boolalpha << option);
+ is_media_ = option;
}
bool IsTTSState(const HmiStatePtr state) {
@@ -524,13 +537,13 @@ bool ApplicationImpl::audio_streaming_allowed() const {
bool ApplicationImpl::SetVideoConfig(protocol_handler::ServiceType service_type,
const smart_objects::SmartObject& params) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (ServiceType::kMobileNav == service_type) {
// See StartStreaming(). We issue SetVideoConfig and StartStream
// only when streaming is not approved yet
if (!video_streaming_approved()) {
- LOG4CXX_TRACE(logger_, "Video streaming not approved");
+ SDL_LOG_TRACE("Video streaming not approved");
MessageHelper::SendNaviSetVideoConfig(
app_id(), application_manager_, params);
return true;
@@ -542,19 +555,19 @@ bool ApplicationImpl::SetVideoConfig(protocol_handler::ServiceType service_type,
void ApplicationImpl::StartStreaming(
protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (ServiceType::kMobileNav == service_type) {
- LOG4CXX_TRACE(logger_, "ServiceType = Video");
+ SDL_LOG_TRACE("ServiceType = Video");
if (!video_streaming_approved()) {
- LOG4CXX_TRACE(logger_, "Video streaming not approved");
+ SDL_LOG_TRACE("Video streaming not approved");
MessageHelper::SendNaviStartStream(app_id(), application_manager_);
set_video_stream_retry_number(0);
}
} else if (ServiceType::kAudio == service_type) {
- LOG4CXX_TRACE(logger_, "ServiceType = Audio");
+ SDL_LOG_TRACE("ServiceType = Audio");
if (!audio_streaming_approved()) {
- LOG4CXX_TRACE(logger_, "Audio streaming not approved");
+ SDL_LOG_TRACE("Audio streaming not approved");
MessageHelper::SendAudioStartStream(app_id(), application_manager_);
set_audio_stream_retry_number(0);
}
@@ -564,7 +577,7 @@ void ApplicationImpl::StartStreaming(
void ApplicationImpl::StopStreamingForce(
protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// see the comment in StopStreaming()
sync_primitives::AutoLock lock(streaming_stop_lock_);
@@ -581,7 +594,7 @@ void ApplicationImpl::StopStreamingForce(
void ApplicationImpl::StopStreaming(
protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// since WakeUpStreaming() is called from another thread, it is possible that
// the stream will be restarted after we call SuspendStreaming() and before
@@ -600,7 +613,7 @@ void ApplicationImpl::StopStreaming(
}
void ApplicationImpl::StopNaviStreaming() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
video_stream_suspend_timer_.Stop();
MessageHelper::SendNaviStopStream(app_id(), application_manager_);
set_video_streaming_approved(false);
@@ -608,7 +621,7 @@ void ApplicationImpl::StopNaviStreaming() {
}
void ApplicationImpl::StopAudioStreaming() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
audio_stream_suspend_timer_.Stop();
MessageHelper::SendAudioStopStream(app_id(), application_manager_);
set_audio_streaming_approved(false);
@@ -618,7 +631,7 @@ void ApplicationImpl::StopAudioStreaming() {
void ApplicationImpl::SuspendStreaming(
protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (ServiceType::kMobileNav == service_type) {
video_stream_suspend_timer_.Stop();
@@ -638,7 +651,7 @@ void ApplicationImpl::SuspendStreaming(
void ApplicationImpl::WakeUpStreaming(
protocol_handler::ServiceType service_type, uint32_t timer_len) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// See the comment in StopStreaming(). Also, please make sure that we acquire
// streaming_stop_lock_ then xxx_streaming_suspended_lock_ in this order!
@@ -675,15 +688,15 @@ void ApplicationImpl::WakeUpStreaming(
void ApplicationImpl::OnVideoStreamSuspend() {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "Suspend video streaming by timer");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_INFO("Suspend video streaming by timer");
SuspendStreaming(ServiceType::kMobileNav);
}
void ApplicationImpl::OnAudioStreamSuspend() {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "Suspend audio streaming by timer");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_INFO("Suspend audio streaming by timer");
SuspendStreaming(ServiceType::kAudio);
}
@@ -799,8 +812,7 @@ mobile_api::HMILevel::eType ApplicationImpl::deferred_resumption_hmi_level()
bool ApplicationImpl::AddFile(const AppFile& file) {
if (app_files_.count(file.file_name) == 0) {
- LOG4CXX_INFO(logger_,
- "AddFile file " << file.file_name << " File type is "
+ SDL_LOG_INFO("AddFile file " << file.file_name << " File type is "
<< file.file_type);
app_files_[file.file_name] = file;
return true;
@@ -810,8 +822,7 @@ bool ApplicationImpl::AddFile(const AppFile& file) {
bool ApplicationImpl::UpdateFile(const AppFile& file) {
if (app_files_.count(file.file_name) != 0) {
- LOG4CXX_INFO(logger_,
- "UpdateFile file " << file.file_name << " File type is "
+ SDL_LOG_INFO("UpdateFile file " << file.file_name << " File type is "
<< file.file_type);
app_files_[file.file_name] = file;
return true;
@@ -822,8 +833,7 @@ bool ApplicationImpl::UpdateFile(const AppFile& file) {
bool ApplicationImpl::DeleteFile(const std::string& file_name) {
AppFilesMap::iterator it = app_files_.find(file_name);
if (it != app_files_.end()) {
- LOG4CXX_INFO(logger_,
- "DeleteFile file " << it->second.file_name << " File type is "
+ SDL_LOG_INFO("DeleteFile file " << it->second.file_name << " File type is "
<< it->second.file_type);
app_files_.erase(it);
return true;
@@ -881,8 +891,7 @@ bool ApplicationImpl::AreCommandLimitsExceeded(
CommandNumberTimeLimit::iterator it =
cmd_number_to_time_limits_.find(cmd_id);
if (cmd_number_to_time_limits_.end() == it) {
- LOG4CXX_WARN(logger_,
- "Limits for command id " << cmd_id << "had not been set.");
+ SDL_LOG_WARN("Limits for command id " << cmd_id << "had not been set.");
return true;
}
@@ -898,19 +907,18 @@ bool ApplicationImpl::AreCommandLimitsExceeded(
frequency_restrictions =
application_manager_.get_settings().get_vehicle_data_frequency();
} else {
- LOG4CXX_INFO(logger_, "No restrictions for request");
+ SDL_LOG_INFO("No restrictions for request");
return false;
}
- LOG4CXX_INFO(logger_,
- "Time Info: "
- << "\n Current: " << date_time::getSecs(current)
- << "\n Limit: (" << date_time::getSecs(limit.first)
- << "," << limit.second
- << ")"
- "\n frequency_restrictions: ("
- << frequency_restrictions.first << ","
- << frequency_restrictions.second << ")");
+ SDL_LOG_INFO("Time Info: "
+ << "\n Current: " << date_time::getSecs(current)
+ << "\n Limit: (" << date_time::getSecs(limit.first) << ","
+ << limit.second
+ << ")"
+ "\n frequency_restrictions: ("
+ << frequency_restrictions.first << ","
+ << frequency_restrictions.second << ")");
if (date_time::getSecs(current) <
date_time::getSecs(limit.first) + frequency_restrictions.second) {
if (limit.second < frequency_restrictions.first) {
@@ -969,7 +977,7 @@ bool ApplicationImpl::AreCommandLimitsExceeded(
break;
}
default: {
- LOG4CXX_WARN(logger_, "Limit source is not implemented.");
+ SDL_LOG_WARN("Limit source is not implemented.");
break;
}
}
@@ -1002,7 +1010,7 @@ void ApplicationImpl::set_is_application_data_changed(
}
void ApplicationImpl::UpdateHash() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hash_val_ =
utils::gen_hash(application_manager_.get_settings().hash_string_size());
set_is_application_data_changed(true);
@@ -1039,7 +1047,7 @@ void ApplicationImpl::CleanupFiles() {
app_files_it = app_files_.find(file_name);
if ((app_files_it == app_files_.end()) ||
(!app_files_it->second.is_persistent)) {
- LOG4CXX_INFO(logger_, "DeleteFile file " << file_name);
+ SDL_LOG_INFO("DeleteFile file " << file_name);
file_system::DeleteFile(file_name);
}
}
@@ -1091,9 +1099,8 @@ void ApplicationImpl::LoadPersistentFiles() {
file.file_type = StringToFileType(file_type.c_str());
}
- LOG4CXX_INFO(logger_,
- "Loaded persistent file "
- << file.file_name << " File type is " << file.file_type);
+ SDL_LOG_INFO("Loaded persistent file "
+ << file.file_name << " File type is " << file.file_type);
AddFile(file);
}
}
@@ -1155,7 +1162,7 @@ struct FindSoftButtonId {
};
bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
for (; it != cmd_softbuttonid_.end(); ++it) {
@@ -1171,7 +1178,7 @@ bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
}
WindowID ApplicationImpl::GetSoftButtonWindowID(const uint32_t softbutton_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
@@ -1207,9 +1214,9 @@ void ApplicationImpl::set_audio_streaming_state(
const mobile_api::AudioStreamingState::eType& state) {
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");
+ SDL_LOG_WARN(
+ "Trying to set audio streaming state"
+ " for non-media application to different from NOT_AUDIBLE");
return;
}
@@ -1236,7 +1243,7 @@ void ApplicationImpl::set_hmi_level(
DCHECK_OR_RETURN_VOID(app)
application_manager_.state_controller().SetRegularState(
app, window_id, new_hmi_level);
- LOG4CXX_INFO(logger_, "hmi_level = " << new_hmi_level);
+ SDL_LOG_INFO("hmi_level = " << new_hmi_level);
usage_report_.RecordHmiStateChanged(new_hmi_level);
}
@@ -1247,12 +1254,13 @@ AppExtensionPtr ApplicationImpl::QueryInterface(AppExtensionUID uid) {
return (*it);
}
}
-
return AppExtensionPtr();
}
bool ApplicationImpl::AddExtension(AppExtensionPtr extension) {
if (!QueryInterface(extension->uid())) {
+ SDL_LOG_TRACE("Add extenstion to add id" << app_id() << " with uid "
+ << extension->uid());
extensions_.push_back(extension);
return true;
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 53b84caed8..8d4d2c8bec 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -117,8 +117,7 @@ DeviceTypes devicesType = {
bool device_id_comparator(const std::string& device_id,
ApplicationSharedPtr app) {
DCHECK_OR_RETURN(app, false);
- LOG4CXX_DEBUG(logger_,
- "Data to compare: device_id : " << device_id << " app mac: "
+ SDL_LOG_DEBUG("Data to compare: device_id : " << device_id << " app mac: "
<< app->mac_address());
return device_id == app->mac_address();
@@ -228,7 +227,7 @@ ApplicationManagerImpl::ApplicationManagerImpl(
}
ApplicationManagerImpl::~ApplicationManagerImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_stopping_ = true;
SendOnSDLClose();
@@ -244,7 +243,7 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
mobile_so_factory_ = NULL;
}
protocol_handler_ = NULL;
- LOG4CXX_DEBUG(logger_, "Destroying Policy Handler");
+ SDL_LOG_DEBUG("Destroying Policy Handler");
RemovePolicyObserver(this);
{
@@ -354,16 +353,17 @@ ApplicationSharedPtr ApplicationManagerImpl::get_full_or_limited_application()
return FindApp(accessor, FullOrLimitedAppPredicate);
}
-bool LimitedAppPredicate(const ApplicationSharedPtr app) {
- return app ? app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
- mobile_api::HMILevel::HMI_LIMITED
+bool LimitedMediaAppPredicate(const ApplicationSharedPtr app) {
+ return app ? (app->is_media_application() &&
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
const {
DataAccessor<ApplicationSet> accessor = applications();
- return FindApp(accessor, LimitedAppPredicate);
+ return FindApp(accessor, LimitedMediaAppPredicate);
}
bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
@@ -463,7 +463,7 @@ void ApplicationManagerImpl::IviInfoUpdated(const std::string& vehicle_info,
}
void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app);
@@ -471,14 +471,14 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
}
void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
commands_holder_->Resume(app, CommandHolder::CommandType::kMobileCommand);
commands_holder_->Resume(app, CommandHolder::CommandType::kHmiCommand);
}
bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
ApplicationConstSharedPtr app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool voice_state = app->is_voice_communication_supported();
bool media_state = app->is_media_application();
bool navi_state = app->is_navi();
@@ -546,7 +546,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
const std::shared_ptr<smart_objects::SmartObject>&
request_for_registration) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& message = *request_for_registration;
uint32_t connection_key =
@@ -561,7 +561,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
DCHECK_OR_RETURN(connection_handler_, ApplicationSharedPtr());
if (connection_handler().get_session_observer().GetDataOnSessionKey(
connection_key, &app_id, &sessions_list, &device_id) == -1) {
- LOG4CXX_ERROR(logger_, "Failed to create application: no connection info.");
+ SDL_LOG_ERROR("Failed to create application: no connection info.");
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
connection_key,
@@ -581,20 +581,18 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
std::string connection_type;
if (connection_handler().get_session_observer().GetDataOnDeviceID(
device_id, NULL, NULL, &device_mac, &connection_type) == -1) {
- LOG4CXX_DEBUG(logger_, "Failed to extract device mac for id " << device_id);
+ SDL_LOG_DEBUG("Failed to extract device mac for id " << device_id);
} else {
- LOG4CXX_DEBUG(logger_,
- "Device mac for id" << device_id << " is " << device_mac);
+ SDL_LOG_DEBUG("Device mac for id " << device_id << " is " << device_mac);
}
- LOG4CXX_DEBUG(logger_, "Restarting application list update timer");
+ SDL_LOG_DEBUG("Restarting application list update timer");
GetPolicyHandler().OnAppsSearchStarted();
uint32_t timeout = get_settings().application_list_update_timeout();
application_list_update_timer_.Start(timeout, timer::kSingleShot);
if (!is_all_apps_allowed_) {
- LOG4CXX_WARN(logger_,
- "RegisterApplication: access to app's disabled by user");
+ SDL_LOG_WARN("RegisterApplication: access to app's disabled by user");
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
connection_key,
@@ -780,10 +778,10 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
using namespace mobile_api;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(app, false);
- LOG4CXX_DEBUG(logger_, "Activating application with id:" << app->app_id());
+ SDL_LOG_DEBUG("Activating application with id: " << app->app_id());
// Remove from resumption if app was activated by user
resume_controller().OnAppActivated(app);
@@ -799,9 +797,9 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app) {
- LOG4CXX_ERROR(logger_, "Application pointer invalid");
+ SDL_LOG_ERROR("Application pointer invalid");
NOTREACHED();
return mobile_api::HMILevel::INVALID_ENUM;
}
@@ -818,27 +816,24 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
} else if (is_active_app_exist && (!is_audio_app)) {
result = GetDefaultHmiLevel(app);
}
- LOG4CXX_ERROR(
- logger_,
- "is_audio_app : " << is_audio_app
- << "; does_audio_app_with_same_type_exist : "
- << does_audio_app_with_same_type_exist
- << "; is_active_app_exist : " << is_active_app_exist
- << "; result : " << result);
+ SDL_LOG_ERROR("is_audio_app : "
+ << is_audio_app << "; does_audio_app_with_same_type_exist : "
+ << does_audio_app_with_same_type_exist
+ << "; is_active_app_exist : " << is_active_app_exist
+ << "; result : " << result);
return result;
}
void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) {
// TODO(VS): Call function from ConnectionHandler
if (!connection_handler_) {
- LOG4CXX_WARN(logger_, "Connection handler is not set.");
+ SDL_LOG_WARN("Connection handler is not set.");
return;
}
connection_handler::DeviceHandle handle;
if (!connection_handler().GetDeviceID(device_mac, &handle)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Attempt to connect to invalid device with mac:" << device_mac);
return;
}
@@ -846,7 +841,7 @@ void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) {
}
void ApplicationManagerImpl::OnHMIReady() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
connection_handler_->CreateWebEngineDevice();
@@ -871,7 +866,7 @@ void ApplicationManagerImpl::OnHMIReady() {
}
void ApplicationManagerImpl::RequestForInterfacesAvailability() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::shared_ptr<smart_objects::SmartObject> is_ivi_ready(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::VehicleInfo_IsReady, *this));
@@ -912,7 +907,7 @@ std::string ApplicationManagerImpl::PolicyIDByIconUrl(const std::string url) {
auto policy_id = x.first;
std::string icon_url = GetPolicyHandler().GetIconUrl(policy_id);
if (icon_url == url) {
- LOG4CXX_DEBUG(logger_, "Matched icon url: " << url);
+ SDL_LOG_DEBUG("Matched icon url: " << url);
x.second.pending_request = false;
return policy_id;
}
@@ -937,7 +932,7 @@ void ApplicationManagerImpl::SetIconFileFromSystemRequest(
const std::string app_icon_dir(settings_.app_icons_folder());
const std::string full_icon_path(app_icon_dir + "/" + policy_id);
if (file_system::FileExists(full_icon_path)) {
- LOG4CXX_DEBUG(logger_, "Set Icon Path: " << full_icon_path);
+ SDL_LOG_DEBUG("Set Icon Path: " << full_icon_path);
AppFile file;
file.is_persistent = true;
file.is_download_complete = true;
@@ -962,14 +957,14 @@ void ApplicationManagerImpl::SetIconFileFromSystemRequest(
void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) {
#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
- LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ SDL_LOG_TRACE("Cloud app support is disabled. Exiting function");
return;
#else
std::string policy_app_id = app->policy_app_id();
policy::AppProperties app_properties;
GetPolicyHandler().GetAppProperties(policy_app_id, app_properties);
if (app->IsRegistered() && app->is_cloud_app()) {
- LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now");
+ SDL_LOG_DEBUG("Disabled app is registered, unregistering now");
GetRPCService().ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
app->app_id(),
@@ -989,17 +984,17 @@ void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) {
app_properties.transport_type,
app_properties.hybrid_app_preference};
// Create device in pending state
- LOG4CXX_DEBUG(logger_, "Re-adding the cloud app device");
+ SDL_LOG_DEBUG("Re-adding the cloud app device");
connection_handler().AddCloudAppDevice(policy_app_id, properties);
#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
void ApplicationManagerImpl::RefreshCloudAppInformation() {
#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
- LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ SDL_LOG_TRACE("Cloud app support is disabled. Exiting function");
return;
#else
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (is_stopping()) {
return;
}
@@ -1035,7 +1030,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
GetPolicyHandler().GetInitialAppData(policy_id, &nicknames, &app_hmi_types);
if (nicknames.empty()) {
- LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ SDL_LOG_ERROR("Cloud App missing nickname");
continue;
} else if (mobile_apis::HybridAppPreference::MOBILE ==
hybrid_app_preference) {
@@ -1045,9 +1040,8 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
auto apps = applications_by_name(*nickname_it);
for (auto app : apps) {
if (app.use_count() != 0 && !app->is_cloud_app()) {
- LOG4CXX_ERROR(logger_,
- "Mobile app already registered for cloud app: "
- << *nickname_it);
+ SDL_LOG_ERROR("Mobile app already registered for cloud app: "
+ << *nickname_it);
duplicate_found = true;
break;
}
@@ -1083,13 +1077,13 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
std::string url = GetPolicyHandler().GetIconUrl(policy_id);
if (url.empty()) {
- LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app");
+ SDL_LOG_DEBUG("No Icon Url for cloud app");
continue;
}
auto app_icon_it = app_icon_map_.find(policy_id);
if (app_icon_it != app_icon_map_.end()) {
- LOG4CXX_DEBUG(logger_, "Cloud App Already Exists in Icon Map");
+ SDL_LOG_DEBUG("Cloud App Already Exists in Icon Map");
continue;
}
@@ -1097,8 +1091,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
const std::string full_icon_path(app_icon_dir + "/" + policy_id);
if (!file_system::FileExists(full_icon_path)) {
AppIconInfo icon_info(app_properties.endpoint, false);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Inserting cloud app into icon map: " << app_icon_map_.size());
app_icon_map_.insert(
std::pair<std::string, AppIconInfo>(policy_id, icon_info));
@@ -1121,9 +1114,8 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
ApplicationSet::iterator it = std::find_if(
apps_to_register_.begin(), apps_to_register_.end(), finder);
if (it == apps_to_register_.end()) {
- LOG4CXX_DEBUG(
- logger_,
- "Unable to find app to remove (" << policy_app_id << "), skipping");
+ SDL_LOG_DEBUG("Unable to find app to remove (" << policy_app_id
+ << "), skipping");
continue;
}
app = *it;
@@ -1132,7 +1124,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
// If the disabled app is registered, unregistered it before destroying the
// device
if (app->IsRegistered() && app->is_cloud_app()) {
- LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now");
+ SDL_LOG_DEBUG("Disabled app is registered, unregistering now");
GetRPCService().ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
app->app_id(),
@@ -1148,7 +1140,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
// Update app list if disabled apps were removed
if (removed_app_count > 0) {
- LOG4CXX_DEBUG(logger_, "Removed " << removed_app_count << " disabled apps");
+ SDL_LOG_DEBUG("Removed " << removed_app_count << " disabled apps");
SendUpdateAppList();
}
#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
@@ -1158,7 +1150,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
const transport_manager::ConnectionUID connection_id,
const transport_manager::DeviceInfo& device_info,
connection_handler::DeviceHandle device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string name = device_info.name();
pending_device_map_lock_ptr_->Acquire();
@@ -1178,7 +1170,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
policy_app_id, &nicknames, &app_hmi_types);
if (nicknames.empty()) {
- LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ SDL_LOG_ERROR("Cloud App missing nickname");
return;
}
@@ -1194,7 +1186,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
*this));
if (!application) {
- LOG4CXX_INFO(logger_, "Could not create application");
+ SDL_LOG_INFO("Could not create application");
return;
}
@@ -1214,9 +1206,8 @@ void ApplicationManagerImpl::CreatePendingApplication(
&hybrid_app_preference_enum);
if (!app_properties.hybrid_app_preference.empty() && !convert_result) {
- LOG4CXX_ERROR(logger_,
- "Could not convert string to enum: "
- << app_properties.hybrid_app_preference);
+ SDL_LOG_ERROR("Could not convert string to enum: "
+ << app_properties.hybrid_app_preference);
return;
}
@@ -1228,33 +1219,29 @@ void ApplicationManagerImpl::CreatePendingApplication(
application->set_cloud_app_certificate(app_properties.certificate);
sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
- LOG4CXX_DEBUG(logger_,
- "apps_to_register_ size before: " << apps_to_register_.size());
+ SDL_LOG_DEBUG("apps_to_register_ size before: " << apps_to_register_.size());
apps_to_register_.insert(application);
- LOG4CXX_DEBUG(logger_,
- "apps_to_register_ size after: " << apps_to_register_.size());
+ SDL_LOG_DEBUG("apps_to_register_ size after: " << apps_to_register_.size());
SendUpdateAppList();
}
void ApplicationManagerImpl::RemovePendingApplication(
const std::string& policy_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
PolicyAppIdPredicate finder(policy_app_id);
auto app_it =
std::find_if(apps_to_register_.begin(), apps_to_register_.end(), finder);
if (apps_to_register_.end() == app_it) {
- LOG4CXX_WARN(
- logger_,
- "Unable to find app to remove (" << policy_app_id << "), skipping");
+ SDL_LOG_WARN("Unable to find app to remove (" << policy_app_id
+ << "), skipping");
return;
}
apps_to_register_.erase(app_it);
- LOG4CXX_DEBUG(logger_,
- "Remove " << policy_app_id
+ SDL_LOG_DEBUG("Remove " << policy_app_id
<< " from apps_to_register_. new size = "
<< apps_to_register_.size());
}
@@ -1268,8 +1255,7 @@ void ApplicationManagerImpl::CreatePendingLocalApplication(
policy_app_id, &nicknames, &app_hmi_types);
if (nicknames.empty()) {
- LOG4CXX_ERROR(logger_,
- "Cloud/Web App " << policy_app_id << "missing nickname");
+ SDL_LOG_ERROR("Cloud/Web App " << policy_app_id << " missing nickname");
return;
}
@@ -1301,9 +1287,8 @@ void ApplicationManagerImpl::CreatePendingLocalApplication(
&hybrid_app_preference_enum);
if (!app_properties.hybrid_app_preference.empty() && !convert_result) {
- LOG4CXX_ERROR(logger_,
- "Could not convert string to enum: "
- << app_properties.hybrid_app_preference);
+ SDL_LOG_ERROR("Could not convert string to enum: "
+ << app_properties.hybrid_app_preference);
return;
}
@@ -1316,18 +1301,17 @@ void ApplicationManagerImpl::CreatePendingLocalApplication(
sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
apps_to_register_.insert(application);
- LOG4CXX_DEBUG(logger_,
- "Insert " << application->name().c_str()
+ SDL_LOG_DEBUG("Insert " << application->name().c_str()
<< " to apps_to_register_. new size = "
<< apps_to_register_.size());
}
void ApplicationManagerImpl::OnWebEngineDeviceCreated() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps();
if (enabled_local_apps.empty()) {
- LOG4CXX_DEBUG(logger_, "No enabled local apps present");
+ SDL_LOG_DEBUG("No enabled local apps present");
return;
}
@@ -1355,8 +1339,7 @@ void ApplicationManagerImpl::SetPendingApplicationState(
if (!app) {
return;
}
- LOG4CXX_DEBUG(logger_,
- "Unregister application and move into apps_to_register");
+ SDL_LOG_DEBUG("Unregister application and move into apps_to_register");
UnregisterApplication(
app->app_id(), mobile_apis::Result::INVALID_ENUM, true, true);
@@ -1472,8 +1455,8 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key,
int32_t sampling_rate,
int32_t bits_per_sample,
int32_t audio_type) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "START MICROPHONE RECORDER");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_INFO("START MICROPHONE RECORDER");
DCHECK_OR_RETURN_VOID(media_manager_);
media_manager_->StartMicrophoneRecording(
session_key,
@@ -1485,7 +1468,7 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key,
}
void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
DCHECK_OR_RETURN_VOID(media_manager_);
media_manager_->StopMicrophoneRecording(application_key);
@@ -1497,9 +1480,9 @@ std::string ApplicationManagerImpl::GetDeviceName(
std::string device_name = "";
if (connection_handler().get_session_observer().GetDataOnDeviceID(
handle, &device_name, NULL, NULL, NULL) == -1) {
- LOG4CXX_ERROR(logger_, "Failed to extract device name for id " << handle);
+ SDL_LOG_ERROR("Failed to extract device name for id " << handle);
} else {
- LOG4CXX_DEBUG(logger_, "\t\t\t\t\tDevice name is " << device_name);
+ SDL_LOG_DEBUG("\t\t\t\t\tDevice name is " << device_name);
}
return device_name;
@@ -1515,7 +1498,7 @@ ApplicationManagerImpl::GetDeviceTransportType(
if (it != devicesType.end()) {
return devicesType[transport_type];
} else {
- LOG4CXX_ERROR(logger_, "Unknown transport type " << transport_type);
+ SDL_LOG_ERROR("Unknown transport type " << transport_type);
}
return result;
@@ -1565,7 +1548,7 @@ std::string ApplicationManagerImpl::GetCorrectMobileIDFromMessage(
if ((*message)[strings::msg_params].keyExists(strings::full_app_id)) {
return (*message)[strings::msg_params][strings::full_app_id].asString();
} else {
- LOG4CXX_DEBUG(logger_, "UseFullAppID is on but only short ID given!");
+ SDL_LOG_DEBUG("UseFullAppID is on but only short ID given!");
}
}
// If core isn't using full or no full given, use regular appID
@@ -1586,7 +1569,7 @@ void application_manager::ApplicationManagerImpl::MarkAppsGreyOut(
void ApplicationManagerImpl::OnDeviceListUpdated(
const connection_handler::DeviceMap& device_list) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// add device to policy DB
connection_handler::DeviceMap::const_iterator it = device_list.begin();
@@ -1610,7 +1593,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
smart_objects::SmartObjectSPtr msg_params =
MessageHelper::CreateDeviceListSO(device_list, GetPolicyHandler(), *this);
if (!msg_params) {
- LOG4CXX_WARN(logger_, "Failed to create sub-smart object.");
+ SDL_LOG_WARN("Failed to create sub-smart object.");
return;
}
@@ -1631,7 +1614,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
connection_handler().ConnectToAllDevices();
- LOG4CXX_DEBUG(logger_, "Starting application list update timer");
+ SDL_LOG_DEBUG("Starting application list update timer");
uint32_t timeout = get_settings().application_list_update_timeout();
application_list_update_timer_.Start(timeout, timer::kSingleShot);
GetPolicyHandler().OnAppsSearchStarted();
@@ -1639,13 +1622,13 @@ void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
void ApplicationManagerImpl::OnQueryAppsRequest(
const connection_handler::DeviceHandle device) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(query_apps_devices_lock_);
query_apps_devices_.insert(device);
}
void ApplicationManagerImpl::SendUpdateAppList() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
using namespace hmi_apis;
@@ -1667,7 +1650,7 @@ void ApplicationManagerImpl::SendUpdateAppList() {
void ApplicationManagerImpl::RemoveDevice(
const connection_handler::DeviceHandle& device_handle) {
- LOG4CXX_DEBUG(logger_, "device_handle " << device_handle);
+ SDL_LOG_DEBUG("device_handle " << device_handle);
sync_primitives::AutoLock lock(query_apps_devices_lock_);
query_apps_devices_.erase(device_handle);
}
@@ -1675,7 +1658,7 @@ void ApplicationManagerImpl::RemoveDevice(
void ApplicationManagerImpl::OnDeviceSwitchingStart(
const connection_handler::Device& device_from,
const connection_handler::Device& device_to) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ReregisterWaitList wait_list;
{
auto apps_data_accessor = applications();
@@ -1707,7 +1690,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart(
void ApplicationManagerImpl::OnDeviceSwitchingFinish(
const std::string& device_uid) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
UNUSED(device_uid);
ReregisterWaitList wait_list;
@@ -1731,17 +1714,15 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app,
const uint32_t connection_key,
const size_t device_id,
const std::string& mac_address) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
DCHECK_OR_RETURN_VOID(1 == applications_.erase(app));
- LOG4CXX_DEBUG(logger_,
- "Changing app id to " << connection_key
- << ". Changing device id to "
- << device_id);
+ SDL_LOG_DEBUG("Changing app id to "
+ << connection_key << ". Changing device id to " << device_id);
- bool is_subscribed_to_way_points = IsAppSubscribedForWayPoints(app);
+ bool is_subscribed_to_way_points = IsAppSubscribedForWayPoints(*app);
if (is_subscribed_to_way_points) {
UnsubscribeAppFromWayPoints(app);
}
@@ -1763,7 +1744,7 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app,
mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
ApplicationConstSharedPtr application) const {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
HMILevel::eType default_hmi = HMILevel::HMI_NONE;
if (GetPolicyHandler().PolicyEnabled()) {
@@ -1780,13 +1761,11 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
} else if ("NONE" == default_hmi_string) {
default_hmi = HMILevel::HMI_NONE;
} else {
- LOG4CXX_ERROR(
- logger_,
- "Unable to convert " + default_hmi_string + " to HMILevel");
+ SDL_LOG_ERROR("Unable to convert " + default_hmi_string +
+ " to HMILevel");
}
} else {
- LOG4CXX_ERROR(logger_,
- "Unable to get default hmi_level for " << policy_app_id);
+ SDL_LOG_ERROR("Unable to get default hmi_level for " << policy_app_id);
}
}
return default_hmi;
@@ -1795,7 +1774,7 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
bool ApplicationManagerImpl::CheckResumptionRequiredTransportAvailable(
ApplicationConstSharedPtr application) const {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::map<std::string, std::vector<std::string> >& transport_map =
get_settings().transport_required_for_resumption_map();
@@ -1870,14 +1849,14 @@ uint32_t ApplicationManagerImpl::GenerateGrammarID() {
}
uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t hmi_app_id = get_rand_from_range(1);
- LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id);
+ SDL_LOG_DEBUG("GenerateNewHMIAppID value is: " << hmi_app_id);
while (resume_controller().IsHMIApplicationIdExist(hmi_app_id)) {
- LOG4CXX_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists.");
+ SDL_LOG_DEBUG("HMI appID " << hmi_app_id << " is exists.");
hmi_app_id = get_rand_from_range(1);
- LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id);
+ SDL_LOG_DEBUG("Trying new value: " << hmi_app_id);
}
return hmi_app_id;
@@ -1888,7 +1867,7 @@ bool ApplicationManagerImpl::StartNaviService(
protocol_handler::ServiceType service_type,
const BsonObject* params) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (HMIStateAllowsStreaming(app_id, service_type)) {
{
@@ -1901,7 +1880,7 @@ bool ApplicationManagerImpl::StartNaviService(
std::pair<uint32_t, std::pair<bool, bool> >(
app_id, std::make_pair(false, false)));
if (!res.second) {
- LOG4CXX_WARN(logger_, "Navi service refused");
+ SDL_LOG_WARN("Navi service refused");
return false;
}
it = res.first;
@@ -1915,14 +1894,11 @@ bool ApplicationManagerImpl::StartNaviService(
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
for (auto app : applications_) {
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_DEBUG(logger_,
- "Continue, Not Navi App Id: " << app->app_id());
+ SDL_LOG_DEBUG("Continue, Not Navi App Id: " << app->app_id());
continue;
}
- LOG4CXX_DEBUG(logger_,
- "Abort Stream Service of other NaviAppId: "
- << app->app_id()
- << " Service_type: " << service_type);
+ SDL_LOG_DEBUG("Abort Stream Service of other NaviAppId: "
+ << app->app_id() << " Service_type: " << service_type);
StopNaviService(app->app_id(), service_type);
}
}
@@ -1946,7 +1922,7 @@ bool ApplicationManagerImpl::StartNaviService(
OnStreamingConfigured(app_id, service_type, false, rejected_params);
return false;
} else if (!converted_params.empty()) {
- LOG4CXX_INFO(logger_, "Sending video configuration params");
+ SDL_LOG_INFO("Sending video configuration params");
MessageHelper::PrintSmartObject(converted_params);
bool request_sent =
application(app_id)->SetVideoConfig(service_type, converted_params);
@@ -1961,7 +1937,7 @@ bool ApplicationManagerImpl::StartNaviService(
return true;
} else {
- LOG4CXX_WARN(logger_, "Refused navi service by HMI level");
+ SDL_LOG_WARN("Refused navi service by HMI level");
}
std::vector<std::string> empty;
OnStreamingConfigured(app_id, service_type, false, empty);
@@ -1974,11 +1950,10 @@ void ApplicationManagerImpl::OnStreamingConfigured(
bool result,
std::vector<std::string>& rejected_params) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_INFO(logger_,
- "OnStreamingConfigured called for service "
- << service_type << ", result=" << result);
+ SDL_LOG_INFO("OnStreamingConfigured called for service "
+ << service_type << ", result=" << result);
if (result) {
std::vector<std::string> empty;
@@ -1987,7 +1962,7 @@ void ApplicationManagerImpl::OnStreamingConfigured(
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it) {
- LOG4CXX_WARN(logger_, "Application not found in navi status map");
+ SDL_LOG_WARN("Application not found in navi status map");
connection_handler().NotifyServiceStartedResult(app_id, false, empty);
return;
}
@@ -2032,35 +2007,33 @@ void ApplicationManagerImpl::OnStreamingConfigured(
void ApplicationManagerImpl::StopNaviService(
uint32_t app_id, protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(navi_service_status_lock_);
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it) {
- LOG4CXX_WARN(logger_,
- "No Information about navi service " << service_type);
+ SDL_LOG_WARN("No Information about navi service " << service_type);
// Fix: Need return for Not navi service at now
return;
} else {
// Fix: Repeated tests are not executed after they have stopped for Navi
if (false == it->second.first &&
ServiceType::kMobileNav == service_type) {
- LOG4CXX_DEBUG(logger_, "appId: " << app_id << "Navi had stopped");
+ SDL_LOG_DEBUG("appId: " << app_id << "Navi had stopped");
return;
}
// Fix: Repeated tests are not executed after they have stopped for Audio
if (false == it->second.second && ServiceType::kAudio == service_type) {
- LOG4CXX_DEBUG(logger_, "appId: " << app_id << "Audio had stopped");
+ SDL_LOG_DEBUG("appId: " << app_id << "Audio had stopped");
return;
}
// Fill NaviServices map. Set false to first value of pair if
// we've stopped video service or to second value if we've
// stopped audio service
- LOG4CXX_DEBUG(logger_,
- "appId: " << app_id << " service_type: " << service_type
+ SDL_LOG_DEBUG("appId: " << app_id << " service_type: " << service_type
<< " to stopped");
service_type == ServiceType::kMobileNav ? it->second.first = false
: it->second.second = false;
@@ -2070,7 +2043,7 @@ void ApplicationManagerImpl::StopNaviService(
// because Not set Allowstream flag
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_ERROR(logger_, "Navi/Projection application not found");
+ SDL_LOG_ERROR("Navi/Projection application not found");
return;
}
if (service_type == ServiceType::kMobileNav) {
@@ -2085,7 +2058,7 @@ void ApplicationManagerImpl::StopNaviService(
ApplicationSharedPtr app = application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_, "An application is not registered.");
+ SDL_LOG_WARN("An application is not registered.");
return;
}
@@ -2099,22 +2072,20 @@ void ApplicationManagerImpl::OnServiceStartedCallback(
const BsonObject* params) {
using namespace helpers;
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "ServiceType = " << type << ". Session = " << std::hex << session_key);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("ServiceType = " << type << ". Session = " << std::hex
+ << session_key);
std::vector<std::string> empty;
if (kRpc == type) {
- LOG4CXX_DEBUG(logger_, "RPC service is about to be started.");
+ SDL_LOG_DEBUG("RPC service is about to be started.");
connection_handler().NotifyServiceStartedResult(session_key, true, empty);
return;
}
ApplicationSharedPtr app = application(session_key);
if (!app) {
- LOG4CXX_WARN(
- logger_,
- "The application with id:" << session_key << " doesn't exists.");
+ SDL_LOG_WARN("The application with id:" << session_key
+ << " doesn't exists.");
connection_handler().NotifyServiceStartedResult(session_key, false, empty);
return;
}
@@ -2123,14 +2094,14 @@ void ApplicationManagerImpl::OnServiceStartedCallback(
type, ServiceType::kMobileNav, ServiceType::kAudio)) {
if (app->is_navi() || app->mobile_projection_enabled()) {
if (!StartNaviService(session_key, type, params)) {
- LOG4CXX_WARN(logger_, "Starting Navigation service failed");
+ SDL_LOG_WARN("Starting Navigation service failed");
}
return;
} else {
- LOG4CXX_WARN(logger_, "Refuse not navi/projection application");
+ SDL_LOG_WARN("Refuse not navi/projection application");
}
} else {
- LOG4CXX_WARN(logger_, "Refuse unknown service");
+ SDL_LOG_WARN("Refuse unknown service");
}
connection_handler().NotifyServiceStartedResult(session_key, false, empty);
@@ -2145,10 +2116,9 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
using namespace connection_handler;
using namespace mobile_apis;
- LOG4CXX_DEBUG(logger_,
- "OnServiceEndedCallback for service "
- << type << " with reason " << close_reason
- << " in session 0x" << std::hex << session_key);
+ SDL_LOG_DEBUG("OnServiceEndedCallback for service "
+ << type << " with reason " << close_reason << " in session 0x"
+ << std::hex << session_key);
auto app = application(static_cast<uint32_t>(session_key));
if (!app) {
@@ -2156,13 +2126,12 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
}
if (IsAppInReconnectMode(app->device(), app->policy_app_id())) {
- LOG4CXX_DEBUG(logger_,
- "Application is in reconnection list and won't be closed.");
+ SDL_LOG_DEBUG("Application is in reconnection list and won't be closed.");
return;
}
if (type == kRpc) {
- LOG4CXX_INFO(logger_, "Remove application.");
+ SDL_LOG_INFO("Remove application.");
/* In case it was unexpected disconnect or some special case
(malformed message, flood) application will be removed
and we will unregister application correctly, but in case it was
@@ -2221,13 +2190,12 @@ void ApplicationManagerImpl::ProcessServiceStatusUpdate(
hmi_apis::Common_ServiceEvent::eType service_event,
utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType>
service_update_reason) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_DEBUG(logger_,
- "Processing status update with connection key: "
- << connection_key << " service type: " << service_type
- << " service_event " << service_event
- << " service_update_reason " << service_update_reason);
+ SDL_LOG_DEBUG("Processing status update with connection key: "
+ << connection_key << " service type: " << service_type
+ << " service_event " << service_event
+ << " service_update_reason " << service_update_reason);
const auto app = application(connection_key);
@@ -2254,9 +2222,9 @@ void ApplicationManagerImpl::ProcessServiceStatusUpdate(
bool ApplicationManagerImpl::HandleRejectedServiceStatus(
ApplicationSharedPtr app,
const hmi_apis::Common_ServiceType::eType service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app) {
- LOG4CXX_WARN(logger_, "Received invalid app");
+ SDL_LOG_WARN("Received invalid app");
return false;
}
@@ -2270,20 +2238,19 @@ bool ApplicationManagerImpl::HandleRejectedServiceStatus(
navi_service_status_.erase(app_services);
}
}
- LOG4CXX_DEBUG(logger_,
- "The start of service"
- << service_type << " for appID: " << app
- << " is failed. Service info has been removed");
+ SDL_LOG_DEBUG("The start of service"
+ << service_type << " for appID: " << app
+ << " is failed. Service info has been removed");
return true;
}
case hmi_apis::Common_ServiceType::RPC: {
connection_handler().SendEndService(app->app_id(),
protocol_handler::ServiceType::kRpc);
- LOG4CXX_DEBUG(logger_, "RPC service for appID: " << app << " is stopped");
+ SDL_LOG_DEBUG("RPC service for appID: " << app << " is stopped");
return true;
}
default:
- LOG4CXX_DEBUG(logger_, "Unknown service type: " << service_type);
+ SDL_LOG_DEBUG("Unknown service type: " << service_type);
return false;
}
}
@@ -2291,12 +2258,11 @@ bool ApplicationManagerImpl::HandleRejectedServiceStatus(
void ApplicationManagerImpl::OnSecondaryTransportStartedCallback(
const connection_handler::DeviceHandle device_handle,
const int32_t session_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (device_handle == 0) {
- LOG4CXX_WARN(logger_,
- "Invalid device handle passed for secondary transport of app "
- << session_key);
+ SDL_LOG_WARN("Invalid device handle passed for secondary transport of app "
+ << session_key);
return;
}
@@ -2309,8 +2275,7 @@ void ApplicationManagerImpl::OnSecondaryTransportStartedCallback(
// It is possible that secondary transport is established prior to
// RegisterAppInterface request being processed. In this case, we will
// update the app's information during RegisterApplication().
- LOG4CXX_DEBUG(logger_,
- "Application with id: " << session_key << " is not found");
+ SDL_LOG_DEBUG("Application with id: " << session_key << " is not found");
return;
}
app->set_secondary_device(device_handle);
@@ -2325,14 +2290,13 @@ void ApplicationManagerImpl::OnSecondaryTransportStartedCallback(
void ApplicationManagerImpl::OnSecondaryTransportEndedCallback(
const int32_t session_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceMap::iterator it = secondary_transport_devices_cache_.find(session_key);
if (it == secondary_transport_devices_cache_.end()) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Unknown session_key specified while removing secondary transport: "
- << session_key);
+ << session_key);
} else {
secondary_transport_devices_cache_.erase(it);
}
@@ -2341,16 +2305,14 @@ void ApplicationManagerImpl::OnSecondaryTransportEndedCallback(
sync_primitives::AutoLock auto_lock(applications_list_lock_ptr_);
ApplicationSharedPtr app = application(session_key);
if (!app) {
- LOG4CXX_DEBUG(logger_,
- "Application with id: " << session_key << " is not found");
+ SDL_LOG_DEBUG("Application with id: " << session_key << " is not found");
return;
}
connection_handler::DeviceHandle device_handle = app->secondary_device();
if (device_handle == 0) {
- LOG4CXX_WARN(
- logger_,
- "Secondary transport of app " << session_key << " is not found");
+ SDL_LOG_WARN("Secondary transport of app " << session_key
+ << " is not found");
return;
}
@@ -2362,7 +2324,7 @@ void ApplicationManagerImpl::OnSecondaryTransportEndedCallback(
}
bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (app) {
return app->is_navi();
@@ -2374,15 +2336,14 @@ bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const {
bool ApplicationManagerImpl::OnHandshakeDone(
uint32_t connection_key,
security_manager::SSLContext::HandshakeResult result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using security_manager::SSLContext;
using namespace helpers;
ApplicationSharedPtr app = application(connection_key);
if (!app) {
- LOG4CXX_WARN(logger_,
- "Application for connection key: " << connection_key
+ SDL_LOG_WARN("Application for connection key: " << connection_key
<< " was not found");
return false;
}
@@ -2399,30 +2360,30 @@ bool ApplicationManagerImpl::OnHandshakeDone(
}
#ifdef ENABLE_SECURITY
bool ApplicationManagerImpl::OnPTUFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return false;
}
#endif // ENABLE_SECURITY
bool ApplicationManagerImpl::OnGetSystemTimeFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return false;
}
void ApplicationManagerImpl::OnCertificateUpdateRequired() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
GetPolicyHandler().OnPTExchangeNeeded();
}
bool ApplicationManagerImpl::GetPolicyCertificateData(std::string& data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
data = GetPolicyHandler().RetrieveCertificate();
return true;
}
security_manager::SSLContext::HandshakeContext
ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using security_manager::SSLContext;
ApplicationConstSharedPtr app = application(key);
if (app) {
@@ -2473,11 +2434,10 @@ void ApplicationManagerImpl::TerminateRequest(const uint32_t connection_key,
void ApplicationManagerImpl::RemoveHMIFakeParameters(
application_manager::commands::MessageSharedPtr& message,
const hmi_apis::FunctionID::eType& function_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_apis::HMI_API factory;
if (!(*message)[jhs::S_PARAMS].keyExists(jhs::S_FUNCTION_ID)) {
- LOG4CXX_ERROR(logger_,
- "RemoveHMIFakeParameters message missing function id");
+ SDL_LOG_ERROR("RemoveHMIFakeParameters message missing function id");
return;
}
mobile_apis::FunctionID::eType mobile_function_id =
@@ -2496,7 +2456,7 @@ bool ApplicationManagerImpl::Init(resumption::LastState&,
bool ApplicationManagerImpl::Init(
resumption::LastStateWrapperPtr last_state_wrapper,
media_manager::MediaManager* media_manager) {
- LOG4CXX_TRACE(logger_, "Init application manager");
+ SDL_LOG_TRACE("Init application manager");
plugin_manager_.reset(
new plugin_manager::RPCPluginManagerImpl(*this,
*rpc_service_,
@@ -2504,7 +2464,7 @@ bool ApplicationManagerImpl::Init(
*policy_handler_,
last_state_wrapper));
if (!plugin_manager_->LoadPlugins(get_settings().plugins_folder())) {
- LOG4CXX_ERROR(logger_, "Plugins are not loaded");
+ SDL_LOG_ERROR("Plugins are not loaded");
return false;
}
const std::string app_storage_folder = get_settings().app_storage_folder();
@@ -2513,15 +2473,14 @@ bool ApplicationManagerImpl::Init(
return false;
}
if (!resume_controller().Init(last_state_wrapper)) {
- LOG4CXX_ERROR(logger_, "Problem with initialization of resume controller");
+ SDL_LOG_ERROR("Problem with initialization of resume controller");
return false;
}
hmi_capabilities_->Init(last_state_wrapper);
if (!(file_system::IsWritingAllowed(app_storage_folder) &&
file_system::IsReadingAllowed(app_storage_folder))) {
- LOG4CXX_ERROR(logger_,
- "Storage directory doesn't have read/write permissions");
+ SDL_LOG_ERROR("Storage directory doesn't have read/write permissions");
return false;
}
@@ -2539,18 +2498,16 @@ bool ApplicationManagerImpl::Init(
IsReadWriteAllowed(app_icons_folder, TYPE_ICONS);
if (GetPolicyHandler().PolicyEnabled()) {
if (!GetPolicyHandler().LoadPolicyLibrary()) {
- LOG4CXX_ERROR(logger_,
- "Policy library is not loaded. Check LD_LIBRARY_PATH");
+ SDL_LOG_ERROR("Policy library is not loaded. Check LD_LIBRARY_PATH");
return false;
}
- LOG4CXX_INFO(logger_, "Policy library is loaded, now initing PT");
+ SDL_LOG_INFO("Policy library is loaded, now initing PT");
if (!GetPolicyHandler().InitPolicyTable()) {
- LOG4CXX_ERROR(logger_, "Policy table is not initialized.");
+ SDL_LOG_ERROR("Policy table is not initialized.");
return false;
}
} else {
- LOG4CXX_WARN(logger_,
- "System is configured to work without policy functionality.");
+ SDL_LOG_WARN("System is configured to work without policy functionality.");
}
media_manager_ = media_manager;
@@ -2576,7 +2533,7 @@ bool ApplicationManagerImpl::Init(
}
bool ApplicationManagerImpl::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
stopping_application_mng_lock_.Acquire();
is_stopping_ = true;
stopping_application_mng_lock_.Release();
@@ -2590,13 +2547,12 @@ bool ApplicationManagerImpl::Stop() {
UnregisterAllApplications();
} catch (...) {
- LOG4CXX_ERROR(logger_,
- "An error occurred during unregistering applications.");
+ SDL_LOG_ERROR("An error occurred during unregistering applications.");
}
request_ctrl_.DestroyThreadpool();
// for PASA customer policy backup should happen :AllApp(SUSPEND)
- LOG4CXX_DEBUG(logger_, "Unloading policy library.");
+ SDL_LOG_DEBUG("Unloading policy library.");
GetPolicyHandler().UnloadPolicyLibrary();
rpc_service_->Stop();
@@ -2608,16 +2564,15 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
const smart_objects::SmartObject& message,
Message& output,
const bool allow_unknown_parameters) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (smart_objects::SmartType_Null == message.getType() ||
smart_objects::SmartType_Invalid == message.getType()) {
- LOG4CXX_WARN(logger_, "Invalid smart object received.");
+ SDL_LOG_WARN("Invalid smart object received.");
return false;
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Message with protocol: " << message.getElement(jhs::S_PARAMS)
.getElement(jhs::S_PROTOCOL_TYPE)
.asInt());
@@ -2634,7 +2589,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
if (protocol_version == 1) {
if (!formatters::CFormatterJsonSDLRPCv1::toString(
message, output_string, !allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ SDL_LOG_WARN("Failed to serialize smart object");
return false;
}
output.set_protocol_version(
@@ -2642,7 +2597,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
} else {
if (!formatters::CFormatterJsonSDLRPCv2::toString(
message, output_string, !allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ SDL_LOG_WARN("Failed to serialize smart object");
return false;
}
output.set_protocol_version(
@@ -2655,7 +2610,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
case 1: {
if (!formatters::FormatterJsonRpc::ToString(
message, output_string, !allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ SDL_LOG_WARN("Failed to serialize smart object");
return false;
}
output.set_protocol_version(
@@ -2667,7 +2622,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
return false;
}
- LOG4CXX_DEBUG(logger_, "Convertion result: " << output_string);
+ SDL_LOG_DEBUG("Convertion result: " << output_string);
output.set_connection_key(message.getElement(jhs::S_PARAMS)
.getElement(strings::connection_key)
@@ -2702,7 +2657,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
output.set_binary_data(&binaryData);
}
- LOG4CXX_DEBUG(logger_, "Successfully parsed smart object into message");
+ SDL_LOG_DEBUG("Successfully parsed smart object into message");
return true;
}
@@ -2710,7 +2665,7 @@ hmi_apis::HMI_API& ApplicationManagerImpl::hmi_so_factory() {
if (!hmi_so_factory_) {
hmi_so_factory_ = new hmi_apis::HMI_API;
if (!hmi_so_factory_) {
- LOG4CXX_ERROR(logger_, "Out of memory");
+ SDL_LOG_ERROR("Out of memory");
NOTREACHED();
}
}
@@ -2721,7 +2676,7 @@ mobile_apis::MOBILE_API& ApplicationManagerImpl::mobile_so_factory() {
if (!mobile_so_factory_) {
mobile_so_factory_ = new mobile_apis::MOBILE_API;
if (!mobile_so_factory_) {
- LOG4CXX_ERROR(logger_, "Out of memory.");
+ SDL_LOG_ERROR("Out of memory");
NOTREACHED();
}
}
@@ -2739,9 +2694,9 @@ const HMICapabilities& ApplicationManagerImpl::hmi_capabilities() const {
void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data,
SmartObject& ttsName,
SmartObject& vrSynonym) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app_data.keyExists(json::languages)) {
- LOG4CXX_WARN(logger_, "\"languages\" not exists");
+ SDL_LOG_WARN("\"languages\" not exists");
return;
}
@@ -2758,44 +2713,41 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data,
const size_t size = languages.length();
for (size_t idx = 0; idx < size; ++idx) {
if (languages[idx].keyExists(cur_vr_lang)) {
- LOG4CXX_DEBUG(logger_, "Found active HMI language " << cur_vr_lang);
+ SDL_LOG_DEBUG("Found active HMI language " << cur_vr_lang);
specific_idx = idx;
} else if (languages[idx].keyExists(json::default_)) {
- LOG4CXX_DEBUG(logger_, "Found default language");
+ SDL_LOG_DEBUG("Found default language");
default_idx = idx;
}
}
if ((-1 == specific_idx) && (-1 == default_idx)) {
- LOG4CXX_DEBUG(logger_, "No suitable language found");
+ SDL_LOG_DEBUG("No suitable language found");
return;
}
if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists(
json::ttsName)) {
- LOG4CXX_DEBUG(logger_, "Get ttsName from " << cur_vr_lang << " language");
+ SDL_LOG_DEBUG("Get ttsName from " << cur_vr_lang << " language");
ttsName =
app_data[json::languages][specific_idx][cur_vr_lang][json::ttsName];
} else {
- LOG4CXX_DEBUG(logger_,
- "No data for ttsName for " << cur_vr_lang << " language");
+ SDL_LOG_DEBUG("No data for ttsName for " << cur_vr_lang << " language");
}
if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists(
json::vrSynonyms)) {
- LOG4CXX_DEBUG(logger_,
- "Get vrSynonyms from " << cur_vr_lang << " language");
+ SDL_LOG_DEBUG("Get vrSynonyms from " << cur_vr_lang << " language");
vrSynonym =
app_data[json::languages][specific_idx][cur_vr_lang][json::vrSynonyms];
} else {
- LOG4CXX_DEBUG(logger_,
- "No data for vrSynonyms for " << cur_vr_lang << " language");
+ SDL_LOG_DEBUG("No data for vrSynonyms for " << cur_vr_lang << " language");
}
}
void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
const uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace policy;
const std::size_t arr_size(obj_array.size());
@@ -2803,7 +2755,7 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
const SmartObject& app_data = obj_array[idx];
if (!(app_data.keyExists(json::name) && app_data.keyExists(json::appId))) {
- LOG4CXX_DEBUG(logger_, "The entry in query apps json is not valid");
+ SDL_LOG_DEBUG("The entry in query apps json is not valid");
continue;
}
@@ -2812,24 +2764,21 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
connection_handler::DeviceHandle device_handle;
if (-1 == connection_handler().get_session_observer().GetDataOnSessionKey(
connection_key, nullptr, nullptr, &device_handle)) {
- LOG4CXX_ERROR(logger_,
- "Failed to create application: no connection info.");
+ SDL_LOG_ERROR("Failed to create application: no connection info.");
continue;
}
std::string device_id;
if (-1 == connection_handler().get_session_observer().GetDataOnDeviceID(
device_handle, nullptr, nullptr, &device_id)) {
- LOG4CXX_ERROR(logger_,
- "Failed to create application: no connection info.");
+ SDL_LOG_ERROR("Failed to create application: no connection info.");
continue;
}
ApplicationSharedPtr registered_app = application(device_id, policy_app_id);
if (registered_app) {
- LOG4CXX_DEBUG(logger_,
- "Application with the same id: "
- << policy_app_id << " is registered already.");
+ SDL_LOG_DEBUG("Application with the same id: "
+ << policy_app_id << " is registered already.");
continue;
}
@@ -2889,22 +2838,21 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
app->set_tts_name(ttsName);
sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
- LOG4CXX_DEBUG(
- logger_, "apps_to_register_ size before: " << apps_to_register_.size());
+ SDL_LOG_DEBUG(
+ "apps_to_register_ size before: " << apps_to_register_.size());
apps_to_register_.insert(app);
- LOG4CXX_DEBUG(logger_,
- "apps_to_register_ size after: " << apps_to_register_.size());
+ SDL_LOG_DEBUG("apps_to_register_ size after: " << apps_to_register_.size());
}
}
void ApplicationManagerImpl::ProcessQueryApp(
const smart_objects::SmartObject& sm_object,
const uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace policy;
if (!sm_object.keyExists(json::response)) {
- LOG4CXX_DEBUG(logger_, "The response key is not exists.");
+ SDL_LOG_DEBUG("The response key is not exists.");
return;
}
@@ -2949,16 +2897,15 @@ void ApplicationManagerImpl::updateRequestTimeout(
uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
request_ctrl_.updateRequestTimeout(
connection_key, mobile_correlation_id, new_timeout_value);
}
void ApplicationManagerImpl::IncreaseForwardedRequestTimeout(
uint32_t connection_key, uint32_t mobile_correlation_id) {
- LOG4CXX_DEBUG(logger_,
- "Increasing Request Timeout by "
- << get_settings().rpc_pass_through_timeout());
+ SDL_LOG_DEBUG("Increasing Request Timeout by "
+ << get_settings().rpc_pass_through_timeout());
uint32_t new_timeout_value = get_settings().default_timeout() +
get_settings().rpc_pass_through_timeout();
request_ctrl_.updateRequestTimeout(
@@ -3004,27 +2951,27 @@ void ApplicationManagerImpl::RemovePolicyObserver(
void ApplicationManagerImpl::SetUnregisterAllApplicationsReason(
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_TRACE(logger_, "reason = " << reason);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("reason = " << reason);
unregister_reason_ = reason;
}
void ApplicationManagerImpl::HeadUnitReset(
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
stopping_application_mng_lock_.Acquire();
is_stopping_ = true;
stopping_application_mng_lock_.Release();
switch (reason) {
case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: {
- LOG4CXX_TRACE(logger_, "Performing MASTER_RESET");
+ SDL_LOG_TRACE("Performing MASTER_RESET");
UnregisterAllApplications();
GetPolicyHandler().ResetPolicyTable();
GetPolicyHandler().UnloadPolicyLibrary();
resume_controller().StopSavePersistentDataTimer();
if (!hmi_capabilities_->DeleteCachedCapabilitiesFile()) {
- LOG4CXX_ERROR(logger_, "Failed to remove HMI capabilities cache file");
+ SDL_LOG_ERROR("Failed to remove HMI capabilities cache file");
}
const std::string storage_folder = get_settings().app_storage_folder();
file_system::RemoveDirectory(storage_folder, true);
@@ -3032,25 +2979,25 @@ void ApplicationManagerImpl::HeadUnitReset(
break;
}
case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS: {
- LOG4CXX_TRACE(logger_, "Performing FACTORY_DEFAULTS");
+ SDL_LOG_TRACE("Performing FACTORY_DEFAULTS");
GetPolicyHandler().ClearUserConsent();
resume_controller().StopSavePersistentDataTimer();
if (!hmi_capabilities_->DeleteCachedCapabilitiesFile()) {
- LOG4CXX_ERROR(logger_, "Failed to remove HMI capabilities cache file");
+ SDL_LOG_ERROR("Failed to remove HMI capabilities cache file");
}
ClearAppsPersistentData();
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Bad AppInterfaceUnregisteredReason");
+ SDL_LOG_ERROR("Bad AppInterfaceUnregisteredReason");
return;
}
}
}
void ApplicationManagerImpl::ClearAppsPersistentData() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
typedef std::vector<std::string> FilesList;
const std::string apps_info_storage_file = get_settings().app_info_storage();
file_system::DeleteFile(apps_info_storage_file);
@@ -3068,14 +3015,12 @@ void ApplicationManagerImpl::ClearAppsPersistentData() {
for (; it != files.end(); ++it) {
const std::string path_to_item = storage_folder + "/";
const std::string item_to_remove = path_to_item + (*it);
- LOG4CXX_TRACE(logger_, "Removing : " << item_to_remove);
+ SDL_LOG_TRACE("Removing : " << item_to_remove);
if (file_system::IsDirectory(item_to_remove)) {
- LOG4CXX_TRACE(logger_,
- "Removal result : " << file_system::RemoveDirectory(
+ SDL_LOG_TRACE("Removal result : " << file_system::RemoveDirectory(
item_to_remove, true));
} else {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
"Removal result : " << file_system::DeleteFile(item_to_remove));
}
}
@@ -3087,9 +3032,9 @@ void ApplicationManagerImpl::ClearAppsPersistentData() {
}
void ApplicationManagerImpl::SendOnSDLClose() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (IsLowVoltage()) {
- LOG4CXX_TRACE(logger_, "SDL is in Low Voltage State");
+ SDL_LOG_TRACE("SDL is in Low Voltage State");
return;
}
// must be sent to PASA HMI on shutdown synchronously
@@ -3106,7 +3051,7 @@ void ApplicationManagerImpl::SendOnSDLClose() {
commands::CommandImpl::protocol_version_;
if (!msg) {
- LOG4CXX_WARN(logger_, "Null-pointer message received.");
+ SDL_LOG_WARN("Null-pointer message received.");
NOTREACHED();
return;
}
@@ -3116,18 +3061,16 @@ void ApplicationManagerImpl::SendOnSDLClose() {
new Message(protocol_handler::MessagePriority::kDefault));
hmi_so_factory().attachSchema(*msg, false);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Attached schema to message, result if valid: " << msg->isValid());
if (!ConvertSOtoMessage(*msg, *message_to_send)) {
- LOG4CXX_WARN(logger_,
- "Cannot send message to HMI: failed to create string");
+ SDL_LOG_WARN("Cannot send message to HMI: failed to create string");
return;
}
if (!hmi_handler_) {
- LOG4CXX_WARN(logger_, "No HMI Handler set");
+ SDL_LOG_WARN("No HMI Handler set");
return;
}
@@ -3135,7 +3078,7 @@ void ApplicationManagerImpl::SendOnSDLClose() {
}
void ApplicationManagerImpl::UnregisterAllApplications() {
- LOG4CXX_DEBUG(logger_, "Unregister reason " << unregister_reason_);
+ SDL_LOG_DEBUG("Unregister reason " << unregister_reason_);
SetHMICooperating(false);
bool is_ignition_off = false;
@@ -3191,7 +3134,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
void ApplicationManagerImpl::RemoveAppsWaitingForRegistration(
const connection_handler::DeviceHandle handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DevicePredicate device_finder(handle);
apps_to_register_list_lock_ptr_->Acquire();
std::vector<ApplicationSharedPtr> apps_to_remove;
@@ -3205,8 +3148,7 @@ void ApplicationManagerImpl::RemoveAppsWaitingForRegistration(
const bool is_app_enabled =
helpers::in_range(enabled_local_apps, app->policy_app_id());
if (!is_app_enabled) {
- LOG4CXX_DEBUG(logger_,
- "Waiting app: " << app->name().c_str() << " is removed.");
+ SDL_LOG_DEBUG("Waiting app: " << app->name().c_str() << " is removed.");
apps_to_register_.erase(app);
}
}
@@ -3219,21 +3161,13 @@ void ApplicationManagerImpl::UnregisterApplication(
mobile_apis::Result::eType reason,
bool is_resuming,
bool is_unexpected_disconnect) {
- LOG4CXX_DEBUG(logger_,
- "app_id = " << app_id << "; reason = " << reason
+ SDL_LOG_DEBUG("app_id = " << app_id << "; reason = " << reason
<< "; is_resuming = " << is_resuming
<< "; is_unexpected_disconnect = "
<< is_unexpected_disconnect);
GetAppServiceManager().UnpublishServices(app_id);
- if (IsAppSubscribedForWayPoints(app_id)) {
- UnsubscribeAppFromWayPoints(app_id);
- if (!IsAnyAppSubscribedForWayPoints()) {
- LOG4CXX_ERROR(logger_, "Send UnsubscribeWayPoints");
- MessageHelper::SendUnsubscribedWayPoints(*this);
- }
- }
EndNaviServices(app_id);
{
@@ -3264,8 +3198,7 @@ void ApplicationManagerImpl::UnregisterApplication(
if (app_ptr) {
app_ptr->usage_report().RecordRemovalsForBadBehavior();
if (reason == mobile_apis::Result::TOO_MANY_PENDING_REQUESTS) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"INSERT: " << GetHashedAppID(app_id, app_ptr->policy_app_id()));
forbidden_applications.insert(
GetHashedAppID(app_id, app_ptr->policy_app_id()));
@@ -3274,7 +3207,7 @@ void ApplicationManagerImpl::UnregisterApplication(
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Unknown unregister reason " << reason);
+ SDL_LOG_ERROR("Unknown unregister reason " << reason);
break;
}
}
@@ -3293,11 +3226,11 @@ void ApplicationManagerImpl::UnregisterApplication(
}
}
if (!app_to_remove) {
- LOG4CXX_ERROR(logger_, "Cant find application with app_id = " << app_id);
+ SDL_LOG_ERROR("Cant find application with app_id = " << app_id);
// Just to terminate RAI in case of connection is dropped (rare case)
// App won't be unregistered since RAI has not been started yet
- LOG4CXX_DEBUG(logger_, "Trying to terminate possible RAI request.");
+ SDL_LOG_DEBUG("Trying to terminate possible RAI request.");
request_ctrl_.terminateAppRequests(app_id);
return;
@@ -3309,6 +3242,16 @@ void ApplicationManagerImpl::UnregisterApplication(
resume_controller().RemoveApplicationFromSaved(app_to_remove);
}
+ if (IsAppSubscribedForWayPoints(app_id)) {
+ UnsubscribeAppFromWayPoints(app_id);
+ if (!IsAnyAppSubscribedForWayPoints()) {
+ SDL_LOG_DEBUG("Send UnsubscribeWayPoints");
+ auto request = MessageHelper::CreateUnsubscribeWayPointsRequest(
+ GetNextHMICorrelationID());
+ rpc_service_->ManageHMICommand(request);
+ }
+ }
+
(hmi_capabilities_->get_hmi_language_handler())
.OnUnregisterApplication(app_id);
@@ -3317,8 +3260,7 @@ void ApplicationManagerImpl::UnregisterApplication(
AppV4DevicePredicate finder(handle);
ApplicationSharedPtr app = FindApp(applications(), finder);
if (!app) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"There is no more SDL4 apps with device handle: " << handle);
RemoveAppsWaitingForRegistration(handle);
@@ -3331,9 +3273,9 @@ void ApplicationManagerImpl::UnregisterApplication(
const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps();
if (helpers::in_range(enabled_local_apps, app_to_remove->policy_app_id())) {
- LOG4CXX_DEBUG(logger_,
- "Enabled local app has been unregistered. Re-create "
- "pending application");
+ SDL_LOG_DEBUG(
+ "Enabled local app has been unregistered. Re-create "
+ "pending application");
CreatePendingLocalApplication(app_to_remove->policy_app_id());
}
@@ -3372,7 +3314,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(AOleynik): Remove check of policy_enable, when this flag will be
// unused in config file
if (!GetPolicyHandler().PolicyEnabled()) {
@@ -3407,7 +3349,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
", HMI status: " + EnumToString(app->hmi_level(window_id));
#endif // ENABLE_LOG
if (result.hmi_level_permitted != policy::kRpcAllowed) {
- LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg);
+ SDL_LOG_WARN("Request is blocked by policies. " << log_msg);
app->usage_report().RecordPolicyRejectedRpcCall();
@@ -3420,7 +3362,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
return mobile_apis::Result::INVALID_ENUM;
}
}
- LOG4CXX_DEBUG(logger_, "Request is allowed by policies. " << log_msg);
+ SDL_LOG_DEBUG("Request is allowed by policies. " << log_msg);
return mobile_api::Result::SUCCESS;
}
@@ -3434,7 +3376,7 @@ bool ApplicationManagerImpl::is_audio_pass_thru_active() const {
}
void ApplicationManagerImpl::OnLowVoltage() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_low_voltage_ = true;
resume_ctrl_->SaveLowVoltageTime();
resume_ctrl_->StopSavePersistentDataTimer();
@@ -3442,12 +3384,12 @@ void ApplicationManagerImpl::OnLowVoltage() {
}
bool ApplicationManagerImpl::IsLowVoltage() const {
- LOG4CXX_TRACE(logger_, "Result: " << is_low_voltage_);
+ SDL_LOG_TRACE("Result: " << is_low_voltage_);
return is_low_voltage_;
}
void ApplicationManagerImpl::OnWakeUp() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resume_ctrl_->SaveWakeUpTime();
resume_ctrl_->StartSavePersistentDataTimer();
request_ctrl_.OnWakeUp();
@@ -3468,7 +3410,7 @@ std::string ApplicationManagerImpl::GetHashedAppID(
bool ApplicationManagerImpl::HMIStateAllowsStreaming(
uint32_t app_id, protocol_handler::ServiceType service_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis::HMILevel;
using namespace mobile_apis::PredefinedWindows;
using namespace mobile_apis::VideoStreamingState;
@@ -3476,7 +3418,7 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming(
ApplicationSharedPtr app = application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_, "An application is not registered.");
+ SDL_LOG_WARN("An application is not registered.");
return false;
}
@@ -3493,11 +3435,11 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming(
bool ApplicationManagerImpl::CanAppStream(
uint32_t app_id, protocol_handler::ServiceType service_type) const {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_, "An application is not registered.");
+ SDL_LOG_WARN("An application is not registered.");
return false;
}
@@ -3507,7 +3449,7 @@ bool ApplicationManagerImpl::CanAppStream(
} else if (ServiceType::kAudio == service_type) {
is_allowed = app->audio_streaming_allowed();
} else {
- LOG4CXX_WARN(logger_, "Unsupported service_type " << service_type);
+ SDL_LOG_WARN("Unsupported service_type " << service_type);
}
return HMIStateAllowsStreaming(app_id, service_type) && is_allowed;
@@ -3517,12 +3459,11 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
using namespace mobile_apis::AppInterfaceUnregisteredReason;
using namespace mobile_apis::Result;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"There is no navi or projection application with id: " << app_id);
return;
}
@@ -3567,12 +3508,11 @@ void ApplicationManagerImpl::ForbidStreaming(
using namespace mobile_apis::Result;
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"There is no navi or projection application with id: " << app_id);
return;
}
@@ -3612,12 +3552,12 @@ void ApplicationManagerImpl::ForbidStreaming(
if (ServiceType::kMobileNav == service_type &&
app->video_streaming_allowed()) {
- LOG4CXX_DEBUG(logger_, "Video streaming is still allowed");
+ SDL_LOG_DEBUG("Video streaming is still allowed");
return;
}
if (ServiceType::kAudio == service_type && app->audio_streaming_allowed()) {
- LOG4CXX_DEBUG(logger_, "Audio streaming is still allowed");
+ SDL_LOG_DEBUG("Audio streaming is still allowed");
return;
}
@@ -3626,12 +3566,11 @@ void ApplicationManagerImpl::ForbidStreaming(
void ApplicationManagerImpl::OnAppStreaming(
uint32_t app_id, protocol_handler::ServiceType service_type, bool state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
" There is no navi or projection application with id: " << app_id);
return;
}
@@ -3648,12 +3587,11 @@ void ApplicationManagerImpl::OnAppStreaming(
void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"There is no navi or projection application with id: " << app_id);
return;
}
@@ -3665,7 +3603,7 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it) {
- LOG4CXX_ERROR(logger_, "No info about navi servicies for app");
+ SDL_LOG_ERROR("No info about navi servicies for app");
return;
}
end_video = it->second.first;
@@ -3674,12 +3612,12 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
if (connection_handler_) {
if (end_video) {
- LOG4CXX_DEBUG(logger_, "Going to end video service");
+ SDL_LOG_DEBUG("Going to end video service");
connection_handler().SendEndService(app_id, ServiceType::kMobileNav);
app->StopStreamingForce(ServiceType::kMobileNav);
}
if (end_audio) {
- LOG4CXX_DEBUG(logger_, "Going to end audio service");
+ SDL_LOG_DEBUG("Going to end audio service");
connection_handler().SendEndService(app_id, ServiceType::kAudio);
app->StopStreamingForce(ServiceType::kAudio);
}
@@ -3705,17 +3643,17 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
void ApplicationManagerImpl::OnHMIStateChanged(const uint32_t app_id,
const HmiStatePtr from,
const HmiStatePtr to) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessPostponedMessages(app_id);
ProcessApp(app_id, from, to);
}
void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_, "The app with id: " << app_id << " does not exist");
+ SDL_LOG_WARN("The app with id: " << app_id << " does not exist");
return;
}
MobileMessageQueue messages;
@@ -3743,7 +3681,7 @@ void ApplicationManagerImpl::ProcessOnDataStreamingNotification(
const protocol_handler::ServiceType service_type,
const uint32_t app_id,
const bool streaming_data_available) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool should_send_notification = false;
@@ -3753,23 +3691,21 @@ void ApplicationManagerImpl::ProcessOnDataStreamingNotification(
should_send_notification = active_services.empty();
if (streaming_data_available) {
active_services.insert(app_id);
- LOG4CXX_DEBUG(logger_,
- "Streaming session with id "
- << app_id << " for service "
- << static_cast<uint32_t>(service_type)
- << " was added. Currently streaming sessions count: "
- << active_services.size());
+ SDL_LOG_DEBUG("Streaming session with id "
+ << app_id << " for service "
+ << static_cast<uint32_t>(service_type)
+ << " was added. Currently streaming sessions count: "
+ << active_services.size());
} else {
active_services.erase(app_id);
should_send_notification =
!should_send_notification && active_services.empty();
- LOG4CXX_DEBUG(logger_,
- "Streaming session with id "
- << app_id << " for service "
- << static_cast<uint32_t>(service_type)
- << " was removed. Currently streaming sessions count: "
- << active_services.size());
+ SDL_LOG_DEBUG("Streaming session with id "
+ << app_id << " for service "
+ << static_cast<uint32_t>(service_type)
+ << " was removed. Currently streaming sessions count: "
+ << active_services.size());
}
}
@@ -3788,7 +3724,7 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_ERROR(logger_, "Navi/Projection application not found");
+ SDL_LOG_ERROR("Navi/Projection application not found");
return;
}
@@ -3799,7 +3735,7 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
if (hmi_level_from == hmi_level_to &&
streaming_state_from == streaming_state_to) {
- LOG4CXX_TRACE(logger_, "HMILevel && streaming state were not changed");
+ SDL_LOG_TRACE("HMILevel && streaming state were not changed");
return;
}
@@ -3816,11 +3752,10 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
full_or_limited_hmi_level(hmi_level_to) &&
STREAMABLE == streaming_state_to;
if (allow_streaming_by_streaming_state || allow_streaming_by_hmi_level) {
- LOG4CXX_TRACE(logger_,
- "Allow streaming by streaming state: "
- << std::boolalpha << allow_streaming_by_streaming_state
- << "; by hmi level: " << std::boolalpha
- << allow_streaming_by_hmi_level);
+ SDL_LOG_TRACE("Allow streaming by streaming state: "
+ << std::boolalpha << allow_streaming_by_streaming_state
+ << "; by hmi level: " << std::boolalpha
+ << allow_streaming_by_hmi_level);
AllowStreaming(app_id);
return;
}
@@ -3833,11 +3768,10 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
full_or_limited_hmi_level(hmi_level_from) &&
HMI_BACKGROUND == hmi_level_to;
if (end_streaming_by_streaming_state || start_timer_by_hmi_level) {
- LOG4CXX_TRACE(logger_,
- "Start EndStream timer by streaming state: "
- << std::boolalpha << end_streaming_by_streaming_state
- << "; by hmi level: " << std::boolalpha
- << start_timer_by_hmi_level);
+ SDL_LOG_TRACE("Start EndStream timer by streaming state: "
+ << std::boolalpha << end_streaming_by_streaming_state
+ << "; by hmi level: " << std::boolalpha
+ << start_timer_by_hmi_level);
StartEndStreamTimer(app_id);
return;
}
@@ -3845,18 +3779,84 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
const bool end_streaming_by_hmi_level =
full_or_limited_hmi_level(hmi_level_from) && HMI_NONE == hmi_level_to;
if (end_streaming_by_hmi_level) {
- LOG4CXX_TRACE(logger_,
- "End streaming services by hmi level: "
- << std::boolalpha << end_streaming_by_hmi_level);
+ SDL_LOG_TRACE("End streaming services by hmi level: "
+ << std::boolalpha << end_streaming_by_hmi_level);
EndNaviServices(app_id);
return;
}
- LOG4CXX_TRACE(logger_, "No actions required for app " << app_id);
+ SDL_LOG_TRACE("No actions required for app " << app_id);
+}
+
+bool ApplicationManagerImpl::ResetHelpPromt(ApplicationSharedPtr app) const {
+ if (!app) {
+ SDL_LOG_ERROR("Null pointer");
+ return false;
+ }
+ const std::vector<std::string>& help_prompt = get_settings().help_prompt();
+
+ smart_objects::SmartObject so_help_prompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ for (size_t i = 0; i < help_prompt.size(); ++i) {
+ smart_objects::SmartObject help_prompt_item =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ help_prompt_item[strings::text] = help_prompt[i];
+ help_prompt_item[strings::type] =
+ hmi_apis::Common_SpeechCapabilities::SC_TEXT;
+ so_help_prompt[i] = help_prompt_item;
+ }
+
+ app->set_help_prompt(so_help_prompt);
+ return true;
+}
+
+bool ApplicationManagerImpl::ResetTimeoutPromt(ApplicationSharedPtr app) const {
+ if (!app) {
+ SDL_LOG_ERROR("Null pointer");
+ return false;
+ }
+
+ const std::vector<std::string>& time_out_promt =
+ get_settings().time_out_promt();
+
+ smart_objects::SmartObject so_time_out_promt =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ for (uint32_t i = 0; i < time_out_promt.size(); ++i) {
+ smart_objects::SmartObject timeoutPrompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ timeoutPrompt[strings::text] = time_out_promt[i];
+ timeoutPrompt[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT;
+ so_time_out_promt[i] = timeoutPrompt;
+ }
+
+ app->set_timeout_prompt(so_time_out_promt);
+
+ return true;
+}
+
+bool ApplicationManagerImpl::ResetVrHelpTitleItems(
+ ApplicationSharedPtr app) const {
+ if (!app) {
+ SDL_LOG_ERROR("Null pointer");
+ return false;
+ }
+
+ const std::string& vr_help_title = get_settings().vr_help_title();
+ smart_objects::SmartObject so_vr_help_title =
+ smart_objects::SmartObject(smart_objects::SmartType_String);
+ so_vr_help_title = vr_help_title;
+
+ app->reset_vr_help_title();
+ app->reset_vr_help();
+ app->set_vr_help_title(so_vr_help_title);
+
+ return true;
}
void ApplicationManagerImpl::StartEndStreamTimer(const uint32_t app_id) {
- LOG4CXX_DEBUG(logger_, "Start end stream timer for app " << app_id);
+ SDL_LOG_DEBUG("Start end stream timer for app " << app_id);
navi_app_to_end_stream_.push_back(app_id);
TimerSPtr end_stream_timer(std::make_shared<timer::Timer>(
"DisallowAppStreamTimer",
@@ -3869,7 +3869,7 @@ void ApplicationManagerImpl::StartEndStreamTimer(const uint32_t app_id) {
}
void ApplicationManagerImpl::ClearTimerPool() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
@@ -3891,7 +3891,7 @@ void ApplicationManagerImpl::ClearTimerPool() {
}
void ApplicationManagerImpl::CloseNaviApp() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis::AppInterfaceUnregisteredReason;
using namespace mobile_apis::Result;
uint32_t app_id;
@@ -3916,8 +3916,7 @@ void ApplicationManagerImpl::CloseNaviApp() {
}
}
if (unregister) {
- LOG4CXX_INFO(logger_,
- "App haven't answered for EndService. Unregister it.");
+ SDL_LOG_INFO("App haven't answered for EndService. Unregister it.");
rpc_service_->ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
app_id, PROTOCOL_VIOLATION),
@@ -3927,7 +3926,7 @@ void ApplicationManagerImpl::CloseNaviApp() {
}
void ApplicationManagerImpl::EndNaviStreaming() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis::AppInterfaceUnregisteredReason;
using namespace mobile_apis::Result;
@@ -3948,11 +3947,11 @@ void ApplicationManagerImpl::EndNaviStreaming() {
void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_ERROR(logger_, "Navi/Projection application not found");
+ SDL_LOG_ERROR("Navi/Projection application not found");
return;
}
@@ -3973,11 +3972,11 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) {
void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) {
using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- LOG4CXX_ERROR(logger_, "Navi/Projection application not found");
+ SDL_LOG_ERROR("Navi/Projection application not found");
return;
}
@@ -4005,7 +4004,7 @@ bool ApplicationManagerImpl::IsApplicationForbidden(
bool ApplicationManagerImpl::IsAppInReconnectMode(
const connection_handler::DeviceHandle& device_id,
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(reregister_wait_list_lock_ptr_);
return reregister_wait_list_.end() !=
std::find_if(reregister_wait_list_.begin(),
@@ -4023,12 +4022,11 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
const std::string& file_path,
const std::string& file_name,
const uint64_t offset) {
- LOG4CXX_DEBUG(logger_,
- "SaveBinaryWithOffset binary_size = "
- << binary_data.size() << " offset = " << offset);
+ SDL_LOG_DEBUG("SaveBinaryWithOffset binary_size = "
+ << binary_data.size() << " offset = " << offset);
if (binary_data.size() > file_system::GetAvailableDiskSpace(file_path)) {
- LOG4CXX_ERROR(logger_, "Out of free disc space.");
+ SDL_LOG_ERROR("Out of free disc space.");
return mobile_apis::Result::OUT_OF_MEMORY;
}
@@ -4037,15 +4035,13 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
std::ofstream* file_stream;
if (offset != 0) {
if (file_size != offset) {
- LOG4CXX_DEBUG(logger_,
- "ApplicationManagerImpl::SaveBinaryWithOffset offset"
- << " does'n match existing file size");
+ SDL_LOG_DEBUG("ApplicationManagerImpl::SaveBinaryWithOffset offset"
+ << " does'n match existing file size");
return mobile_apis::Result::INVALID_DATA;
}
file_stream = file_system::Open(full_file_path, std::ios_base::app);
} else {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite");
// if offset == 0: rewrite file
file_stream = file_system::Open(full_file_path, std::ios_base::out);
@@ -4062,7 +4058,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
file_system::Close(file_stream);
delete file_stream;
file_stream = NULL;
- LOG4CXX_INFO(logger_, "Successfully write data to file");
+ SDL_LOG_INFO("Successfully write data to file");
return mobile_apis::Result::SUCCESS;
}
@@ -4103,7 +4099,7 @@ void ApplicationManagerImpl::SetHMICooperating(const bool hmi_cooperating) {
}
void ApplicationManagerImpl::OnApplicationListUpdateTimer() {
- LOG4CXX_DEBUG(logger_, "Application list update timer finished");
+ SDL_LOG_DEBUG("Application list update timer finished");
const bool is_new_app_registered = registered_during_timer_execution_;
registered_during_timer_execution_ = false;
@@ -4137,8 +4133,7 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
}
if (!app_list.empty()) {
for (uint32_t i = 0; i < app_list.size(); ++i) {
- LOG4CXX_INFO(logger_,
- "Send TTS GlobalProperties to HMI with default helpPrompt");
+ SDL_LOG_INFO("Send TTS GlobalProperties to HMI with default helpPrompt");
MessageHelper::SendTTSGlobalProperties(
application(app_list[i]), true, *this);
RemoveAppFromTTSGlobalPropertiesList(app_list[i]);
@@ -4148,7 +4143,7 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint16_t timeout = get_settings().tts_global_properties_timeout();
date_time::TimeDuration current_time = date_time::getCurrentTime();
current_time += date_time::seconds(timeout);
@@ -4160,7 +4155,7 @@ 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_");
+ SDL_LOG_INFO("Start tts_global_properties_timer_");
tts_global_properties_app_list_lock_.Release();
const uint32_t timeout_ms = 1000;
tts_global_properties_timer_.Start(timeout_ms, timer::kSingleShot);
@@ -4171,7 +4166,7 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// please avoid AutoLock usage to avoid deadlock
tts_global_properties_app_list_lock_.Acquire();
std::map<uint32_t, date_time::TimeDuration>::iterator it =
@@ -4179,7 +4174,7 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
if (tts_global_properties_app_list_.end() != it) {
tts_global_properties_app_list_.erase(it);
if (tts_global_properties_app_list_.empty()) {
- LOG4CXX_DEBUG(logger_, "Stop tts_global_properties_timer_");
+ SDL_LOG_DEBUG("Stop tts_global_properties_timer_");
// if container is empty need to stop timer
tts_global_properties_app_list_lock_.Release();
tts_global_properties_timer_.Stop();
@@ -4189,10 +4184,111 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
tts_global_properties_app_list_lock_.Release();
}
+ResetGlobalPropertiesResult ApplicationManagerImpl::ResetGlobalProperties(
+ const smart_objects::SmartObject& global_properties_ids,
+ const uint32_t app_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::application(app_id);
+ // if application waits for sending ttsGlobalProperties need to remove this
+ // application from tts_global_properties_app_list_
+ SDL_LOG_DEBUG("RemoveAppFromTTSGlobalPropertiesList");
+ RemoveAppFromTTSGlobalPropertiesList(app_id);
+
+ ResetGlobalPropertiesResult result;
+
+ for (size_t i = 0; i < global_properties_ids.length(); ++i) {
+ mobile_apis::GlobalProperty::eType global_property =
+ static_cast<mobile_apis::GlobalProperty::eType>(
+ global_properties_ids[i].asInt());
+ switch (global_property) {
+ case mobile_apis::GlobalProperty::HELPPROMPT: {
+ result.help_prompt = ResetHelpPromt(application);
+ break;
+ }
+ case mobile_apis::GlobalProperty::TIMEOUTPROMPT: {
+ result.timeout_prompt = ResetTimeoutPromt(application);
+ break;
+ }
+ case mobile_apis::GlobalProperty::VRHELPTITLE:
+ case mobile_apis::GlobalProperty::VRHELPITEMS: {
+ if (!result.vr_has_been_reset) {
+ result.vr_has_been_reset = true;
+ result.vr_help_title_items = ResetVrHelpTitleItems(application);
+ }
+ break;
+ }
+ case mobile_apis::GlobalProperty::MENUNAME: {
+ result.menu_name = true;
+ break;
+ }
+ case mobile_apis::GlobalProperty::MENUICON: {
+ result.menu_icon = true;
+ break;
+ }
+ case mobile_apis::GlobalProperty::KEYBOARDPROPERTIES: {
+ result.keyboard_properties = true;
+ break;
+ }
+ default: {
+ SDL_LOG_TRACE("Unknown global property: " << global_property);
+ break;
+ }
+ }
+ }
+
+ return result;
+}
+
+ResetGlobalPropertiesResult
+ApplicationManagerImpl::ResetAllApplicationGlobalProperties(
+ const uint32_t app_id) {
+ const smart_objects::SmartObjectSPtr application_gl_props =
+ CreateAllAppGlobalPropsIDList(app_id);
+ return ResetGlobalProperties(*application_gl_props, app_id);
+}
+
+const smart_objects::SmartObjectSPtr
+ApplicationManagerImpl::CreateAllAppGlobalPropsIDList(
+ const uint32_t app_id) const {
+ auto global_properties = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
+ using namespace mobile_apis;
+
+ ApplicationConstSharedPtr application =
+ ApplicationManagerImpl::application(app_id);
+ int32_t i = 0;
+
+ if (application->help_prompt()) {
+ (*global_properties)[i++] = GlobalProperty::HELPPROMPT;
+ }
+ if (application->timeout_prompt()) {
+ (*global_properties)[i++] = GlobalProperty::TIMEOUTPROMPT;
+ }
+ if (application->vr_help_title()) {
+ (*global_properties)[i++] = GlobalProperty::VRHELPTITLE;
+ }
+ if (application->vr_help()) {
+ (*global_properties)[i++] = GlobalProperty::VRHELPITEMS;
+ }
+ if (application->menu_title()) {
+ (*global_properties)[i++] = GlobalProperty::MENUNAME;
+ }
+ if (application->menu_icon()) {
+ (*global_properties)[i++] = GlobalProperty::MENUICON;
+ }
+ if (application->keyboard_props()) {
+ (*global_properties)[i++] = GlobalProperty::KEYBOARDPROPERTIES;
+ }
+
+ return global_properties;
+}
+
bool ApplicationManagerImpl::CompareAppHMIType(
const smart_objects::SmartObject& from_policy,
const smart_objects::SmartObject& from_application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool equal = false;
uint32_t lenght_policy_app_types = from_policy.length();
uint32_t lenght_application_app_types = from_application.length();
@@ -4214,7 +4310,7 @@ bool ApplicationManagerImpl::CompareAppHMIType(
void ApplicationManagerImpl::OnUpdateHMIAppType(
std::map<std::string, std::vector<std::string> > app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::map<std::string, std::vector<std::string> >::iterator
it_app_hmi_types_from_policy;
@@ -4280,9 +4376,9 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
void ApplicationManagerImpl::EraseAppFromReconnectionList(
const ApplicationSharedPtr& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app) {
- LOG4CXX_WARN(logger_, "Application is not valid.");
+ SDL_LOG_WARN("Application is not valid.");
return;
}
@@ -4299,7 +4395,7 @@ void ApplicationManagerImpl::EraseAppFromReconnectionList(
void ApplicationManagerImpl::ProcessReconnection(
ApplicationSharedPtr application, const uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
connection_handler::DeviceHandle new_device_id = 0;
@@ -4321,7 +4417,7 @@ void ApplicationManagerImpl::ProcessReconnection(
}
void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ptu_result) {
protocol_handler_->ProcessFailedPTU();
return;
@@ -4344,29 +4440,29 @@ void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) {
#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
void ApplicationManagerImpl::OnCertDecryptFinished(const bool decrypt_result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!decrypt_result) {
protocol_handler_->ProcessFailedCertDecrypt();
}
}
bool ApplicationManagerImpl::OnCertDecryptFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return false;
}
#endif
void ApplicationManagerImpl::OnPTUTimeoutExceeded() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
protocol_handler_->ProcessFailedPTU();
}
void ApplicationManagerImpl::SendDriverDistractionState(
ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (hmi_apis::Common_DriverDistractionState::INVALID_ENUM ==
driver_distraction_state()) {
- LOG4CXX_WARN(logger_, "DriverDistractionState is INVALID_ENUM");
+ SDL_LOG_WARN("DriverDistractionState is INVALID_ENUM");
return;
}
@@ -4439,7 +4535,7 @@ void ApplicationManagerImpl::SendDriverDistractionState(
void ApplicationManagerImpl::SendGetIconUrlNotifications(
const uint32_t connection_key, ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<std::string> enabled_apps;
GetPolicyHandler().GetEnabledCloudApps(enabled_apps);
std::vector<std::string>::iterator enabled_it = enabled_apps.begin();
@@ -4448,7 +4544,7 @@ void ApplicationManagerImpl::SendGetIconUrlNotifications(
for (; enabled_it != enabled_end; ++enabled_it) {
auto app_icon_it = app_icon_map_.find(*enabled_it);
if (app_icon_it == app_icon_map_.end()) {
- LOG4CXX_WARN(logger_, "Could not find cloud app in icon map");
+ SDL_LOG_WARN("Could not find cloud app in icon map");
continue;
}
@@ -4456,18 +4552,18 @@ void ApplicationManagerImpl::SendGetIconUrlNotifications(
bool pending_request = app_icon_it->second.pending_request;
if (pending_request) {
- LOG4CXX_DEBUG(logger_, "Cloud app has already sent request");
+ SDL_LOG_DEBUG("Cloud app has already sent request");
continue;
}
std::string url = GetPolicyHandler().GetIconUrl(*enabled_it);
if (url.empty()) {
- LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app");
+ SDL_LOG_DEBUG("No Icon Url for cloud app");
continue;
}
- LOG4CXX_DEBUG(logger_, "Creating Get Icon Request");
+ SDL_LOG_DEBUG("Creating Get Icon Request");
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
@@ -4491,24 +4587,23 @@ void ApplicationManagerImpl::SendGetIconUrlNotifications(
protocol_handler::MajorProtocolVersion
ApplicationManagerImpl::SupportedSDLVersion() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return static_cast<protocol_handler::MajorProtocolVersion>(
get_settings().max_supported_protocol_version());
}
void ApplicationManagerImpl::AddAppToRegisteredAppList(
const ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
// Add application to registered app list and set appropriate mark.
application->MarkRegistered();
applications_.insert(application);
- LOG4CXX_DEBUG(
- logger_,
- "App with app_id: " << application->app_id()
- << " has been added to registered applications list");
+ SDL_LOG_DEBUG("App with app_id: "
+ << application->app_id()
+ << " has been added to registered applications list");
if (application_list_update_timer_.is_running() &&
!registered_during_timer_execution_) {
GetPolicyHandler().OnAddedNewApplicationToAppList(
@@ -4520,7 +4615,7 @@ void ApplicationManagerImpl::AddAppToRegisteredAppList(
void ApplicationManagerImpl::ApplyFunctorForEachPlugin(
std::function<void(plugin_manager::RPCPlugin&)> functor) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
plugin_manager_->ForEachPlugin(functor);
}
@@ -4545,16 +4640,14 @@ bool ApplicationManagerImpl::InitDirectory(
const std::string& path, ApplicationManagerImpl::DirectoryType type) const {
const std::string directory_type = DirectoryTypeToString(type);
if (!file_system::DirectoryExists(path)) {
- LOG4CXX_WARN(logger_, directory_type << " directory doesn't exist.");
+ SDL_LOG_WARN(directory_type << " directory doesn't exist.");
// if storage directory doesn't exist try to create it
if (!file_system::CreateDirectoryRecursively(path)) {
- LOG4CXX_ERROR(
- logger_,
- "Unable to create " << directory_type << " directory " << path);
+ SDL_LOG_ERROR("Unable to create " << directory_type << " directory "
+ << path);
return false;
}
- LOG4CXX_DEBUG(logger_,
- directory_type << " directory has been created: " << path);
+ SDL_LOG_DEBUG(directory_type << " directory has been created: " << path);
}
return true;
@@ -4565,31 +4658,28 @@ bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string& path,
const std::string directory_type = DirectoryTypeToString(type);
if (!(file_system::IsWritingAllowed(path) &&
file_system::IsReadingAllowed(path))) {
- LOG4CXX_ERROR(
- logger_,
- directory_type << " directory doesn't have read/write permissions.");
+ SDL_LOG_ERROR(directory_type
+ << " directory doesn't have read/write permissions.");
return false;
}
- LOG4CXX_DEBUG(logger_,
- directory_type << " directory has read/write permissions.");
+ SDL_LOG_DEBUG(directory_type << " directory has read/write permissions.");
return true;
}
void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
tts_global_properties_app_list_.clear();
}
bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
uint32_t app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- LOG4CXX_DEBUG(logger_,
- "There are applications subscribed: "
- << subscribed_way_points_apps_list_.size());
+ SDL_LOG_DEBUG("There are applications subscribed: "
+ << subscribed_way_points_apps_list_.size());
if (subscribed_way_points_apps_list_.find(app_id) ==
subscribed_way_points_apps_list_.end()) {
return false;
@@ -4598,18 +4688,17 @@ bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
}
bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
- ApplicationSharedPtr app) const {
- return IsAppSubscribedForWayPoints(app->app_id());
+ Application& app) const {
+ return IsAppSubscribedForWayPoints(app.app_id());
}
void ApplicationManagerImpl::SubscribeAppForWayPoints(uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- LOG4CXX_DEBUG(logger_, "Subscribing " << app_id);
+ SDL_LOG_DEBUG("Subscribing " << app_id);
subscribed_way_points_apps_list_.insert(app_id);
- LOG4CXX_DEBUG(logger_,
- "There are applications subscribed: "
- << subscribed_way_points_apps_list_.size());
+ SDL_LOG_DEBUG("There are applications subscribed: "
+ << subscribed_way_points_apps_list_.size());
if (way_points_data_) {
smart_objects::SmartObjectSPtr way_point_notification_ =
std::make_shared<smart_objects::SmartObject>(*way_points_data_);
@@ -4625,13 +4714,12 @@ void ApplicationManagerImpl::SubscribeAppForWayPoints(
}
void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- LOG4CXX_DEBUG(logger_, "Unsubscribing " << app_id);
+ SDL_LOG_DEBUG("Unsubscribing " << app_id);
subscribed_way_points_apps_list_.erase(app_id);
- LOG4CXX_DEBUG(logger_,
- "There are applications subscribed: "
- << subscribed_way_points_apps_list_.size());
+ SDL_LOG_DEBUG("There are applications subscribed: "
+ << subscribed_way_points_apps_list_.size());
if (subscribed_way_points_apps_list_.empty()) {
way_points_data_.reset();
}
@@ -4643,11 +4731,10 @@ void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
}
bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- LOG4CXX_DEBUG(logger_,
- "There are applications subscribed: "
- << subscribed_way_points_apps_list_.size());
+ SDL_LOG_DEBUG("There are applications subscribed: "
+ << subscribed_way_points_apps_list_.size());
return !subscribed_way_points_apps_list_.empty();
}
@@ -4659,7 +4746,7 @@ void ApplicationManagerImpl::SaveWayPointsMessage(
const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
return subscribed_way_points_apps_list_;
}
@@ -4667,7 +4754,7 @@ const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints()
// retrieve transport type string used in .ini file, e.g. "TCP_WIFI"
const std::string ApplicationManagerImpl::GetTransportTypeProfileString(
connection_handler::DeviceHandle device_handle) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return connection_handler()
.get_session_observer()
@@ -4766,7 +4853,7 @@ bool ApplicationManagerImpl::IsSOStructValid(
return display_capabilities_so.isValid();
}
- LOG4CXX_ERROR(logger_, "Could not find struct id: " << struct_id);
+ SDL_LOG_ERROR("Could not find struct id: " << struct_id);
return false;
}
@@ -4816,7 +4903,7 @@ ApplicationSharedPtr ApplicationManagerImpl::application(
const std::string& device_id, const std::string& policy_app_id) const {
connection_handler::DeviceHandle device_handle;
if (!connection_handler().GetDeviceID(device_id, &device_handle)) {
- LOG4CXX_DEBUG(logger_, "No such device : " << device_id);
+ SDL_LOG_DEBUG("No such device : " << device_id);
return ApplicationSharedPtr();
}
@@ -4824,8 +4911,7 @@ ApplicationSharedPtr ApplicationManagerImpl::application(
ApplicationSharedPtr app =
FindApp(accessor, IsApplication(device_handle, policy_app_id));
- LOG4CXX_DEBUG(logger_,
- " policy_app_id << " << policy_app_id << "Found = " << app);
+ SDL_LOG_DEBUG(" policy_app_id << " << policy_app_id << "Found = " << app);
return app;
}
@@ -4843,11 +4929,11 @@ std::vector<std::string> ApplicationManagerImpl::devices(
void ApplicationManagerImpl::ChangeAppsHMILevel(
uint32_t app_id, mobile_apis::HMILevel::eType level) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "AppID to change: " << app_id << " -> " << level);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("AppID to change: " << app_id << " -> " << level);
ApplicationSharedPtr app = application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id);
+ SDL_LOG_ERROR("There is no app with id: " << app_id);
return;
}
@@ -4864,7 +4950,7 @@ void ApplicationManagerImpl::ChangeAppsHMILevel(
old_hmi_state->system_context());
OnHMIStateChanged(app_id, old_hmi_state, new_hmi_state);
} else {
- LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level);
+ SDL_LOG_WARN("Redundant changing HMI level: " << level);
}
}
diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc
index 6ed784424a..2fb583ab3e 100644
--- a/src/components/application_manager/src/application_state.cc
+++ b/src/components/application_manager/src/application_state.cc
@@ -52,17 +52,16 @@ struct StateIDComparator {
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
ApplicationState::ApplicationState() {}
void ApplicationState::InitState(const WindowID window_id,
const std::string& window_name,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(state);
- LOG4CXX_DEBUG(logger_,
- "Initing state " << state << " for window " << window_id
+ SDL_LOG_DEBUG("Initing state " << state << " for window " << window_id
<< " with name " << window_name);
{
sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
@@ -72,7 +71,7 @@ void ApplicationState::InitState(const WindowID window_id,
}
void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(state);
switch (state->state_id()) {
case HmiState::StateID::STATE_ID_REGULAR:
@@ -82,8 +81,7 @@ void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) {
SetPostponedState(window_id, state);
return;
case HmiState::StateID::STATE_ID_CURRENT:
- LOG4CXX_ERROR(logger_,
- "State of type '" << state << "' can't be added for window "
+ SDL_LOG_ERROR("State of type '" << state << "' can't be added for window "
<< window_id);
return;
default:
@@ -96,14 +94,13 @@ void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) {
void ApplicationState::RemoveState(const WindowID window_id,
HmiState::StateID state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(state);
switch (state) {
case HmiState::StateID::STATE_ID_CURRENT:
case HmiState::StateID::STATE_ID_REGULAR:
if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) {
- LOG4CXX_ERROR(logger_,
- "State of type '" << state
+ SDL_LOG_ERROR("State of type '" << state
<< "' can't be removed for window "
<< window_id);
return;
@@ -124,20 +121,19 @@ HmiStatePtr ApplicationState::GetState(const WindowID window_id,
HmiState::StateID state_id) const {
switch (state_id) {
case HmiState::StateID::STATE_ID_REGULAR:
- LOG4CXX_DEBUG(logger_, "Getting regular state for window " << window_id);
+ SDL_LOG_DEBUG("Getting regular state for window " << window_id);
return RegularHmiState(window_id);
case HmiState::StateID::STATE_ID_POSTPONED:
- LOG4CXX_DEBUG(logger_,
- "Getting postponed state for window " << window_id);
+ SDL_LOG_DEBUG("Getting postponed state for window " << window_id);
return PostponedHmiState(window_id);
default:
- LOG4CXX_DEBUG(logger_, "Getting current state for window " << window_id);
+ SDL_LOG_DEBUG("Getting current state for window " << window_id);
return CurrentHmiState(window_id);
}
}
HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const {
- LOG4CXX_DEBUG(logger_, "Collecting all states of type " << state_id);
+ SDL_LOG_DEBUG("Collecting all states of type " << state_id);
HmiStates hmi_states;
sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
@@ -149,7 +145,7 @@ HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const {
}
WindowIds ApplicationState::GetWindowIds() const {
- LOG4CXX_DEBUG(logger_, "Collecting available window ID's");
+ SDL_LOG_DEBUG("Collecting available window ID's");
WindowIds window_ids;
std::string stringified_window_ids;
@@ -161,14 +157,13 @@ WindowIds ApplicationState::GetWindowIds() const {
std::to_string(hmi_state_pair.first);
}
- LOG4CXX_DEBUG(logger_,
- "Existing window IDs: [" + stringified_window_ids + "]");
+ SDL_LOG_DEBUG("Existing window IDs: [" + stringified_window_ids + "]");
return window_ids;
}
void ApplicationState::AddHMIState(const WindowID window_id,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(state);
sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
HmiStates& hmi_states = hmi_states_map_[window_id];
@@ -176,54 +171,63 @@ void ApplicationState::AddHMIState(const WindowID window_id,
hmi_states.end(),
StateIDComparator(state->state_id()));
if (hmi_states.end() != it) {
- LOG4CXX_WARN(logger_,
- "Hmi state with ID " << state->state_id()
- << "has been already applied for window "
- << window_id
- << " of this application. Ignoring");
- return;
+ SDL_LOG_WARN("Hmi state with ID "
+ << state->state_id() << "has been already applied for window "
+ << window_id << " of this application. Overwriting");
+ EraseHMIState(hmi_states, it);
}
+ if (!hmi_states.empty()) {
+ HmiStatePtr back_state = hmi_states.back();
+ state->set_parent(back_state);
+ }
hmi_states.push_back(state);
}
void ApplicationState::RemoveHMIState(const WindowID window_id,
HmiState::StateID state_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
HmiStates& hmi_states = hmi_states_map_[window_id];
+ // unable to remove regular state
+ DCHECK_OR_RETURN_VOID(state_id != HmiState::StateID::STATE_ID_REGULAR);
HmiStates::iterator it = std::find_if(
hmi_states.begin(), hmi_states.end(), StateIDComparator(state_id));
if (hmi_states.end() == it) {
- LOG4CXX_ERROR(logger_,
- "Unsuccesful remove HmiState: " << state_id << " for window "
+ SDL_LOG_ERROR("Unsuccesful remove HmiState: " << state_id << " for window "
<< window_id);
return;
}
- // unable to remove regular state
- DCHECK_OR_RETURN_VOID(hmi_states.begin() != it);
- HmiStates::iterator next = it;
- HmiStates::iterator prev = it;
- next++;
- prev--;
-
- if (next != hmi_states.end()) {
- HmiStatePtr next_state = *next;
- HmiStatePtr prev_state = *prev;
- next_state->set_parent(prev_state);
+ EraseHMIState(hmi_states, it);
+}
+
+void ApplicationState::EraseHMIState(HmiStates& hmi_states,
+ HmiStates::iterator it) {
+ if (hmi_states.begin() == it) {
+ (*it)->set_parent(nullptr);
+ } else {
+ HmiStates::iterator next = it;
+ HmiStates::iterator prev = it;
+ next++;
+ prev--;
+
+ if (hmi_states.end() != next) {
+ HmiStatePtr next_state = *next;
+ HmiStatePtr prev_state = *prev;
+ next_state->set_parent(prev_state);
+ }
}
hmi_states.erase(it);
}
void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(mobile_apis::PredefinedWindows::DEFAULT_WINDOW !=
window_id);
- LOG4CXX_DEBUG(logger_,
- "Removing HMI states for window with id #" << window_id);
+ SDL_LOG_DEBUG("Removing HMI states for window with id #" << window_id);
{
sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
hmi_states_map_.erase(window_id);
@@ -231,28 +235,17 @@ void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) {
}
void ApplicationState::RemovePostponedState(const WindowID window_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
- HmiStates& hmi_states = hmi_states_map_[window_id];
- DCHECK_OR_RETURN_VOID(!hmi_states.empty());
-
- StateIDComparator finder(HmiState::StateID::STATE_ID_POSTPONED);
-
- HmiStates::iterator postponed_state =
- std::find_if(hmi_states.begin(), hmi_states.end(), finder);
-
- if (hmi_states.end() == postponed_state) {
- LOG4CXX_ERROR(logger_,
- "No postponed state is set for window " << window_id);
- return;
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock auto_lock(postponed_states_map_lock_);
+ size_t deleted_elements = postponed_states_map_.erase(window_id);
+ if (0 == deleted_elements) {
+ SDL_LOG_ERROR("No postponed state is set for window " << window_id);
}
-
- hmi_states.erase(postponed_state);
}
void ApplicationState::SetRegularState(const WindowID window_id,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_REGULAR);
@@ -260,45 +253,32 @@ void ApplicationState::SetRegularState(const WindowID window_id,
HmiStates& hmi_states = hmi_states_map_[window_id];
DCHECK_OR_RETURN_VOID(!hmi_states.empty());
- HmiStatePtr front_state = hmi_states.front();
- HmiState::StateID front_state_id = front_state->state_id();
- if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
- // Drop postponed state
- hmi_states.erase(hmi_states.begin());
- }
-
// Drop regular state
- hmi_states.erase(hmi_states.begin());
+ HmiStates::iterator it =
+ std::find_if(hmi_states.begin(),
+ hmi_states.end(),
+ StateIDComparator(HmiState::StateID::STATE_ID_REGULAR));
+ DCHECK_OR_RETURN_VOID(hmi_states.end() != it);
+ EraseHMIState(hmi_states, it);
if (!hmi_states.empty()) {
- HmiStatePtr front_state = hmi_states.front();
- front_state->set_parent(state);
+ HmiStatePtr back_state = hmi_states.back();
+ state->set_parent(back_state);
}
// Insert new regular state
- hmi_states.insert(hmi_states.begin(), state);
- if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
- // Restore postponed state if it was before
- hmi_states.insert(hmi_states.begin(), front_state);
- }
+ hmi_states.push_back(state);
}
void ApplicationState::SetPostponedState(const WindowID window_id,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_POSTPONED);
- sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
- HmiStates& hmi_states = hmi_states_map_[window_id];
- DCHECK_OR_RETURN_VOID(!hmi_states.empty());
- HmiStatePtr front_state = hmi_states.front();
- if (front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
- hmi_states.erase(hmi_states.begin());
- }
-
- hmi_states.insert(hmi_states.begin(), state);
+ sync_primitives::AutoLock auto_lock(postponed_states_map_lock_);
+ postponed_states_map_[window_id] = state;
}
HmiStatePtr ApplicationState::CurrentHmiState(const WindowID window_id) const {
@@ -310,9 +290,6 @@ HmiStatePtr ApplicationState::CurrentHmiState(const WindowID window_id) const {
DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
HmiStatePtr back_state = hmi_states.back();
- DCHECK_OR_RETURN(
- back_state->state_id() != HmiState::StateID::STATE_ID_POSTPONED,
- HmiStatePtr());
return back_state;
}
@@ -324,28 +301,21 @@ HmiStatePtr ApplicationState::RegularHmiState(const WindowID window_id) const {
const HmiStates& hmi_states = it_states->second;
DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+ auto it =
+ std::find_if(hmi_states.begin(),
+ hmi_states.end(),
+ StateIDComparator(HmiState::StateID::STATE_ID_REGULAR));
+ DCHECK_OR_RETURN(hmi_states.end() != it, HmiStatePtr());
- HmiStates::const_iterator front_itr = hmi_states.begin();
- if ((*front_itr)->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
- ++front_itr;
- }
-
- return *front_itr;
+ return *it;
}
HmiStatePtr ApplicationState::PostponedHmiState(
const WindowID window_id) const {
- sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
- auto it_states = hmi_states_map_.find(window_id);
- DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
-
- const HmiStates& hmi_states = it_states->second;
- DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+ sync_primitives::AutoLock auto_lock(postponed_states_map_lock_);
- HmiStatePtr front_state = hmi_states.front();
- return front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED
- ? front_state
- : HmiStatePtr();
+ auto it = postponed_states_map_.find(window_id);
+ return it != postponed_states_map_.end() ? it->second : HmiStatePtr();
}
} // namespace application_manager
diff --git a/src/components/application_manager/src/command_holder_impl.cc b/src/components/application_manager/src/command_holder_impl.cc
index 1c336ac64f..cfd782a80b 100644
--- a/src/components/application_manager/src/command_holder_impl.cc
+++ b/src/components/application_manager/src/command_holder_impl.cc
@@ -35,7 +35,7 @@
#include "application_manager/commands/command.h"
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
CommandHolderImpl::CommandHolderImpl(ApplicationManager& app_manager)
: app_manager_(app_manager) {}
@@ -45,33 +45,29 @@ void CommandHolderImpl::Suspend(
CommandType type,
commands::Command::CommandSource source,
std::shared_ptr<smart_objects::SmartObject> command) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
- LOG4CXX_DEBUG(logger_,
- "Suspending command(s) for application: "
- << application->policy_app_id());
+ SDL_LOG_DEBUG("Suspending command(s) for application: "
+ << application->policy_app_id());
AppCommandInfo info = {command, source};
sync_primitives::AutoLock lock(commands_lock_);
if (CommandType::kHmiCommand == type) {
app_hmi_commands_[application].push_back(info);
- LOG4CXX_DEBUG(logger_,
- "Suspended HMI command(s): " << app_hmi_commands_.size());
+ SDL_LOG_DEBUG("Suspended HMI command(s): " << app_hmi_commands_.size());
} else {
app_mobile_commands_[application].push_back(info);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Suspended mobile command(s): " << app_mobile_commands_.size());
}
}
void CommandHolderImpl::Resume(ApplicationSharedPtr application,
CommandType type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Resuming command(s) for application: " << application->policy_app_id());
if (CommandType::kHmiCommand == type) {
ResumeHmiCommand(application);
@@ -81,24 +77,21 @@ void CommandHolderImpl::Resume(ApplicationSharedPtr application,
}
void CommandHolderImpl::Clear(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Clearing command(s) for application: " << application->policy_app_id());
sync_primitives::AutoLock lock(commands_lock_);
auto app_hmi_commands = app_hmi_commands_.find(application);
if (app_hmi_commands_.end() != app_hmi_commands) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Clearing HMI command(s): " << app_hmi_commands->second.size());
app_hmi_commands_.erase(app_hmi_commands);
}
auto app_mobile_commands = app_mobile_commands_.find(application);
if (app_mobile_commands_.end() != app_mobile_commands) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Clearing mobile command(s): " << app_mobile_commands->second.size());
app_mobile_commands_.erase(app_mobile_commands);
}
@@ -112,8 +105,7 @@ void CommandHolderImpl::ResumeHmiCommand(ApplicationSharedPtr application) {
return;
}
- LOG4CXX_DEBUG(logger_,
- "Resuming HMI command(s): " << app_hmi_commands_.size());
+ SDL_LOG_DEBUG("Resuming HMI command(s): " << app_hmi_commands_.size());
for (auto cmd : app_commands->second) {
(*cmd.command_ptr_)[strings::msg_params][strings::app_id] =
@@ -133,8 +125,7 @@ void CommandHolderImpl::ResumeMobileCommand(ApplicationSharedPtr application) {
return;
}
- LOG4CXX_DEBUG(logger_,
- "Resuming mobile command(s): " << app_mobile_commands_.size());
+ SDL_LOG_DEBUG("Resuming mobile command(s): " << app_mobile_commands_.size());
for (auto cmd : app_commands->second) {
(*cmd.command_ptr_)[strings::params][strings::connection_key] =
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 3872ae45ab..47659e52ca 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -49,7 +49,7 @@ struct AppExtensionPredicate {
namespace commands {
-CREATE_LOGGERPTR_LOCAL(CommandImpl::logger_, "Commands")
+SDL_CREATE_LOG_VARIABLE("Commands")
const int32_t CommandImpl::hmi_protocol_type_ = 1;
const int32_t CommandImpl::mobile_protocol_type_ = 0;
@@ -130,15 +130,15 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) {
}
bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const ApplicationSharedPtr app =
application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "There is no registered application with "
- "connection key '"
- << connection_key() << "'");
+ SDL_LOG_ERROR(
+ "There is no registered application with "
+ "connection key '"
+ << connection_key() << "'");
return false;
}
@@ -149,7 +149,7 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
smart_objects::SmartMap::const_iterator iter_end = s_map.map_end();
for (; iter != iter_end; ++iter) {
- LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
+ SDL_LOG_DEBUG("Request's param: " << iter->first);
params.insert(iter->first);
}
@@ -199,7 +199,7 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
}
void CommandImpl::RemoveDisallowedParameters() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject& params = (*message_)[strings::msg_params];
@@ -209,8 +209,7 @@ void CommandImpl::RemoveDisallowedParameters() {
// Remove from request all disallowed parameters
params.erase(key);
removed_parameters_permissions_.disallowed_params.insert(key);
- LOG4CXX_INFO(logger_,
- "Following parameter is disallowed by user: " << key);
+ SDL_LOG_INFO("Following parameter is disallowed by user: " << key);
}
else if (removed_parameters_permissions_.undefined_params.end() !=
@@ -218,8 +217,7 @@ void CommandImpl::RemoveDisallowedParameters() {
// Remove from request all undefined yet parameters
params.erase(key);
removed_parameters_permissions_.undefined_params.insert(key);
- LOG4CXX_INFO(logger_,
- "Following parameter is disallowed by policy: " << key);
+ SDL_LOG_INFO("Following parameter is disallowed by policy: " << key);
}
else if (parameters_permissions_.allowed_params.end() ==
@@ -227,27 +225,25 @@ void CommandImpl::RemoveDisallowedParameters() {
// Remove from request all parameters missed in allowed
params.erase(key);
removed_parameters_permissions_.undefined_params.insert(key);
- LOG4CXX_INFO(logger_,
- "Following parameter is not found among allowed parameters '"
- << key << "' and will be treated as disallowed.");
+ SDL_LOG_INFO("Following parameter is not found among allowed parameters '"
+ << key << "' and will be treated as disallowed.");
}
}
}
bool CommandImpl::ReplaceMobileWithHMIAppId(
ns_smart_device_link::ns_smart_objects::SmartObject& message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (message.keyExists(strings::app_id)) {
ApplicationSharedPtr application =
application_manager_.application(message[strings::app_id].asUInt());
if (!application) {
- LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed.");
+ SDL_LOG_ERROR("Substitution mobile --> HMI id is failed.");
return false;
}
- LOG4CXX_DEBUG(logger_,
- "ReplaceMobileWithHMIAppId from "
- << message[strings::app_id].asInt() << " to "
- << application->hmi_app_id());
+ SDL_LOG_DEBUG("ReplaceMobileWithHMIAppId from "
+ << message[strings::app_id].asInt() << " to "
+ << application->hmi_app_id());
message[strings::app_id] = application->hmi_app_id();
} else {
switch (message.getType()) {
@@ -287,13 +283,12 @@ bool CommandImpl::ReplaceHMIWithMobileAppId(
message[strings::app_id].asUInt());
if (!application) {
- LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed.");
+ SDL_LOG_ERROR("Substitution HMI --> mobile id is failed.");
return false;
}
- LOG4CXX_DEBUG(logger_,
- "ReplaceHMIWithMobileAppId from "
- << message[strings::app_id].asInt() << " to "
- << application->app_id());
+ SDL_LOG_DEBUG("ReplaceHMIWithMobileAppId from "
+ << message[strings::app_id].asInt() << " to "
+ << application->app_id());
message[strings::app_id] = application->app_id();
} else {
switch (message.getType()) {
@@ -326,7 +321,7 @@ bool CommandImpl::ReplaceHMIWithMobileAppId(
uint32_t CommandImpl::CalcCommandInternalConsecutiveNumber(
ApplicationConstSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const DataAccessor<CommandsMap> accessor = app->commands_map();
const CommandsMap& commands = accessor.GetData();
@@ -341,12 +336,12 @@ uint32_t CommandImpl::CalcCommandInternalConsecutiveNumber(
bool CommandImpl::CheckSyntax(const std::string& str,
bool allow_empty_line) const {
if (std::string::npos != str.find_first_of("\t\n")) {
- LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str);
+ SDL_LOG_ERROR("CheckSyntax failed! :" << str);
return false;
}
if (std::string::npos != str.find("\\n") ||
std::string::npos != str.find("\\t")) {
- LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str);
+ SDL_LOG_ERROR("CheckSyntax failed! :" << str);
return false;
}
if (!allow_empty_line) {
diff --git a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
index 46c1c87699..e978a49635 100644
--- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
+++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
@@ -39,6 +39,8 @@ namespace application_manager {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CommandNotificationFromMobileImpl::CommandNotificationFromMobileImpl(
const MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -73,7 +75,7 @@ void CommandNotificationFromMobileImpl::SendNotification() {
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
- LOG4CXX_INFO(logger_, "SendNotification");
+ SDL_LOG_INFO("SendNotification");
MessageHelper::PrintSmartObject(*message_);
rpc_service_.SendMessageToMobile(message_);
diff --git a/src/components/application_manager/src/commands/command_notification_impl.cc b/src/components/application_manager/src/commands/command_notification_impl.cc
index cc2606ab6f..13020828b1 100644
--- a/src/components/application_manager/src/commands/command_notification_impl.cc
+++ b/src/components/application_manager/src/commands/command_notification_impl.cc
@@ -39,6 +39,8 @@ namespace application_manager {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
CommandNotificationImpl::CommandNotificationImpl(
const MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -63,16 +65,17 @@ bool CommandNotificationImpl::CleanUp() {
void CommandNotificationImpl::Run() {}
-void CommandNotificationImpl::SendNotification() {
+void CommandNotificationImpl::SendNotification(const bool final_message) {
(*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");
+ SDL_LOG_INFO("SendNotification: final_message = " << std::boolalpha
+ << final_message);
MessageHelper::PrintSmartObject(*message_);
- rpc_service_.SendMessageToMobile(message_);
+ rpc_service_.SendMessageToMobile(message_, final_message);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index d20039bf70..938b7afc99 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -49,6 +49,8 @@ namespace application_manager {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands");
+
std::string MergeInfos(const ResponseInfo& first_info,
const std::string& first_str,
const ResponseInfo& second_info,
@@ -92,22 +94,19 @@ const std::string CreateInfoForUnsupportedResult(
return "UI is not supported by system";
}
case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): {
- return "Navi is not supported by system";
+ return "Navigation is not supported by system";
}
case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): {
return "VehicleInfo is not supported by system";
}
case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): {
- return "Remote control is not supported by system";
+ return "RC is not supported by system";
}
default:
-#ifdef ENABLE_LOG
- CREATE_LOGGERPTR_LOCAL(logger, "Commands");
- LOG4CXX_WARN(logger,
- "Could not create info because"
- " interface isn't valid. Interface is:"
- << static_cast<int32_t>(interface));
-#endif // ENABLE_LOG
+ SDL_LOG_WARN(
+ "Could not create info because"
+ " interface isn't valid. Interface is:"
+ << static_cast<int32_t>(interface));
return "";
}
}
@@ -232,7 +231,7 @@ bool CommandRequestImpl::CleanUp() {
void CommandRequestImpl::Run() {}
void CommandRequestImpl::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
unsubscribe_from_all_hmi_events();
unsubscribe_from_all_mobile_events();
@@ -240,7 +239,7 @@ void CommandRequestImpl::onTimeOut() {
// 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");
+ SDL_LOG_DEBUG("current_state_ = kCompleted");
// don't send timeout if request completed
return;
}
@@ -267,7 +266,7 @@ void CommandRequestImpl::SendResponse(
const char* info,
const smart_objects::SmartObject* response_params,
const std::vector<uint8_t> binary_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock auto_lock(state_lock_);
if (kTimedOut == current_state_) {
@@ -355,7 +354,7 @@ smart_objects::SmartObject CreateUnsupportedResourceResponse(
bool CommandRequestImpl::ProcessHMIInterfacesAvailability(
const uint32_t hmi_correlation_id,
const hmi_apis::FunctionID::eType& function_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
HmiInterfaces::InterfaceID interface =
hmi_interfaces.GetInterfaceFromFunction(function_id);
@@ -373,41 +372,38 @@ bool CommandRequestImpl::ProcessHMIInterfacesAvailability(
}
void CommandRequestImpl::UpdateHash() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (hash_update_mode_ == kSkipHashUpdate) {
- LOG4CXX_DEBUG(logger_, "Hash update is disabled for " << function_id());
+ SDL_LOG_DEBUG("Hash update is disabled for " << function_id());
return;
}
if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE ==
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) {
- LOG4CXX_ERROR(logger_,
- "UI interface has not responded. Hash won't be updated.");
+ SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated.");
return;
}
if (!is_success_result_) {
- LOG4CXX_WARN(logger_, "Command is not succeeded. Hash won't be updated.");
+ SDL_LOG_WARN("Command is not succeeded. Hash won't be updated.");
return;
}
ApplicationSharedPtr application =
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_,
- "Application with connection key "
- << connection_key()
- << " not found. Not able to update hash.");
+ SDL_LOG_ERROR("Application with connection key "
+ << connection_key()
+ << " not found. Not able to update hash.");
return;
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Updating hash for application with connection key "
- << connection_key() << " while processing function id "
- << MessageHelper::StringifiedFunctionID(
- static_cast<mobile_api::FunctionID::eType>(function_id())));
+ << connection_key() << " while processing function id "
+ << MessageHelper::StringifiedFunctionID(
+ static_cast<mobile_api::FunctionID::eType>(function_id())));
application->UpdateHash();
}
@@ -417,7 +413,7 @@ void CommandRequestImpl::SendProviderRequest(
const hmi_apis::FunctionID::eType& hmi_function_id,
const smart_objects::SmartObject* msg,
bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool hmi_destination = false;
ApplicationSharedPtr app;
// Default error code and error message
@@ -444,7 +440,7 @@ void CommandRequestImpl::SendProviderRequest(
}
if (hmi_destination) {
- LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ SDL_LOG_DEBUG("Sending Request to HMI Provider");
application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
correlation_id());
SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
@@ -452,7 +448,7 @@ void CommandRequestImpl::SendProviderRequest(
}
if (!app) {
- LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
+ SDL_LOG_DEBUG("Invalid App Provider pointer");
SendResponse(false, error_code, error_msg.c_str());
return;
}
@@ -489,14 +485,13 @@ void CommandRequestImpl::SendMobileRequest(
request[strings::params][strings::correlation_id] = mobile_correlation_id;
request[strings::params][strings::message_type] = MessageType::kRequest;
if (use_events) {
- LOG4CXX_DEBUG(logger_,
- "SendMobileRequest subscribe_on_event "
- << function_id << " " << mobile_correlation_id);
+ SDL_LOG_DEBUG("SendMobileRequest subscribe_on_event "
+ << function_id << " " << mobile_correlation_id);
subscribe_on_event(function_id, mobile_correlation_id);
}
if (!rpc_service_.ManageMobileCommand(msg, SOURCE_SDL)) {
- LOG4CXX_ERROR(logger_, "Unable to send request to mobile");
+ SDL_LOG_ERROR("Unable to send request to mobile");
}
}
@@ -524,18 +519,17 @@ uint32_t CommandRequestImpl::SendHMIRequest(
}
if (use_events) {
- LOG4CXX_DEBUG(logger_,
- "SendHMIRequest subscribe_on_event " << function_id << " "
+ SDL_LOG_DEBUG("SendHMIRequest subscribe_on_event " << function_id << " "
<< hmi_correlation_id);
subscribe_on_event(function_id, hmi_correlation_id);
}
if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
+ SDL_LOG_ERROR("Unable to send request");
SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
}
} else {
- LOG4CXX_DEBUG(logger_, "Interface is not available");
+ SDL_LOG_DEBUG("Interface is not available");
}
return hmi_correlation_id;
}
@@ -546,7 +540,7 @@ void CommandRequestImpl::CreateHMINotification(
smart_objects::SmartObjectSPtr result =
std::make_shared<smart_objects::SmartObject>();
if (!result) {
- LOG4CXX_ERROR(logger_, "Memory allocation failed.");
+ SDL_LOG_ERROR("Memory allocation failed.");
return;
}
smart_objects::SmartObject& notify = *result;
@@ -561,7 +555,7 @@ void CommandRequestImpl::CreateHMINotification(
notify[strings::msg_params] = msg_params;
if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
- LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
+ SDL_LOG_ERROR("Unable to send HMI notification");
}
}
@@ -674,7 +668,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code);
+ SDL_LOG_ERROR("Unknown HMI result code " << hmi_code);
break;
}
}
@@ -684,7 +678,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
bool CommandRequestImpl::CheckAllowedParameters(
const Command::CommandSource source) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// RegisterAppInterface should always be allowed
if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
@@ -697,19 +691,19 @@ bool CommandRequestImpl::CheckAllowedParameters(
bool CommandRequestImpl::CheckHMICapabilities(
const mobile_apis::ButtonName::eType button) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
using namespace mobile_apis;
if (!hmi_capabilities_.is_ui_cooperating()) {
- LOG4CXX_ERROR(logger_, "UI is not supported by HMI");
+ SDL_LOG_ERROR("UI is not supported by HMI");
return false;
}
auto button_capabilities = hmi_capabilities_.button_capabilities();
if (!button_capabilities) {
- LOG4CXX_ERROR(logger_, "Invalid button capabilities object");
+ SDL_LOG_ERROR("Invalid button capabilities object");
return false;
}
@@ -718,14 +712,12 @@ bool CommandRequestImpl::CheckHMICapabilities(
const ButtonName::eType current_button = static_cast<ButtonName::eType>(
capabilities.getElement(hmi_response::button_name).asInt());
if (current_button == button) {
- LOG4CXX_DEBUG(logger_,
- "Button capabilities for " << button << " was found");
+ SDL_LOG_DEBUG("Button capabilities for " << button << " was found");
return true;
}
}
- LOG4CXX_DEBUG(logger_,
- "Button capabilities for " << button << " was not found");
+ SDL_LOG_DEBUG("Button capabilities for " << button << " was not found");
return false;
}
@@ -789,7 +781,7 @@ bool CommandRequestImpl::HasDisallowedParams() const {
bool CommandRequestImpl::IsMobileResultSuccess(
const mobile_apis::Result::eType result_code) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
return Compare<mobile_apis::Result::eType, EQ, ONE>(
result_code,
@@ -803,7 +795,7 @@ bool CommandRequestImpl::IsMobileResultSuccess(
bool CommandRequestImpl::IsHMIResultSuccess(
const hmi_apis::Common_Result::eType result_code) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
return Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
result_code,
@@ -818,7 +810,7 @@ bool CommandRequestImpl::IsHMIResultSuccess(
bool CommandRequestImpl::PrepareResultForMobileResponse(
hmi_apis::Common_Result::eType result_code,
HmiInterfaces::InterfaceID interface) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (IsHMIResultSuccess(result_code)) {
return true;
}
@@ -834,7 +826,7 @@ bool CommandRequestImpl::PrepareResultForMobileResponse(
bool CommandRequestImpl::PrepareResultForMobileResponse(
ResponseInfo& out_first, ResponseInfo& out_second) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool result =
CheckResult(out_first, out_second) || CheckResult(out_second, out_first);
return result;
@@ -853,7 +845,7 @@ void CommandRequestImpl::GetInfo(
mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse(
const ResponseInfo& first, const ResponseInfo& second) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
if (IsResultCodeUnsupported(first, second) ||
IsResultCodeUnsupported(second, first)) {
@@ -907,10 +899,10 @@ void CommandRequestImpl::EndAwaitForInterface(
if (it != awaiting_response_interfaces_.end()) {
awaiting_response_interfaces_.erase(it);
} else {
- LOG4CXX_WARN(logger_,
- "EndAwaitForInterface called on interface \
+ SDL_LOG_WARN(
+ "EndAwaitForInterface called on interface \
which was not put into await state: "
- << interface_id);
+ << interface_id);
}
}
@@ -961,10 +953,10 @@ const std::string InfoInterfaceSeparator(
void CommandRequestImpl::AddTimeOutComponentInfoToMessage(
smart_objects::SmartObject& response) const {
using ns_smart_device_link::ns_smart_objects::SmartObject;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
if (awaiting_response_interfaces_.empty()) {
- LOG4CXX_ERROR(logger_, "No interfaces awaiting, info param is empty");
+ SDL_LOG_ERROR("No interfaces awaiting, info param is empty");
return;
}
@@ -973,8 +965,7 @@ void CommandRequestImpl::AddTimeOutComponentInfoToMessage(
awaiting_response_interfaces_.end(),
std::string(""),
InfoInterfaceSeparator);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Not responding interfaces string: " << not_responding_interfaces_string);
if (!not_responding_interfaces_string.empty()) {
const std::string component_info =
diff --git a/src/components/application_manager/src/commands/command_response_impl.cc b/src/components/application_manager/src/commands/command_response_impl.cc
index b956a4c7a5..b86a719aae 100644
--- a/src/components/application_manager/src/commands/command_response_impl.cc
+++ b/src/components/application_manager/src/commands/command_response_impl.cc
@@ -38,6 +38,8 @@ namespace application_manager {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands");
+
CommandResponseImpl::CommandResponseImpl(
const MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -66,7 +68,7 @@ void CommandResponseImpl::SendResponse(
bool success,
const mobile_apis::Result::eType& result_code,
bool final_message) {
- LOG4CXX_INFO(logger_, "Trying to send response");
+ SDL_LOG_INFO("Trying to send response");
(*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
diff --git a/src/components/application_manager/src/commands/notification_from_hmi.cc b/src/components/application_manager/src/commands/notification_from_hmi.cc
index 5e1314bad3..ef3755ebfd 100644
--- a/src/components/application_manager/src/commands/notification_from_hmi.cc
+++ b/src/components/application_manager/src/commands/notification_from_hmi.cc
@@ -39,6 +39,8 @@ namespace application_manager {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
NotificationFromHMI::NotificationFromHMI(
const MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -93,7 +95,7 @@ void NotificationFromHMI::CreateHMIRequest(
smart_objects::SmartObjectSPtr result =
std::make_shared<smart_objects::SmartObject>();
if (!result) {
- LOG4CXX_ERROR(logger_, "Memory allocation failed.");
+ SDL_LOG_ERROR("Memory allocation failed.");
return;
}
@@ -115,7 +117,7 @@ void NotificationFromHMI::CreateHMIRequest(
request[strings::msg_params] = msg_params;
if (!rpc_service_.ManageHMICommand(result)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
+ SDL_LOG_ERROR("Unable to send request");
return;
}
}
diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc
index eb9d914f00..835df70202 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -46,6 +46,8 @@ namespace application_manager {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -143,7 +145,7 @@ void RequestFromHMI::FillCommonParametersOfSO(
bool RequestFromHMI::IsMobileResultSuccess(
mobile_apis::Result::eType result_code) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
return Compare<mobile_apis::Result::eType, EQ, ONE>(
result_code,
@@ -157,7 +159,7 @@ bool RequestFromHMI::IsMobileResultSuccess(
bool RequestFromHMI::IsHMIResultSuccess(
hmi_apis::Common_Result::eType result_code,
HmiInterfaces::InterfaceID interface) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
result_code,
@@ -183,7 +185,7 @@ void RequestFromHMI::SendProviderRequest(
const hmi_apis::FunctionID::eType& hmi_function_id,
const smart_objects::SmartObject* msg,
bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool hmi_destination = false;
ApplicationSharedPtr app;
// Default error code and error message
@@ -210,7 +212,7 @@ void RequestFromHMI::SendProviderRequest(
}
if (hmi_destination) {
- LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ SDL_LOG_DEBUG("Sending Request to HMI Provider");
application_manager_.IncreaseForwardedRequestTimeout(
application_manager::request_controller::RequestInfo::HmiConnectionKey,
correlation_id());
@@ -219,7 +221,7 @@ void RequestFromHMI::SendProviderRequest(
}
if (!app) {
- LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
+ SDL_LOG_DEBUG("Invalid App Provider pointer");
SendErrorResponse(correlation_id(),
static_cast<hmi_apis::FunctionID::eType>(function_id()),
error_code,
@@ -228,7 +230,7 @@ void RequestFromHMI::SendProviderRequest(
return;
}
- LOG4CXX_DEBUG(logger_, "Sending Request to Mobile Provider");
+ SDL_LOG_DEBUG("Sending Request to Mobile Provider");
application_manager_.IncreaseForwardedRequestTimeout(
application_manager::request_controller::RequestInfo::HmiConnectionKey,
correlation_id());
@@ -263,14 +265,13 @@ void RequestFromHMI::SendMobileRequest(
}
if (use_events) {
- LOG4CXX_DEBUG(logger_,
- "RequestFromHMI subscribe_on_event "
- << function_id << " " << mobile_correlation_id);
+ SDL_LOG_DEBUG("RequestFromHMI subscribe_on_event "
+ << function_id << " " << mobile_correlation_id);
subscribe_on_event(function_id, mobile_correlation_id);
}
if (!rpc_service_.ManageMobileCommand(
result, commands::Command::CommandSource::SOURCE_SDL)) {
- LOG4CXX_ERROR(logger_, "Unable to send request to mobile");
+ SDL_LOG_ERROR("Unable to send request to mobile");
}
}
@@ -296,25 +297,24 @@ void RequestFromHMI::SendHMIRequest(
}
if (use_events) {
- LOG4CXX_DEBUG(logger_,
- "RequestFromHMI subscribe_on_event " << function_id << " "
+ SDL_LOG_DEBUG("RequestFromHMI subscribe_on_event " << function_id << " "
<< hmi_correlation_id);
subscribe_on_event(function_id, hmi_correlation_id);
}
if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
if (!rpc_service_.ManageHMICommand(
result, commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
+ SDL_LOG_ERROR("Unable to send request");
}
} else {
- LOG4CXX_DEBUG(logger_, "Interface is not available");
+ SDL_LOG_DEBUG("Interface is not available");
}
}
bool RequestFromHMI::ProcessHMIInterfacesAvailability(
const uint32_t hmi_correlation_id,
const hmi_apis::FunctionID::eType& function_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
HmiInterfaces::InterfaceID interface =
hmi_interfaces.GetInterfaceFromFunction(function_id);
diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc
index ac34d091af..35ac71c8bd 100644
--- a/src/components/application_manager/src/commands/request_to_hmi.cc
+++ b/src/components/application_manager/src/commands/request_to_hmi.cc
@@ -33,6 +33,7 @@
#include "application_manager/commands/request_to_hmi.h"
#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -70,6 +71,8 @@ static std::map<std::string, std::set<hmi_apis::FunctionID::eType> >
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager,
HmiInterfaces::InterfaceID interface) {
const HmiInterfaces::InterfaceState state =
@@ -77,19 +80,59 @@ bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager,
return HmiInterfaces::STATE_NOT_AVAILABLE != state;
}
+bool IsResponseCodeSuccess(
+ const smart_objects::SmartObject& response_from_hmi) {
+ auto response_code = static_cast<hmi_apis::Common_Result::eType>(
+ response_from_hmi[strings::params][hmi_response::code].asInt());
+
+ using helpers::Compare;
+ using helpers::EQ;
+ using helpers::ONE;
+
+ const bool is_result_success =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ response_code,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED);
+ return is_result_success;
+}
+
bool ChangeInterfaceState(ApplicationManager& application_manager,
const smart_objects::SmartObject& response_from_hmi,
HmiInterfaces::InterfaceID interface) {
if (response_from_hmi[strings::msg_params].keyExists(strings::available)) {
const bool is_available =
response_from_hmi[strings::msg_params][strings::available].asBool();
- const HmiInterfaces::InterfaceState interface_state =
- is_available ? HmiInterfaces::STATE_AVAILABLE
- : HmiInterfaces::STATE_NOT_AVAILABLE;
- application_manager.hmi_interfaces().SetInterfaceState(interface,
- interface_state);
- return is_available;
+
+ if (!is_available) {
+ application_manager.hmi_interfaces().SetInterfaceState(
+ interface, HmiInterfaces::STATE_NOT_AVAILABLE);
+ return false;
+ }
+
+ // Process response with result
+ if (response_from_hmi[strings::params].keyExists(hmi_response::code) &&
+ !IsResponseCodeSuccess(response_from_hmi)) {
+ application_manager.hmi_interfaces().SetInterfaceState(
+ interface, HmiInterfaces::STATE_NOT_AVAILABLE);
+ return false;
+ }
+
+ application_manager.hmi_interfaces().SetInterfaceState(
+ interface, HmiInterfaces::STATE_AVAILABLE);
+ return true;
}
+
+ // Process response with error
+ if (response_from_hmi[strings::params].keyExists(strings::error_msg)) {
+ application_manager.hmi_interfaces().SetInterfaceState(
+ interface, HmiInterfaces::STATE_NOT_AVAILABLE);
+ return false;
+ }
+
return false;
}
@@ -126,9 +169,8 @@ void RequestToHMI::SendRequest() {
}
void RequestToHMI::RequestInterfaceCapabilities(const char* interface_name) {
- LOG4CXX_DEBUG(
- logger_,
- "Request capabilities for the " << interface_name << " interface");
+ SDL_LOG_DEBUG("Request capabilities for the " << interface_name
+ << " interface");
const auto& request_ids = interface_requests[std::string(interface_name)];
RequestCapabilities(request_ids);
@@ -143,9 +185,8 @@ void RequestToHMI::UpdateRequestsRequiredForCapabilities(
void RequestToHMI::UpdateRequiredInterfaceCapabilitiesRequests(
const std::string& interface_name) {
- LOG4CXX_DEBUG(
- logger_,
- "Update requests required for the " << interface_name << " interface");
+ SDL_LOG_DEBUG("Update requests required for the " << interface_name
+ << " interface");
const auto& request_ids = interface_requests[std::string(interface_name)];
UpdateRequestsRequiredForCapabilities(request_ids);
@@ -153,8 +194,7 @@ void RequestToHMI::UpdateRequiredInterfaceCapabilitiesRequests(
void RequestToHMI::RequestCapabilities(
const std::set<hmi_apis::FunctionID::eType>& requests_to_send_to_hmi) {
- LOG4CXX_DEBUG(logger_,
- "There are " << requests_to_send_to_hmi.size()
+ SDL_LOG_DEBUG("There are " << requests_to_send_to_hmi.size()
<< " requests to send to the HMI");
for (const auto& function_id : requests_to_send_to_hmi) {
diff --git a/src/components/application_manager/src/commands/response_from_hmi.cc b/src/components/application_manager/src/commands/response_from_hmi.cc
index c88b14bf9c..f37028d53e 100644
--- a/src/components/application_manager/src/commands/response_from_hmi.cc
+++ b/src/components/application_manager/src/commands/response_from_hmi.cc
@@ -38,6 +38,8 @@ namespace application_manager {
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -84,7 +86,7 @@ void ResponseFromHMI::CreateHMIRequest(
std::make_shared<smart_objects::SmartObject>();
if (!result) {
- LOG4CXX_ERROR(logger_, "Memory allocation failed.");
+ SDL_LOG_ERROR("Memory allocation failed.");
return;
}
@@ -104,7 +106,7 @@ void ResponseFromHMI::CreateHMIRequest(
request[strings::msg_params] = msg_params;
if (!rpc_service_.ManageHMICommand(result)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
+ SDL_LOG_ERROR("Unable to send request");
return;
}
}
diff --git a/src/components/application_manager/src/display_capabilities_builder.cc b/src/components/application_manager/src/display_capabilities_builder.cc
index 8234128280..e0d486ab14 100644
--- a/src/components/application_manager/src/display_capabilities_builder.cc
+++ b/src/components/application_manager/src/display_capabilities_builder.cc
@@ -29,39 +29,42 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "application_manager/display_capabilities_builder.h"
+
+#include <algorithm>
+
#include "application_manager/message_helper.h"
#include "application_manager/smart_object_keys.h"
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "DisplayCapabilitiesBuilder")
+SDL_CREATE_LOG_VARIABLE("DisplayCapabilitiesBuilder")
const WindowID kDefaultWindowID = 0;
DisplayCapabilitiesBuilder::DisplayCapabilitiesBuilder(Application& application)
- : owner_(application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ : owner_(application), is_widget_windows_resumption_(false) {
+ SDL_LOG_AUTO_TRACE();
}
void DisplayCapabilitiesBuilder::InitBuilder(
DisplayCapabilitiesBuilder::ResumeCallback resume_callback,
const smart_objects::SmartObject& windows_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(display_capabilities_lock_);
resume_callback_ = resume_callback;
window_ids_to_resume_.insert(kDefaultWindowID);
+ is_widget_windows_resumption_ = !windows_info.empty();
+
for (size_t i = 0; i < windows_info.length(); ++i) {
auto window_id = windows_info[i][strings::window_id].asInt();
- LOG4CXX_DEBUG(logger_,
- "Inserting " << window_id << " to waiting container");
+ SDL_LOG_DEBUG("Inserting " << window_id << " to waiting container");
window_ids_to_resume_.insert(window_id);
}
}
void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities(
const smart_objects::SmartObject& incoming_display_capabilities) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
sync_primitives::AutoLock lock(display_capabilities_lock_);
@@ -83,7 +86,7 @@ void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities(
: kDefaultWindowID;
if (window_ids_to_resume_.end() != window_ids_to_resume_.find(window_id)) {
cur_window_caps[cur_window_caps.length()] = inc_window_caps[i];
- LOG4CXX_DEBUG(logger_, "Stop waiting for: " << window_id);
+ SDL_LOG_DEBUG("Stop waiting for: " << window_id);
window_ids_to_resume_.erase(window_id);
}
}
@@ -91,38 +94,100 @@ void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities(
*display_capabilities_ = incoming_display_capabilities;
(*display_capabilities_)[0][strings::window_capabilities] = cur_window_caps;
- if (window_ids_to_resume_.empty()) {
- LOG4CXX_TRACE(logger_, "Invoking resume callback");
- resume_callback_(owner_, *display_capabilities_);
- display_capabilities_.reset();
- }
-} // namespace application_manager
+ InvokeResumeCallback();
+}
const smart_objects::SmartObjectSPtr
DisplayCapabilitiesBuilder::display_capabilities() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return display_capabilities_;
}
+bool DisplayCapabilitiesBuilder::IsWindowResumptionNeeded() const {
+ return is_widget_windows_resumption_;
+}
+
+void DisplayCapabilitiesBuilder::InvokeResumeCallback() {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!window_ids_to_resume_.empty()) {
+ SDL_LOG_DEBUG("Still waiting for another windows capabilities");
+ return;
+ }
+
+ if (!display_capabilities_) {
+ SDL_LOG_DEBUG("Cached display capabilities are not available");
+ return;
+ }
+
+ if (owner_.hmi_level(kDefaultWindowID) ==
+ mobile_apis::HMILevel::INVALID_ENUM) {
+ SDL_LOG_DEBUG("Main window HMI level is not set yet");
+ return;
+ }
+
+ SDL_LOG_TRACE("Invoking resume callback");
+ resume_callback_(owner_, *display_capabilities_);
+ display_capabilities_.reset();
+}
+
+bool DisplayCapabilitiesBuilder::IsWaitingForWindowCapabilities(
+ const smart_objects::SmartObject& incoming_display_capabilities) const {
+ const auto& inc_window_caps =
+ incoming_display_capabilities[0][strings::window_capabilities];
+
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ for (size_t i = 0; i < inc_window_caps.length(); ++i) {
+ const WindowID window_id =
+ inc_window_caps[i].keyExists(strings::window_id)
+ ? inc_window_caps[i][strings::window_id].asInt()
+ : kDefaultWindowID;
+ if (helpers::in_range(window_ids_to_resume_, window_id)) {
+ SDL_LOG_TRACE("Application is waiting for capabilities for window "
+ << window_id);
+ return true;
+ }
+ }
+
+ SDL_LOG_TRACE(
+ "Application is not waiting for any of these windows capabilities");
+ return false;
+}
+
void DisplayCapabilitiesBuilder::ResetDisplayCapabilities() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(display_capabilities_lock_);
- display_capabilities_.reset();
+ for (auto& window_id : window_ids_to_resume_) {
+ if (kDefaultWindowID != window_id) {
+ window_ids_to_resume_.erase(window_id);
+ }
+ }
+
+ if (display_capabilities_) {
+ auto* cur_window_caps_ptr =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ if (cur_window_caps_ptr) {
+ for (auto it = cur_window_caps_ptr->begin();
+ it != cur_window_caps_ptr->end();) {
+ if ((*it).keyExists(strings::window_id) &&
+ (*it)[strings::window_id].asInt() != kDefaultWindowID) {
+ it = cur_window_caps_ptr->erase(it);
+ } else {
+ ++it;
+ }
+ }
+ }
+ }
}
void DisplayCapabilitiesBuilder::StopWaitingForWindow(
const WindowID window_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(display_capabilities_lock_);
- LOG4CXX_DEBUG(logger_,
- "Window id " << window_id << " will be erased due to failure");
+ SDL_LOG_DEBUG("Window id " << window_id << " will be erased");
window_ids_to_resume_.erase(window_id);
- if (window_ids_to_resume_.empty()) {
- LOG4CXX_TRACE(logger_,
- window_id << " was the last window pending resumption. "
- "Invoking resume callback");
- resume_callback_(owner_, *display_capabilities_);
- display_capabilities_.reset();
- }
+
+ InvokeResumeCallback();
}
+
} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
index 30b1b83e79..3d294f0035 100644
--- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
+++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
@@ -44,6 +44,7 @@ EventDispatcherImpl::EventDispatcherImpl() : observers_event_() {}
EventDispatcherImpl::~EventDispatcherImpl() {}
void EventDispatcherImpl::raise_event(const Event& event) {
+ ObserverVector observers;
AutoLock observer_lock(observer_lock_);
{
AutoLock state_lock(state_lock_);
@@ -51,20 +52,19 @@ void EventDispatcherImpl::raise_event(const Event& event) {
// check if event is notification
if (hmi_apis::messageType::notification == event.smart_object_type()) {
const uint32_t notification_correlation_id = 0;
- observers_ = observers_event_[event.id()][notification_correlation_id];
+ observers = observers_event_[event.id()][notification_correlation_id];
}
if (hmi_apis::messageType::response == event.smart_object_type() ||
hmi_apis::messageType::error_response == event.smart_object_type()) {
- observers_ =
+ observers =
observers_event_[event.id()][event.smart_object_correlation_id()];
}
}
- // Call observers
- while (!observers_.empty()) {
- EventObserver* temp = *observers_.begin();
- observers_.erase(observers_.begin());
+ while (!observers.empty()) {
+ EventObserver* temp = *observers.begin();
+ observers.erase(observers.begin());
AutoUnlock unlock_observer(observer_lock);
temp->on_event(event);
}
diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc
index ec883e5fc2..8d43ff2d9f 100644
--- a/src/components/application_manager/src/help_prompt_manager_impl.cc
+++ b/src/components/application_manager/src/help_prompt_manager_impl.cc
@@ -43,7 +43,7 @@
#include "smart_objects/smart_object.h"
#include "utils/logger.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "HelpPromptManagerImpl")
+SDL_CREATE_LOG_VARIABLE("HelpPromptManagerImpl")
namespace {
const size_t kLimitCommand = 30;
@@ -60,19 +60,19 @@ HelpPromptManagerImpl::HelpPromptManagerImpl(Application& app,
, is_ui_send_(false) {}
HelpPromptManagerImpl::~HelpPromptManagerImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool HelpPromptManagerImpl::AddCommand(
const uint32_t cmd_id, const smart_objects::SmartObject& command) {
if (!command.keyExists(strings::vr_commands)) {
- LOG4CXX_DEBUG(logger_, "vr_commands does`t present");
+ SDL_LOG_DEBUG("vr_commands does`t present");
return false;
}
const smart_objects::SmartObject& commands = command[strings::vr_commands];
if (commands.empty()) {
- LOG4CXX_DEBUG(logger_, "vr_commands array is empty");
+ SDL_LOG_DEBUG("vr_commands array is empty");
return false;
}
@@ -83,23 +83,21 @@ bool HelpPromptManagerImpl::AddCommand(
[cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; });
if (vr_commands_.end() != it) {
- LOG4CXX_DEBUG(logger_, "Command with id:" << cmd_id << " already exists");
+ SDL_LOG_DEBUG("Command with id:" << cmd_id << " already exists");
return false;
}
const bool limit_exceeded =
kLimitCommand <= GetCommandsCount(vr_commands_.end());
- LOG4CXX_DEBUG(
- logger_,
- "Will be added first command from array " << strings::vr_commands);
+ SDL_LOG_DEBUG("Will be added first command from array "
+ << strings::vr_commands);
smart_objects::SmartObjectSPtr vr_item =
std::make_shared<smart_objects::SmartObject>(commands.asArray()->front());
vr_commands_.push_back(std::make_pair(cmd_id, vr_item));
- LOG4CXX_DEBUG(logger_,
- "VR command with id: " << cmd_id << " added for appID: "
+ SDL_LOG_DEBUG("VR command with id: " << cmd_id << " added for appID: "
<< app_.app_id() << ". Total "
<< vr_commands_.size() << " in cache");
@@ -107,7 +105,7 @@ bool HelpPromptManagerImpl::AddCommand(
}
bool HelpPromptManagerImpl::DeleteCommand(const uint32_t cmd_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(vr_commands_lock_);
@@ -117,17 +115,16 @@ bool HelpPromptManagerImpl::DeleteCommand(const uint32_t cmd_id) {
[cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; });
if (vr_commands_.end() == it) {
- LOG4CXX_WARN(logger_, "VR command with id: " << cmd_id << " not found");
+ SDL_LOG_WARN("VR command with id: " << cmd_id << " not found");
return false;
}
const size_t commands_before_current = GetCommandsCount(it);
vr_commands_.erase(it);
- LOG4CXX_DEBUG(logger_,
- "VR command with id: "
- << cmd_id << " found after " << commands_before_current
- << " commands was deleted for appID: " << app_.app_id()
- << " Cache size after deleting: " << vr_commands_.size());
+ SDL_LOG_DEBUG("VR command with id: "
+ << cmd_id << " found after " << commands_before_current
+ << " commands was deleted for appID: " << app_.app_id()
+ << " Cache size after deleting: " << vr_commands_.size());
return commands_before_current < kLimitCommand;
}
@@ -136,12 +133,10 @@ void HelpPromptManagerImpl::OnVrCommandAdded(
const uint32_t cmd_id,
const smart_objects::SmartObject& command,
const bool is_resumption) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (SendingType::kNoneSend == sending_type_) {
- LOG4CXX_DEBUG(logger_,
- "SendingType::kNoneSend"
- << " commands with id:" << cmd_id
- << " will not be added");
+ SDL_LOG_DEBUG("SendingType::kNoneSend"
+ << " commands with id:" << cmd_id << " will not be added");
return;
}
if (AddCommand(cmd_id, command) && !is_resumption) {
@@ -151,12 +146,10 @@ void HelpPromptManagerImpl::OnVrCommandAdded(
void HelpPromptManagerImpl::OnVrCommandDeleted(const uint32_t cmd_id,
const bool is_resumption) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (SendingType::kNoneSend == sending_type_) {
- LOG4CXX_DEBUG(logger_,
- "SendingType::kNoneSend"
- << " commands with id:" << cmd_id
- << " will not be deleted");
+ SDL_LOG_DEBUG("SendingType::kNoneSend"
+ << " commands with id:" << cmd_id << " will not be deleted");
return;
}
if (DeleteCommand(cmd_id) && !is_resumption) {
@@ -166,11 +159,11 @@ void HelpPromptManagerImpl::OnVrCommandDeleted(const uint32_t cmd_id,
void HelpPromptManagerImpl::OnSetGlobalPropertiesReceived(
const smart_objects::SmartObject& msg, const bool is_response) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (SendingType::kNoneSend == sending_type_) {
- LOG4CXX_DEBUG(logger_,
- "SendingType::kNoneSend"
- " do not track SetGlobalProperties");
+ SDL_LOG_DEBUG(
+ "SendingType::kNoneSend"
+ " do not track SetGlobalProperties");
return;
}
@@ -182,8 +175,8 @@ void HelpPromptManagerImpl::OnSetGlobalPropertiesReceived(
is_ui_send_ = true;
}
- LOG4CXX_DEBUG(logger_, "is_tts_send_:" << is_tts_send_);
- LOG4CXX_DEBUG(logger_, "is_ui_send_:" << is_ui_send_);
+ SDL_LOG_DEBUG("is_tts_send_:" << is_tts_send_);
+ SDL_LOG_DEBUG("is_ui_send_:" << is_ui_send_);
return;
}
@@ -222,8 +215,8 @@ void HelpPromptManagerImpl::GenerateVrItems(
}
void HelpPromptManagerImpl::SendTTSRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "TTS request for appID:" << app_.app_id());
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("TTS request for appID:" << app_.app_id());
smart_objects::SmartObjectSPtr tts_global_properties =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -256,8 +249,8 @@ void HelpPromptManagerImpl::SendTTSRequest() {
}
void HelpPromptManagerImpl::SendUIRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "UI request for appID:" << app_.app_id());
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("UI request for appID:" << app_.app_id());
smart_objects::SmartObjectSPtr ui_global_properties =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -290,13 +283,13 @@ void HelpPromptManagerImpl::SendUIRequest() {
}
void HelpPromptManagerImpl::SendBothRequests() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SendTTSRequest();
SendUIRequest();
}
void HelpPromptManagerImpl::SendRequests() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(vr_commands_lock_);
switch (sending_type_) {
@@ -312,21 +305,20 @@ void HelpPromptManagerImpl::SendRequests() {
case SendingType::kNoneSend:
break;
}
- LOG4CXX_DEBUG(logger_,
- "SendingType:" << static_cast<uint32_t>(sending_type_)
+ SDL_LOG_DEBUG("SendingType:" << static_cast<uint32_t>(sending_type_)
<< " request not sending");
}
void HelpPromptManagerImpl::CreatePromptMsg(
smart_objects::SmartObject& out_msg_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
GenerateVrItems(out_msg_params, strings::help_prompt);
app_.set_help_prompt(out_msg_params[strings::help_prompt]);
}
void HelpPromptManagerImpl::CreateVRMsg(
smart_objects::SmartObject& out_msg_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (false == out_msg_params.keyExists(strings::vr_help_title)) {
if (app_.vr_help_title()) {
out_msg_params[strings::vr_help_title] = (*app_.vr_help_title());
@@ -347,17 +339,17 @@ void HelpPromptManagerImpl::CreateVRMsg(
void HelpPromptManagerImpl::SetSendingType(
const smart_objects::SmartObject& msg) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
hmi_apis::Common_Result::eType result =
static_cast<hmi_apis::Common_Result::eType>(
msg[strings::params][hmi_response::code].asInt());
- LOG4CXX_DEBUG(logger_, "HMI response result:" << result);
+ SDL_LOG_DEBUG("HMI response result:" << result);
if (hmi_apis::Common_Result::eType::SUCCESS == result) {
hmi_apis::FunctionID::eType function_id =
static_cast<hmi_apis::FunctionID::eType>(
msg[strings::params][strings::function_id].asUInt());
- LOG4CXX_DEBUG(logger_, "Function id:" << function_id);
+ SDL_LOG_DEBUG("Function id:" << function_id);
switch (function_id) {
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
if (is_tts_send_) {
@@ -379,8 +371,7 @@ void HelpPromptManagerImpl::SetSendingType(
}
default: { break; }
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Sending type set to:" << static_cast<uint32_t>(sending_type_));
}
}
diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc
index fc86eb5e62..488ee4aca0 100644
--- a/src/components/application_manager/src/helpers/application_helper.cc
+++ b/src/components/application_manager/src/helpers/application_helper.cc
@@ -11,24 +11,35 @@ void DeleteWayPoints(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
app_manager.UnsubscribeAppFromWayPoints(app);
if (!app_manager.IsAnyAppSubscribedForWayPoints()) {
- MessageHelper::SendUnsubscribedWayPoints(app_manager);
+ auto request = MessageHelper::CreateUnsubscribeWayPointsRequest(
+ app_manager.GetNextHMICorrelationID());
+ app_manager.GetRPCService().ManageHMICommand(request);
}
}
void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) {
- CommandsMap cmap = app->commands_map().GetData();
+ auto accessor = app->commands_map();
+ const auto& commands_map = accessor.GetData();
+
+ for (const auto& cmd : commands_map) {
+ auto delete_UI_msg = MessageHelper::CreateDeleteUICommandRequest(
+ cmd.second, app->app_id(), app_manager.GetNextHMICorrelationID());
+ app_manager.GetRPCService().ManageHMICommand(delete_UI_msg);
+
+ auto delete_VR_msg = MessageHelper::CreateDeleteVRCommandRequest(
+ cmd.second, app, app_manager.GetNextHMICorrelationID());
+ app_manager.GetRPCService().ManageHMICommand(delete_VR_msg);
- for (auto cmd : cmap) {
- MessageHelper::SendDeleteCommandRequest(cmd.second, app, app_manager);
app->RemoveCommand(cmd.first);
app->help_prompt_manager().OnVrCommandDeleted(cmd.first, true);
}
}
void DeleteSubmenus(ApplicationSharedPtr app, ApplicationManager& app_manager) {
- SubMenuMap smap = app->sub_menu_map().GetData();
+ auto accessor = app->sub_menu_map();
+ const auto& sub_menu_map = accessor.GetData();
- for (auto smenu : smap) {
+ for (const auto& smenu : sub_menu_map) {
MessageHelper::SendDeleteSubmenuRequest(smenu.second, app, app_manager);
app->RemoveSubMenu(smenu.first);
}
@@ -36,9 +47,10 @@ void DeleteSubmenus(ApplicationSharedPtr app, ApplicationManager& app_manager) {
void DeleteChoiceSets(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
- ChoiceSetMap csmap = app->choice_set_map().GetData();
+ auto accessor = app->choice_set_map();
+ const auto& choices = accessor.GetData();
- for (auto choice : csmap) {
+ for (const auto& choice : choices) {
MessageHelper::SendDeleteChoiceSetRequest(choice.second, app, app_manager);
app->RemoveChoiceSet(choice.first);
}
@@ -105,11 +117,11 @@ void CleanupAppFiles(ApplicationSharedPtr app) {
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
void DeleteApplicationData(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
DeleteWayPoints(app, app_manager);
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index a10d2f130d..75ca3e89a9 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -51,7 +51,7 @@
namespace application_manager {
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
-CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities")
+SDL_CREATE_LOG_VARIABLE("HMICapabilities")
namespace {
std::map<std::string, hmi_apis::Common_VrCapabilities::eType>
@@ -799,9 +799,9 @@ void HMICapabilitiesImpl::Init(
resumption::LastStateWrapperPtr last_state_wrapper) {
hmi_language_handler_.Init(last_state_wrapper);
if (!LoadCapabilitiesFromFile()) {
- LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
+ SDL_LOG_ERROR("file hmi_capabilities.json was not loaded");
} else {
- LOG4CXX_INFO(logger_, "file hmi_capabilities.json was loaded");
+ SDL_LOG_INFO("file hmi_capabilities.json was loaded");
}
hmi_language_handler_.set_default_capabilities_languages(
ui_language_, vr_language_, tts_language_);
@@ -1044,8 +1044,7 @@ struct JsonCapabilitiesGetter {
return GetCachedJsonMember(member_name);
}
- LOG4CXX_DEBUG(logger_,
- "Add request ID: " << request_id
+ SDL_LOG_DEBUG("Add request ID: " << request_id
<< " for the interface: " << member_name);
default_initialized_capabilities.insert(request_id);
@@ -1118,13 +1117,11 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() {
Json::Value root_json_override;
if (file_system::FileExists(cache_file_name)) {
- LOG4CXX_DEBUG(logger_,
- "HMI capabilities cache was found: " << cache_file_name);
+ SDL_LOG_DEBUG("HMI capabilities cache was found: " << cache_file_name);
std::string cache_json_string;
if (!file_system::ReadFile(cache_file_name, cache_json_string)) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Failed to read data from cache file. Cache will be ignored");
}
@@ -1132,8 +1129,7 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() {
utils::JsonReader reader;
std::string json(cache_json_string.begin(), cache_json_string.end());
if (!reader.parse(json, &root_json_override)) {
- LOG4CXX_ERROR(logger_,
- "Cached JSON file is invalid. Deleting the file");
+ SDL_LOG_ERROR("Cached JSON file is invalid. Deleting the file");
file_system::DeleteFile(cache_file_name);
root_json_override =
Json::Value::null; // Just to clear intermediate state of value
@@ -1148,7 +1144,7 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() {
utils::JsonReader reader;
std::string json(json_string.begin(), json_string.end());
if (!reader.parse(json, &root_json)) {
- LOG4CXX_DEBUG(logger_, "Default JSON parsing fails");
+ SDL_LOG_DEBUG("Default JSON parsing fails");
return false;
}
@@ -1702,7 +1698,7 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() {
hmi_apis::Common_Language::eType
HMICapabilitiesImpl::GetActiveLanguageForInterface(
const std::string& interface_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (hmi_interface::ui == interface_name) {
return active_ui_language();
}
@@ -1717,11 +1713,11 @@ HMICapabilitiesImpl::GetActiveLanguageForInterface(
void HMICapabilitiesImpl::UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::eType requested_interface) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app_mngr_.IsHMICooperating()) {
- LOG4CXX_DEBUG(logger_,
- "Remove from default initialized capabilities skipped, "
- "because hmi_cooperating equal true already");
+ SDL_LOG_DEBUG(
+ "Remove from default initialized capabilities skipped, "
+ "because hmi_cooperating equal true already");
return;
}
@@ -1733,10 +1729,10 @@ void HMICapabilitiesImpl::UpdateRequestsRequiredForCapabilities(
void HMICapabilitiesImpl::OnSoftwareVersionReceived(
const std::string& ccpu_version) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (ccpu_version == ccpu_version_) {
- LOG4CXX_DEBUG(logger_, "Software version not changed");
+ SDL_LOG_DEBUG("Software version not changed");
if (requests_required_for_capabilities_.empty()) {
app_mngr_.SetHMICooperating(true);
}
@@ -1744,18 +1740,18 @@ void HMICapabilitiesImpl::OnSoftwareVersionReceived(
return;
}
- LOG4CXX_DEBUG(logger_, "Software version changed");
+ SDL_LOG_DEBUG("Software version changed");
set_ccpu_version(ccpu_version);
UpdateCachedCapabilities();
}
void HMICapabilitiesImpl::UpdateCachedCapabilities() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeleteCachedCapabilitiesFile();
if (!LoadCapabilitiesFromFile()) {
- LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
+ SDL_LOG_ERROR("file hmi_capabilities.json was not loaded");
}
app_mngr_.RequestForInterfacesAvailability();
@@ -1765,11 +1761,10 @@ bool HMICapabilitiesImpl::AllFieldsSaved(
const Json::Value& root_node,
const std::string& interface_name,
const std::vector<std::string>& sections_to_check) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!JsonIsMemberSafe(root_node, interface_name.c_str())) {
- LOG4CXX_DEBUG(logger_,
- interface_name
- << " interface is not found. All fields should be saved");
+ SDL_LOG_DEBUG(interface_name
+ << " interface is not found. All fields should be saved");
return false;
}
@@ -1778,8 +1773,7 @@ bool HMICapabilitiesImpl::AllFieldsSaved(
++it) {
const std::string section = (*it).c_str();
if (!JsonIsMemberSafe(interface_node, section.c_str())) {
- LOG4CXX_DEBUG(logger_,
- "Field " << *it << " should be saved into the file");
+ SDL_LOG_DEBUG("Field " << *it << " should be saved into the file");
return false;
}
@@ -1790,8 +1784,7 @@ bool HMICapabilitiesImpl::AllFieldsSaved(
if (active_language != StringToEnum<hmi_apis::Common_Language::eType>(
json_language.asString())) {
- LOG4CXX_DEBUG(logger_,
- "Active " << interface_name
+ SDL_LOG_DEBUG("Active " << interface_name
<< " language is not the same as the persisted "
"one. Field should be overwritten");
return false;
@@ -1804,15 +1797,14 @@ bool HMICapabilitiesImpl::AllFieldsSaved(
void HMICapabilitiesImpl::RemoveFromRequestsRequiredForCapabilities(
hmi_apis::FunctionID::eType requested_interface) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto it = find(requests_required_for_capabilities_.begin(),
requests_required_for_capabilities_.end(),
requested_interface);
if (it != requests_required_for_capabilities_.end()) {
requests_required_for_capabilities_.erase(it);
- LOG4CXX_DEBUG(logger_,
- "Wait for " << requests_required_for_capabilities_.size()
+ SDL_LOG_DEBUG("Wait for " << requests_required_for_capabilities_.size()
<< " responses");
}
}
@@ -1821,7 +1813,7 @@ void HMICapabilitiesImpl::PrepareUiJsonValueForSaving(
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema,
Json::Value& out_node) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject capability(smart_objects::SmartType_Map);
auto system_capabilities = std::make_shared<smart_objects::SmartObject>(
@@ -1901,6 +1893,16 @@ void HMICapabilitiesImpl::PrepareUiJsonValueForSaving(
}
}
+ else if (section_to_update == strings::driver_distraction_capability) {
+ const auto driver_distraction_capability_so =
+ driver_distraction_capability();
+
+ if (driver_distraction_capability_so) {
+ (*system_capabilities)[strings::driver_distraction_capability] =
+ *driver_distraction_capability_so;
+ }
+ }
+
else if (section_to_update == strings::display_capabilities) {
const auto display_capabilities_so = display_capabilities();
@@ -1939,7 +1941,7 @@ void HMICapabilitiesImpl::PrepareVrJsonValueForSaving(
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema,
Json::Value& out_node) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (const auto& section_to_update : sections_to_update) {
if (section_to_update == hmi_response::language) {
@@ -1962,7 +1964,7 @@ void HMICapabilitiesImpl::PrepareTtsJsonValueForSaving(
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema,
Json::Value& out_node) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (const auto& section_to_update : sections_to_update) {
if (section_to_update == hmi_response::language) {
@@ -1995,7 +1997,7 @@ void HMICapabilitiesImpl::PrepareButtonsJsonValueForSaving(
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema,
Json::Value& out_node) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (const auto& section_to_update : sections_to_update) {
if (section_to_update == hmi_response::button_capabilities) {
@@ -2016,7 +2018,7 @@ void HMICapabilitiesImpl::PrepareVehicleInfoJsonValueForSaving(
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema,
Json::Value& out_node) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (helpers::in_range(sections_to_update, hmi_response::vehicle_type)) {
save_hmi_capability_field_to_json(
hmi_response::vehicle_type, schema, vehicle_type(), out_node);
@@ -2027,7 +2029,7 @@ void HMICapabilitiesImpl::PrepareRCJsonValueForSaving(
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema,
Json::Value& out_node) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (const auto& section_to_update : sections_to_update) {
if (section_to_update == strings::rc_capability) {
@@ -2046,7 +2048,7 @@ void HMICapabilitiesImpl::PrepareRCJsonValueForSaving(
void HMICapabilitiesImpl::AddRequiredRequestsForCapabilities(
const std::string& interface_name) {
- LOG4CXX_DEBUG(logger_, "Add request IDs for interface: " << interface_name);
+ SDL_LOG_DEBUG("Add request IDs for interface: " << interface_name);
if (interface_name == hmi_interface::ui) {
requests_required_for_capabilities_.insert(
@@ -2096,8 +2098,7 @@ void HMICapabilitiesImpl::PrepareJsonValueForSaving(
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema,
Json::Value& out_root_node) const {
- LOG4CXX_DEBUG(logger_,
- "Prepare " << interface_name << " sections for saving");
+ SDL_LOG_DEBUG("Prepare " << interface_name << " sections for saving");
if (out_root_node.isNull()) {
out_root_node = Json::Value(Json::objectValue);
@@ -2139,29 +2140,27 @@ bool HMICapabilitiesImpl::SaveCachedCapabilitiesToFile(
const std::string& interface_name,
const std::vector<std::string>& sections_to_update,
const smart_objects::CSmartSchema& schema) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (sections_to_update.empty()) {
- LOG4CXX_DEBUG(logger_,
- "There is no one section to update in the cache file");
+ SDL_LOG_DEBUG("There is no one section to update in the cache file");
return true;
}
const std::string cache_file_name =
app_mngr_.get_settings().hmi_capabilities_cache_file_name();
if (cache_file_name.empty()) {
- LOG4CXX_DEBUG(logger_,
- "Cache file name is not specified. No need to save cache");
+ SDL_LOG_DEBUG("Cache file name is not specified. No need to save cache");
return true;
}
Json::Value root_node;
if (file_system::FileExists(cache_file_name)) {
- LOG4CXX_DEBUG(logger_, "Cache file exists. Check for it's content");
+ SDL_LOG_DEBUG("Cache file exists. Check for it's content");
std::string file_content;
if (!file_system::ReadFile(cache_file_name, file_content)) {
- LOG4CXX_ERROR(logger_, "Failed to read file content");
+ SDL_LOG_ERROR("Failed to read file content");
return false;
}
@@ -2171,25 +2170,24 @@ bool HMICapabilitiesImpl::SaveCachedCapabilitiesToFile(
file_content.c_str() + file_content.length(),
&root_node,
NULL)) {
- LOG4CXX_ERROR(logger_, "Can't parse the file. Skipping");
+ SDL_LOG_ERROR("Can't parse the file. Skipping");
return false;
}
if (AllFieldsSaved(root_node, interface_name, sections_to_update)) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"All " << interface_name
<< " fields are present in the file. No need to update");
return true;
}
- LOG4CXX_DEBUG(logger_, "Some fields in the cache file should be updated");
+ SDL_LOG_DEBUG("Some fields in the cache file should be updated");
}
PrepareJsonValueForSaving(
interface_name.c_str(), sections_to_update, schema, root_node);
- LOG4CXX_DEBUG(logger_, "Saving cache to file: " << cache_file_name);
+ SDL_LOG_DEBUG("Saving cache to file: " << cache_file_name);
const std::string content_to_save = root_node.toStyledString();
const std::vector<uint8_t> binary_data_to_save(content_to_save.begin(),
content_to_save.end());
@@ -2198,22 +2196,21 @@ bool HMICapabilitiesImpl::SaveCachedCapabilitiesToFile(
}
bool HMICapabilitiesImpl::DeleteCachedCapabilitiesFile() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string cache_file_name =
app_mngr_.get_settings().hmi_capabilities_cache_file_name();
if (cache_file_name.empty()) {
- LOG4CXX_DEBUG(logger_,
- "Cache file name is not specified. Nothing to delete");
+ SDL_LOG_DEBUG("Cache file name is not specified. Nothing to delete");
return false;
}
if (!file_system::FileExists(cache_file_name)) {
- LOG4CXX_DEBUG(logger_, "Cache file does not exist");
+ SDL_LOG_DEBUG("Cache file does not exist");
return false;
}
if (!file_system::DeleteFile(cache_file_name)) {
- LOG4CXX_ERROR(logger_, "Failed to delete cache file");
+ SDL_LOG_ERROR("Failed to delete cache file");
return false;
}
return true;
diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc
index 46231c4596..750755478e 100644
--- a/src/components/application_manager/src/hmi_language_handler.cc
+++ b/src/components/application_manager/src/hmi_language_handler.cc
@@ -44,7 +44,7 @@ static const std::string UIKey = "UI";
static const std::string VRKey = "VR";
static const std::string TTSKey = "TTS";
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
namespace application_manager {
HMILanguageHandler::HMILanguageHandler(ApplicationManager& application_manager)
@@ -62,7 +62,7 @@ HMILanguageHandler::HMILanguageHandler(ApplicationManager& application_manager)
void HMILanguageHandler::set_language_for(
HMILanguageHandler::Interface interface,
hmi_apis::Common_Language::eType language) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string key = "UNKNOWN";
switch (interface) {
case INTERFACE_UI:
@@ -75,12 +75,11 @@ void HMILanguageHandler::set_language_for(
key = TTSKey;
break;
default:
- LOG4CXX_WARN(logger_, "Unknown interface has been passed " << interface);
+ SDL_LOG_WARN("Unknown interface has been passed " << interface);
return;
}
- LOG4CXX_DEBUG(
- logger_,
- "Setting language " << language << " for interface " << interface);
+ SDL_LOG_DEBUG("Setting language " << language << " for interface "
+ << interface);
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
dictionary[LanguagesKey][key] = static_cast<int32_t>(language);
@@ -89,7 +88,7 @@ void HMILanguageHandler::set_language_for(
hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for(
HMILanguageHandler::Interface interface) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace resumption;
using namespace hmi_apis;
std::string key = "UNKNOWN";
@@ -104,7 +103,7 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for(
key = TTSKey;
break;
default:
- LOG4CXX_WARN(logger_, "Unknown interfcase has been passed " << interface);
+ SDL_LOG_WARN("Unknown interfcase has been passed " << interface);
return Common_Language::INVALID_ENUM;
}
@@ -121,24 +120,24 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for(
}
void HMILanguageHandler::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject msg = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_GetLanguage:
- LOG4CXX_DEBUG(logger_, "Got UI language response.");
+ SDL_LOG_DEBUG("Got UI language response.");
is_ui_language_received_ = true;
break;
case hmi_apis::FunctionID::VR_GetLanguage:
- LOG4CXX_DEBUG(logger_, "Got VR language response.");
+ SDL_LOG_DEBUG("Got VR language response.");
is_vr_language_received_ = true;
break;
case hmi_apis::FunctionID::TTS_GetLanguage:
- LOG4CXX_DEBUG(logger_, "Got TTS language response.");
+ SDL_LOG_DEBUG("Got TTS language response.");
is_tts_language_received_ = true;
break;
case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered:
if (!(msg[strings::params].keyExists(strings::app_id))) {
- LOG4CXX_ERROR(logger_, "Message doesn't contain parameter app_id");
+ SDL_LOG_ERROR("Message doesn't contain parameter app_id");
return;
}
CheckApplication(
@@ -150,30 +149,28 @@ void HMILanguageHandler::on_event(const event_engine::Event& event) {
if (is_ui_language_received_ && is_vr_language_received_ &&
is_tts_language_received_) {
- LOG4CXX_DEBUG(logger_, "All GetLanguages responses gotten.");
+ SDL_LOG_DEBUG("All GetLanguages responses gotten.");
VerifyWithPersistedLanguages();
}
}
void HMILanguageHandler::set_handle_response_for(
const smart_objects::SmartObject& request) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
if (!request.keyExists(strings::params)) {
- LOG4CXX_ERROR(logger_,
- "Object does not have " << strings::params << " key.");
+ SDL_LOG_ERROR("Object does not have " << strings::params << " key.");
return;
}
if (!request[strings::params].keyExists(strings::function_id)) {
- LOG4CXX_ERROR(logger_,
- "Object does not have " << strings::function_id << " key.");
+ SDL_LOG_ERROR("Object does not have " << strings::function_id << " key.");
return;
}
if (!request[strings::params].keyExists(strings::correlation_id)) {
- LOG4CXX_ERROR(
- logger_, "Object does not have " << strings::correlation_id << " key.");
+ SDL_LOG_ERROR("Object does not have " << strings::correlation_id
+ << " key.");
return;
}
@@ -186,8 +183,7 @@ void HMILanguageHandler::set_handle_response_for(
hmi_apis::FunctionID::UI_GetLanguage,
hmi_apis::FunctionID::VR_GetLanguage,
hmi_apis::FunctionID::TTS_GetLanguage)) {
- LOG4CXX_ERROR(logger_,
- "Only *GetLanguage request are allowed to be subscribed.");
+ SDL_LOG_ERROR("Only *GetLanguage request are allowed to be subscribed.");
return;
}
@@ -196,9 +192,8 @@ void HMILanguageHandler::set_handle_response_for(
subscribe_on_event(function_id, correlation_id);
- LOG4CXX_DEBUG(logger_,
- "Subscribed for function_id "
- << function_id << " and correlation_id " << correlation_id);
+ SDL_LOG_DEBUG("Subscribed for function_id "
+ << function_id << " and correlation_id " << correlation_id);
}
void HMILanguageHandler::set_default_capabilities_languages(
@@ -223,7 +218,7 @@ void HMILanguageHandler::set_default_capabilities_languages(
void HMILanguageHandler::SendOnLanguageChangeToMobile(
const uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr notification =
std::make_shared<smart_objects::SmartObject>();
@@ -242,14 +237,14 @@ void HMILanguageHandler::SendOnLanguageChangeToMobile(
hmi_capabilities.active_vr_language();
if (application_manager_.GetRPCService().ManageMobileCommand(
notification, commands::Command::SOURCE_SDL)) {
- LOG4CXX_INFO(logger_, "Mobile command sent");
+ SDL_LOG_INFO("Mobile command sent");
} else {
- LOG4CXX_WARN(logger_, "Cannot send mobile command");
+ SDL_LOG_WARN("Cannot send mobile command");
}
}
void HMILanguageHandler::VerifyWithPersistedLanguages() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const HMICapabilities& hmi_capabilities =
application_manager_.hmi_capabilities();
@@ -258,14 +253,13 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() {
if (hmi_capabilities.active_ui_language() == persisted_ui_language_ &&
hmi_capabilities.active_vr_language() == persisted_vr_language_ &&
hmi_capabilities.active_tts_language() == persisted_tts_language_) {
- LOG4CXX_INFO(logger_,
- "All languages gotten from HMI match to persisted values.");
+ SDL_LOG_INFO("All languages gotten from HMI match to persisted values.");
return;
}
- LOG4CXX_INFO(logger_,
- "Some languages gotten from HMI have "
- "mismatch with persisted values.");
+ SDL_LOG_INFO(
+ "Some languages gotten from HMI have "
+ "mismatch with persisted values.");
const ApplicationSet& accessor =
application_manager_.applications().GetData();
@@ -273,40 +267,37 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() {
for (; accessor.end() != it;) {
ApplicationConstSharedPtr app = *it++;
- LOG4CXX_INFO(logger_,
- "Application with app_id "
- << app->app_id()
- << " will be unregistered because of "
- "HMI language(s) mismatch.");
+ SDL_LOG_INFO("Application with app_id "
+ << app->app_id()
+ << " will be unregistered because of "
+ "HMI language(s) mismatch.");
CheckApplication(std::make_pair(app->app_id(), false));
}
sync_primitives::AutoLock lock(apps_lock_);
if (0 == apps_.size()) {
- LOG4CXX_DEBUG(logger_,
- "No registered apps found. HMILanguageHandler unsubscribed "
- "from all events.");
+ SDL_LOG_DEBUG(
+ "No registered apps found. HMILanguageHandler unsubscribed "
+ "from all events.");
unsubscribe_from_all_hmi_events();
}
}
void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(apps_lock_);
Apps::iterator it = apps_.find(app.first);
if (apps_.end() == it) {
- LOG4CXX_DEBUG(logger_,
- "Application id "
- << app.first
- << " is not found within apps with wrong language.");
+ SDL_LOG_DEBUG("Application id "
+ << app.first
+ << " is not found within apps with wrong language.");
return;
}
apps_.erase(it);
if (0 == apps_.size()) {
- LOG4CXX_DEBUG(logger_,
- "HMILanguageHandler unsubscribed from all events.");
+ SDL_LOG_DEBUG("HMILanguageHandler unsubscribed from all events.");
unsubscribe_from_all_hmi_events();
}
}
@@ -318,22 +309,19 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) {
commands::Command::SOURCE_SDL);
application_manager_.UnregisterApplication(
app.first, mobile_apis::Result::SUCCESS, false);
- LOG4CXX_INFO(logger_,
- "Unregistering application with app_id "
- << app.first << " because of HMI language(s) mismatch.");
+ SDL_LOG_INFO("Unregistering application with app_id "
+ << app.first << " because of HMI language(s) mismatch.");
}
void HMILanguageHandler::CheckApplication(const Apps::value_type app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool is_need_handle_wrong_language = false;
{
sync_primitives::AutoLock lock(apps_lock_);
Apps::iterator it = apps_.find(app.first);
if (apps_.end() == it) {
- LOG4CXX_INFO(logger_,
- "Adding application id "
- << app.first
- << " Application registered: " << app.second);
+ SDL_LOG_INFO("Adding application id "
+ << app.first << " Application registered: " << app.second);
apps_.insert(app);
return;
}
@@ -352,7 +340,7 @@ void HMILanguageHandler::Init(resumption::LastStateWrapperPtr value) {
}
void HMILanguageHandler::OnUnregisterApplication(uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_lock_);
apps_.erase(app_id);
}
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index 844d0254cf..3dadd8c193 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -32,15 +32,17 @@
*/
#include "application_manager/hmi_state.h"
+
#include <boost/assign.hpp>
#include <boost/bimap.hpp>
#include <ostream>
+
#include "application_manager/application_manager.h"
#include "utils/helpers.h"
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "HmiState")
+SDL_CREATE_LOG_VARIABLE("HmiState")
HmiState::HmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr,
@@ -53,7 +55,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
, system_context_(mobile_apis::SystemContext::INVALID_ENUM) {
- LOG4CXX_DEBUG(logger_, *this);
+ SDL_LOG_DEBUG(*this);
}
HmiState::HmiState(std::shared_ptr<Application> app,
@@ -66,11 +68,10 @@ HmiState::HmiState(std::shared_ptr<Application> app,
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
, system_context_(mobile_apis::SystemContext::INVALID_ENUM) {
- LOG4CXX_DEBUG(logger_, *this);
+ SDL_LOG_DEBUG(*this);
}
void HmiState::set_parent(HmiStatePtr parent) {
- DCHECK_OR_RETURN_VOID(parent);
parent_ = parent;
}
@@ -80,6 +81,12 @@ bool HmiState::is_navi_app() const {
return app ? app->is_navi() : false;
}
+bool HmiState::is_projection_app() const {
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->mobile_projection_enabled() : false;
+}
+
bool HmiState::is_media_app() const {
const ApplicationSharedPtr app =
app_mngr_.application_by_hmi_app(hmi_app_id_);
@@ -98,6 +105,42 @@ bool HmiState::is_mobile_projection_app() const {
return app ? app->mobile_projection_enabled() : false;
}
+mobile_apis::HMILevel::eType HmiState::parent_hmi_level() const {
+ using namespace mobile_apis;
+ return parent() ? parent()->hmi_level() : HMILevel::HMI_NONE;
+}
+
+mobile_apis::HMILevel::eType HmiState::parent_max_hmi_level() const {
+ using namespace mobile_apis;
+ return parent() ? parent()->max_hmi_level() : HMILevel::HMI_FULL;
+}
+
+mobile_apis::AudioStreamingState::eType HmiState::parent_audio_state() const {
+ using namespace mobile_apis;
+ return parent() ? parent()->audio_streaming_state()
+ : AudioStreamingState::NOT_AUDIBLE;
+}
+
+mobile_apis::AudioStreamingState::eType HmiState::parent_max_audio_state()
+ const {
+ using namespace mobile_apis;
+ return parent() ? parent()->max_audio_streaming_state()
+ : AudioStreamingState::AUDIBLE;
+}
+
+mobile_apis::VideoStreamingState::eType HmiState::parent_video_state() const {
+ using namespace mobile_apis;
+ return parent() ? parent()->video_streaming_state()
+ : VideoStreamingState::NOT_STREAMABLE;
+}
+
+mobile_apis::VideoStreamingState::eType HmiState::parent_max_video_state()
+ const {
+ using namespace mobile_apis;
+ return parent() ? parent()->max_video_streaming_state()
+ : VideoStreamingState::STREAMABLE;
+}
+
mobile_apis::WindowType::eType HmiState::window_type() const {
return window_type_;
}
@@ -113,6 +156,12 @@ mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state()
return AudioStreamingState::NOT_AUDIBLE;
}
+mobile_apis::AudioStreamingState::eType VRHmiState::max_audio_streaming_state()
+ const {
+ using namespace mobile_apis;
+ return AudioStreamingState::NOT_AUDIBLE;
+}
+
VRHmiState::VRHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_VR_SESSION) {}
@@ -126,14 +175,21 @@ mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state()
using namespace helpers;
using namespace mobile_apis;
- AudioStreamingState::eType expected_state = AudioStreamingState::NOT_AUDIBLE;
- if (app_mngr_.is_attenuated_supported() &&
- AudioStreamingState::NOT_AUDIBLE != parent()->audio_streaming_state() &&
- Compare<HMILevel::eType, EQ, ONE>(
+ if (Compare<HMILevel::eType, EQ, ONE>(
hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) {
- expected_state = AudioStreamingState::ATTENUATED;
+ return std::max(parent_audio_state(), max_audio_streaming_state());
+ }
+ return AudioStreamingState::NOT_AUDIBLE;
+}
+
+mobile_apis::AudioStreamingState::eType TTSHmiState::max_audio_streaming_state()
+ const {
+ using namespace mobile_apis;
+
+ if (app_mngr_.is_attenuated_supported()) {
+ return std::max(parent_max_audio_state(), AudioStreamingState::ATTENUATED);
}
- return expected_state;
+ return AudioStreamingState::NOT_AUDIBLE;
}
VideoStreamingHmiState::VideoStreamingHmiState(
@@ -142,13 +198,19 @@ VideoStreamingHmiState::VideoStreamingHmiState(
mobile_apis::VideoStreamingState::eType
VideoStreamingHmiState::video_streaming_state() const {
+ return std::max(parent_video_state(), max_video_streaming_state());
+}
+
+mobile_apis::VideoStreamingState::eType
+VideoStreamingHmiState::max_video_streaming_state() const {
+ using namespace mobile_apis;
const ApplicationSharedPtr app =
app_mngr_.application_by_hmi_app(hmi_app_id_);
if (app && app->IsVideoApplication()) {
- return parent()->video_streaming_state();
+ return std::max(parent_max_video_state(), VideoStreamingState::STREAMABLE);
}
- return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
+ return VideoStreamingState::NOT_STREAMABLE;
}
NaviStreamingHmiState::NaviStreamingHmiState(std::shared_ptr<Application> app,
@@ -159,22 +221,20 @@ NaviStreamingHmiState::NaviStreamingHmiState(std::shared_ptr<Application> app,
mobile_apis::AudioStreamingState::eType
NaviStreamingHmiState::audio_streaming_state() const {
- using namespace helpers;
- using namespace mobile_apis;
+ return std::max(parent_audio_state(), max_audio_streaming_state());
+}
- AudioStreamingState::eType expected_state = parent()->audio_streaming_state();
- if (!is_navi_app() && Compare<AudioStreamingState::eType, EQ, ONE>(
- expected_state,
- AudioStreamingState::AUDIBLE,
- AudioStreamingState::ATTENUATED)) {
- if (app_mngr_.is_attenuated_supported()) {
- expected_state = AudioStreamingState::ATTENUATED;
- } else {
- expected_state = AudioStreamingState::NOT_AUDIBLE;
- }
+mobile_apis::AudioStreamingState::eType
+NaviStreamingHmiState::max_audio_streaming_state() const {
+ using namespace mobile_apis;
+ auto expected = AudioStreamingState::AUDIBLE;
+ if (!is_navi_app()) {
+ expected = app_mngr_.is_attenuated_supported()
+ ? AudioStreamingState::ATTENUATED
+ : AudioStreamingState::NOT_AUDIBLE;
}
- return expected_state;
+ return std::max(expected, parent_max_audio_state());
}
PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app,
@@ -182,28 +242,25 @@ PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app,
: HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {}
mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const {
+ return std::max(parent_hmi_level(), max_hmi_level());
+}
+
+mobile_apis::HMILevel::eType PhoneCallHmiState::max_hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
if (WindowType::WIDGET == window_type()) {
- return parent()->hmi_level();
- }
-
- if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
- HMILevel::HMI_BACKGROUND,
- HMILevel::HMI_NONE)) {
- return parent()->hmi_level();
+ return std::max(HMILevel::HMI_FULL, parent_max_hmi_level());
}
+ auto expected = HMILevel::HMI_FULL;
if (is_navi_app() || is_mobile_projection_app()) {
- return HMILevel::HMI_LIMITED;
- }
-
- if (!is_media_app()) {
- return parent()->hmi_level();
+ expected = HMILevel::HMI_LIMITED;
+ } else if (is_media_app()) {
+ expected = HMILevel::HMI_BACKGROUND;
}
- return HMILevel::HMI_BACKGROUND;
+ return std::max(expected, parent_max_hmi_level());
}
SafetyModeHmiState::SafetyModeHmiState(std::shared_ptr<Application> app,
@@ -215,20 +272,18 @@ DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app,
: HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {}
mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const {
+ return std::max(parent_hmi_level(), max_hmi_level());
+}
+
+mobile_apis::HMILevel::eType DeactivateHMI::max_hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
if (WindowType::WIDGET == window_type()) {
- return parent()->hmi_level();
+ return std::max(HMILevel::HMI_FULL, parent_max_hmi_level());
}
- if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
- HMILevel::HMI_BACKGROUND,
- HMILevel::HMI_NONE)) {
- return parent()->hmi_level();
- }
-
- return HMILevel::HMI_BACKGROUND;
+ return std::max(HMILevel::HMI_BACKGROUND, parent_max_hmi_level());
}
AudioSource::AudioSource(std::shared_ptr<Application> app,
@@ -241,38 +296,116 @@ AudioSource::AudioSource(std::shared_ptr<Application> app,
mobile_apis::HMILevel::eType AudioSource::hmi_level() const {
using namespace mobile_apis;
+ if (WindowType::WIDGET == window_type() || keep_context_) {
+ return std::max(parent_hmi_level(), max_hmi_level());
+ }
+
+ auto expected = HMILevel::HMI_BACKGROUND;
+ if (is_navi_app() || is_projection_app() || is_voice_communication_app()) {
+ expected = HMILevel::HMI_LIMITED;
+ }
+
+ return std::max(std::max(expected, max_hmi_level()), parent_hmi_level());
+}
+
+mobile_apis::AudioStreamingState::eType AudioSource::audio_streaming_state()
+ const {
+ return is_media_app() && !is_navi_app()
+ ? mobile_apis::AudioStreamingState::NOT_AUDIBLE
+ : parent_audio_state();
+}
+
+mobile_apis::VideoStreamingState::eType AudioSource::video_streaming_state()
+ const {
+ return parent_video_state();
+}
+
+mobile_apis::HMILevel::eType AudioSource::max_hmi_level() const {
+ using namespace mobile_apis;
+
if (WindowType::WIDGET == window_type()) {
- return parent()->hmi_level();
+ return std::max(HMILevel::HMI_FULL, parent_max_hmi_level());
}
- // Checking for NONE is necessary to avoid issue during
- // calculation of HMI level during setting default HMI level
- if (keep_context_ || HMILevel::HMI_NONE == parent()->hmi_level()) {
- return parent()->hmi_level();
+ auto expected = HMILevel::HMI_FULL;
+ if (!keep_context_ && is_media_app() && !is_navi_app() &&
+ !is_projection_app()) {
+ expected = HMILevel::HMI_BACKGROUND;
}
- return HMILevel::HMI_BACKGROUND;
+ return std::max(expected, parent_max_hmi_level());
+}
+
+mobile_apis::AudioStreamingState::eType AudioSource::max_audio_streaming_state()
+ const {
+ return is_media_app() && !is_navi_app()
+ ? mobile_apis::AudioStreamingState::NOT_AUDIBLE
+ : parent_max_audio_state();
+}
+
+mobile_apis::VideoStreamingState::eType AudioSource::max_video_streaming_state()
+ const {
+ return parent() ? parent()->max_video_streaming_state()
+ : mobile_apis::VideoStreamingState::STREAMABLE;
}
EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_EMBEDDED_NAVI) {}
+mobile_apis::AudioStreamingState::eType EmbeddedNavi::audio_streaming_state()
+ const {
+ return is_navi_app() ? mobile_apis::AudioStreamingState::NOT_AUDIBLE
+ : parent_audio_state();
+}
+
+mobile_apis::VideoStreamingState::eType EmbeddedNavi::video_streaming_state()
+ const {
+ return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
+}
+
mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const {
using namespace mobile_apis;
using namespace helpers;
if (WindowType::WIDGET == window_type()) {
- return parent()->hmi_level();
+ return std::max(parent_hmi_level(), max_hmi_level());
+ }
+
+ auto expected = HMILevel::HMI_BACKGROUND;
+ if ((is_media_app() || is_voice_communication_app()) && !is_navi_app()) {
+ expected = HMILevel::HMI_LIMITED;
+ }
+
+ return std::max(std::max(expected, max_hmi_level()), parent_hmi_level());
+}
+
+mobile_apis::AudioStreamingState::eType
+EmbeddedNavi::max_audio_streaming_state() const {
+ return is_navi_app() ? mobile_apis::AudioStreamingState::NOT_AUDIBLE
+ : parent_max_audio_state();
+}
+
+mobile_apis::VideoStreamingState::eType
+EmbeddedNavi::max_video_streaming_state() const {
+ return is_navi_app() ? mobile_apis::VideoStreamingState::NOT_STREAMABLE
+ : parent_max_video_state();
+}
+
+mobile_apis::HMILevel::eType EmbeddedNavi::max_hmi_level() const {
+ using namespace mobile_apis;
+ using namespace helpers;
+
+ if (WindowType::WIDGET == window_type()) {
+ return std::max(HMILevel::HMI_FULL, parent_max_hmi_level());
}
- if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
- HMILevel::HMI_BACKGROUND,
- HMILevel::HMI_NONE)) {
- return parent()->hmi_level();
+ auto expected = HMILevel::HMI_FULL;
+ if (is_navi_app()) {
+ expected = HMILevel::HMI_BACKGROUND;
}
- return HMILevel::HMI_BACKGROUND;
+ return std::max(expected, parent_max_hmi_level());
}
namespace {
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 02ccb46845..314f3731ec 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -68,7 +68,7 @@
#include "formatters/formatter_json_rpc.h"
#include "json/json.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
namespace application_manager {
@@ -257,7 +257,7 @@ const VehicleData MessageHelper::vehicle_data_(
smart_objects::SmartObjectSPtr MessageHelper::CreateNotification(
mobile_apis::FunctionID::eType function_id, uint32_t app_id) {
using smart_objects::SmartObject;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr object(
new SmartObject(smart_objects::SmartType_Map));
(*object)[strings::params][strings::message_type] =
@@ -278,7 +278,7 @@ MessageHelper::CreateHMINotification(hmi_apis::FunctionID::eType function_id) {
using smart_objects::SmartObject;
using smart_objects::SmartObjectSPtr;
using smart_objects::SmartType_Map;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SmartObjectSPtr notification_ptr =
std::make_shared<SmartObject>(SmartType_Map);
SmartObject& notification = *notification_ptr;
@@ -307,12 +307,13 @@ std::string MessageHelper::GetDeviceMacAddressForHandle(
std::string device_mac_address = "";
app_mngr.connection_handler().get_session_observer().GetDataOnDeviceID(
device_handle, NULL, NULL, &device_mac_address);
- LOG4CXX_DEBUG(logger_, "result : " << device_handle);
+ SDL_LOG_DEBUG("result : " << device_handle);
return device_mac_address;
}
smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
- hmi_apis::messageType::eType message_type, const uint32_t correlation_id) {
+ const hmi_apis::messageType::eType message_type,
+ const uint32_t correlation_id) {
using namespace smart_objects;
SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map);
@@ -327,10 +328,93 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
return message;
}
+smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
+ const hmi_apis::FunctionID::eType function_id,
+ const uint32_t correlation_id) {
+ using namespace smart_objects;
+
+ SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject& ref = *message;
+
+ ref[strings::params][strings::function_id] = static_cast<int>(function_id);
+ ref[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ ref[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ ref[strings::params][strings::correlation_id] = correlation_id;
+ return message;
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateTTSResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ const ApplicationSharedPtr application) {
+ smart_objects::SmartObjectSPtr tts_reset_global_prop_request =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ if (reset_result.help_prompt) {
+ (*tts_reset_global_prop_request)[strings::help_prompt] =
+ *(application->help_prompt());
+ }
+
+ if (reset_result.timeout_prompt) {
+ (*tts_reset_global_prop_request)[strings::timeout_prompt] =
+ *(application->timeout_prompt());
+ }
+
+ (*tts_reset_global_prop_request)[strings::app_id] = application->app_id();
+
+ return tts_reset_global_prop_request;
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateUIResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ const ApplicationSharedPtr application) {
+ smart_objects::SmartObjectSPtr ui_reset_global_prop_request =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ if (reset_result.vr_help_title_items) {
+ smart_objects::SmartObjectSPtr vr_help = CreateAppVrHelp(application);
+ if (!vr_help.get()) {
+ SDL_LOG_WARN("Failed to create vr_help");
+ return smart_objects::SmartObjectSPtr();
+ } else {
+ ui_reset_global_prop_request = vr_help;
+ }
+ }
+ if (reset_result.menu_name) {
+ (*ui_reset_global_prop_request)[hmi_request::menu_title] = "";
+ application->set_menu_title(
+ (*ui_reset_global_prop_request)[hmi_request::menu_title]);
+ }
+
+ if (reset_result.keyboard_properties) {
+ smart_objects::SmartObject key_board_properties =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ key_board_properties[strings::language] =
+ static_cast<int32_t>(hmi_apis::Common_Language::EN_US);
+ key_board_properties[hmi_request::keyboard_layout] =
+ static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY);
+ key_board_properties[hmi_request::auto_complete_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ key_board_properties[strings::auto_complete_text] = "";
+ (*ui_reset_global_prop_request)[hmi_request::keyboard_properties] =
+ key_board_properties;
+ }
+
+ (*ui_reset_global_prop_request)[strings::app_id] = application->app_id();
+
+ return ui_reset_global_prop_request;
+}
+
smart_objects::SmartObjectSPtr
MessageHelper::CreateDisplayCapabilityUpdateToMobile(
const smart_objects::SmartObject& display_capabilities, Application& app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto message = std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -356,7 +440,7 @@ MessageHelper::CreateDisplayCapabilityUpdateToMobile(
void MessageHelper::BroadcastCapabilityUpdate(
smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject message(smart_objects::SmartType_Map);
message[strings::params][strings::message_type] = MessageType::kNotification;
@@ -402,7 +486,7 @@ smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification(
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -449,17 +533,17 @@ void MessageHelper::SendGetSystemTimeRequest(const uint32_t correlation_id,
void MessageHelper::SendHashUpdateNotification(const uint32_t app_id,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = app_mngr.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application not found by appID");
+ SDL_LOG_ERROR("Application not found by appID");
return;
}
smart_objects::SmartObjectSPtr so = CreateHashUpdateNotification(app_id);
PrintSmartObject(*so);
if (!app_mngr.GetRPCService().ManageMobileCommand(
so, commands::Command::SOURCE_SDL)) {
- LOG4CXX_ERROR(logger_, "Failed to send HashUpdate notification.");
+ SDL_LOG_ERROR("Failed to send HashUpdate notification.");
return;
}
app_mngr.resume_controller().ApplicationsDataUpdated();
@@ -469,7 +553,7 @@ smart_objects::SmartObjectSPtr
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
int32_t connection_key,
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr notification =
std::make_shared<smart_objects::SmartObject>();
@@ -488,20 +572,23 @@ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
return notification;
}
-void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd,
- ApplicationSharedPtr application,
- ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(cmd);
+smart_objects::SmartObjectSPtr MessageHelper::CreateDeleteUICommandRequest(
+ smart_objects::SmartObject* cmd,
+ const uint32_t app_id,
+ const uint32_t corr_id) {
+ SDL_LOG_AUTO_TRACE();
+
using namespace smart_objects;
+ DCHECK_OR_RETURN(cmd, nullptr);
+
SmartObject msg_params = SmartObject(smart_objects::SmartType_Map);
msg_params[strings::cmd_id] = (*cmd)[strings::cmd_id];
- msg_params[strings::app_id] = application->app_id();
+ msg_params[strings::app_id] = app_id;
if ((*cmd).keyExists(strings::menu_params)) {
- SmartObjectSPtr message = CreateMessageForHMI(
- hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
+ SmartObjectSPtr message =
+ CreateMessageForHMI(hmi_apis::messageType::request, corr_id);
DCHECK(message);
SmartObject& object = *message;
@@ -509,16 +596,31 @@ void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd,
hmi_apis::FunctionID::UI_DeleteCommand;
object[strings::msg_params] = msg_params;
-
- app_mngr.GetRPCService().ManageHMICommand(message);
+ return message;
}
+ return nullptr;
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateDeleteVRCommandRequest(
+ smart_objects::SmartObject* cmd,
+ ApplicationSharedPtr application,
+ const uint32_t corr_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ using namespace smart_objects;
+ DCHECK_OR_RETURN(cmd, nullptr);
+
+ SmartObject msg_params = SmartObject(smart_objects::SmartType_Map);
+
+ msg_params[strings::cmd_id] = (*cmd)[strings::cmd_id];
+ msg_params[strings::app_id] = application->app_id();
if ((*cmd).keyExists(strings::vr_commands)) {
msg_params[strings::grammar_id] = application->get_grammar_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
- SmartObjectSPtr message = CreateMessageForHMI(
- hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
+ SmartObjectSPtr message =
+ CreateMessageForHMI(hmi_apis::messageType::request, corr_id);
DCHECK(message);
SmartObject& object = *message;
@@ -526,15 +628,15 @@ void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd,
hmi_apis::FunctionID::VR_DeleteCommand;
object[strings::msg_params] = msg_params;
-
- app_mngr.GetRPCService().ManageHMICommand(message);
+ return message;
}
+ return nullptr;
}
void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd,
ApplicationSharedPtr application,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(cmd);
using namespace smart_objects;
@@ -590,12 +692,10 @@ void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd,
void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd,
ApplicationSharedPtr application,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(cmd);
using namespace smart_objects;
- // Same is deleted with SendDeleteCommandRequest?
-
SmartObject msg_params = SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = application->app_id();
@@ -621,7 +721,7 @@ void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd,
void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
{
@@ -724,16 +824,14 @@ hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult(
return StringToEnum<hmi_apis::Common_Result::eType>(result);
}
-void MessageHelper::SendHMIStatusNotification(
- ApplicationSharedPtr application,
- const WindowID window_id,
- ApplicationManager& application_manager) {
- LOG4CXX_AUTO_TRACE(logger_);
+smart_objects::SmartObjectSPtr MessageHelper::CreateHMIStatusNotification(
+ ApplicationSharedPtr application, const WindowID window_id) {
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr notification =
std::make_shared<smart_objects::SmartObject>();
if (!notification) {
- LOG4CXX_ERROR(logger_, "Failed to create smart object");
- return;
+ SDL_LOG_ERROR("Failed to create smart object");
+ return notification;
}
smart_objects::SmartObject& message = *notification;
@@ -759,9 +857,7 @@ void MessageHelper::SendHMIStatusNotification(
message[strings::msg_params][strings::system_context] =
static_cast<int32_t>(application->system_context(window_id));
-
- application_manager.GetRPCService().ManageMobileCommand(
- notification, commands::Command::SOURCE_SDL);
+ return notification;
}
void MessageHelper::SendActivateAppToHMI(
@@ -772,7 +868,7 @@ void MessageHelper::SendActivateAppToHMI(
application_manager::ApplicationConstSharedPtr app =
application_manager.application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id);
+ SDL_LOG_WARN("Invalid app_id: " << app_id);
return;
}
@@ -821,7 +917,7 @@ void MessageHelper::SendActivateAppToHMI(
std::string MessageHelper::StringifiedFunctionID(
mobile_apis::FunctionID::eType function_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace ns_smart_device_link::ns_smart_objects;
const char* str = 0;
if (EnumConversionHelper<mobile_apis::FunctionID::eType>::EnumToCString(
@@ -839,7 +935,7 @@ void MessageHelper::CreateGetVehicleDataRequest(
const uint32_t correlation_id,
const std::vector<std::string>& params,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr request =
std::make_shared<smart_objects::SmartObject>();
@@ -867,7 +963,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
mobile_apis::Result::eType result,
const uint32_t correlation_id,
uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr response =
std::make_shared<smart_objects::SmartObject>();
@@ -891,7 +987,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
const connection_handler::DeviceMap& devices,
const policy::PolicyHandlerInterface& policy_handler,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr device_list_so =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -925,7 +1021,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
uint32_t function_id, ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr module_info =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -941,7 +1037,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon(
const std::string& path_to_icon, uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr set_icon =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -967,12 +1063,12 @@ void MessageHelper::SendOnButtonSubscriptionNotification(
ApplicationManager& app_mngr) {
using namespace smart_objects;
using namespace hmi_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SmartObjectSPtr notification_ptr =
std::make_shared<SmartObject>(SmartType_Map);
if (!notification_ptr) {
- LOG4CXX_ERROR(logger_, "Memory allocation failed.");
+ SDL_LOG_ERROR("Memory allocation failed.");
return;
}
SmartObject& notification = *notification_ptr;
@@ -993,7 +1089,7 @@ void MessageHelper::SendOnButtonSubscriptionNotification(
notification[strings::msg_params] = msg_params;
if (!app_mngr.GetRPCService().ManageHMICommand(notification_ptr)) {
- LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
+ SDL_LOG_ERROR("Unable to send HMI notification");
}
}
@@ -1002,10 +1098,10 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
using namespace smart_objects;
using namespace hmi_apis;
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Invalid application pointer ");
+ SDL_LOG_ERROR("Invalid application pointer ");
return;
}
@@ -1020,6 +1116,61 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
}
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateOnButtonSubscriptionNotification(
+ uint32_t app_id,
+ hmi_apis::Common_ButtonName::eType button,
+ bool is_subscribed) {
+ using namespace smart_objects;
+ using namespace hmi_apis;
+ SDL_LOG_AUTO_TRACE();
+ SmartObjectSPtr notification_ptr =
+ std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject& notification = *notification_ptr;
+ SmartObject msg_params = SmartObject(SmartType_Map);
+ msg_params[strings::app_id] = app_id;
+ msg_params[strings::name] = button;
+ msg_params[strings::is_suscribed] = is_subscribed;
+ notification[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ notification[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ notification[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ notification[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::Buttons_OnButtonSubscription;
+ notification[strings::msg_params] = msg_params;
+ return notification_ptr;
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr,
+ const ButtonSubscriptions& button_subscriptions) {
+ using namespace smart_objects;
+ using namespace hmi_apis;
+ using namespace mobile_apis;
+ SDL_LOG_AUTO_TRACE();
+
+ SmartObjectList button_subscription_requests;
+
+ if (app.use_count() == 0) {
+ SDL_LOG_ERROR("Invalid application pointer ");
+ return button_subscription_requests;
+ }
+
+ for (auto& it : button_subscriptions) {
+ const Common_ButtonName::eType btn =
+ static_cast<Common_ButtonName::eType>(it);
+
+ button_subscription_requests.push_back(
+ CreateOnButtonSubscriptionNotification(app->hmi_app_id(), btn, true));
+ }
+
+ return button_subscription_requests;
+}
+
void MessageHelper::SendSetAppIcon(
const uint32_t app_id,
const std::string& icon_path,
@@ -1049,7 +1200,7 @@ void MessageHelper::SendSetAppIcon(
void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_man) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app) {
SendSetAppIcon(app->app_id(), app->app_icon_path(), app_man);
SendGlobalPropertiesToHMI(app, app_man);
@@ -1060,12 +1211,12 @@ void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app,
void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr) {
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Invalid application");
+ SDL_LOG_ERROR("Invalid application");
return;
}
- smart_objects::SmartObjectList requests = CreateGlobalPropertiesRequestsToHMI(
- app, app_mngr.GetNextHMICorrelationID());
+ smart_objects::SmartObjectList requests =
+ CreateGlobalPropertiesRequestsToHMI(app, app_mngr);
for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
it != requests.end();
++it) {
@@ -1075,12 +1226,14 @@ void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
smart_objects::SmartObjectList
MessageHelper::CreateGlobalPropertiesRequestsToHMI(
- ApplicationConstSharedPtr app, const uint32_t correlation_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ SDL_LOG_AUTO_TRACE();
+
+ uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
smart_objects::SmartObjectList requests;
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Invalid application");
+ SDL_LOG_ERROR("Invalid application");
return requests;
}
@@ -1096,8 +1249,8 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
// UI global properties
if (can_send_ui && (app->vr_help_title() || app->vr_help())) {
- smart_objects::SmartObjectSPtr ui_global_properties =
- CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
+ smart_objects::SmartObjectSPtr ui_global_properties = CreateMessageForHMI(
+ hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
if (!ui_global_properties) {
return requests;
}
@@ -1137,6 +1290,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
// TTS global properties
if (can_send_vr && (app->help_prompt() || app->timeout_prompt())) {
+ correlation_id = app_mngr.GetNextHMICorrelationID();
smart_objects::SmartObjectSPtr tts_global_properties =
CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
if (!tts_global_properties) {
@@ -1166,7 +1320,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app,
bool default_help_prompt,
ApplicationManager& app_man) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!app) {
return;
}
@@ -1253,7 +1407,7 @@ smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI(
ApplicationConstSharedPtr app, const uint32_t correlation_id) {
smart_objects::SmartObjectList requests;
if (!app) {
- LOG4CXX_ERROR(logger_, "Invalid application");
+ SDL_LOG_ERROR("Invalid application");
return requests;
}
@@ -1304,25 +1458,11 @@ void MessageHelper::SendShowConstantTBTRequestToHMI(
}
}
-void MessageHelper::SendAddCommandRequestToHMI(ApplicationConstSharedPtr app,
- ApplicationManager& app_man) {
- if (!app) {
- return;
- }
- smart_objects::SmartObjectList requests =
- CreateAddCommandRequestToHMI(app, app_man);
- for (smart_objects::SmartObjectList::iterator it = requests.begin();
- it != requests.end();
- ++it) {
- DCHECK(app_man.GetRPCService().ManageHMICommand(*it));
- }
-}
-
smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
smart_objects::SmartObjectList requests;
if (!app) {
- LOG4CXX_ERROR(logger_, "Invalid application");
+ SDL_LOG_ERROR("Invalid application");
return requests;
}
@@ -1334,42 +1474,44 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
if ((*i->second).keyExists(strings::menu_params)) {
smart_objects::SmartObjectSPtr ui_command = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
- if (!ui_command) {
- return requests;
- }
-
- (*ui_command)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::UI_AddCommand);
-
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (ui_command) {
+ (*ui_command)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_AddCommand);
- if ((*i->second).keyExists(strings::cmd_id)) {
- msg_params[strings::cmd_id] = (*i->second)[strings::cmd_id].asUInt();
- } else {
- LOG4CXX_ERROR(logger_, "Command ID is missing.");
- continue;
- }
- msg_params[strings::menu_params] = (*i->second)[strings::menu_params];
- msg_params[strings::app_id] = app->app_id();
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (((*i->second).keyExists(strings::cmd_icon)) &&
- (0 < (*i->second)[strings::cmd_icon][strings::value].length())) {
- msg_params[strings::cmd_icon] = (*i->second)[strings::cmd_icon];
- msg_params[strings::cmd_icon][strings::value] =
- (*i->second)[strings::cmd_icon][strings::value].asString();
+ if ((*i->second).keyExists(strings::cmd_id)) {
+ msg_params[strings::cmd_id] = (*i->second)[strings::cmd_id].asUInt();
+ } else {
+ SDL_LOG_ERROR("Command ID is missing.");
+ continue;
+ }
+ msg_params[strings::menu_params] = (*i->second)[strings::menu_params];
+ msg_params[strings::app_id] = app->app_id();
+
+ if (((*i->second).keyExists(strings::cmd_icon)) &&
+ (0 < (*i->second)[strings::cmd_icon][strings::value].length())) {
+ msg_params[strings::cmd_icon] = (*i->second)[strings::cmd_icon];
+ msg_params[strings::cmd_icon][strings::value] =
+ (*i->second)[strings::cmd_icon][strings::value].asString();
+ }
+ (*ui_command)[strings::msg_params] = msg_params;
+ requests.push_back(ui_command);
}
- (*ui_command)[strings::msg_params] = msg_params;
- requests.push_back(ui_command);
}
// VR Interface
if ((*i->second).keyExists(strings::vr_commands) &&
(*i->second).keyExists(strings::cmd_id)) {
- SendAddVRCommandToHMI((*i->second)[strings::cmd_id].asUInt(),
- (*i->second)[strings::vr_commands],
- app->app_id(),
- app_mngr);
+ auto vr_command =
+ CreateAddVRCommandToHMI((*i->second)[strings::cmd_id].asUInt(),
+ (*i->second)[strings::vr_commands],
+ app->app_id(),
+ app_mngr);
+ if (vr_command) {
+ requests.push_back(vr_command);
+ }
}
}
return requests;
@@ -1380,7 +1522,7 @@ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
smart_objects::SmartObjectList requests;
if (!app) {
- LOG4CXX_ERROR(logger_, "Invalid application");
+ SDL_LOG_ERROR("Invalid application");
return requests;
}
@@ -1450,7 +1592,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration(
void MessageHelper::SendUIChangeRegistrationRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Application is not valid");
+ SDL_LOG_ERROR("Application is not valid");
return;
}
@@ -1468,16 +1610,6 @@ void MessageHelper::SendUIChangeRegistrationRequestToHMI(
}
}
-void MessageHelper::SendAddVRCommandToHMI(
- const uint32_t cmd_id,
- const smart_objects::SmartObject& vr_commands,
- const uint32_t app_id,
- ApplicationManager& app_mngr) {
- smart_objects::SmartObjectSPtr request =
- CreateAddVRCommandToHMI(cmd_id, vr_commands, app_id, app_mngr);
- DCHECK(app_mngr.GetRPCService().ManageHMICommand(request));
-}
-
smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
const uint32_t cmd_id,
const smart_objects::SmartObject& vr_commands,
@@ -1514,7 +1646,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateUICreateWindowRequestToHMI(
ApplicationSharedPtr application,
ApplicationManager& app_mngr,
const smart_objects::SmartObject& window_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto ui_request = CreateMessageForHMI(hmi_apis::messageType::request,
app_mngr.GetNextHMICorrelationID());
@@ -1543,7 +1675,34 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateUICreateWindowRequestToHMI(
window_info[strings::duplicate_updates_from_window_id].asInt();
}
- msg_params[strings::app_id] = application->hmi_app_id();
+ msg_params[strings::app_id] = application->app_id();
+
+ (*ui_request)[strings::msg_params] = msg_params;
+
+ return ui_request;
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateUIDeleteWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const WindowID window_id) {
+ SDL_LOG_AUTO_TRACE();
+ auto ui_request = CreateMessageForHMI(hmi_apis::messageType::request,
+ app_mngr.GetNextHMICorrelationID());
+
+ (*ui_request)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_DeleteWindow);
+
+ (*ui_request)[strings::correlation_id] =
+ (*ui_request)[strings::params][strings::correlation_id];
+ (*ui_request)[strings::function_id] =
+ (*ui_request)[strings::params][strings::function_id];
+
+ smart_objects::SmartObject msg_params(
+ smart_objects::SmartObject(smart_objects::SmartType_Map));
+
+ msg_params[strings::window_id] = window_id;
+ msg_params[strings::app_id] = application->app_id();
(*ui_request)[strings::msg_params] = msg_params;
@@ -1585,8 +1744,7 @@ bool MessageHelper::CreateDeviceInfo(
if (-1 ==
session_observer.GetDataOnDeviceID(
device_handle, &device_name, NULL, &mac_address, &transport_type)) {
- LOG4CXX_ERROR(logger_,
- "Failed to extract information for device " << device_handle);
+ SDL_LOG_ERROR("Failed to extract information for device " << device_handle);
}
smart_objects::SmartObject& device_info_map = *output;
@@ -1616,7 +1774,7 @@ bool MessageHelper::CreateHMIApplicationStruct(
SmartObject& message = *output;
if (!app) {
- LOG4CXX_WARN(logger_, "Application is not valid");
+ SDL_LOG_WARN("Application is not valid");
return false;
}
@@ -1740,12 +1898,12 @@ bool MessageHelper::CreateHMIApplicationStruct(
void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr) {
if (app.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Invalid application");
+ SDL_LOG_ERROR("Invalid application");
return;
}
smart_objects::SmartObjectList requests =
- CreateAddSubMenuRequestToHMI(app, app_mngr.GetNextHMICorrelationID());
+ CreateAddSubMenuRequestsToHMI(app, app_mngr);
for (smart_objects::SmartObjectList::iterator it = requests.begin();
it != requests.end();
++it) {
@@ -1753,15 +1911,15 @@ void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app,
}
}
-smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
- ApplicationConstSharedPtr app, const uint32_t correlation_id) {
+smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestsToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
smart_objects::SmartObjectList requsets;
const DataAccessor<SubMenuMap> accessor = app->sub_menu_map();
const SubMenuMap& sub_menu = accessor.GetData();
SubMenuMap::const_iterator i = sub_menu.begin();
for (; sub_menu.end() != i; ++i) {
- smart_objects::SmartObjectSPtr ui_sub_menu =
- CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
+ smart_objects::SmartObjectSPtr ui_sub_menu = CreateMessageForHMI(
+ hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
if (!ui_sub_menu) {
return requsets;
}
@@ -1821,7 +1979,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI(
smart_objects::SmartObjectSPtr
MessageHelper::CreateOnAppPropertiesChangeNotification(
const std::string& policy_app_id, ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr notification =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -1877,8 +2035,7 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
ApplicationManager& app_mngr) {
DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
if (hmi_apis::Common_HMILevel::NONE == level) {
- LOG4CXX_WARN(logger_,
- "BC.ActivateApp cannot be used to deactivate an application");
+ SDL_LOG_WARN("BC.ActivateApp cannot be used to deactivate an application");
return NULL;
}
@@ -1936,11 +2093,11 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI(
void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr) {
- LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id);
+ SDL_LOG_WARN("SendOnResumeAudioSourceToHMI app_id: " << app_id);
application_manager::ApplicationConstSharedPtr app =
app_mngr.application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id);
+ SDL_LOG_WARN("Invalid app_id: " << app_id);
return;
}
@@ -2051,7 +2208,7 @@ void MessageHelper::SendGetUserFriendlyMessageResponse(
const std::vector<policy::UserFriendlyMessage>& msg,
const uint32_t correlation_id,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -2210,13 +2367,58 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse(
return std::make_shared<smart_objects::SmartObject>(response_data);
}
+smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponseFromHmi(
+ const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code,
+ const std::string& info) {
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*message)[strings::params][strings::function_id] = function_id;
+ (*message)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ (*message)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kErrorResponse;
+ (*message)[strings::params][hmi_response::code] = result_code;
+ (*message)[strings::params][strings::error_msg] = info;
+
+ return message;
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateResponseMessageFromHmi(
+ const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code) {
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+ params[strings::function_id] = function_id;
+ params[strings::message_type] = MessageType::kResponse;
+ params[strings::correlation_id] = correlation_id;
+ params[strings::protocol_type] = commands::CommandImpl::hmi_protocol_type_;
+ params[hmi_response::code] = result_code;
+
+ smart_objects::SmartObjectSPtr response =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ auto& message = *response;
+ message[strings::params] = params;
+ message[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ return response;
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateOnServiceUpdateNotification(
const hmi_apis::Common_ServiceType::eType service_type,
const hmi_apis::Common_ServiceEvent::eType service_event,
const hmi_apis::Common_ServiceStatusUpdateReason::eType
service_update_reason,
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto notification = MessageHelper::CreateHMINotification(
hmi_apis::FunctionID::BasicCommunication_OnServiceUpdate);
@@ -2242,7 +2444,7 @@ void MessageHelper::SendNaviSetVideoConfig(
int32_t app_id,
ApplicationManager& app_mngr,
const smart_objects::SmartObject& video_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr request = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
if (!request) {
@@ -2260,7 +2462,7 @@ void MessageHelper::SendNaviSetVideoConfig(
void MessageHelper::SendNaviStartStream(const int32_t app_id,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr start_stream = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
if (!start_stream) {
@@ -2294,7 +2496,7 @@ void MessageHelper::SendNaviStartStream(const int32_t app_id,
void MessageHelper::SendNaviStopStream(const int32_t app_id,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr stop_stream = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
if (!stop_stream) {
@@ -2311,7 +2513,7 @@ void MessageHelper::SendNaviStopStream(const int32_t app_id,
void MessageHelper::SendAudioStartStream(const int32_t app_id,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr start_stream = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
@@ -2346,7 +2548,7 @@ void MessageHelper::SendAudioStartStream(const int32_t app_id,
void MessageHelper::SendAudioStopStream(const int32_t app_id,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr stop_stream = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
@@ -2395,7 +2597,7 @@ void MessageHelper::SendOnDataStreaming(
}
bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) {
- LOG4CXX_INFO(logger_, "MessageHelper::SendAudioStopAudioPathThru");
+ SDL_LOG_INFO("MessageHelper::SendAudioStopAudioPathThru");
smart_objects::SmartObjectSPtr result = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
@@ -2406,16 +2608,16 @@ bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) {
return app_mngr.GetRPCService().ManageHMICommand(result);
}
-bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) {
- LOG4CXX_INFO(logger_, "MessageHelper::SendUnsubscribedWayPoints");
+smart_objects::SmartObjectSPtr MessageHelper::CreateUnsubscribeWayPointsRequest(
+ const uint32_t correlation_id) {
+ SDL_LOG_INFO("MessageHelper::CreateUnsubscribeWayPointsRequest");
- smart_objects::SmartObjectSPtr result = CreateMessageForHMI(
- hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
+ smart_objects::SmartObjectSPtr result =
+ CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
(*result)[strings::params][strings::function_id] =
hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints;
-
- return app_mngr.GetRPCService().ManageHMICommand(result);
+ return result;
}
void MessageHelper::SendPolicySnapshotNotification(
@@ -2423,7 +2625,7 @@ void MessageHelper::SendPolicySnapshotNotification(
const std::string& snapshot_file_path,
const std::string& url,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject content(smart_objects::SmartType_Map);
const auto request_type =
#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
@@ -2437,7 +2639,7 @@ void MessageHelper::SendPolicySnapshotNotification(
if (!url.empty()) {
content[strings::msg_params][strings::url] = url;
} else {
- LOG4CXX_WARN(logger_, "No service URLs");
+ SDL_LOG_WARN("No service URLs");
}
content[strings::msg_params][strings::file_name] = snapshot_file_path;
@@ -2464,7 +2666,7 @@ void MessageHelper::SendPolicySnapshotNotification(
content[strings::msg_params][strings::url] =
url; // Doesn't work with mobile_notification::syncp_url ("URL")
} else {
- LOG4CXX_WARN(logger_, "No service URLs");
+ SDL_LOG_WARN("No service URLs");
}
content[strings::params][strings::binary_data] =
@@ -2552,7 +2754,7 @@ void MessageHelper::SendOnPermissionsChangeNotification(
const policy::Permissions& permissions,
ApplicationManager& app_mngr,
const policy::EncryptionRequired encryprion_required) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject content(smart_objects::SmartType_Map);
content[strings::params][strings::function_id] =
@@ -2830,7 +3032,7 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result,
void MessageHelper::SendOnStatusUpdate(const std::string& status,
ApplicationManager& app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -2843,7 +3045,7 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status,
(*message)[strings::params][strings::message_type] =
MessageType::kNotification;
- LOG4CXX_DEBUG(logger_, "Sending new status:" << status);
+ SDL_LOG_DEBUG("Sending new status:" << status);
(*message)[strings::msg_params]["status"] = status;
app_mngr.GetRPCService().ManageHMICommand(message);
@@ -2872,7 +3074,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
mobile_apis::Result::eType res =
VerifyImageFiles(message[i], app, app_mngr);
if (mobile_apis::Result::SUCCESS != res) {
- LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res);
+ SDL_LOG_DEBUG("VerifyImageFiles result:" << res);
return res;
}
}
@@ -2883,8 +3085,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
VerifyImage(message, app, app_mngr);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_DEBUG(logger_,
- "VerifyImageFiles result:" << verification_result);
+ SDL_LOG_DEBUG("VerifyImageFiles result:" << verification_result);
return verification_result; // exit point
}
} else {
@@ -2897,7 +3098,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
mobile_apis::Result::eType res =
VerifyImageFiles(message[*key], app, app_mngr);
if (mobile_apis::Result::SUCCESS != res) {
- LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res);
+ SDL_LOG_DEBUG("VerifyImageFiles result:" << res);
return res;
}
}
@@ -3057,9 +3258,9 @@ bool MessageHelper::VerifyString(const std::string& str) {
(std::string::npos != str.find("\\n")) ||
(std::string::npos != str.find("\\t")) ||
(std::string::npos == str.find_first_not_of(' '))) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyString"
- "string contains incorrect character");
+ SDL_LOG_ERROR(
+ "MessageHelper::VerifyString"
+ "string contains incorrect character");
return false;
}
return true;
@@ -3189,7 +3390,7 @@ void MessageHelper::SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
int32_t function_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SubscribeApplicationToSoftButton(
message_params,
app,
@@ -3202,7 +3403,7 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
Json::Value tmp;
namespace Formatters = ns_smart_device_link::ns_json_handler::formatters;
Formatters::CFormatterJsonBase::objToJsonValue(object, tmp);
- LOG4CXX_DEBUG(logger_, "SMART OBJECT: " << tmp.toStyledString());
+ SDL_LOG_DEBUG("SMART OBJECT: " << tmp.toStyledString());
#endif
return true;
}
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index d3e7c782f7..a9c0a362be 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -59,7 +59,7 @@ MessageTypeMap message_types = {std::make_pair(kRequest, "Request"),
std::make_pair(kResponse, "Response"),
std::make_pair(kNotification, "Notification")};
} // namespace
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+SDL_CREATE_LOG_VARIABLE("ApplicationManager")
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocol(
@@ -68,41 +68,40 @@ MobileMessageHandler::HandleIncomingMessageProtocol(
application_manager::Message* out_message = NULL;
switch (message->protocol_version()) {
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1:
- LOG4CXX_DEBUG(logger_, "Protocol version - V1");
+ SDL_LOG_DEBUG("Protocol version - V1");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV1(message);
break;
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2:
- LOG4CXX_DEBUG(logger_, "Protocol version - V2");
+ SDL_LOG_DEBUG("Protocol version - V2");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3:
- LOG4CXX_DEBUG(logger_, "Protocol version - V3");
+ SDL_LOG_DEBUG("Protocol version - V3");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4:
- LOG4CXX_DEBUG(logger_, "Protocol version - V4");
+ SDL_LOG_DEBUG("Protocol version - V4");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5:
- LOG4CXX_DEBUG(logger_, "Protocol version - V5");
+ SDL_LOG_DEBUG("Protocol version - V5");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
default:
- LOG4CXX_WARN(logger_, "Can't recognise protocol version");
+ SDL_LOG_WARN("Can't recognise protocol version");
out_message = NULL;
break;
}
if (out_message == NULL) {
- LOG4CXX_WARN(logger_, "Message is NULL");
+ SDL_LOG_WARN("Message is NULL");
return NULL;
}
- LOG4CXX_DEBUG(logger_,
- "Incoming RPC_INFO: " << (out_message->connection_key() >> 16)
+ SDL_LOG_DEBUG("Incoming RPC_INFO: " << (out_message->connection_key() >> 16)
<< ", "
<< message_types[out_message->type()]
<< ", " << out_message->function_id()
@@ -114,8 +113,7 @@ MobileMessageHandler::HandleIncomingMessageProtocol(
protocol_handler::RawMessage*
MobileMessageHandler::HandleOutgoingMessageProtocol(
const MobileMessage& message) {
- LOG4CXX_DEBUG(logger_,
- "Outgoing RPC_INFO: " << (message->connection_key() >> 16)
+ SDL_LOG_DEBUG("Outgoing RPC_INFO: " << (message->connection_key() >> 16)
<< ", " << message_types[message->type()]
<< ", " << message->function_id() << ", "
<< message->correlation_id() << ", "
@@ -136,7 +134,7 @@ MobileMessageHandler::HandleOutgoingMessageProtocol(
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocolV1(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
application_manager::Message* outgoing_message =
new application_manager::Message(
protocol_handler::MessagePriority::FromServiceType(
@@ -165,7 +163,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1(
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocolV2(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::BitStream message_bytestream(message->data(), message->data_size());
protocol_handler::ProtocolPayloadV2 payload;
protocol_handler::Extract(
@@ -173,8 +171,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
// Silently drop message if it wasn't parsed correctly
if (message_bytestream.IsBad()) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Drop ill-formed message from mobile, partially parsed: " << payload);
return NULL;
}
@@ -207,10 +204,10 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
protocol_handler::RawMessage*
MobileMessageHandler::HandleOutgoingMessageProtocolV1(
const MobileMessage& message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string message_string = message->json_message();
if (message_string.length() == 0) {
- LOG4CXX_WARN(logger_, "Drop ill-formed message from mobile");
+ SDL_LOG_WARN("Drop ill-formed message from mobile");
return NULL;
}
@@ -230,9 +227,9 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1(
protocol_handler::RawMessage*
MobileMessageHandler::HandleOutgoingMessageProtocolV2(
const MobileMessage& message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (message->json_message().length() == 0) {
- LOG4CXX_ERROR(logger_, "json string is empty.");
+ SDL_LOG_ERROR("json string is empty.");
}
uint32_t json_size = message->json_message().length();
uint32_t binary_size = 0;
diff --git a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
index 9214a30513..0276e59b7d 100644
--- a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
+++ b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
@@ -2,11 +2,12 @@
#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h"
#include "utils/file_system.h"
+#include "utils/ilogger.h"
namespace application_manager {
namespace plugin_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PluginManager")
+SDL_CREATE_LOG_VARIABLE("PluginManager")
RPCPluginManagerImpl::RPCPluginManagerImpl(
ApplicationManager& app_manager,
@@ -37,7 +38,7 @@ T GetFuncFromLib(void* dl_handle, const std::string& function_name) {
reinterpret_cast<T>(dlsym(dl_handle, function_name.c_str()));
char* error_string = dlerror();
if (nullptr != error_string) {
- LOG4CXX_ERROR(logger_, "Failed to export symbols : " << error_string);
+ SDL_LOG_ERROR("Failed to export symbols : " << error_string);
return nullptr;
}
return exported_func;
@@ -46,22 +47,21 @@ T GetFuncFromLib(void* dl_handle, const std::string& function_name) {
RPCPluginManagerImpl::RPCPluginPtr RPCPluginManagerImpl::LoadPlugin(
const std::string& full_plugin_path) const {
if (!IsLibraryFile(full_plugin_path)) {
- LOG4CXX_DEBUG(logger_, "Skip loading " << full_plugin_path);
+ SDL_LOG_DEBUG("Skip loading " << full_plugin_path);
return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
void* plugin_dll = dlopen(full_plugin_path.c_str(), RTLD_LAZY);
if (nullptr == plugin_dll) {
- LOG4CXX_ERROR(
- logger_,
- "Failed to open dll " << full_plugin_path << " : " << dlerror());
+ SDL_LOG_ERROR("Failed to open dll " << full_plugin_path << " : "
+ << dlerror());
return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
- typedef RPCPlugin* (*Create)();
+ typedef RPCPlugin* (*Create)(logger::Logger*);
Create create_plugin = GetFuncFromLib<Create>(plugin_dll, "Create");
if (!create_plugin) {
- LOG4CXX_ERROR(logger_, "No Create function in " << full_plugin_path);
+ SDL_LOG_ERROR("No Create function in " << full_plugin_path);
dlclose(plugin_dll);
return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
@@ -69,23 +69,23 @@ RPCPluginManagerImpl::RPCPluginPtr RPCPluginManagerImpl::LoadPlugin(
typedef void (*Delete)(RPCPlugin*);
Delete delete_plugin = GetFuncFromLib<Delete>(plugin_dll, "Delete");
if (!delete_plugin) {
- LOG4CXX_ERROR(logger_, "No Delete function in " << full_plugin_path);
+ SDL_LOG_ERROR("No Delete function in " << full_plugin_path);
dlclose(plugin_dll);
return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
auto plugin_destroyer = [delete_plugin, plugin_dll](RPCPlugin* plugin) {
- LOG4CXX_DEBUG(logger_, "Delete plugin " << plugin->PluginName());
+ SDL_LOG_DEBUG("Delete plugin " << plugin->PluginName());
delete_plugin(plugin);
dlclose(plugin_dll);
return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
};
- RPCPlugin* plugin = create_plugin();
+ RPCPlugin* plugin = create_plugin(&logger::Logger::instance());
return RPCPluginPtr(plugin, plugin_destroyer);
}
uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
- LOG4CXX_INFO(logger_, "Loading plugins from " << plugins_path);
+ SDL_LOG_INFO("Loading plugins from " << plugins_path);
std::vector<std::string> plugin_files = file_system::ListFiles(plugins_path);
for (auto& plugin_file : plugin_files) {
std::string full_name = plugins_path + '/' + plugin_file;
@@ -93,9 +93,8 @@ uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
if (!plugin) {
continue;
}
- LOG4CXX_DEBUG(
- logger_,
- "Loaded " << plugin->PluginName() << " plugin from " << full_name);
+ SDL_LOG_DEBUG("Loaded " << plugin->PluginName() << " plugin from "
+ << full_name);
if (plugin->Init(app_manager_,
rpc_service_,
hmi_capabilities_,
@@ -103,8 +102,7 @@ uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
last_state_)) {
loaded_plugins_.push_back(std::move(plugin));
} else {
- LOG4CXX_ERROR(logger_,
- "Initialisation of " << plugin->PluginName()
+ SDL_LOG_ERROR("Initialisation of " << plugin->PluginName()
<< " plugin from " << full_name
<< " failed");
}
diff --git a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc
index 871e96442a..b5c329fdd2 100644
--- a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc
+++ b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc
@@ -34,7 +34,7 @@
#include "application_manager/application_manager.h"
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+SDL_CREATE_LOG_VARIABLE("PolicyHandler")
#ifdef EXTERNAL_PROPRIETARY_MODE
AppPermissionDelegate::AppPermissionDelegate(
@@ -57,7 +57,7 @@ AppPermissionDelegate::AppPermissionDelegate(
#endif
void AppPermissionDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef EXTERNAL_PROPRIETARY_MODE
policy_handler_.OnAppPermissionConsentInternal(
diff --git a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
index e668be4ed1..3b662ed201 100644
--- a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
+++ b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
@@ -33,7 +33,7 @@
#include "application_manager/policies/delegates/statistics_delegate.h"
#include "application_manager/policies/policy_handler.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+SDL_CREATE_LOG_VARIABLE("PolicyHandler")
namespace policy {
StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
usage_statistics::GlobalCounterId type)
@@ -89,7 +89,7 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
, policy_handler_(policy_handler) {}
void StatisticsDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (type_) {
case INCREMENT_GLOBAL:
policy_handler_.Increment(global_counter_);
@@ -104,7 +104,7 @@ void StatisticsDelegate::threadMain() {
policy_handler_.Add(app_id_, stop_watch_, timespan_seconds_);
break;
default:
- LOG4CXX_ERROR(logger_, "Unknown statistics operator");
+ SDL_LOG_ERROR("Unknown statistics operator");
break;
}
}
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 7ca4d7b5b8..af44fd033f 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -40,7 +40,7 @@ namespace policy {
using namespace application_manager;
class PolicyHandler;
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+SDL_CREATE_LOG_VARIABLE("PolicyHandler")
PolicyEventObserver::PolicyEventObserver(
policy::PolicyHandlerInterface* const policy_handler,
@@ -49,9 +49,9 @@ PolicyEventObserver::PolicyEventObserver(
void PolicyEventObserver::set_policy_handler(
PolicyHandlerInterface* const policy_handler) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(policy_handler_lock_);
- LOG4CXX_DEBUG(logger_, "Set policy handler " << policy_handler);
+ SDL_LOG_DEBUG("Set policy handler " << policy_handler);
policy_handler_ = policy_handler;
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 66f04cff50..404a95f807 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -66,7 +66,7 @@ namespace policy {
using namespace application_manager;
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+SDL_CREATE_LOG_VARIABLE("PolicyHandler")
namespace {
using namespace mobile_apis;
@@ -108,7 +108,6 @@ const std::string RequestTypeToString(mobile_apis::RequestType::eType type) {
const policy::DeviceParams GetDeviceParams(
connection_handler::DeviceHandle device_handle,
const protocol_handler::SessionObserver& session_observer) {
- CREATE_LOGGERPTR_LOCAL(logger_, "PolicyHandler");
policy::DeviceParams device_params;
if (-1 == session_observer.GetDataOnDeviceID(
device_handle,
@@ -116,8 +115,7 @@ const policy::DeviceParams GetDeviceParams(
NULL,
&device_params.device_mac_address,
&device_params.device_connection_type)) {
- LOG4CXX_ERROR(logger_,
- "Failed to extract information for device " << device_handle);
+ SDL_LOG_ERROR("Failed to extract information for device " << device_handle);
}
device_params.device_handle = device_handle;
return device_params;
@@ -141,22 +139,22 @@ struct HMILevelPredicate
} // namespace
-#define POLICY_LIB_CHECK_OR_RETURN(return_value) \
- { \
- sync_primitives::AutoReadLock lock(policy_manager_lock_); \
- if (!policy_manager_) { \
- LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded"); \
- return return_value; \
- } \
+#define POLICY_LIB_CHECK_OR_RETURN(return_value) \
+ { \
+ sync_primitives::AutoReadLock lock(policy_manager_lock_); \
+ if (!policy_manager_) { \
+ SDL_LOG_DEBUG("The shared library of policy is not loaded"); \
+ return return_value; \
+ } \
}
-#define POLICY_LIB_CHECK_VOID() \
- { \
- sync_primitives::AutoReadLock lock(policy_manager_lock_); \
- if (!policy_manager_) { \
- LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded"); \
- return; \
- } \
+#define POLICY_LIB_CHECK_VOID() \
+ { \
+ sync_primitives::AutoReadLock lock(policy_manager_lock_); \
+ if (!policy_manager_) { \
+ SDL_LOG_DEBUG("The shared library of policy is not loaded"); \
+ return; \
+ } \
}
static const std::string kCerficateFileName = "certificate";
@@ -198,9 +196,9 @@ struct LinksCollector {
void operator()(const ApplicationSharedPtr& app) {
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_,
- "Invalid pointer to application was passed."
- "Skip current application.");
+ SDL_LOG_WARN(
+ "Invalid pointer to application was passed."
+ "Skip current application.");
return;
}
DeviceParams device_params = GetDeviceParams(
@@ -208,8 +206,7 @@ struct LinksCollector {
application_manager_.connection_handler().get_session_observer());
const std::string app_id = app->policy_app_id();
if (device_params.device_mac_address.empty()) {
- LOG4CXX_WARN(logger_,
- "Couldn't find device, which hosts application " << app_id);
+ SDL_LOG_WARN("Couldn't find device, which hosts application " << app_id);
return;
}
out_app_to_device_link_.insert(
@@ -232,9 +229,9 @@ struct LinkAppToDevice {
void operator()(const ApplicationSharedPtr& app) {
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_,
- "Invalid pointer to application was passed."
- "Skip current application.");
+ SDL_LOG_WARN(
+ "Invalid pointer to application was passed."
+ "Skip current application.");
return;
}
DeviceParams device_params = GetDeviceParams(
@@ -242,8 +239,7 @@ struct LinkAppToDevice {
application_manager_.connection_handler().get_session_observer());
const std::string app_id = app->policy_app_id();
if (device_params.device_mac_address.empty()) {
- LOG4CXX_WARN(logger_,
- "Couldn't find device, which hosts application " << app_id);
+ SDL_LOG_WARN("Couldn't find device, which hosts application " << app_id);
return;
}
app_to_device_link_[app_id] = device_params.device_mac_address;
@@ -320,12 +316,12 @@ bool PolicyHandler::PolicyEnabled() const {
}
bool PolicyHandler::LoadPolicyLibrary() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoWriteLock lock(policy_manager_lock_);
if (!PolicyEnabled()) {
- LOG4CXX_WARN(logger_,
- "System is configured to work without policy "
- "functionality.");
+ SDL_LOG_WARN(
+ "System is configured to work without policy "
+ "functionality.");
policy_manager_.reset();
return false;
}
@@ -343,14 +339,13 @@ bool PolicyHandler::CreateManager() {
void* policy_handle = dlopen(kLibrary.c_str(), RTLD_LAZY);
const char* error = dlerror();
if (!policy_handle) {
- LOG4CXX_ERROR(
- logger_,
- (error == NULL ? "Unknown error in dlopen while loading policy table"
+ SDL_LOG_ERROR((error == NULL
+ ? "Unknown error in dlopen while loading policy table"
: error));
return false;
}
- typedef PolicyManager* (*CreateManager)();
+ typedef PolicyManager* (*CreateManager)(logger::Logger*);
typedef void (*DeleteManager)(PolicyManager*);
CreateManager create_manager =
reinterpret_cast<CreateManager>(dlsym(policy_handle, "CreateManager"));
@@ -358,16 +353,16 @@ bool PolicyHandler::CreateManager() {
reinterpret_cast<DeleteManager>(dlsym(policy_handle, "DeleteManager"));
auto policy_destroyer = [delete_manager,
policy_handle](PolicyManager* policy_manager) {
- LOG4CXX_DEBUG(logger_, "Delete Policy Manager");
+ SDL_LOG_DEBUG("Delete Policy Manager");
delete_manager(policy_manager);
dlclose(policy_handle);
};
char* error_string = dlerror();
if (NULL == error_string) {
- policy_manager_ =
- std::shared_ptr<PolicyManager>(create_manager(), policy_destroyer);
+ policy_manager_ = std::shared_ptr<PolicyManager>(
+ create_manager(&logger::Logger::instance()), policy_destroyer);
} else {
- LOG4CXX_WARN(logger_, error_string);
+ SDL_LOG_WARN(error_string);
dlclose(policy_handle);
}
return (policy_manager_.use_count() != 0);
@@ -378,7 +373,7 @@ const PolicySettings& PolicyHandler::get_settings() const {
}
bool PolicyHandler::InitPolicyTable() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
std::string preloaded_file = get_settings().preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
@@ -387,12 +382,12 @@ bool PolicyHandler::InitPolicyTable() {
OnPTInited();
return pt_inited;
}
- LOG4CXX_FATAL(logger_, "The file which contains preloaded PT is not exist");
+ SDL_LOG_FATAL("The file which contains preloaded PT is not exist");
return false;
}
void PolicyHandler::OnPTInited() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(listeners_lock_);
@@ -402,7 +397,7 @@ void PolicyHandler::OnPTInited() {
}
void PolicyHandler::StopRetrySequence() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
#ifndef EXTERNAL_PROPRIETARY_MODE
// Clear cached PTU app
@@ -412,18 +407,18 @@ void PolicyHandler::StopRetrySequence() {
}
bool PolicyHandler::ResetPolicyTable() {
- LOG4CXX_TRACE(logger_, "Reset policy table.");
+ SDL_LOG_TRACE("Reset policy table.");
POLICY_LIB_CHECK_OR_RETURN(false);
std::string preloaded_file = get_settings().preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
return policy_manager_->ResetPT(preloaded_file);
}
- LOG4CXX_WARN(logger_, "The file which contains preloaded PT is not exist");
+ SDL_LOG_WARN("The file which contains preloaded PT is not exist");
return false;
}
bool PolicyHandler::ClearUserConsent() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->ResetUserConsent();
}
@@ -431,7 +426,7 @@ bool PolicyHandler::ClearUserConsent() {
#ifndef EXTERNAL_PROPRIETARY_MODE
uint32_t PolicyHandler::ChoosePTUApplication(
const PTUIterationType iteration_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Return the previous app chosen if this is a retry for a PTU in progress
if (iteration_type == PTUIterationType::RetryIteration &&
@@ -439,7 +434,7 @@ uint32_t PolicyHandler::ChoosePTUApplication(
ApplicationSharedPtr app =
application_manager_.application(last_ptu_app_id_);
if (app && app->IsRegistered()) {
- LOG4CXX_INFO(logger_, "Previously chosen application exists, returning");
+ SDL_LOG_INFO("Previously chosen application exists, returning");
return last_ptu_app_id_;
}
}
@@ -458,7 +453,7 @@ void PolicyHandler::CacheRetryInfo(const uint32_t app_id,
#endif // EXTERNAL_PROPRIETARY_MODE
uint32_t PolicyHandler::GetAppIdForSending() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(0);
// fix ApplicationSet access crash
@@ -471,9 +466,8 @@ uint32_t PolicyHandler::GetAppIdForSending() const {
std::back_inserter(apps_without_none_level),
std::not1(has_none_level));
- LOG4CXX_DEBUG(logger_,
- "Number of apps with different from NONE level: "
- << apps_without_none_level.size());
+ SDL_LOG_DEBUG("Number of apps with different from NONE level: "
+ << apps_without_none_level.size());
uint32_t app_id = ChooseRandomAppForPolicyUpdate(apps_without_none_level);
@@ -487,12 +481,11 @@ uint32_t PolicyHandler::GetAppIdForSending() const {
std::back_inserter(apps_with_none_level),
has_none_level);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Number of apps with NONE level: " << apps_with_none_level.size());
if (apps_with_none_level.empty()) {
- LOG4CXX_WARN(logger_, "There is no registered application");
+ SDL_LOG_WARN("There is no registered application");
return 0;
}
@@ -500,7 +493,7 @@ uint32_t PolicyHandler::GetAppIdForSending() const {
}
void PolicyHandler::PushAppIdToPTUQueue(const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
sync_primitives::AutoLock lock(app_id_queue_lock_);
const auto result = applications_ptu_queue_.insert(app_id);
@@ -510,7 +503,7 @@ void PolicyHandler::PushAppIdToPTUQueue(const uint32_t app_id) {
}
void PolicyHandler::PopAppIdFromPTUQueue() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
sync_primitives::AutoLock lock(app_id_queue_lock_);
if (applications_ptu_queue_.size() > 0) {
@@ -521,7 +514,7 @@ void PolicyHandler::PopAppIdFromPTUQueue() {
#ifdef EXTERNAL_PROPRIETARY_MODE
PTURetryHandler& PolicyHandler::ptu_retry_handler() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return *policy_manager_;
}
@@ -529,14 +522,14 @@ void PolicyHandler::OnAppPermissionConsent(
const uint32_t connection_key,
const PermissionConsent& permissions,
const ExternalConsentStatus& external_consent_status) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AsyncRun(new AppPermissionDelegate(
connection_key, permissions, external_consent_status, *this));
}
#else
void PolicyHandler::OnAppPermissionConsent(
const uint32_t connection_key, const PermissionConsent& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AsyncRun(new AppPermissionDelegate(connection_key, permissions, *this));
}
@@ -544,13 +537,12 @@ void PolicyHandler::OnAppPermissionConsent(
void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
const bool is_allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
connection_handler::DeviceHandle device_handle;
if (!application_manager_.connection_handler().GetDeviceID(device_id,
&device_handle)) {
- LOG4CXX_ERROR(logger_,
- "Unable to get device handle for device_id: " << device_id);
+ SDL_LOG_ERROR("Unable to get device handle for device_id: " << device_id);
return;
}
// In case of changed consent for device, related applications will be
@@ -588,14 +580,13 @@ void PolicyHandler::SendOnAppPermissionsChanged(
const AppPermissions& permissions,
const std::string& device_id,
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "PolicyHandler::SendOnAppPermissionsChanged for " << policy_app_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("PolicyHandler::SendOnAppPermissionsChanged for "
+ << policy_app_id);
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_, "No app found for policy app id = " << policy_app_id);
+ SDL_LOG_WARN("No app found for policy app id = " << policy_app_id);
return;
}
MessageHelper::SendOnAppPermissionsChangedNotification(
@@ -604,7 +595,7 @@ void PolicyHandler::SendOnAppPermissionsChanged(
void PolicyHandler::SendOnAppPropertiesChangeNotification(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto notification =
MessageHelper::CreateOnAppPropertiesChangeNotification(
policy_app_id, application_manager_);
@@ -612,19 +603,19 @@ void PolicyHandler::SendOnAppPropertiesChangeNotification(
}
void PolicyHandler::OnPTExchangeNeeded() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->ForcePTExchange();
}
void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) {
- LOG4CXX_INFO(logger_, "GetAvailable apps");
+ SDL_LOG_INFO("GetAvailable apps");
const ApplicationSet& app_list =
application_manager_.applications().GetData();
ApplicationSetConstIt iter = app_list.begin();
for (; app_list.end() != iter; ++iter) {
- LOG4CXX_INFO(logger_, "one more app");
+ SDL_LOG_INFO("one more app");
apps.push((*iter)->policy_app_id());
}
}
@@ -645,14 +636,14 @@ StatusNotifier PolicyHandler::AddApplication(
void PolicyHandler::AddDevice(const std::string& device_id,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->AddDevice(device_id, connection_type);
}
void PolicyHandler::SetDeviceInfo(const std::string& device_id,
const DeviceInfo& device_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->SetDeviceInfo(device_id, device_info);
}
@@ -662,7 +653,7 @@ void PolicyHandler::OnAppPermissionConsentInternal(
const uint32_t connection_key,
const ExternalConsentStatus& external_consent_status,
PermissionConsent& out_permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const PolicyManager::NotificationMode mode =
external_consent_status.empty() ? PolicyManager::kNotifyApplicationMode
: PolicyManager::kSilentMode;
@@ -699,15 +690,14 @@ void PolicyHandler::OnAppPermissionConsentInternal(
// current,
// permissions should be set only for coincident to registered apps
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_,
- "Invalid pointer to application was passed."
- "Permissions setting skipped.");
+ SDL_LOG_WARN(
+ "Invalid pointer to application was passed. "
+ "Permissions setting skipped.");
continue;
}
if (!app->IsRegistered()) {
- LOG4CXX_DEBUG(logger_,
- "Application " << app->policy_app_id()
+ SDL_LOG_DEBUG("Application " << app->policy_app_id()
<< " is not marked as registered.");
continue;
}
@@ -717,9 +707,9 @@ void PolicyHandler::OnAppPermissionConsentInternal(
application_manager_.connection_handler().get_session_observer());
if (device_params.device_mac_address != app->mac_address()) {
- LOG4CXX_WARN(logger_,
- "Device_id of application is changed."
- "Permissions setting skipped.");
+ SDL_LOG_WARN(
+ "Device_id of application is changed. "
+ "Permissions setting skipped.");
continue;
}
@@ -732,14 +722,13 @@ void PolicyHandler::OnAppPermissionConsentInternal(
#endif
}
} else {
- LOG4CXX_WARN(logger_,
- "There are no applications previously stored for "
- "setting common permissions.");
+ SDL_LOG_WARN(
+ "There are no applications previously stored for "
+ "setting common permissions.");
}
#ifdef EXTERNAL_PROPRIETARY_MODE
if (!policy_manager_->SetExternalConsentStatus(external_consent_status)) {
- LOG4CXX_WARN(logger_,
- "External User Consent Settings status has not been set!");
+ SDL_LOG_WARN("External User Consent Settings status has not been set!");
}
#endif
}
@@ -763,7 +752,7 @@ void PolicyHandler::OnGetUserFriendlyMessage(
const std::vector<std::string>& message_codes,
const std::string& language,
uint32_t correlation_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
#ifdef EXTERNAL_PROPRIETARY_MODE
@@ -806,7 +795,7 @@ void PolicyHandler::GetRegisteredLinks(
std::vector<policy::FunctionalGroupPermission>
PolicyHandler::CollectRegisteredAppsPermissions() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(std::vector<policy::FunctionalGroupPermission>());
// If no specific app was passed, get permissions for all currently registered
// applications
@@ -835,11 +824,10 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions(
ApplicationSharedPtr app = application_manager_.application(connection_key);
if (NULL == app.get() || app.use_count() == 0) {
- LOG4CXX_WARN(logger_,
- "Connection key '"
- << connection_key
- << "' "
- "not found within registered applications.");
+ SDL_LOG_WARN("Connection key '"
+ << connection_key
+ << "' "
+ "not found within registered applications.");
return group_permissions;
}
@@ -849,7 +837,7 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions(
application_manager_.connection_handler().get_session_observer());
if (device_params.device_mac_address.empty()) {
- LOG4CXX_WARN(logger_, "Couldn't find device, which hosts application.");
+ SDL_LOG_WARN("Couldn't find device, which hosts application.");
return group_permissions;
}
@@ -862,7 +850,7 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions(
void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
const uint32_t correlation_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
application_manager::ApplicationSharedPtr app =
@@ -875,9 +863,8 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
: CollectRegisteredAppsPermissions();
if (permissions.empty() && is_connection_key_valid) {
- LOG4CXX_ERROR(logger_,
- "No permissions found for application with connection key:"
- << connection_key);
+ SDL_LOG_ERROR("No permissions found for application with connection key:"
+ << connection_key);
return;
}
@@ -893,13 +880,12 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
void PolicyHandler::LinkAppsToDevice() {
sync_primitives::AutoLock lock(app_to_device_link_lock_);
LinkAppToDevice linker(app_to_device_link_, application_manager_);
- LOG4CXX_DEBUG(logger_, "add links to app. no specific app was passed");
+ SDL_LOG_DEBUG("add links to app. no specific app was passed");
{
const ApplicationSet& accessor =
application_manager_.applications().GetData();
if (accessor.empty()) {
- LOG4CXX_WARN(logger_,
- "application_manager doesn't have any applications");
+ SDL_LOG_WARN("application_manager doesn't have any applications");
} else {
// Add all currently registered applications
std::for_each(accessor.begin(), accessor.end(), linker);
@@ -909,18 +895,16 @@ void PolicyHandler::LinkAppsToDevice() {
bool PolicyHandler::IsAppSuitableForPolicyUpdate(
const Applications::value_type value) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
if (!value->IsRegistered()) {
- LOG4CXX_DEBUG(
- logger_,
- "Application " << value->app_id() << " is not marked as registered.");
+ SDL_LOG_DEBUG("Application " << value->app_id()
+ << " is not marked as registered.");
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Application " << value->app_id()
+ SDL_LOG_DEBUG("Application " << value->app_id()
<< " marked as registered."
"Checking its parameters.");
@@ -932,15 +916,14 @@ bool PolicyHandler::IsAppSuitableForPolicyUpdate(
(kDeviceAllowed == policy_manager_->GetUserConsentForDevice(
device_params.device_mac_address));
- LOG4CXX_DEBUG(logger_,
- "Is device " << device_params.device_mac_address << " allowed "
+ SDL_LOG_DEBUG("Is device " << device_params.device_mac_address << " allowed "
<< std::boolalpha << is_device_allowed);
return is_device_allowed;
}
uint32_t PolicyHandler::ChooseRandomAppForPolicyUpdate(
Applications& app_list) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::random_shuffle(app_list.begin(), app_list.end());
Applications::const_iterator choosen_app = std::find_if(
@@ -958,13 +941,13 @@ uint32_t PolicyHandler::ChooseRandomAppForPolicyUpdate(
void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->OnDeviceSwitching(device_id_from, device_id_to);
}
void PolicyHandler::OnLockScreenDismissalStateChanged() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto accessor = application_manager_.applications();
const auto apps = accessor.GetData();
for (auto& app : apps) {
@@ -973,7 +956,7 @@ void PolicyHandler::OnLockScreenDismissalStateChanged() {
}
void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
MessageHelper::SendGetStatusUpdateResponse(
policy_manager_->GetPolicyTableStatus(),
@@ -982,7 +965,7 @@ void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) {
}
void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->SaveUpdateStatusRequired(policy::kUpToDate != status);
MessageHelper::SendOnStatusUpdate(status, application_manager_);
@@ -991,7 +974,7 @@ void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceParams device_params = GetDeviceParams(
device_handle,
application_manager_.connection_handler().get_session_observer());
@@ -1000,11 +983,10 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
device_params.device_mac_address, policy_app_id);
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_,
- "Application with id '"
- << policy_app_id
- << "' "
- "not found within registered applications.");
+ SDL_LOG_WARN("Application with id '"
+ << policy_app_id
+ << "' "
+ "not found within registered applications.");
return std::string();
}
@@ -1012,31 +994,31 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
}
void PolicyHandler::OnSystemInfoChanged(const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->SetSystemLanguage(language);
}
void PolicyHandler::SetPreloadedPtFlag(const bool is_preloaded) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_manager_->SetPreloadedPtFlag(is_preloaded);
}
void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
}
std::string PolicyHandler::GetCCPUVersionFromPT() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return policy_manager_->GetCCPUVersionFromPT();
}
void PolicyHandler::OnVIIsReady() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t correlation_id =
application_manager_.GetNextHMICorrelationID();
@@ -1052,9 +1034,8 @@ void PolicyHandler::OnVehicleDataUpdated(
POLICY_LIB_CHECK_VOID();
#ifdef EXTERNAL_PROPRIETARY_MODE
if (!message.keyExists(strings::msg_params)) {
- LOG4CXX_ERROR(
- logger_,
- "Message does not contains mandatory section " << strings::msg_params);
+ SDL_LOG_ERROR("Message does not contains mandatory section "
+ << strings::msg_params);
return;
}
if (message[strings::msg_params].keyExists(strings::vin)) {
@@ -1062,23 +1043,20 @@ void PolicyHandler::OnVehicleDataUpdated(
message[strings::msg_params][strings::vin].asString());
}
#else
- LOG4CXX_DEBUG(logger_,
- "This functionality is not available for not external policy");
+ SDL_LOG_DEBUG("This functionality is not available for not external policy");
#endif
}
void PolicyHandler::OnPendingPermissionChange(
const std::string& device_id, const std::string& policy_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "PolicyHandler::OnPendingPermissionChange for " << policy_app_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("PolicyHandler::OnPendingPermissionChange for "
+ << policy_app_id);
POLICY_LIB_CHECK_VOID();
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_,
- "No app found for " << policy_app_id << " policy app id.");
+ SDL_LOG_WARN("No app found for " << policy_app_id << " policy app id.");
return;
}
@@ -1158,31 +1136,29 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
const std::string& url,
const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_,
- "There is no registered application with "
- "connection key '"
- << app_id << "'");
+ SDL_LOG_WARN(
+ "There is no registered application with "
+ "connection key '"
+ << app_id << "'");
return false;
}
const std::string& mobile_app_id = app->policy_app_id();
if (mobile_app_id.empty()) {
- LOG4CXX_WARN(logger_,
- "Application with connection key '"
- << app_id
- << "'"
- " has no application id.");
+ SDL_LOG_WARN("Application with connection key '"
+ << app_id
+ << "'"
+ " has no application id.");
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Update url is " << url
+ SDL_LOG_DEBUG("Update url is " << url
<< " for application "
"with connection key "
<< app_id);
@@ -1199,14 +1175,14 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
const auto load_pt_result = policy_manager_->LoadPT(file, pt_string);
- LOG4CXX_INFO(logger_, "Load policy table result code: " << load_pt_result);
+ SDL_LOG_INFO("Load policy table result code: " << load_pt_result);
const bool is_ptu_successful =
load_pt_result == PolicyManager::PtProcessingResult::kSuccess;
OnPTUFinished(is_ptu_successful);
if (is_ptu_successful) {
- LOG4CXX_INFO(logger_, "PTU was successful.");
+ SDL_LOG_INFO("PTU was successful.");
policy_manager_->CleanupUnpairedDevices();
SetDaysAfterEpoch();
policy_manager_->OnPTUFinished(load_pt_result);
@@ -1223,7 +1199,7 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
MessageHelper::CreateGetVehicleDataRequest(
correlation_id, vehicle_data_args, application_manager_);
} else {
- LOG4CXX_WARN(logger_, "Exchange wasn't successful");
+ SDL_LOG_WARN("Exchange wasn't successful");
policy_manager_->OnPTUFinished(load_pt_result);
}
@@ -1231,15 +1207,15 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
}
bool PolicyHandler::UnloadPolicyLibrary() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "policy_manager_ = " << policy_manager_);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("policy_manager_ = " << policy_manager_);
bool ret = true;
AsyncRunner::Stop();
sync_primitives::AutoWriteLock lock(policy_manager_lock_);
if (policy_manager_) {
policy_manager_.reset();
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
return ret;
}
@@ -1287,7 +1263,7 @@ struct SDLAlowedNotification {
void PolicyHandler::OnAllowSDLFunctionalityNotification(
bool is_allowed, const std::string& device_mac) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
using namespace mobile_apis;
const bool device_specific = !device_mac.empty();
@@ -1305,16 +1281,14 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
const std::string device_id = *it_ids;
if (kDefaultDeviceMacAddress == device_id) {
- LOG4CXX_WARN(logger_,
- "Device with id " << device_id << " wasn't found.");
+ SDL_LOG_WARN("Device with id " << device_id << " wasn't found.");
continue;
}
policy_manager_->SetUserConsentForDevice(device_id, is_allowed);
connection_handler::DeviceHandle device_handle = 0;
if (!connection_handler.GetDeviceID(device_id, &device_handle)) {
- LOG4CXX_WARN(
- logger_,
- "Device handle with mac " << device_id << " wasn't found.");
+ SDL_LOG_WARN("Device handle with mac " << device_id
+ << " wasn't found.");
}
#ifdef EXTERNAL_PROPRIETARY_MODE
@@ -1348,15 +1322,14 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
if (device_specific) {
policy_manager_->SetUserConsentForDevice(device_mac, is_allowed);
if (!connection_handler.GetDeviceID(device_mac, &device_handle)) {
- LOG4CXX_WARN(logger_,
- "Device hadle with mac " << device_mac << " wasn't found.");
+ SDL_LOG_WARN("Device hadle with mac " << device_mac << " wasn't found.");
}
DeviceHandles::iterator it = std::find(pending_device_handles_.begin(),
pending_device_handles_.end(),
device_handle);
// If consent done from HMI menu
if (it == pending_device_handles_.end()) {
- LOG4CXX_WARN(logger_, "No pendining application activation");
+ SDL_LOG_WARN("No pendining application activation");
return;
}
@@ -1370,10 +1343,9 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
application_manager_.application(last_activated_app_id_);
if (!app) {
- LOG4CXX_WARN(logger_,
- "Application with id '"
- << last_activated_app_id_
- << "' not found among registered applications.");
+ SDL_LOG_WARN("Application with id '"
+ << last_activated_app_id_
+ << "' not found among registered applications.");
return;
}
if (is_allowed) {
@@ -1404,17 +1376,17 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
}
void PolicyHandler::OnIgnitionCycleOver() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->IncrementIgnitionCycles();
}
void PolicyHandler::OnActivateApp(uint32_t connection_key,
uint32_t correlation_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key);
if (app.use_count() == 0) {
- LOG4CXX_WARN(logger_, "Activated App failed: no app found.");
+ SDL_LOG_WARN("Activated App failed: no app found.");
return;
}
std::string policy_app_id = app->policy_app_id();
@@ -1423,7 +1395,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
sync_primitives::AutoReadLock lock(policy_manager_lock_);
if (!policy_manager_) {
- LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded");
+ SDL_LOG_DEBUG("The shared library of policy is not loaded");
if (!PolicyEnabled()) {
permissions.isSDLAllowed = true;
}
@@ -1473,12 +1445,13 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
// If application is revoked it should not be activated
// In this case we need to activate application
if (false == permissions.appRevoked && true == permissions.isSDLAllowed) {
- LOG4CXX_INFO(logger_, "Application will be activated");
+ SDL_LOG_INFO("Application will be activated");
+ sync_primitives::AutoReadUnlock unlock(policy_manager_lock_);
if (application_manager_.ActivateApplication(app)) {
last_activated_app_id_ = 0;
}
} else {
- LOG4CXX_WARN(logger_, "Application should not be activated");
+ SDL_LOG_WARN("Application should not be activated");
}
MessageHelper::SendSDLActivateAppResponse(
@@ -1486,14 +1459,13 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
}
void PolicyHandler::KmsChanged(int kilometers) {
- LOG4CXX_DEBUG(logger_,
- "PolicyHandler::KmsChanged " << kilometers << " kilometers");
+ SDL_LOG_DEBUG("PolicyHandler::KmsChanged " << kilometers << " kilometers");
POLICY_LIB_CHECK_VOID();
policy_manager_->KmsChanged(kilometers);
}
void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) {
- LOG4CXX_TRACE(logger_, "PT exchange at user request");
+ SDL_LOG_TRACE("PT exchange at user request");
POLICY_LIB_CHECK_VOID();
std::string update_status = policy_manager_->ForcePTExchangeAtUserRequest();
MessageHelper::SendUpdateSDLResponse(
@@ -1504,14 +1476,13 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
const std::string& policy_app_id,
const Permissions& permissions,
const HMILevel& default_hmi) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
OnPermissionsUpdated(device_id, policy_app_id, permissions);
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Connection_key not found for application_id: " << policy_app_id);
return;
}
@@ -1523,21 +1494,18 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
auto hmi_level = StringToEnum<mobile_apis::HMILevel::eType>(default_hmi);
if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level) {
- LOG4CXX_WARN(
- logger_,
- "Couldn't convert default hmi level " << default_hmi << " to enum.");
+ SDL_LOG_WARN("Couldn't convert default hmi level " << default_hmi
+ << " to enum.");
return;
}
if (current_hmi_level == hmi_level) {
- LOG4CXX_DEBUG(logger_, "Application already in default hmi state.");
+ SDL_LOG_DEBUG("Application already in default hmi state.");
return;
}
switch (current_hmi_level) {
case mobile_apis::HMILevel::HMI_NONE: {
- LOG4CXX_INFO(logger_,
- "Changing hmi level of application "
- << policy_app_id << " to default hmi level "
- << default_hmi);
+ SDL_LOG_INFO("Changing hmi level of application "
+ << policy_app_id << " to default hmi level " << default_hmi);
if (hmi_level == mobile_apis::HMILevel::HMI_FULL) {
application_manager_.state_controller().SetRegularState(
@@ -1555,8 +1523,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
break;
}
default:
- LOG4CXX_WARN(logger_,
- "Application " << policy_app_id
+ SDL_LOG_WARN("Application " << policy_app_id
<< " is running."
"HMI level won't be changed.");
break;
@@ -1566,14 +1533,13 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
const std::string& policy_app_id,
const Permissions& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Connection_key not found for application_id: " << policy_app_id);
return;
}
@@ -1584,10 +1550,8 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
MessageHelper::SendOnPermissionsChangeNotification(
app->app_id(), permissions, application_manager_, require_encryption);
- LOG4CXX_DEBUG(logger_,
- "Notification sent for application_id: "
- << policy_app_id << " and connection_key "
- << app->app_id());
+ SDL_LOG_DEBUG("Notification sent for application_id: "
+ << policy_app_id << " and connection_key " << app->app_id());
}
void PolicyHandler::OnPTUTimeOut() {
@@ -1610,7 +1574,7 @@ bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string,
}
if (!result) {
- LOG4CXX_ERROR(logger_, "Failed to write snapshot file to " << snap_path);
+ SDL_LOG_ERROR("Failed to write snapshot file to " << snap_path);
}
return result;
@@ -1634,7 +1598,7 @@ void PolicyHandler::OnSnapshotCreated(
#else // EXTERNAL_PROPRIETARY_MODE
void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string,
const PTUIterationType iteration_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
#ifdef PROPRIETARY_MODE
if (PTUIterationType::RetryIteration == iteration_type) {
@@ -1648,7 +1612,7 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string,
} else {
std::string policy_snapshot_full_path;
if (!SaveSnapshot(pt_string, policy_snapshot_full_path)) {
- LOG4CXX_ERROR(logger_, "Snapshot processing skipped.");
+ SDL_LOG_ERROR("Snapshot processing skipped.");
return;
}
@@ -1659,7 +1623,7 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string,
application_manager_);
}
#else // PROPRIETARY_MODE
- LOG4CXX_INFO(logger_, "HTTP policy");
+ SDL_LOG_INFO("HTTP policy");
uint32_t app_id_for_sending = 0;
const std::string& url = GetNextUpdateUrl(iteration_type, app_id_for_sending);
@@ -1671,7 +1635,7 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string,
std::string PolicyHandler::GetNextUpdateUrl(
const PTUIterationType iteration_type, uint32_t& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(std::string());
app_id = ChoosePTUApplication(iteration_type);
@@ -1689,7 +1653,7 @@ std::string PolicyHandler::GetNextUpdateUrl(
policy_manager_->GetUpdateUrls("0x07", endpoint_urls);
if (endpoint_urls.empty()) {
- LOG4CXX_ERROR(logger_, "Service URLs are empty!");
+ SDL_LOG_ERROR("Service URLs are empty!");
return std::string();
}
@@ -1707,7 +1671,7 @@ std::string PolicyHandler::GetNextUpdateUrl(
AppIdURL app_url = policy_manager_->GetNextUpdateUrl(endpoint_urls);
ApplicationSharedPtr app = get_ptu_app(app_url, app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "No available applications for PTU!");
+ SDL_LOG_ERROR("No available applications for PTU!");
return std::string();
}
EndpointData& data = endpoint_urls[app_url.first];
@@ -1715,7 +1679,7 @@ std::string PolicyHandler::GetNextUpdateUrl(
app_url = policy_manager_->GetNextUpdateUrl(endpoint_urls);
app = get_ptu_app(app_url, app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "No available applications for PTU!");
+ SDL_LOG_ERROR("No available applications for PTU!");
return std::string();
}
data = endpoint_urls[app_url.first];
@@ -1741,16 +1705,14 @@ void PolicyHandler::CheckPermissions(
const std::string hmi_level =
application_manager::EnumToString(app->hmi_level(window_id));
if (hmi_level.empty()) {
- LOG4CXX_WARN(logger_,
- "HMI level for " << app->policy_app_id() << " is invalid, rpc "
+ SDL_LOG_WARN("HMI level for " << app->policy_app_id() << " is invalid, rpc "
<< rpc << " is not allowed.");
result.hmi_level_permitted = policy::kRpcDisallowed;
return;
}
const std::string device_id = MessageHelper::GetDeviceMacAddressForHandle(
app->device(), application_manager_);
- LOG4CXX_INFO(logger_,
- "Checking permissions for " << app->policy_app_id() << " in "
+ SDL_LOG_INFO("Checking permissions for " << app->policy_app_id() << " in "
<< hmi_level << " on device "
<< device_id << " rpc " << rpc);
policy_manager_->CheckPermissions(
@@ -1817,8 +1779,7 @@ std::string PolicyHandler::GetLockScreenIconUrl(
});
if (endpoints.end() != it_specific && !it_specific->url.empty()) {
- LOG4CXX_DEBUG(logger_,
- "Specific app URL will be used for " << policy_app_id);
+ SDL_LOG_DEBUG("Specific app URL will be used for " << policy_app_id);
return it_specific->url.front();
}
@@ -1828,11 +1789,11 @@ std::string PolicyHandler::GetLockScreenIconUrl(
});
if (endpoints.end() != it_default && !it_default->url.empty()) {
- LOG4CXX_DEBUG(logger_, "Default URL will be used for " << policy_app_id);
+ SDL_LOG_DEBUG("Default URL will be used for " << policy_app_id);
return it_default->url.front();
}
- LOG4CXX_ERROR(logger_, "Can't find URL for " << policy_app_id);
+ SDL_LOG_ERROR("Can't find URL for " << policy_app_id);
return std::string();
}
@@ -1843,7 +1804,7 @@ std::string PolicyHandler::GetIconUrl(const std::string& policy_app_id) const {
uint32_t PolicyHandler::NextRetryTimeout() {
POLICY_LIB_CHECK_OR_RETURN(0);
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return policy_manager_->NextRetryTimeout();
}
@@ -1857,7 +1818,7 @@ uint32_t PolicyHandler::TimeoutExchangeMSec() const {
}
void PolicyHandler::OnExceededTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
std::for_each(listeners_.begin(),
@@ -1915,7 +1876,7 @@ void PolicyHandler::AddStatisticsInfo(int type) {
++count_of_iap_buffer_full;
break;
}
- default: { LOG4CXX_WARN(logger_, "Type of statistics is unknown"); }
+ default: { SDL_LOG_WARN("Type of statistics is unknown"); }
}
}
@@ -1934,7 +1895,7 @@ void PolicyHandler::OnSystemError(int code) {
++count_sync_out_of_memory;
break;
}
- default: { LOG4CXX_WARN(logger_, "System error is unknown"); }
+ default: { SDL_LOG_WARN("System error is unknown"); }
}
}
@@ -1944,8 +1905,7 @@ custom_str::CustomString PolicyHandler::GetAppName(
application_manager_.application_by_policy_id(policy_app_id);
if (app.use_count() == 0) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Connection_key not found for application_id: " << policy_app_id);
return custom_str::CustomString("");
}
@@ -1954,7 +1914,7 @@ custom_str::CustomString PolicyHandler::GetAppName(
void PolicyHandler::OnUpdateHMIAppType(
std::map<std::string, StringArray> app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(listeners_lock_);
HandlersCollection::const_iterator it = listeners_.begin();
for (; it != listeners_.end(); ++it) {
@@ -1964,7 +1924,7 @@ void PolicyHandler::OnUpdateHMIAppType(
#ifdef EXTERNAL_PROPRIETARY_MODE
void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (certificate_data.empty()) {
OnEmptyCertificateArrived();
return;
@@ -1976,21 +1936,19 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
const bool is_written = file_system::Write(
file_name,
std::vector<uint8_t>(certificate_data.begin(), certificate_data.end()));
- LOG4CXX_DEBUG(
- logger_,
- "Saving encrypted certificate data: \"" << certificate_data << '"');
+ SDL_LOG_DEBUG("Saving encrypted certificate data: \"" << certificate_data
+ << '"');
if (!is_written) {
- LOG4CXX_ERROR(logger_,
- "Unable to save encrypted certificate to file " << file_name);
+ SDL_LOG_ERROR("Unable to save encrypted certificate to file " << file_name);
return;
}
- LOG4CXX_DEBUG(logger_, "Saved encrypted certificate data" << file_name);
+ SDL_LOG_DEBUG("Saved encrypted certificate data" << file_name);
MessageHelper::SendDecryptCertificateToHMI(file_name, application_manager_);
}
void PolicyHandler::OnEmptyCertificateArrived() const {
- LOG4CXX_DEBUG(logger_, "Empty certificate arrived");
+ SDL_LOG_DEBUG("Empty certificate arrived");
const std::string empty_certificate;
sync_primitives::AutoLock lock(listeners_lock_);
std::for_each(
@@ -2001,34 +1959,32 @@ void PolicyHandler::OnEmptyCertificateArrived() const {
}
void PolicyHandler::OnCertificateDecrypted(bool is_succeeded) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
const std::string file_name =
file_system::GetAbsolutePath(get_settings().app_storage_folder()) + +"/" +
kCerficateFileName;
- LOG4CXX_DEBUG(logger_, "Loading certificate data from file " << file_name);
+ SDL_LOG_DEBUG("Loading certificate data from file " << file_name);
utils::ScopeGuard file_deleter =
utils::MakeGuard(file_system::DeleteFile, file_name);
UNUSED(file_deleter);
if (!is_succeeded) {
- LOG4CXX_ERROR(logger_, "Couldn't delete file " << file_name);
+ SDL_LOG_ERROR("Couldn't delete file " << file_name);
ProcessCertDecryptFailed();
return;
}
std::string certificate_data;
if (!file_system::ReadFile(file_name, certificate_data)) {
- LOG4CXX_ERROR(logger_,
- "Unable to read certificate from file " << file_name);
+ SDL_LOG_ERROR("Unable to read certificate from file " << file_name);
return;
}
- LOG4CXX_DEBUG(
- logger_,
- "Loaded decrypted certificate data: \"" << certificate_data << '"');
+ SDL_LOG_DEBUG("Loaded decrypted certificate data: \"" << certificate_data
+ << '"');
policy_manager_->SetDecryptedCertificate(certificate_data);
@@ -2041,7 +1997,7 @@ void PolicyHandler::OnCertificateDecrypted(bool is_succeeded) {
}
void PolicyHandler::ProcessCertDecryptFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(listeners_lock_);
std::for_each(
@@ -2053,7 +2009,7 @@ void PolicyHandler::ProcessCertDecryptFailed() {
#else // EXTERNAL_PROPRIETARY_MODE
void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(listeners_lock_);
HandlersCollection::const_iterator it = listeners_.begin();
for (; it != listeners_.end(); ++it) {
@@ -2065,7 +2021,7 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
void PolicyHandler::OnAuthTokenUpdated(const std::string& policy_app_id,
const std::string& auth_token) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(listeners_lock_);
HandlersCollection::const_iterator it = listeners_.begin();
for (; it != listeners_.end(); ++it) {
@@ -2075,7 +2031,7 @@ void PolicyHandler::OnAuthTokenUpdated(const std::string& policy_app_id,
}
void PolicyHandler::OnPTUFinished(const bool ptu_result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(listeners_lock_);
PopAppIdFromPTUQueue();
@@ -2092,7 +2048,7 @@ bool PolicyHandler::CanUpdate() {
}
void PolicyHandler::RemoveDevice(const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->MarkUnpairedDevice(device_id);
@@ -2110,14 +2066,14 @@ void PolicyHandler::RemoveDevice(const std::string& device_id) {
}
bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->IsApplicationRevoked(app_id);
}
void PolicyHandler::OnUpdateRequestSentToMobile() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
policy_manager_->OnUpdateStarted();
}
@@ -2136,7 +2092,7 @@ bool PolicyHandler::CheckSystemAction(
mobile_apis::SystemAction::eType system_action,
const std::string& policy_app_id) const {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (system_action) {
case SystemAction::STEAL_FOCUS:
return CheckStealFocus(policy_app_id);
@@ -2147,7 +2103,7 @@ bool PolicyHandler::CheckSystemAction(
default:
break;
}
- LOG4CXX_DEBUG(logger_, "Unknown system action");
+ SDL_LOG_DEBUG("Unknown system action");
return false;
}
@@ -2196,7 +2152,7 @@ const bool PolicyHandler::CheckCloudAppEnabled(
PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus(
const smart_objects::SmartObject& properties,
const std::string& app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(AppPropertiesState::NO_CHANGES);
AppProperties app_properties;
@@ -2208,46 +2164,41 @@ PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus(
if (properties.keyExists(strings::enabled) &&
app_properties.enabled != properties[strings::enabled].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "\"enabled\" was changed from: "
- << app_properties.enabled
- << " to: " << properties[strings::enabled].asBool());
+ SDL_LOG_DEBUG("\"enabled\" was changed from: "
+ << app_properties.enabled
+ << " to: " << properties[strings::enabled].asBool());
return AppPropertiesState::ENABLED_FLAG_SWITCH;
}
if (properties.keyExists(strings::auth_token) &&
app_properties.auth_token != properties[strings::auth_token].asString()) {
- LOG4CXX_DEBUG(logger_,
- "\"auth_token\" was changed from: "
- << app_properties.auth_token
- << " to: " << properties[strings::auth_token].asString());
+ SDL_LOG_DEBUG("\"auth_token\" was changed from: "
+ << app_properties.auth_token
+ << " to: " << properties[strings::auth_token].asString());
return AppPropertiesState::AUTH_TOKEN_CHANGED;
}
if (properties.keyExists(strings::transport_type) &&
app_properties.transport_type !=
properties[strings::transport_type].asString()) {
- LOG4CXX_DEBUG(logger_,
- "\"transport_type\" was changed from: "
- << app_properties.transport_type << " to: "
- << properties[strings::transport_type].asString());
+ SDL_LOG_DEBUG("\"transport_type\" was changed from: "
+ << app_properties.transport_type
+ << " to: " << properties[strings::transport_type].asString());
return AppPropertiesState::TRANSPORT_TYPE_CHANGED;
}
if (properties.keyExists(strings::cloud_transport_type) &&
app_properties.transport_type !=
properties[strings::cloud_transport_type].asString()) {
- LOG4CXX_DEBUG(logger_,
- "\"transport_type\" was changed from: "
- << app_properties.transport_type << " to: "
- << properties[strings::cloud_transport_type].asString());
+ SDL_LOG_DEBUG("\"transport_type\" was changed from: "
+ << app_properties.transport_type << " to: "
+ << properties[strings::cloud_transport_type].asString());
return AppPropertiesState::TRANSPORT_TYPE_CHANGED;
}
if (properties.keyExists(strings::endpoint) &&
app_properties.endpoint != properties[strings::endpoint].asString()) {
- LOG4CXX_DEBUG(logger_,
- "\"endpoint\" was changed from: "
- << app_properties.endpoint
- << " to: " << properties[strings::endpoint].asString());
+ SDL_LOG_DEBUG("\"endpoint\" was changed from: "
+ << app_properties.endpoint
+ << " to: " << properties[strings::endpoint].asString());
return AppPropertiesState::ENDPOINT_CHANGED;
}
if (properties.keyExists(strings::nicknames)) {
@@ -2265,9 +2216,8 @@ PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus(
const auto result =
std::find(nicknames.begin(), nicknames.end(), (*it_begin).asString());
if (nicknames.end() == result) {
- LOG4CXX_DEBUG(logger_,
- "\"nicknames\" were changed, new value: "
- << (*it_begin).asString());
+ SDL_LOG_DEBUG("\"nicknames\" were changed, new value: "
+ << (*it_begin).asString());
return AppPropertiesState::NICKNAMES_CHANGED;
}
}
@@ -2280,11 +2230,9 @@ PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus(
mobile_apis::HybridAppPreference::eType>::
EnumToString(value, &hybrid_app_preference_str);
if (app_properties.hybrid_app_preference != hybrid_app_preference_str) {
- LOG4CXX_DEBUG(
- logger_,
- "\"hybrid_app_preference\" was changed from: "
- << app_properties.hybrid_app_preference << " to: "
- << properties[strings::hybrid_app_preference].asString());
+ SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed from: "
+ << app_properties.hybrid_app_preference << " to: "
+ << properties[strings::hybrid_app_preference].asString());
return AppPropertiesState::HYBRYD_APP_PROPERTIES_CHANGED;
}
}
@@ -2359,24 +2307,21 @@ void PolicyHandler::OnSetCloudAppProperties(
const smart_objects::SmartObject& message) {
POLICY_LIB_CHECK_VOID();
if (!message.keyExists(strings::msg_params)) {
- LOG4CXX_ERROR(
- logger_,
- "Message does not contain mandatory section " << strings::msg_params);
+ SDL_LOG_ERROR("Message does not contain mandatory section "
+ << strings::msg_params);
return;
}
if (!message[strings::msg_params].keyExists(strings::properties)) {
- LOG4CXX_ERROR(
- logger_,
- "Message does not contain app properties " << strings::msg_params);
+ SDL_LOG_ERROR("Message does not contain app properties "
+ << strings::msg_params);
return;
}
const smart_objects::SmartObject& properties =
message[strings::msg_params][strings::properties];
if (!properties.keyExists(strings::app_id)) {
- LOG4CXX_ERROR(
- logger_,
- "Message does not contain mandatory parameter " << strings::app_id);
+ SDL_LOG_ERROR("Message does not contain mandatory parameter "
+ << strings::app_id);
return;
}
std::string policy_app_id(properties[strings::app_id].asString());
@@ -2455,24 +2400,21 @@ bool PolicyHandler::CheckAppServiceParameters(
if (app_service_parameters.find(requested_service_type) ==
app_service_parameters.end()) {
- LOG4CXX_DEBUG(logger_,
- "Disallowed service type: " << requested_service_type);
+ SDL_LOG_DEBUG("Disallowed service type: " << requested_service_type);
return false;
}
auto service_names =
*(app_service_parameters[requested_service_type].service_names);
if (!service_names.is_initialized()) {
- LOG4CXX_DEBUG(logger_,
- "Pt Service Name is Null, All service names accepted");
+ SDL_LOG_DEBUG("Pt Service Name is Null, All service names accepted");
} else if (!requested_service_name.empty()) {
auto find_name_result =
std::find(service_names.begin(),
service_names.end(),
rpc::String<0, 255>(requested_service_name));
if (find_name_result == service_names.end()) {
- LOG4CXX_DEBUG(logger_,
- "Disallowed service name: " << requested_service_name);
+ SDL_LOG_DEBUG("Disallowed service name: " << requested_service_name);
return false;
}
}
@@ -2491,8 +2433,7 @@ bool PolicyHandler::CheckAppServiceParameters(
auto find_result = std::find(
handled_rpcs.begin(), handled_rpcs.end(), requested_it->asInt());
if (find_result == handled_rpcs.end()) {
- LOG4CXX_DEBUG(logger_,
- "Disallowed by handled rpc: " << requested_it->asInt());
+ SDL_LOG_DEBUG("Disallowed by handled rpc: " << requested_it->asInt());
return false;
}
}
@@ -2502,7 +2443,7 @@ bool PolicyHandler::CheckAppServiceParameters(
bool PolicyHandler::UnknownRPCPassthroughAllowed(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->UnknownRPCPassthroughAllowed(policy_app_id);
}
@@ -2536,7 +2477,7 @@ void PolicyHandler::OnAppsSearchCompleted(const bool trigger_ptu) {
void PolicyHandler::OnAddedNewApplicationToAppList(
const uint32_t new_app_id, const std::string& policy_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (policy_id == last_registered_policy_app_id_) {
return;
}
@@ -2571,7 +2512,7 @@ bool PolicyHandler::IsRequestTypeAllowed(
const std::string stringified_type = RequestTypeToString(type);
if (stringified_type.empty()) {
- LOG4CXX_ERROR(logger_, "Unknown request type.");
+ SDL_LOG_ERROR("Unknown request type.");
return false;
}
@@ -2581,12 +2522,12 @@ bool PolicyHandler::IsRequestTypeAllowed(
switch (request_type_state) {
case RequestType::State::EMPTY: {
// If empty array of request types is assigned to app - any is allowed
- LOG4CXX_TRACE(logger_, "Any Request Type is allowed by policies.");
+ SDL_LOG_TRACE("Any Request Type is allowed by policies.");
return true;
}
case RequestType::State::OMITTED: {
// If RequestType parameter omitted for app - any is disallowed
- LOG4CXX_TRACE(logger_, "All Request Types are disallowed by policies.");
+ SDL_LOG_TRACE("All Request Types are disallowed by policies.");
return false;
}
case RequestType::State::AVAILABLE: {
@@ -2611,7 +2552,7 @@ bool PolicyHandler::IsRequestSubTypeAllowed(
using namespace mobile_apis;
if (request_subtype.empty()) {
- LOG4CXX_ERROR(logger_, "Request subtype to check is empty.");
+ SDL_LOG_ERROR("Request subtype to check is empty.");
return false;
}
@@ -2620,13 +2561,12 @@ bool PolicyHandler::IsRequestSubTypeAllowed(
switch (request_subtype_state) {
case RequestSubType::State::EMPTY: {
// If empty array of request subtypes is assigned to app - any is allowed
- LOG4CXX_TRACE(logger_, "Any Request SubType is allowed by policies.");
+ SDL_LOG_TRACE("Any Request SubType is allowed by policies.");
return true;
}
case RequestSubType::State::OMITTED: {
// If RequestSubType parameter omitted for app - any is disallowed
- LOG4CXX_TRACE(logger_,
- "All Request SubTypes are disallowed by policies.");
+ SDL_LOG_TRACE("All Request SubTypes are disallowed by policies.");
return false;
}
case RequestSubType::State::AVAILABLE: {
@@ -2714,9 +2654,8 @@ bool PolicyHandler::IsUrlAppIdValid(const std::string app_id,
}
const auto devices_ids = GetDevicesIds(app_id);
- LOG4CXX_TRACE(
- logger_,
- "Count devices: " << devices_ids.size() << " for app_id: " << app_id);
+ SDL_LOG_TRACE("Count devices: " << devices_ids.size()
+ << " for app_id: " << app_id);
for (const auto& device_id : devices_ids) {
const ApplicationSharedPtr app =
application_manager_.application(device_id, app_id);
@@ -2735,7 +2674,7 @@ std::vector<std::string> PolicyHandler::GetDevicesIds(
void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
mobile_apis::HMILevel::eType level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
mobile_apis::HMILevel::HMI_NONE) {
@@ -2744,16 +2683,15 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
if (mobile_apis::HMILevel::HMI_FULL == level) {
MessageHelper::SendActivateAppToHMI(app->app_id(), application_manager_);
} else {
- LOG4CXX_INFO(logger_,
- "Changing hmi level of application "
- << app->app_id() << " to default hmi level " << level);
+ SDL_LOG_INFO("Changing hmi level of application "
+ << app->app_id() << " to default hmi level " << level);
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
// If hmi Level is full, it will be seted after ActivateApp response
- MessageHelper::SendHMIStatusNotification(
- app,
- mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
- application_manager_);
+ auto notification = MessageHelper::CreateHMIStatusNotification(
+ app, mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ application_manager_.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::SOURCE_SDL);
}
}
}
@@ -2773,37 +2711,34 @@ void PolicyHandler::OnRemoteAppPermissionsChanged(
void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (!app) {
- LOG4CXX_WARN(
- logger_,
- "Could not find application: " << device_id << " - " << policy_app_id);
+ SDL_LOG_WARN("Could not find application: " << device_id << " - "
+ << policy_app_id);
return;
}
auto level = StringToEnum<mobile_apis::HMILevel::eType>(hmi_level);
if (mobile_apis::HMILevel::INVALID_ENUM == level) {
- LOG4CXX_WARN(
- logger_,
- "Couldn't convert default hmi level " << hmi_level << " to enum.");
+ SDL_LOG_WARN("Couldn't convert default hmi level " << hmi_level
+ << " to enum.");
return;
}
- LOG4CXX_INFO(logger_,
- "Changing hmi level of application "
- << app->app_id() << " to default hmi level " << level);
+ SDL_LOG_INFO("Changing hmi level of application "
+ << app->app_id() << " to default hmi level " << level);
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
- MessageHelper::SendHMIStatusNotification(
- app,
- mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
- application_manager_);
+ auto notification = MessageHelper::CreateHMIStatusNotification(
+ app, mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ application_manager_.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::SOURCE_SDL);
}
bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->GetModuleTypes(policy_app_id, modules);
}
@@ -2812,7 +2747,7 @@ void PolicyHandler::SetDefaultHmiTypes(
const transport_manager::DeviceHandle& device_handle,
const std::string& application_id,
const smart_objects::SmartObject* app_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_VOID();
std::vector<int> hmi_types;
if (app_types && app_types->asArray()) {
@@ -2828,7 +2763,7 @@ void PolicyHandler::SetDefaultHmiTypes(
bool PolicyHandler::CheckHMIType(const std::string& application_id,
mobile_apis::AppHMIType::eType hmi,
const smart_objects::SmartObject* app_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
POLICY_LIB_CHECK_OR_RETURN(false);
std::vector<int> policy_hmi_types;
bool ret = policy_manager_->GetHMITypes(application_id, &policy_hmi_types);
@@ -2849,20 +2784,18 @@ bool PolicyHandler::CheckHMIType(const std::string& application_id,
void PolicyHandler::OnUpdateHMILevel(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (!app) {
- LOG4CXX_WARN(
- logger_,
- "Could not find application: " << device_id << " - " << policy_app_id);
+ SDL_LOG_WARN("Could not find application: " << device_id << " - "
+ << policy_app_id);
return;
}
auto level = StringToEnum<mobile_apis::HMILevel::eType>(hmi_level);
if (mobile_apis::HMILevel::INVALID_ENUM == level) {
- LOG4CXX_WARN(
- logger_,
- "Couldn't convert default hmi level " << hmi_level << " to enum.");
+ SDL_LOG_WARN("Couldn't convert default hmi level " << hmi_level
+ << " to enum.");
return;
}
UpdateHMILevel(app, level);
diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc
index 7d24d0b35c..abb2926c9e 100644
--- a/src/components/application_manager/src/policies/policy_retry_sequence.cc
+++ b/src/components/application_manager/src/policies/policy_retry_sequence.cc
@@ -38,7 +38,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+SDL_CREATE_LOG_VARIABLE("PolicyHandler")
RetrySequence::RetrySequence(PolicyHandler* const policy_handler)
// TODO (Risk copy of PolicyHandler Pointer)
@@ -49,7 +49,7 @@ void RetrySequence::threadMain() {
}
void RetrySequence::StartNextRetry() {
- LOG4CXX_TRACE(logger_, "Start next retry of exchanging PT");
+ SDL_LOG_TRACE("Start next retry of exchanging PT");
DCHECK(policy_handler_);
// TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib
@@ -59,8 +59,7 @@ void RetrySequence::StartNextRetry() {
const uint32_t timeout = policy_handler_->TimeoutExchangeSec();
const int seconds = policy_handler_->NextRetryTimeout();
- LOG4CXX_DEBUG(logger_,
- "Timeout response: " << timeout << " Next try: " << seconds);
+ SDL_LOG_DEBUG("Timeout response: " << timeout << " Next try: " << seconds);
if (timeout > 0) {
sleep(timeout);
policy_handler_->OnExceededTimeout();
@@ -69,7 +68,7 @@ void RetrySequence::StartNextRetry() {
sleep(seconds);
StartNextRetry();
} else {
- LOG4CXX_INFO(logger_, "End retry sequence. Update PT was not received");
+ SDL_LOG_INFO("End retry sequence. Update PT was not received");
policy_handler_->OnPTUFinished(false);
}
}
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc
index eaebaf4861..d2db9fced2 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller.cc
@@ -44,7 +44,7 @@ namespace request_controller {
using namespace sync_primitives;
-CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController")
+SDL_CREATE_LOG_VARIABLE("RequestController")
RequestController::RequestController(const RequestControlerSettings& settings)
: pool_state_(UNDEFINED)
@@ -57,13 +57,13 @@ RequestController::RequestController(const RequestControlerSettings& settings)
, timer_stop_flag_(false)
, is_low_voltage_(false)
, settings_(settings) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
InitializeThreadpool();
timer_.Start(0, timer::kSingleShot);
}
RequestController::~RequestController() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock auto_lock(timer_lock);
timer_stop_flag_ = true;
@@ -76,30 +76,30 @@ RequestController::~RequestController() {
}
void RequestController::InitializeThreadpool() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// 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++) {
snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %d", i);
pool_.push_back(threads::CreateThread(name, new Worker(this)));
- pool_[i]->start();
- LOG4CXX_DEBUG(logger_, "Request thread initialized: " << name);
+ pool_[i]->Start();
+ SDL_LOG_DEBUG("Request thread initialized: " << name);
}
}
void RequestController::DestroyThreadpool() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
AutoLock auto_lock(mobile_request_list_lock_);
pool_state_ = TPoolState::STOPPED;
- LOG4CXX_DEBUG(logger_, "Broadcasting STOP signal to all threads...");
+ SDL_LOG_DEBUG("Broadcasting STOP signal to all threads...");
cond_var_.Broadcast(); // notify all threads we are shutting down
}
for (size_t i = 0; i < pool_.size(); i++) {
threads::Thread* thread = pool_[i];
- thread->join();
- delete thread->delegate();
+ thread->Stop(threads::Thread::kThreadSoftStop);
+ delete thread->GetDelegate();
threads::DeleteThread(thread);
}
pool_.clear();
@@ -107,9 +107,9 @@ void RequestController::DestroyThreadpool() {
RequestController::TResult RequestController::CheckPosibilitytoAdd(
const RequestPtr request, const mobile_apis::HMILevel::eType level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!CheckPendingRequestsAmount(settings_.pending_requests_amount())) {
- LOG4CXX_ERROR(logger_, "Too many pending request");
+ SDL_LOG_ERROR("Too many pending request");
return RequestController::TOO_MANY_PENDING_REQUESTS;
}
@@ -117,18 +117,17 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd(
request_tracker_.Track(request->connection_key(), level);
if (TrackResult::kNoneLevelMaxRequestsExceeded == track_result) {
- LOG4CXX_ERROR(logger_, "Too many application requests in hmi level NONE");
+ SDL_LOG_ERROR("Too many application requests in hmi level NONE");
return RequestController::NONE_HMI_LEVEL_MANY_REQUESTS;
}
if (TrackResult::kMaxRequestsExceeded == track_result) {
- LOG4CXX_ERROR(logger_, "Too many application requests");
+ SDL_LOG_ERROR("Too many application requests");
return RequestController::TOO_MANY_REQUESTS;
}
if (IsLowVoltage()) {
- LOG4CXX_ERROR(logger_,
- "Impossible to add request due to Low Voltage is active");
+ SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active");
return RequestController::INVALID_DATA;
}
@@ -137,41 +136,38 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd(
bool RequestController::CheckPendingRequestsAmount(
const uint32_t& pending_requests_amount) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
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
+ SDL_LOG_WARN("Pending requests count " << pending_requests_size
<< " exceed application limit "
<< pending_requests_amount);
}
return available_to_add;
}
- LOG4CXX_DEBUG(logger_, "CheckPendingRequestsAmount disabled");
+ SDL_LOG_DEBUG("CheckPendingRequestsAmount disabled");
return true;
}
RequestController::TResult RequestController::addMobileRequest(
const RequestPtr request, const mobile_apis::HMILevel::eType& hmi_level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!request) {
- LOG4CXX_ERROR(logger_, "Null Pointer request");
+ SDL_LOG_ERROR("Null Pointer request");
cond_var_.NotifyOne();
return INVALID_DATA;
}
- LOG4CXX_DEBUG(
- logger_,
- "correlation_id : " << request->correlation_id()
- << "connection_key : " << request->connection_key());
+ SDL_LOG_DEBUG("correlation_id : " << request->correlation_id()
+ << "connection_key : "
+ << request->connection_key());
RequestController::TResult result = CheckPosibilitytoAdd(request, hmi_level);
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());
+ SDL_LOG_DEBUG("Waiting for execution: " << mobile_request_list_.size());
// wake up one thread that is waiting for a task to be available
}
cond_var_.NotifyOne();
@@ -180,13 +176,13 @@ RequestController::TResult RequestController::addMobileRequest(
RequestController::TResult RequestController::addHMIRequest(
const RequestPtr request) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (request.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "HMI request pointer is invalid");
+ SDL_LOG_ERROR("HMI request pointer is invalid");
return RequestController::INVALID_DATA;
}
- LOG4CXX_DEBUG(logger_, " correlation_id : " << request->correlation_id());
+ SDL_LOG_DEBUG(" correlation_id : " << request->correlation_id());
const uint64_t timeout_in_mseconds =
static_cast<uint64_t>(request->default_timeout());
@@ -194,30 +190,28 @@ RequestController::TResult RequestController::addHMIRequest(
std::make_shared<HMIRequestInfo>(request, timeout_in_mseconds);
if (0 == timeout_in_mseconds) {
- LOG4CXX_DEBUG(logger_,
- "Default timeout was set to 0."
- "RequestController will not track timeout of this request.");
+ SDL_LOG_DEBUG(
+ "Default timeout was set to 0."
+ "RequestController will not track timeout of this request.");
}
if (IsLowVoltage()) {
- LOG4CXX_ERROR(logger_,
- "Impossible to add request due to Low Voltage is active");
+ SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active");
return RequestController::INVALID_DATA;
}
waiting_for_response_.Add(request_info_ptr);
- LOG4CXX_DEBUG(logger_,
- "Waiting for response count:" << waiting_for_response_.Size());
+ SDL_LOG_DEBUG("Waiting for response count:" << waiting_for_response_.Size());
NotifyTimer();
return RequestController::SUCCESS;
}
void RequestController::addNotification(const RequestPtr ptr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (IsLowVoltage()) {
- LOG4CXX_ERROR(
- logger_, "Impossible to add notification due to Low Voltage is active");
+ SDL_LOG_ERROR(
+ "Impossible to add notification due to Low Voltage is active");
return;
}
notification_list_.push_back(ptr);
@@ -225,30 +219,29 @@ void RequestController::addNotification(const RequestPtr ptr) {
void RequestController::removeNotification(
const commands::Command* notification) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::list<RequestPtr>::iterator it = notification_list_.begin();
for (; notification_list_.end() != it;) {
if (it->get() == notification) {
notification_list_.erase(it++);
- LOG4CXX_DEBUG(logger_, "Notification removed");
+ SDL_LOG_DEBUG("Notification removed");
return;
} else {
++it;
}
}
- LOG4CXX_DEBUG(logger_, "Cannot find notification");
+ SDL_LOG_DEBUG("Cannot find notification");
}
void RequestController::TerminateRequest(const uint32_t correlation_id,
const uint32_t connection_key,
const int32_t function_id,
bool force_terminate) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "correlation_id = "
- << correlation_id << " connection_key = " << connection_key
- << " function_id = " << function_id
- << " force_terminate = " << force_terminate);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("correlation_id = "
+ << correlation_id << " connection_key = " << connection_key
+ << " function_id = " << function_id
+ << " force_terminate = " << force_terminate);
{
AutoLock auto_lock(duplicate_message_count_lock_);
auto dup_it = duplicate_message_count_.find(correlation_id);
@@ -257,9 +250,9 @@ void RequestController::TerminateRequest(const uint32_t correlation_id,
if (0 == duplicate_message_count_[correlation_id]) {
duplicate_message_count_.erase(dup_it);
}
- LOG4CXX_DEBUG(logger_,
- "Ignoring termination request due to duplicate correlation "
- "ID being sent");
+ SDL_LOG_DEBUG(
+ "Ignoring termination request due to duplicate correlation "
+ "ID being sent");
return;
}
}
@@ -267,17 +260,17 @@ void RequestController::TerminateRequest(const uint32_t correlation_id,
RequestInfoPtr request =
waiting_for_response_.Find(connection_key, correlation_id);
if (!request) {
- LOG4CXX_WARN(logger_, "Request was not found in waiting_for_response");
+ SDL_LOG_WARN("Request was not found in waiting_for_response");
return;
}
if (request->request()->function_id() != function_id) {
- LOG4CXX_ERROR(logger_, "Request and response function_id's don't match");
+ SDL_LOG_ERROR("Request and response function_id's don't match");
return;
}
if (force_terminate || request->request()->AllowedToTerminate()) {
waiting_for_response_.RemoveRequest(request);
} else {
- LOG4CXX_WARN(logger_, "Request was not terminated");
+ SDL_LOG_WARN("Request was not terminated");
}
NotifyTimer();
}
@@ -285,21 +278,20 @@ void RequestController::TerminateRequest(const uint32_t correlation_id,
void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id,
const uint32_t connection_key,
const int32_t function_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
TerminateRequest(mobile_correlation_id, connection_key, function_id);
}
void RequestController::OnHMIResponse(const uint32_t correlation_id,
const int32_t function_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
TerminateRequest(correlation_id, RequestInfo::HmiConnectionKey, function_id);
}
void RequestController::terminateWaitingForExecutionAppRequests(
const uint32_t& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "app_id: " << app_id << "Waiting for execution"
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("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();
@@ -311,22 +303,20 @@ void RequestController::terminateWaitingForExecutionAppRequests(
++request_it;
}
}
- LOG4CXX_DEBUG(logger_,
- "Waiting for execution " << mobile_request_list_.size());
+ SDL_LOG_DEBUG("Waiting for execution " << mobile_request_list_.size());
}
void RequestController::terminateWaitingForResponseAppRequests(
const uint32_t& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
waiting_for_response_.RemoveByConnectionKey(app_id);
- LOG4CXX_DEBUG(
- logger_, "Waiting for response count : " << waiting_for_response_.Size());
+ SDL_LOG_DEBUG(
+ "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
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("app_id : " << app_id
<< "Requests waiting for execution count : "
<< mobile_request_list_.size()
<< "Requests waiting for response count : "
@@ -338,32 +328,31 @@ void RequestController::terminateAppRequests(const uint32_t& app_id) {
}
void RequestController::terminateAllHMIRequests() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectionKey);
}
void RequestController::terminateAllMobileRequests() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
waiting_for_response_.RemoveMobileRequests();
- LOG4CXX_DEBUG(logger_, "Mobile Requests waiting for response cleared");
+ SDL_LOG_DEBUG("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");
+ SDL_LOG_DEBUG("Mobile Requests waiting for execution cleared");
NotifyTimer();
}
void RequestController::updateRequestTimeout(const uint32_t& app_id,
const uint32_t& correlation_id,
const uint32_t& new_timeout) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_DEBUG(logger_,
- "app_id : " << app_id
+ SDL_LOG_DEBUG("app_id : " << app_id
<< " mobile_correlation_id : " << correlation_id
<< " new_timeout : " << new_timeout);
- LOG4CXX_DEBUG(logger_,
- "New_timeout is NULL. RequestCtrl will "
- "not manage this request any more");
+ SDL_LOG_DEBUG(
+ "New_timeout is NULL. RequestCtrl will "
+ "not manage this request any more");
RequestInfoPtr request_info =
waiting_for_response_.Find(app_id, correlation_id);
@@ -372,40 +361,37 @@ void RequestController::updateRequestTimeout(const uint32_t& app_id,
request_info->updateTimeOut(new_timeout);
waiting_for_response_.Add(request_info);
NotifyTimer();
- LOG4CXX_INFO(logger_,
- "Timeout updated for "
- << " app_id: " << app_id << " correlation_id: "
- << correlation_id << " new_timeout (ms): " << new_timeout);
+ SDL_LOG_INFO("Timeout updated for "
+ << " app_id: " << app_id << " correlation_id: "
+ << correlation_id << " new_timeout (ms): " << new_timeout);
} else {
- LOG4CXX_ERROR(logger_,
- "Can't find request with "
- << " app_id: " << app_id
- << " correlation_id: " << correlation_id);
+ SDL_LOG_ERROR("Can't find request with "
+ << " app_id: " << app_id
+ << " correlation_id: " << correlation_id);
}
}
void RequestController::OnLowVoltage() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_low_voltage_ = true;
}
void RequestController::OnWakeUp() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
terminateAllHMIRequests();
terminateAllMobileRequests();
is_low_voltage_ = false;
- LOG4CXX_DEBUG(logger_, "Terminate old requests done");
+ SDL_LOG_DEBUG("Terminate old requests done");
}
bool RequestController::IsLowVoltage() {
- LOG4CXX_TRACE(logger_, "result: " << is_low_voltage_);
+ SDL_LOG_TRACE("result: " << is_low_voltage_);
return is_low_voltage_;
}
void RequestController::TimeoutThread() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG(
"ENTER Waiting fore response count: " << waiting_for_response_.Size());
sync_primitives::AutoLock auto_lock(timer_lock);
while (!timer_stop_flag_) {
@@ -416,54 +402,49 @@ void RequestController::TimeoutThread() {
continue;
}
if (!probably_expired->isExpired()) {
- LOG4CXX_DEBUG(logger_,
- "Timeout for "
- << (RequestInfo::HMIRequest ==
- probably_expired->request_type()
- ? "HMI"
- : "Mobile")
- << " request id: " << probably_expired->requestId()
- << " connection_key: " << probably_expired->app_id()
- << " NOT expired");
+ SDL_LOG_DEBUG("Timeout for "
+ << (RequestInfo::HMIRequest ==
+ probably_expired->request_type()
+ ? "HMI"
+ : "Mobile")
+ << " request id: " << probably_expired->requestId()
+ << " connection_key: " << probably_expired->app_id()
+ << " NOT expired");
const date_time::TimeDuration current_time = date_time::getCurrentTime();
const date_time::TimeDuration end_time = probably_expired->end_time();
if (current_time < end_time) {
const uint32_t msecs =
static_cast<uint32_t>(date_time::getmSecs(end_time - current_time));
- LOG4CXX_DEBUG(logger_, "Sleep for " << msecs << " millisecs");
+ SDL_LOG_DEBUG("Sleep for " << msecs << " millisecs");
timer_condition_.WaitFor(auto_lock, msecs);
}
continue;
}
- LOG4CXX_INFO(logger_,
- "Timeout for "
- << (RequestInfo::HMIRequest ==
- probably_expired->request_type()
- ? "HMI"
- : "Mobile")
- << " request id: " << probably_expired->requestId()
- << " connection_key: " << probably_expired->app_id()
- << " is expired");
+ SDL_LOG_INFO("Timeout for "
+ << (RequestInfo::HMIRequest == probably_expired->request_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::HmiConnectionKey == probably_expired->app_id()) {
- LOG4CXX_DEBUG(logger_,
- "Erase HMI request: " << probably_expired->requestId());
+ SDL_LOG_DEBUG("Erase HMI request: " << probably_expired->requestId());
waiting_for_response_.RemoveRequest(probably_expired);
}
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");
+ SDL_LOG_DEBUG("Expired request wasn't removed");
break;
}
}
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"EXIT Waiting for response count : " << waiting_for_response_.Size());
}
@@ -473,7 +454,7 @@ RequestController::Worker::Worker(RequestController* requestController)
RequestController::Worker::~Worker() {}
void RequestController::Worker::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AutoLock auto_lock(thread_lock_);
while (!stop_flag_) {
// Try to pick a request
@@ -483,9 +464,9 @@ void RequestController::Worker::threadMain() {
(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");
+ SDL_LOG_INFO("Unlocking and waiting");
request_controller_->cond_var_.Wait(auto_lock);
- LOG4CXX_INFO(logger_, "Signaled and locking");
+ SDL_LOG_INFO("Signaled and locking");
}
// If the thread was shutdown, return from here
@@ -494,7 +475,7 @@ void RequestController::Worker::threadMain() {
}
if (request_controller_->mobile_request_list_.empty()) {
- LOG4CXX_WARN(logger_, "Mobile request list is empty");
+ SDL_LOG_WARN("Mobile request list is empty");
break;
}
@@ -526,15 +507,15 @@ void RequestController::Worker::threadMain() {
}
continue;
}
- LOG4CXX_DEBUG(logger_, "timeout_in_mseconds " << timeout_in_mseconds);
+ SDL_LOG_DEBUG("timeout_in_mseconds " << timeout_in_mseconds);
if (0 != timeout_in_mseconds) {
request_controller_->NotifyTimer();
} else {
- LOG4CXX_DEBUG(logger_,
- "Default timeout was set to 0. "
- "RequestController will not track timeout "
- "of this request.");
+ SDL_LOG_DEBUG(
+ "Default timeout was set to 0. "
+ "RequestController will not track timeout "
+ "of this request.");
}
AutoUnlock unlock(auto_lock);
@@ -542,10 +523,9 @@ void RequestController::Worker::threadMain() {
// execute
if ((false == request_controller_->IsLowVoltage()) &&
request_ptr->CheckPermissions() && init_res) {
- LOG4CXX_DEBUG(logger_,
- "Execute MobileRequest corr_id = "
- << request_info_ptr->requestId()
- << " with timeout: " << timeout_in_mseconds);
+ SDL_LOG_DEBUG("Execute MobileRequest corr_id = "
+ << request_info_ptr->requestId()
+ << " with timeout: " << timeout_in_mseconds);
request_ptr->Run();
}
}
@@ -558,7 +538,7 @@ void RequestController::Worker::exitThreadMain() {
}
void RequestController::NotifyTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
timer_condition_.NotifyOne();
}
diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc
index 4f1e0a8f07..1149c9aaf9 100644
--- a/src/components/application_manager/src/request_info.cc
+++ b/src/components/application_manager/src/request_info.cc
@@ -40,7 +40,7 @@ namespace application_manager {
namespace request_controller {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController")
+SDL_CREATE_LOG_VARIABLE("RequestController")
uint32_t RequestInfo::HmiConnectionKey = 0;
@@ -116,12 +116,20 @@ FakeRequestInfo::FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id) {
correlation_id_ = correaltion_id;
}
+RequestInfoSet::~RequestInfoSet() {
+ sync_primitives::AutoLock lock(pending_requests_lock_);
+ auto it = time_sorted_pending_requests_.begin();
+ while (!time_sorted_pending_requests_.empty()) {
+ Erase(*it);
+ it = time_sorted_pending_requests_.begin();
+ }
+}
+
bool RequestInfoSet::Add(RequestInfoPtr request_info) {
DCHECK_OR_RETURN(request_info, false);
- LOG4CXX_DEBUG(
- logger_,
- "Add request app_id = " << request_info->app_id()
- << "; corr_id = " << request_info->requestId());
+ SDL_LOG_DEBUG("Add request app_id = " << request_info->app_id()
+ << "; corr_id = "
+ << request_info->requestId());
sync_primitives::AutoLock lock(pending_requests_lock_);
CheckSetSizes();
const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt =
@@ -136,10 +144,9 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) {
CheckSetSizes();
return true;
} else {
- LOG4CXX_ERROR(logger_,
- "Request with app_id = "
- << request_info->app_id() << "; corr_id "
- << request_info->requestId() << " Already exist ");
+ SDL_LOG_ERROR("Request with app_id = "
+ << request_info->app_id() << "; corr_id "
+ << request_info->requestId() << " Already exist ");
}
CheckSetSizes();
return false;
@@ -174,7 +181,7 @@ RequestInfoPtr RequestInfoSet::Front() {
}
RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(pending_requests_lock_);
RequestInfoPtr result;
TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin();
@@ -193,7 +200,7 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() {
bool RequestInfoSet::Erase(const RequestInfoPtr request_info) {
DCHECK(request_info);
if (!request_info) {
- LOG4CXX_ERROR(logger_, "NULL ponter request_info");
+ SDL_LOG_ERROR("NULL ponter request_info");
return false;
}
CheckSetSizes();
@@ -205,7 +212,7 @@ bool RequestInfoSet::Erase(const RequestInfoPtr request_info) {
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_");
+ SDL_LOG_ERROR("Can't find request in time_sorted_requests_");
return false;
}
const RequestInfoPtr found = *it;
@@ -225,7 +232,7 @@ bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) {
uint32_t RequestInfoSet::RemoveRequests(
const RequestInfoSet::AppIdCompararator& filter) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t erased = 0;
sync_primitives::AutoLock lock(pending_requests_lock_);
@@ -244,13 +251,13 @@ uint32_t RequestInfoSet::RemoveRequests(
}
uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return RemoveRequests(
AppIdCompararator(AppIdCompararator::Equal, connection_key));
}
uint32_t RequestInfoSet::RemoveMobileRequests() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual,
RequestInfo::HmiConnectionKey));
}
diff --git a/src/components/application_manager/src/request_tracker.cc b/src/components/application_manager/src/request_tracker.cc
index 7bb33dc6dd..2ad504aadf 100644
--- a/src/components/application_manager/src/request_tracker.cc
+++ b/src/components/application_manager/src/request_tracker.cc
@@ -39,17 +39,17 @@ namespace application_manager {
namespace request_controller {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController")
+SDL_CREATE_LOG_VARIABLE("RequestController")
RequestTracker::RequestTracker(const RequestControlerSettings& settings)
: settings_(settings) {}
TrackResult RequestTracker::Track(const ApplicationID& app_id,
const mobile_apis::HMILevel::eType level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool track_result = false;
- LOG4CXX_DEBUG(logger_, "Tracking request for level: " << EnumToString(level));
+ SDL_LOG_DEBUG("Tracking request for level: " << EnumToString(level));
if (mobile_apis::HMILevel::HMI_NONE == level) {
track_result = Track(app_id,
@@ -74,44 +74,41 @@ bool RequestTracker::Track(const ApplicationID& app_id,
const uint32_t time_scale,
const uint32_t max_requests,
ApplicationsRequestsTracker& tracker) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace date_time;
if (!time_scale || !max_requests) {
- LOG4CXX_INFO(logger_, "Time scale request tracking is disabled.");
+ SDL_LOG_INFO("Time scale request tracking is disabled.");
return true;
}
- LOG4CXX_DEBUG(logger_,
- "Time scale is: " << time_scale << ". Max requests number is: "
+ SDL_LOG_DEBUG("Time scale is: " << time_scale << ". Max requests number is: "
<< max_requests);
- LOG4CXX_DEBUG(logger_, "Tracking app id: " << app_id);
+ SDL_LOG_DEBUG("Tracking app id: " << app_id);
ApplicationsRequestsTracker::iterator it_app = tracker.find(app_id);
if (tracker.end() == it_app) {
- LOG4CXX_DEBUG(logger_, "Adding new application into tracking.");
+ SDL_LOG_DEBUG("Adding new application into tracking.");
tracker[app_id].push_back(getCurrentTime());
return true;
}
- LOG4CXX_DEBUG(logger_,
- "Amount of known requests is: " << it_app->second.size());
+ SDL_LOG_DEBUG("Amount of known requests is: " << it_app->second.size());
if (it_app->second.size() < max_requests) {
- LOG4CXX_DEBUG(logger_, "Adding new request into tracking.");
+ SDL_LOG_DEBUG("Adding new request into tracking.");
tracker[app_id].push_back(getCurrentTime());
return true;
}
- LOG4CXX_DEBUG(logger_,
- "Oldest request is added at: "
- << getmSecs(it_app->second.front())
- << ". Current time is: " << getmSecs(getCurrentTime())
- << ". Time scale is: " << time_scale);
+ SDL_LOG_DEBUG("Oldest request is added at: "
+ << getmSecs(it_app->second.front())
+ << ". Current time is: " << getmSecs(getCurrentTime())
+ << ". Time scale is: " << time_scale);
if (calculateTimeSpan(it_app->second.front()) > time_scale) {
- LOG4CXX_DEBUG(logger_, "Dropping oldest request, adding new one.");
+ SDL_LOG_DEBUG("Dropping oldest request, adding new one.");
ApplicationsRequestsTracker::mapped_type& times = tracker[app_id];
DCHECK_OR_RETURN(!times.empty(), false);
@@ -121,7 +118,7 @@ bool RequestTracker::Track(const ApplicationID& app_id,
return true;
}
- LOG4CXX_DEBUG(logger_, "Requests amount per time scale is exceeded.");
+ SDL_LOG_DEBUG("Requests amount per time scale is exceeded.");
return false;
}
diff --git a/src/components/application_manager/src/resumption/pending_resumption_handler.cc b/src/components/application_manager/src/resumption/pending_resumption_handler.cc
new file mode 100644
index 0000000000..9547cba5a6
--- /dev/null
+++ b/src/components/application_manager/src/resumption/pending_resumption_handler.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/resumption/pending_resumption_handler.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+#include "smart_objects/smart_object.h"
+
+namespace resumption {
+
+namespace app_mngr = application_manager;
+
+SDL_CREATE_LOG_VARIABLE("PendingResumptionHandler")
+
+PendingResumptionHandler::PendingResumptionHandler(
+ app_mngr::ApplicationManager& application_manager)
+ : application_manager::event_engine::EventObserver(
+ application_manager.event_dispatcher())
+ , application_manager_(application_manager) {}
+
+resumption::ResumptionDataProcessor&
+PendingResumptionHandler::resumption_data_processor() {
+ return application_manager_.resume_controller().resumption_data_processor();
+}
+
+ResumptionRequest PendingResumptionHandler::MakeResumptionRequest(
+ const uint32_t corr_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const smart_objects::SmartObject& message) {
+ SDL_LOG_AUTO_TRACE();
+ resumption::ResumptionRequest resumption_request;
+ resumption_request.request_id.correlation_id = corr_id;
+ resumption_request.request_id.function_id = function_id;
+ resumption_request.message = message;
+ return resumption_request;
+}
+
+} // namespace resumption
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index 2d5f1b6638..8295ddd1f9 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -43,6 +43,7 @@
#include "application_manager/policies/policy_handler.h"
#include "application_manager/resumption/resumption_data_db.h"
#include "application_manager/resumption/resumption_data_json.h"
+#include "application_manager/resumption/resumption_data_processor_impl.h"
#include "application_manager/state_controller.h"
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler_impl.h"
@@ -61,11 +62,10 @@ static mobile_api::HMILevel::eType PickLowerHmiLevel(
mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2);
static mobile_api::HMILevel::eType ConvertHmiLevelString(const std::string str);
-CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+SDL_CREATE_LOG_VARIABLE("Resumption")
ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager)
- : event_engine::EventObserver(application_manager.event_dispatcher())
- , restore_hmi_level_timer_(
+ : restore_hmi_level_timer_(
"RsmCtrlRstore",
new timer::TimerTaskImpl<ResumeCtrlImpl>(
this, &ResumeCtrlImpl::ApplicationResumptiOnTimer))
@@ -78,7 +78,9 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager)
, launch_time_(time(nullptr))
, low_voltage_time_(0)
, wake_up_time_(0)
- , application_manager_(application_manager) {}
+ , application_manager_(application_manager)
+ , resumption_data_processor_(
+ new ResumptionDataProcessorImpl(application_manager)) {}
#ifdef BUILD_TESTS
void ResumeCtrlImpl::set_resumption_storage(
std::shared_ptr<ResumptionData> mock_storage) {
@@ -104,9 +106,9 @@ bool ResumeCtrlImpl::Init(resumption::LastStateWrapperPtr last_state_wrapper) {
dynamic_cast<ResumptionDataDB*>(resumption_storage_.get());
if (!db->IsDBVersionActual()) {
- LOG4CXX_INFO(logger_,
- "DB version had been changed. "
- "Rebuilding resumption DB.");
+ SDL_LOG_INFO(
+ "DB version had been changed. "
+ "Rebuilding resumption DB.");
smart_objects::SmartObject data;
db->GetAllData(data);
@@ -122,7 +124,7 @@ bool ResumeCtrlImpl::Init(resumption::LastStateWrapperPtr last_state_wrapper) {
resumption_storage_.reset(
new ResumptionDataJson(last_state_wrapper, application_manager_));
if (!resumption_storage_->Init()) {
- LOG4CXX_DEBUG(logger_, "Resumption storage initialisation failed");
+ SDL_LOG_DEBUG("Resumption storage initialisation failed");
return false;
}
}
@@ -147,34 +149,22 @@ void ResumeCtrlImpl::SaveAllApplications() {
}
void ResumeCtrlImpl::SaveApplication(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
if (application_manager_.IsLowVoltage()) {
- LOG4CXX_DEBUG(logger_, "Low Voltage state is active");
+ SDL_LOG_DEBUG("Low Voltage state is active");
return;
}
- LOG4CXX_DEBUG(
- logger_,
- "application with appID " << application->app_id() << " will be saved");
+ SDL_LOG_DEBUG("application with appID " << application->app_id()
+ << " will be saved");
resumption_storage_->SaveApplication(application);
}
-void ResumeCtrlImpl::on_event(const event_engine::Event& event) {
- LOG4CXX_DEBUG(logger_, "Event received: " << event.id());
-
- if (hmi_apis::FunctionID::UI_CreateWindow == event.id()) {
- LOG4CXX_INFO(logger_, "Received UI_CreateWindow event");
- const auto& response_message = event.smart_object();
- RestoreWidgetsHMIState(response_message);
- }
-}
-
bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
- LOG4CXX_DEBUG(logger_,
- "app_id : " << application->app_id() << "; policy_app_id : "
+ SDL_LOG_DEBUG("app_id : " << application->app_id() << "; policy_app_id : "
<< application->policy_app_id());
const std::string& device_mac = application->mac_address();
smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
@@ -187,14 +177,13 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
if (HMILevel::eType::INVALID_ENUM !=
application->deferred_resumption_hmi_level()) {
saved_hmi_level = application->deferred_resumption_hmi_level();
- LOG4CXX_INFO(logger_,
- "Retry resuming into HMI level : " << saved_hmi_level);
+ SDL_LOG_INFO("Retry resuming into HMI level : " << saved_hmi_level);
application->set_deferred_resumption_hmi_level(
HMILevel::eType::INVALID_ENUM);
} else {
saved_hmi_level = static_cast<mobile_apis::HMILevel::eType>(
saved_app[strings::hmi_level].asInt());
- LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level);
+ SDL_LOG_DEBUG("Saved HMI Level is : " << saved_hmi_level);
}
// Check one of the high-bandwidth transports (configured through
@@ -209,120 +198,41 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
saved_hmi_level =
PickLowerHmiLevel(saved_hmi_level, low_bandwidth_level);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"High-bandwidth transport not available, app will resume into : "
- << saved_hmi_level);
+ << saved_hmi_level);
}
const bool app_exists_in_full_or_limited =
application_manager_.get_full_or_limited_application().use_count() !=
0;
- const bool app_hmi_state_is_set =
- SetAppHMIState(application, saved_hmi_level, true);
- size_t restored_widgets = 0;
- if (app_hmi_state_is_set &&
- application->is_app_data_resumption_allowed()) {
- restored_widgets = RestoreAppWidgets(application, saved_app);
- }
- if (0 == restored_widgets && app_exists_in_full_or_limited) {
- LOG4CXX_DEBUG(logger_, "App exists in full or limited. Do not resume");
+ SetAppHMIState(application, saved_hmi_level, true);
+ if (app_exists_in_full_or_limited) {
+ SDL_LOG_DEBUG("App exists in full or limited. Do not resume");
return false;
}
} else {
result = false;
- LOG4CXX_ERROR(logger_, "saved app data corrupted");
+ SDL_LOG_ERROR("saved app data corrupted");
}
} else {
- LOG4CXX_ERROR(logger_, "Application not saved");
+ SDL_LOG_ERROR("Application not saved");
}
return result;
}
-void ResumeCtrlImpl::RestoreWidgetsHMIState(
- const smart_objects::SmartObject& response_message) {
- LOG4CXX_AUTO_TRACE(logger_);
- const auto correlation_id =
- response_message[strings::params][strings::correlation_id].asInt();
- const auto& request = requests_msg_.find(correlation_id);
- if (requests_msg_.end() == request) {
- LOG4CXX_ERROR(logger_,
- "Request UI_CreateWindow for correlation id: "
- << correlation_id << " not found");
- return;
- }
-
- const auto& msg_params = (*request->second)[strings::msg_params];
- const auto hmi_app_id = msg_params[strings::app_id].asInt();
- auto application = application_manager_.application_by_hmi_app(hmi_app_id);
- if (!application) {
- LOG4CXX_ERROR(logger_,
- "Application is not registered by hmi id: " << hmi_app_id);
- requests_msg_.erase(request);
- return;
- }
- const WindowID window_id = msg_params[strings::window_id].asInt();
-
- const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
- response_message[strings::params][hmi_response::code].asInt());
- if (hmi_apis::Common_Result::SUCCESS != result_code) {
- LOG4CXX_ERROR(logger_,
- "UI_CreateWindow for correlation id: "
- << correlation_id
- << " failed with code: " << result_code);
- requests_msg_.erase(request);
- auto& builder = application->display_capabilities_builder();
- builder.StopWaitingForWindow(window_id);
- return;
- }
-
- smart_objects::SmartObject window_info(smart_objects::SmartType_Map);
- auto fill_optional_param = [&window_info,
- &msg_params](const std::string& key) {
- if (msg_params.keyExists(key)) {
- window_info[key] = msg_params[key].asString();
- }
- };
- fill_optional_param(strings::associated_service_type);
- fill_optional_param(strings::duplicate_updates_from_window_id);
-
- const auto window_name = msg_params[strings::window_name].asString();
- window_info[strings::window_name] = window_name;
- application->SetWindowInfo(window_id, window_info);
-
- const auto window_type = static_cast<mobile_apis::WindowType::eType>(
- msg_params[strings::window_type].asInt());
- // State should be initialized with INVALID_ENUM value to let state controller
- // trigger OnHmiStatus notifiation sending
- auto initial_state = application_manager_.CreateRegularState(
- application,
- window_type,
- mobile_apis::HMILevel::INVALID_ENUM,
- mobile_apis::AudioStreamingState::INVALID_ENUM,
- mobile_apis::VideoStreamingState::INVALID_ENUM,
- mobile_api::SystemContext::INVALID_ENUM);
- application->SetInitialState(window_id, window_name, initial_state);
-
- // Default HMI level for all windows except the main one is always NONE
- application_manager_.state_controller().OnAppWindowAdded(
- application, window_id, window_type, mobile_apis::HMILevel::HMI_NONE);
-
- requests_msg_.erase(request);
-}
-
void ResumeCtrlImpl::ProcessSystemCapabilityUpdated(
Application& app, const smart_objects::SmartObject& display_capabilities) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto notification = MessageHelper::CreateDisplayCapabilityUpdateToMobile(
display_capabilities, app);
application_manager_.GetRPCService().ManageMobileCommand(
notification, commands::Command::SOURCE_SDL);
- app.set_is_resuming(false);
}
bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
mobile_apis::HMILevel::eType hmi_level =
application_manager_.GetDefaultHmiLevel(application);
@@ -335,23 +245,22 @@ bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
mobile_apis::HMILevel::eType low_bandwidth_level =
GetHmiLevelOnLowBandwidthTransport(application);
hmi_level = PickLowerHmiLevel(hmi_level, low_bandwidth_level);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"High-bandwidth transport not available, default HMI level is set to : "
- << hmi_level);
+ << hmi_level);
}
return SetAppHMIState(application, hmi_level, false);
}
void ResumeCtrlImpl::ApplicationResumptiOnTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(queue_lock_);
WaitingForTimerList::iterator it = waiting_for_timer_.begin();
for (; it != waiting_for_timer_.end(); ++it) {
ApplicationSharedPtr app = application_manager_.application(*it);
if (!app) {
- LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it);
+ SDL_LOG_ERROR("Invalid app_id = " << *it);
continue;
}
if (!StartAppHmiStateResumption(app)) {
@@ -371,7 +280,7 @@ void ResumeCtrlImpl::OnAppActivated(ApplicationSharedPtr application) {
}
void ResumeCtrlImpl::RemoveFromResumption(uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
queue_lock_.Acquire();
waiting_for_timer_.remove(app_id);
queue_lock_.Release();
@@ -386,55 +295,30 @@ bool ResumeCtrlImpl::SetAppHMIState(
const mobile_apis::HMILevel::eType hmi_level,
bool check_policy) {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
- LOG4CXX_TRACE(logger_,
- " app_id : " << application->app_id()
+ SDL_LOG_TRACE(" app_id : " << application->app_id()
<< ", hmi_level : " << hmi_level
<< ", check_policy : " << check_policy);
const std::string& device_mac = application->mac_address();
if (check_policy &&
application_manager_.GetUserConsentForDevice(device_mac) !=
policy::DeviceConsent::kDeviceAllowed) {
- LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed.");
+ SDL_LOG_ERROR("Resumption abort. Data consent wasn't allowed.");
SetupDefaultHMILevel(application);
return false;
}
application_manager_.state_controller().SetRegularState(
application, mobile_apis::PredefinedWindows::DEFAULT_WINDOW, hmi_level);
- LOG4CXX_INFO(logger_,
- "Application with policy id " << application->policy_app_id()
+ SDL_LOG_INFO("Application with policy id " << application->policy_app_id()
<< " got HMI level " << hmi_level);
return true;
}
-size_t ResumeCtrlImpl::RestoreAppWidgets(
- application_manager::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(application);
- if (!saved_app.keyExists(strings::windows_info)) {
- LOG4CXX_ERROR(logger_, "windows_info section does not exist");
- return 0;
- }
- const auto& windows_info = saved_app[strings::windows_info];
- auto request_list = MessageHelper::CreateUICreateWindowRequestsToHMI(
- application, application_manager_, windows_info);
-
- requests_msg_.clear();
- for (auto& request : request_list) {
- requests_msg_.insert(std::make_pair(
- (*request)[strings::params][strings::correlation_id].asInt(), request));
- }
- ProcessHMIRequests(request_list);
- return request_list.size();
-}
-
bool ResumeCtrlImpl::IsHMIApplicationIdExist(uint32_t hmi_app_id) {
- LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
+ SDL_LOG_DEBUG("hmi_app_id :" << hmi_app_id);
return resumption_storage_->IsHMIApplicationIdExist(hmi_app_id);
}
@@ -452,7 +336,7 @@ uint32_t ResumeCtrlImpl::GetHMIApplicationID(
bool ResumeCtrlImpl::RemoveApplicationFromSaved(
ApplicationConstSharedPtr application) {
if (application_manager_.IsLowVoltage()) {
- LOG4CXX_DEBUG(logger_, "Low Voltage state is active");
+ SDL_LOG_DEBUG("Low Voltage state is active");
return false;
}
const std::string& device_mac = application->mac_address();
@@ -461,13 +345,13 @@ bool ResumeCtrlImpl::RemoveApplicationFromSaved(
}
void ResumeCtrlImpl::OnSuspend() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_suspended_ = true;
FinalPersistData();
}
void ResumeCtrlImpl::OnIgnitionOff() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(resumption_storage_);
if (!application_manager_.IsLowVoltage()) {
resumption_storage_->IncrementIgnOffCount();
@@ -477,7 +361,7 @@ void ResumeCtrlImpl::OnIgnitionOff() {
}
void ResumeCtrlImpl::OnAwake() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_suspended_ = false;
ResetLaunchTime();
StartSavePersistentDataTimer();
@@ -485,13 +369,12 @@ void ResumeCtrlImpl::OnAwake() {
void ResumeCtrlImpl::SaveLowVoltageTime() {
low_voltage_time_ = time(nullptr);
- LOG4CXX_DEBUG(logger_,
- "Low Voltage timestamp : " << low_voltage_time_ << " saved");
+ SDL_LOG_DEBUG("Low Voltage timestamp : " << low_voltage_time_ << " saved");
}
void ResumeCtrlImpl::SaveWakeUpTime() {
wake_up_time_ = std::time(nullptr);
- LOG4CXX_DEBUG(logger_, "Wake Up timestamp : " << wake_up_time_ << " saved");
+ SDL_LOG_DEBUG("Wake Up timestamp : " << wake_up_time_ << " saved");
}
time_t ResumeCtrlImpl::LowVoltageTime() const {
@@ -507,7 +390,7 @@ bool ResumeCtrlImpl::is_suspended() const {
}
void ResumeCtrlImpl::StartSavePersistentDataTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!save_persistent_data_timer_.is_running()) {
save_persistent_data_timer_.Start(
application_manager_.get_settings()
@@ -516,59 +399,60 @@ void ResumeCtrlImpl::StartSavePersistentDataTimer() {
}
}
+ResumptionDataProcessor& ResumeCtrlImpl::resumption_data_processor() {
+ return *resumption_data_processor_;
+}
+
void ResumeCtrlImpl::StopSavePersistentDataTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (save_persistent_data_timer_.is_running()) {
save_persistent_data_timer_.Stop();
}
}
bool ResumeCtrlImpl::StartResumption(ApplicationSharedPtr application,
- const std::string& hash) {
- LOG4CXX_AUTO_TRACE(logger_);
+ const std::string& hash,
+ ResumptionCallBack callback) {
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
- LOG4CXX_DEBUG(
- logger_,
- " Resume app_id = " << application->app_id()
- << " hmi_app_id = " << application->hmi_app_id()
- << " policy_id = " << application->policy_app_id()
- << " received hash = " << hash);
+ SDL_LOG_DEBUG(" Resume app_id = "
+ << application->app_id()
+ << " hmi_app_id = " << application->hmi_app_id()
+ << " policy_id = " << application->policy_app_id()
+ << " received hash = " << hash);
application->set_is_resuming(true);
- if (!application->is_cloud_app()) {
- // Default HMI Level is already set before resumption in
- // ApplicationManager::OnApplicationRegistered, and handling low bandwidth
- // transports doesn't apply to cloud apps, so this step can be skipped for
- // such apps
- SetupDefaultHMILevel(application);
- }
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
bool result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
if (result) {
const std::string& saved_hash = saved_app[strings::hash_id].asString();
- result = saved_hash == hash ? RestoreApplicationData(application) : false;
- application->UpdateHash();
- AddToResumptionTimerQueue(application->app_id());
+ result = saved_hash == hash ? RestoreApplicationData(application, callback)
+ : false;
}
return result;
}
+void ResumeCtrlImpl::HandleOnTimeOut(
+ const uint32_t cor_id, const hmi_apis::FunctionID::eType function_id) {
+ SDL_LOG_AUTO_TRACE();
+ resumption_data_processor_->HandleOnTimeOut(cor_id, function_id);
+}
+
bool ResumeCtrlImpl::StartResumptionOnlyHMILevel(
ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!application) {
- LOG4CXX_WARN(logger_, "Application does not exist.");
+ SDL_LOG_WARN("Application does not exist.");
return false;
}
application->set_is_resuming(true);
- LOG4CXX_DEBUG(logger_,
- "HMI level resumption requested for application id: "
- << application->app_id()
- << " with hmi_app_id: " << application->hmi_app_id()
- << ", policy_app_id " << application->policy_app_id());
+ SDL_LOG_DEBUG("HMI level resumption requested for application id: "
+ << application->app_id()
+ << " with hmi_app_id: " << application->hmi_app_id()
+ << ", policy_app_id " << application->policy_app_id());
if (!application->is_cloud_app()) {
// Default HMI Level is already set before resumption in
// ApplicationManager::OnApplicationRegistered, and handling low bandwidth
@@ -583,16 +467,16 @@ bool ResumeCtrlImpl::StartResumptionOnlyHMILevel(
if (result) {
AddToResumptionTimerQueue(application->app_id());
}
- LOG4CXX_INFO(logger_, "StartResumptionOnlyHMILevel::Result = " << result);
+ SDL_LOG_INFO("StartResumptionOnlyHMILevel::Result = " << result);
return result;
}
void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_WARN(logger_, "Invalid app_id = " << app_id);
+ SDL_LOG_WARN("Invalid app_id = " << app_id);
return;
}
@@ -601,7 +485,7 @@ void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) {
// check and update resumption deferred flag in queue_lock_
if (mobile_api::HMILevel::eType::INVALID_ENUM ==
app->deferred_resumption_hmi_level()) {
- LOG4CXX_DEBUG(logger_, "No need to retry resumption for app: " << app_id);
+ SDL_LOG_DEBUG("No need to retry resumption for app: " << app_id);
return;
}
}
@@ -612,14 +496,14 @@ void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) {
bool ResumeCtrlImpl::StartAppHmiStateResumption(
ApplicationSharedPtr application) {
using namespace date_time;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
const bool get_saved_app_result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
if (!get_saved_app_result) {
- LOG4CXX_ERROR(logger_, "Application was not saved");
+ SDL_LOG_ERROR("Application was not saved");
return false;
}
@@ -627,7 +511,7 @@ bool ResumeCtrlImpl::StartAppHmiStateResumption(
CheckAppRestrictions(application, saved_app);
if (!is_hmi_level_applicable_to_resume) {
- LOG4CXX_DEBUG(logger_, "No applicable HMI level found for resuming");
+ SDL_LOG_DEBUG("No applicable HMI level found for resuming");
return false;
}
const bool is_resume_allowed_by_low_voltage =
@@ -645,8 +529,7 @@ bool ResumeCtrlImpl::StartAppHmiStateResumption(
!is_app_revoked;
if (restore_hmi_level_allowed) {
- LOG4CXX_INFO(logger_,
- "Resume application " << application->policy_app_id());
+ SDL_LOG_INFO("Resume application " << application->policy_app_id());
const bool hmi_state_restore_result = RestoreAppHMIState(application);
if (mobile_apis::HMILevel::eType::INVALID_ENUM !=
application->deferred_resumption_hmi_level()) {
@@ -656,24 +539,22 @@ bool ResumeCtrlImpl::StartAppHmiStateResumption(
RemoveApplicationFromSaved(application);
return hmi_state_restore_result;
} else {
- LOG4CXX_INFO(
- logger_,
- "Do not need to resume application " << application->policy_app_id());
+ SDL_LOG_INFO("Do not need to resume application "
+ << application->policy_app_id());
}
return true;
}
void ResumeCtrlImpl::ResetLaunchTime() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
launch_time_ = time(NULL);
}
bool ResumeCtrlImpl::CheckPersistenceFilesForResumption(
ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
- LOG4CXX_DEBUG(logger_,
- " Resume app_id = " << application->app_id() << " policy_id = "
+ SDL_LOG_DEBUG(" Resume app_id = " << application->app_id() << " policy_id = "
<< application->policy_app_id());
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
@@ -697,10 +578,9 @@ bool ResumeCtrlImpl::CheckPersistenceFilesForResumption(
bool ResumeCtrlImpl::CheckApplicationHash(ApplicationSharedPtr application,
const std::string& hash) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
- LOG4CXX_DEBUG(logger_,
- "app_id : " << application->app_id() << " hash : " << hash);
+ SDL_LOG_DEBUG("app_id : " << application->app_id() << " hash : " << hash);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
const bool get_app_result = resumption_storage_->GetSavedApplication(
@@ -714,9 +594,9 @@ bool ResumeCtrlImpl::CheckApplicationHash(ApplicationSharedPtr application,
}
void ResumeCtrlImpl::SaveDataOnTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (is_resumption_active_) {
- LOG4CXX_WARN(logger_, "Resumption timer is active skip saving");
+ SDL_LOG_WARN("Resumption timer is active skip saving");
return;
}
@@ -730,7 +610,7 @@ void ResumeCtrlImpl::SaveDataOnTimer() {
}
void ResumeCtrlImpl::FinalPersistData() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(resumption_storage_);
StopSavePersistentDataTimer();
SaveAllApplications();
@@ -739,15 +619,16 @@ void ResumeCtrlImpl::FinalPersistData() {
bool ResumeCtrlImpl::IsDeviceMacAddressEqual(
ApplicationSharedPtr application, const std::string& saved_device_mac) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string device_mac = application->mac_address();
return device_mac == saved_device_mac;
}
-bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application,
+ ResumptionCallBack callback) {
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(application, false);
- LOG4CXX_DEBUG(logger_, "app_id : " << application->app_id());
+ SDL_LOG_DEBUG("app_id : " << application->app_id());
smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
const std::string& device_mac = application->mac_address();
@@ -757,205 +638,50 @@ bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application) {
if (saved_app.keyExists(strings::grammar_id)) {
const uint32_t app_grammar_id = saved_app[strings::grammar_id].asUInt();
application->set_grammar_id(app_grammar_id);
- AddFiles(application, saved_app);
- AddSubmenues(application, saved_app);
- AddCommands(application, saved_app);
- AddChoicesets(application, saved_app);
- SetGlobalProperties(application, saved_app);
- AddSubscriptions(application, saved_app);
- AddWayPointsSubscription(application, saved_app);
+ resumption_data_processor_->Restore(application, saved_app, callback);
result = true;
} else {
- LOG4CXX_WARN(logger_,
- "Saved data of application does not contain grammar_id");
+ SDL_LOG_WARN("Saved data of application does not contain grammar_id");
result = false;
}
} else {
- LOG4CXX_WARN(logger_, "Application not saved");
+ SDL_LOG_WARN("Application not saved");
}
return result;
}
void ResumeCtrlImpl::StartWaitingForDisplayCapabilitiesUpdate(
- app_mngr::ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
+ app_mngr::ApplicationSharedPtr application, const bool is_resume_app) {
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
resumption_storage_->GetSavedApplication(
application->policy_app_id(), application->mac_address(), saved_app);
auto resume_callback =
[this](Application& app,
const smart_objects::SmartObject& display_capabilities) -> void {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessSystemCapabilityUpdated(app, display_capabilities);
};
auto& builder = application->display_capabilities_builder();
smart_objects::SmartObject windows_info(smart_objects::SmartType_Null);
- if (saved_app.keyExists(strings::windows_info)) {
+ if (is_resume_app && saved_app.keyExists(strings::windows_info)) {
windows_info = saved_app[strings::windows_info];
}
builder.InitBuilder(resume_callback, windows_info);
}
-void ResumeCtrlImpl::AddFiles(ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (saved_app.keyExists(strings::application_files)) {
- const smart_objects::SmartObject& application_files =
- saved_app[strings::application_files];
- for (size_t i = 0; i < application_files.length(); ++i) {
- const smart_objects::SmartObject& file_data = application_files[i];
- const bool is_persistent =
- file_data.keyExists(strings::persistent_file) &&
- file_data[strings::persistent_file].asBool();
- if (is_persistent) {
- AppFile file;
- file.is_persistent = is_persistent;
- file.is_download_complete =
- file_data[strings::is_download_complete].asBool();
- file.file_name = file_data[strings::sync_file_name].asString();
- file.file_type = static_cast<mobile_apis::FileType::eType>(
- file_data[strings::file_type].asInt());
- application->AddFile(file);
- }
- }
- } else {
- LOG4CXX_FATAL(logger_, "application_files section is not exists");
- }
-}
-
-void ResumeCtrlImpl::AddSubmenues(ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (saved_app.keyExists(strings::application_submenus)) {
- const smart_objects::SmartObject& app_submenus =
- saved_app[strings::application_submenus];
- for (size_t i = 0; i < app_submenus.length(); ++i) {
- const smart_objects::SmartObject& submenu = app_submenus[i];
- application->AddSubMenu(submenu[strings::menu_id].asUInt(), submenu);
- }
- ProcessHMIRequests(MessageHelper::CreateAddSubMenuRequestToHMI(
- application, application_manager_.GetNextHMICorrelationID()));
- } else {
- LOG4CXX_FATAL(logger_, "application_submenus section is not exists");
- }
-}
-
-void ResumeCtrlImpl::AddCommands(ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (saved_app.keyExists(strings::application_commands)) {
- const smart_objects::SmartObject& app_commands =
- saved_app[strings::application_commands];
-
- for (size_t cmd_num = 0; cmd_num < app_commands.length(); ++cmd_num) {
- const smart_objects::SmartObject& command = app_commands[cmd_num];
- const uint32_t cmd_id = command[strings::cmd_id].asUInt();
- const bool is_resumption = true;
- application->AddCommand(
- commands::CommandImpl::CalcCommandInternalConsecutiveNumber(
- application),
- command);
- application->help_prompt_manager().OnVrCommandAdded(
- cmd_id, command, is_resumption);
- }
-
- ProcessHMIRequests(MessageHelper::CreateAddCommandRequestToHMI(
- application, application_manager_));
- } else {
- LOG4CXX_FATAL(logger_, "application_commands section is not exists");
- }
-}
-
-void ResumeCtrlImpl::AddChoicesets(
- ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (saved_app.keyExists(strings::application_choice_sets)) {
- const smart_objects::SmartObject& app_choice_sets =
- saved_app[strings::application_choice_sets];
- for (size_t i = 0; i < app_choice_sets.length(); ++i) {
- const smart_objects::SmartObject& choice_set = app_choice_sets[i];
- const int32_t choice_set_id =
- choice_set[strings::interaction_choice_set_id].asInt();
- application->AddChoiceSet(choice_set_id, choice_set);
- }
- ProcessHMIRequests(MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
- application, application_manager_));
- } else {
- LOG4CXX_FATAL(logger_, "There is no any choicesets");
- }
-}
-
-void ResumeCtrlImpl::SetGlobalProperties(
- ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (saved_app.keyExists(strings::application_global_properties)) {
- const smart_objects::SmartObject& properties_so =
- saved_app[strings::application_global_properties];
- application->load_global_properties(properties_so);
- MessageHelper::SendGlobalPropertiesToHMI(application, application_manager_);
- }
-}
-
-void ResumeCtrlImpl::AddWayPointsSubscription(
- app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (saved_app.keyExists(strings::subscribed_for_way_points)) {
- const smart_objects::SmartObject& subscribed_for_way_points_so =
- saved_app[strings::subscribed_for_way_points];
- if (true == subscribed_for_way_points_so.asBool()) {
- application_manager_.SubscribeAppForWayPoints(application);
- }
- }
-}
-
-void ResumeCtrlImpl::AddSubscriptions(
- ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (saved_app.keyExists(strings::application_subscriptions)) {
- const smart_objects::SmartObject& subscriptions =
- saved_app[strings::application_subscriptions];
-
- if (subscriptions.keyExists(strings::application_buttons)) {
- const smart_objects::SmartObject& subscriptions_buttons =
- subscriptions[strings::application_buttons];
- mobile_apis::ButtonName::eType btn;
- for (size_t i = 0; i < subscriptions_buttons.length(); ++i) {
- btn = static_cast<mobile_apis::ButtonName::eType>(
- (subscriptions_buttons[i]).asInt());
- application->SubscribeToButton(btn);
- }
- }
- MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
- application, application_manager_);
-
- for (auto& extension : application->Extensions()) {
- extension->ProcessResumption(subscriptions);
- }
- }
-}
-
bool ResumeCtrlImpl::CheckIgnCycleRestrictions(
const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!CheckDelayAfterIgnOn()) {
- LOG4CXX_DEBUG(logger_, "Application was connected long after ign on");
+ SDL_LOG_DEBUG("Application was connected long after ign on");
return false;
}
if (!CheckDelayBeforeIgnOff(saved_app)) {
- LOG4CXX_DEBUG(logger_, "Application was disconnected long before ign off");
+ SDL_LOG_DEBUG("Application was disconnected long before ign off");
return false;
}
return true;
@@ -963,27 +689,26 @@ bool ResumeCtrlImpl::CheckIgnCycleRestrictions(
bool ResumeCtrlImpl::CheckLowVoltageRestrictions(
const smart_objects::SmartObject& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!CheckDelayBeforeLowVoltage(saved_app)) {
- LOG4CXX_DEBUG(logger_,
- "Application was disconnected long before low voltage");
+ SDL_LOG_DEBUG("Application was disconnected long before low voltage");
return false;
}
if (!CheckDelayAfterWakeUp()) {
- LOG4CXX_DEBUG(logger_, "Application was connected long after wake up");
+ SDL_LOG_DEBUG("Application was connected long after wake up");
return false;
}
- LOG4CXX_DEBUG(logger_, "HMI Level resuming in not restricted by Low Voltage");
+ SDL_LOG_DEBUG("HMI Level resuming in not restricted by Low Voltage");
return true;
}
bool ResumeCtrlImpl::CheckDelayBeforeIgnOff(
const smart_objects::SmartObject& saved_app) const {
using namespace date_time;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false);
const time_t time_stamp =
@@ -992,26 +717,25 @@ bool ResumeCtrlImpl::CheckDelayBeforeIgnOff(
static_cast<time_t>(resumption_storage_->GetIgnOffTime());
if (CheckIgnCyclesData() && 0 == ign_off_time) {
- LOG4CXX_DEBUG(
- logger_, "No IGNITION OFF records found: This is first Ignition cycle");
+ SDL_LOG_DEBUG(
+ "No IGNITION OFF records found: This is first Ignition cycle");
return true;
}
// This means that ignition off timestamp was not saved
// Possible reasons: Low Voltage event, core crash etc.
if (ign_off_time < time_stamp) {
- LOG4CXX_DEBUG(logger_, "Last IGNITION OFF record missed");
+ SDL_LOG_DEBUG("Last IGNITION OFF record missed");
return true;
}
const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"ign_off_time "
- << ign_off_time << "; app_disconnect_time " << time_stamp
- << "; sec_spent_before_ign " << sec_spent_before_ign
- << "; resumption_delay_before_ign "
- << application_manager_.get_settings().resumption_delay_before_ign());
+ << ign_off_time << "; app_disconnect_time " << time_stamp
+ << "; sec_spent_before_ign " << sec_spent_before_ign
+ << "; resumption_delay_before_ign "
+ << application_manager_.get_settings().resumption_delay_before_ign());
return sec_spent_before_ign <=
application_manager_.get_settings().resumption_delay_before_ign();
}
@@ -1019,11 +743,11 @@ bool ResumeCtrlImpl::CheckDelayBeforeIgnOff(
bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage(
const smart_objects::SmartObject& saved_app) const {
using namespace date_time;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false);
if (0 == LowVoltageTime()) {
- LOG4CXX_DEBUG(logger_, "No Low Voltage signal timestamp saved");
+ SDL_LOG_DEBUG("No Low Voltage signal timestamp saved");
return true;
}
@@ -1033,12 +757,11 @@ bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage(
const int32_t sec_spent_before_low_voltage =
(low_voltage_timestamp - unregistration_time_stamp);
if (0 > sec_spent_before_low_voltage) {
- LOG4CXX_DEBUG(logger_,
- "Low Voltage time: "
- << low_voltage_timestamp
- << "; App disconnect time: " << unregistration_time_stamp
- << "; Secs between app disconnect and low voltage event "
- << sec_spent_before_low_voltage);
+ SDL_LOG_DEBUG("Low Voltage time: "
+ << low_voltage_timestamp
+ << "; App disconnect time: " << unregistration_time_stamp
+ << "; Secs between app disconnect and low voltage event "
+ << sec_spent_before_low_voltage);
return true;
}
@@ -1046,22 +769,21 @@ bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage(
static_cast<uint32_t>(sec_spent_before_low_voltage);
const uint32_t wait_time =
application_manager_.get_settings().resumption_delay_before_ign();
- LOG4CXX_DEBUG(logger_,
- "Low Voltage time: "
- << low_voltage_timestamp
- << "; App disconnect time: " << unregistration_time_stamp
- << "; Secs between app disconnect and low voltage event "
- << secs_between_app_disconnect_and_low_voltage
- << "; Timeout for HMI level resuming: " << wait_time);
+ SDL_LOG_DEBUG("Low Voltage time: "
+ << low_voltage_timestamp
+ << "; App disconnect time: " << unregistration_time_stamp
+ << "; Secs between app disconnect and low voltage event "
+ << secs_between_app_disconnect_and_low_voltage
+ << "; Timeout for HMI level resuming: " << wait_time);
return secs_between_app_disconnect_and_low_voltage <= wait_time;
}
bool ResumeCtrlImpl::CheckDelayAfterWakeUp() const {
using namespace date_time;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (0 == WakeUpTime()) {
- LOG4CXX_DEBUG(logger_, "No WakeUp signal timestamp saved");
+ SDL_LOG_DEBUG("No WakeUp signal timestamp saved");
return true;
}
@@ -1072,12 +794,11 @@ bool ResumeCtrlImpl::CheckDelayAfterWakeUp() const {
labs(current_time - wake_up_timestamp);
const uint32_t wait_time =
application_manager_.get_settings().resumption_delay_after_ign();
- LOG4CXX_DEBUG(
- logger_,
- "Current time: " << current_time << "; WakeUp Signal time: "
- << wake_up_timestamp << "; Seconds passed from wake up: "
- << seconds_from_wake_up_signal
- << "; Timeout for HMI level resuming: " << wait_time);
+ SDL_LOG_DEBUG("Current time: "
+ << current_time << "; WakeUp Signal time: " << wake_up_timestamp
+ << "; Seconds passed from wake up: "
+ << seconds_from_wake_up_signal
+ << "; Timeout for HMI level resuming: " << wait_time);
return seconds_from_wake_up_signal <= wait_time;
}
@@ -1086,7 +807,7 @@ bool ResumeCtrlImpl::CheckAppRestrictions(
const smart_objects::SmartObject& saved_app) {
using namespace mobile_apis;
using namespace helpers;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(saved_app.keyExists(strings::hmi_level), false);
HMILevel::eType hmi_level;
@@ -1101,8 +822,7 @@ bool ResumeCtrlImpl::CheckAppRestrictions(
hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)
? true
: false;
- LOG4CXX_DEBUG(logger_,
- "is_media_app: " << application->is_media_application()
+ SDL_LOG_DEBUG("is_media_app: " << application->is_media_application()
<< "; hmi_level: " << hmi_level << "; result: "
<< (result ? "Applicable for resume"
: "Non-applicable for resume"));
@@ -1112,14 +832,14 @@ bool ResumeCtrlImpl::CheckAppRestrictions(
bool ResumeCtrlImpl::CheckIcons(ApplicationSharedPtr application,
smart_objects::SmartObject& obj) {
using namespace smart_objects;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const mobile_apis::Result::eType verify_images =
MessageHelper::VerifyImageFiles(obj, application, application_manager_);
return mobile_apis::Result::INVALID_DATA != verify_images;
}
bool ResumeCtrlImpl::CheckIgnCyclesData() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t global_ign_on_count =
resumption_storage_->GetGlobalIgnOnCounter();
const uint32_t the_first_ignition = 1;
@@ -1129,8 +849,7 @@ bool ResumeCtrlImpl::CheckIgnCyclesData() const {
// global_ign_on_count is incrementing at ignition on
// global_ign_on_count > 1 means that correct ignition off was not present.
if (is_emergency_ign_off_occurred) {
- LOG4CXX_WARN(logger_,
- "Emergency IGN OFF occurred. Possibly after Low Voltage");
+ SDL_LOG_WARN("Emergency IGN OFF occurred. Possibly after Low Voltage");
return false;
}
return true;
@@ -1138,11 +857,11 @@ bool ResumeCtrlImpl::CheckIgnCyclesData() const {
bool ResumeCtrlImpl::CheckDelayAfterIgnOn() const {
using namespace date_time;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const time_t ign_off_time = GetIgnOffTime();
if (CheckIgnCyclesData() && 0 == ign_off_time) {
- LOG4CXX_DEBUG(logger_, "This is first Ignition cycle");
+ SDL_LOG_DEBUG("This is first Ignition cycle");
return true;
}
const time_t curr_time = time(nullptr);
@@ -1151,8 +870,7 @@ bool ResumeCtrlImpl::CheckDelayAfterIgnOn() const {
const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time);
const uint32_t wait_time =
application_manager_.get_settings().resumption_delay_after_ign();
- LOG4CXX_DEBUG(logger_,
- "curr_time " << curr_time << "; sdl_launch_time "
+ SDL_LOG_DEBUG("curr_time " << curr_time << "; sdl_launch_time "
<< sdl_launch_time << "; seconds_from_sdl_start "
<< seconds_from_sdl_start << "; wait_time "
<< wait_time);
@@ -1167,38 +885,8 @@ time_t ResumeCtrlImpl::GetIgnOffTime() const {
return resumption_storage_->GetIgnOffTime();
}
-bool ResumeCtrlImpl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request,
- bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (use_events) {
- const hmi_apis::FunctionID::eType function_id =
- static_cast<hmi_apis::FunctionID::eType>(
- (*request)[strings::function_id].asInt());
-
- const int32_t hmi_correlation_id =
- (*request)[strings::correlation_id].asInt();
- subscribe_on_event(function_id, hmi_correlation_id);
- }
- if (!application_manager_.GetRPCService().ManageHMICommand(
- request, commands::Command::SOURCE_SDL_TO_HMI)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
- return false;
- }
- return true;
-}
-
-void ResumeCtrlImpl::ProcessHMIRequests(
- const smart_objects::SmartObjectList& requests) {
- for (smart_objects::SmartObjectList::const_iterator it = requests.begin(),
- total = requests.end();
- it != total;
- ++it) {
- ProcessHMIRequest(*it, true);
- }
-}
-
void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool run_resumption = false;
queue_lock_.Acquire();
waiting_for_timer_.push_back(app_id);
@@ -1208,13 +896,11 @@ void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) {
run_resumption = true;
}
queue_lock_.Release();
- LOG4CXX_DEBUG(logger_,
- "Application ID " << app_id
+ SDL_LOG_DEBUG("Application ID " << app_id
<< " have been added"
" to resumption queue.");
if (run_resumption) {
- LOG4CXX_DEBUG(logger_,
- "Application ID " << app_id << " will be restored by timer");
+ SDL_LOG_DEBUG("Application ID " << app_id << " will be restored by timer");
restore_hmi_level_timer_.Start(
application_manager_.get_settings().app_resuming_timeout(),
timer::kSingleShot);
@@ -1222,7 +908,7 @@ void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) {
}
void ResumeCtrlImpl::LoadResumeData() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject so_applications_data;
resumption_storage_->GetDataForLoadResumeData(so_applications_data);
size_t length = so_applications_data.length();
@@ -1231,11 +917,10 @@ void ResumeCtrlImpl::LoadResumeData() {
if (IsAppDataResumptionExpired(application)) {
const std::string device_id = application[strings::device_id].asString();
const std::string app_id = application[strings::app_id].asString();
- LOG4CXX_INFO(logger_, "Data resumption is expired.");
- LOG4CXX_DEBUG(logger_,
- "Resumption data for application "
- << app_id << " and device id " << device_id
- << " will be dropped.");
+ SDL_LOG_INFO("Data resumption is expired.");
+ SDL_LOG_DEBUG("Resumption data for application "
+ << app_id << " and device id " << device_id
+ << " will be dropped.");
resumption_storage_->RemoveApplicationFromSaved(app_id, device_id);
continue;
}
@@ -1244,10 +929,9 @@ void ResumeCtrlImpl::LoadResumeData() {
void ResumeCtrlImpl::OnAppRegistrationStart(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (IsApplicationSaved(policy_app_id, device_id)) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
"Application is found in resumption "
"data and will try to resume. Stopping resume data persistent timer");
StopSavePersistentDataTimer();
@@ -1255,7 +939,7 @@ void ResumeCtrlImpl::OnAppRegistrationStart(const std::string& policy_app_id,
}
void ResumeCtrlImpl::OnAppRegistrationEnd() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
StartSavePersistentDataTimer();
}
@@ -1282,7 +966,7 @@ bool ResumeCtrlImpl::IsAppDataResumptionExpired(
mobile_apis::HMILevel::eType ResumeCtrlImpl::GetHmiLevelOnLowBandwidthTransport(
ApplicationConstSharedPtr application) const {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const ApplicationManagerSettings& settings =
application_manager_.get_settings();
@@ -1301,26 +985,23 @@ mobile_apis::HMILevel::eType ResumeCtrlImpl::GetHmiLevelOnLowBandwidthTransport(
// AppHMIType, then the highest level will be applied.
if (application->is_navi()) {
level = ConvertHmiLevelString(level_for_navi_app);
- LOG4CXX_DEBUG(logger_,
- "NAVIGATION apps may have level "
- << level
- << " while high-bandwidth transport is not available.");
+ SDL_LOG_DEBUG("NAVIGATION apps may have level "
+ << level
+ << " while high-bandwidth transport is not available.");
result_level = PickHigherHmiLevel(level, result_level);
}
if (application->mobile_projection_enabled()) {
level = ConvertHmiLevelString(level_for_projection_app);
- LOG4CXX_DEBUG(logger_,
- "PROJECTION apps may have level "
- << level
- << " while high-bandwidth transport is not available.");
+ SDL_LOG_DEBUG("PROJECTION apps may have level "
+ << level
+ << " while high-bandwidth transport is not available.");
result_level = PickHigherHmiLevel(level, result_level);
}
if (application->is_media_application()) {
level = ConvertHmiLevelString(level_for_media_app);
- LOG4CXX_DEBUG(logger_,
- "media apps may have level "
- << level
- << " while high-bandwidth transport is not available.");
+ SDL_LOG_DEBUG("media apps may have level "
+ << level
+ << " while high-bandwidth transport is not available.");
result_level = PickHigherHmiLevel(level, result_level);
}
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index 0312975fec..558724ecdc 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -37,7 +37,7 @@
namespace resumption {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+SDL_CREATE_LOG_VARIABLE("Resumption")
ResumptionData::ResumptionData(
const application_manager::ApplicationManager& application_manager)
@@ -46,11 +46,11 @@ ResumptionData::ResumptionData(
smart_objects::SmartObject ResumptionData::GetApplicationCommands(
app_mngr::ApplicationConstSharedPtr application) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject commands_array(smart_objects::SmartType_Array);
DCHECK_OR_RETURN(application, commands_array);
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ SDL_LOG_ERROR("NULL Pointer App");
return commands_array;
}
const DataAccessor<CommandsMap> accessor = application->commands_map();
@@ -65,14 +65,14 @@ smart_objects::SmartObject ResumptionData::GetApplicationCommands(
smart_objects::SmartObject ResumptionData::GetApplicationSubMenus(
app_mngr::ApplicationConstSharedPtr application) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(application.get());
smart_objects::SmartObject submenues_array =
smart_objects::SmartObject(smart_objects::SmartType_Array);
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ SDL_LOG_ERROR("NULL Pointer App");
return submenues_array;
}
const DataAccessor<SubMenuMap> accessor = application->sub_menu_map();
@@ -87,13 +87,13 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubMenus(
smart_objects::SmartObject ResumptionData::GetApplicationInteractionChoiseSets(
app_mngr::ApplicationConstSharedPtr application) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(application.get());
smart_objects::SmartObject interaction_choice_set_array =
smart_objects::SmartObject(smart_objects::SmartType_Array);
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ SDL_LOG_ERROR("NULL Pointer App");
return interaction_choice_set_array;
}
const DataAccessor<ChoiceSetMap> accessor = application->choice_set_map();
@@ -108,13 +108,13 @@ smart_objects::SmartObject ResumptionData::GetApplicationInteractionChoiseSets(
smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties(
app_mngr::ApplicationConstSharedPtr application) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(application.get());
smart_objects::SmartObject global_properties =
smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ SDL_LOG_ERROR("NULL Pointer App");
return global_properties;
}
@@ -138,15 +138,15 @@ smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties(
smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions(
app_mngr::ApplicationConstSharedPtr application) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(application.get());
smart_objects::SmartObject subscriptions =
smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ SDL_LOG_ERROR("NULL Pointer App");
return subscriptions;
}
- LOG4CXX_DEBUG(logger_, "app_id:" << application->app_id());
+ SDL_LOG_DEBUG("app_id:" << application->app_id());
{
DataAccessor<ButtonSubscriptions> button_accessor =
@@ -154,7 +154,7 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions(
const ButtonSubscriptions& button_subscriptions = button_accessor.GetData();
- LOG4CXX_DEBUG(logger_, "SubscribedButtons:" << button_subscriptions.size());
+ SDL_LOG_DEBUG("SubscribedButtons:" << button_subscriptions.size());
Append(button_subscriptions.begin(),
button_subscriptions.end(),
strings::application_buttons,
@@ -171,14 +171,14 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions(
smart_objects::SmartObject ResumptionData::GetApplicationFiles(
app_mngr::ApplicationConstSharedPtr application) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(application.get());
- LOG4CXX_TRACE(logger_, "ENTER app_id:" << application->app_id());
+ SDL_LOG_TRACE("ENTER app_id:" << application->app_id());
smart_objects::SmartObject files =
smart_objects::SmartObject(smart_objects::SmartType_Array);
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ SDL_LOG_ERROR("NULL Pointer App");
return files;
}
@@ -204,7 +204,7 @@ smart_objects::SmartObject ResumptionData::GetApplicationFiles(
smart_objects::SmartObject ResumptionData::GetApplicationWidgetsInfo(
app_mngr::ApplicationConstSharedPtr application) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject windows_info =
smart_objects::SmartObject(smart_objects::SmartType_Array);
DCHECK_OR_RETURN(application, windows_info);
@@ -229,7 +229,7 @@ smart_objects::SmartObject ResumptionData::CreateWindowInfoSO(
const mobile_apis::WindowType::eType window_type,
const app_mngr::WindowParamsMap& window_optional_params_map) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto window_info = smart_objects::SmartObject(smart_objects::SmartType_Map);
window_info[strings::window_id] = window_id;
@@ -249,7 +249,7 @@ smart_objects::SmartObject ResumptionData::CreateWindowInfoSO(
smart_objects::SmartObject ResumptionData::PointerToSmartObj(
const smart_objects::SmartObject* ptr) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject temp;
if (ptr != NULL) {
temp = *ptr;
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index 9188a47bf9..88f28a41a3 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -47,7 +47,7 @@ const std::string kDatabaseName = "resumption";
}
namespace resumption {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+SDL_CREATE_LOG_VARIABLE("Resumption")
ResumptionDataDB::ResumptionDataDB(
DbStorage db_storage,
@@ -64,8 +64,8 @@ ResumptionDataDB::ResumptionDataDB(
db_ = new utils::dbms::SQLDatabase();
#endif // __QNX__
} else {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_ERROR(logger_, "Get not existed type of database storage");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_ERROR("Get not existed type of database storage");
}
}
@@ -75,67 +75,61 @@ ResumptionDataDB::~ResumptionDataDB() {
}
bool ResumptionDataDB::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!db_->Open()) {
- LOG4CXX_ERROR(logger_, "Failed opening database.");
- LOG4CXX_INFO(logger_, "Starting opening retries.");
+ SDL_LOG_ERROR("Failed opening database.");
+ SDL_LOG_INFO("Starting opening retries.");
const uint16_t attempts =
application_manager_.get_settings().attempts_to_open_resumption_db();
- LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts);
+ SDL_LOG_DEBUG("Total attempts number is: " << attempts);
bool is_opened = false;
const uint16_t open_attempt_timeout_ms =
application_manager_.get_settings()
.open_attempt_timeout_ms_resumption_db();
const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000;
- LOG4CXX_DEBUG(logger_,
- "Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
+ SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
for (int i = 0; i < attempts; ++i) {
usleep(sleep_interval_mcsec);
- LOG4CXX_INFO(logger_, "Attempt: " << i + 1);
+ SDL_LOG_INFO("Attempt: " << i + 1);
if (db_->Open()) {
- LOG4CXX_INFO(logger_, "Database opened.");
+ SDL_LOG_INFO("Database opened.");
is_opened = true;
break;
}
}
if (!is_opened) {
- LOG4CXX_ERROR(logger_,
- "Open retry sequence failed. Tried "
- << attempts << " attempts with "
- << open_attempt_timeout_ms
- << " open timeout(ms) for each.");
+ SDL_LOG_ERROR("Open retry sequence failed. Tried "
+ << attempts << " attempts with " << open_attempt_timeout_ms
+ << " open timeout(ms) for each.");
return false;
}
}
#ifndef __QNX__
if (!db_->IsReadWrite()) {
- LOG4CXX_ERROR(logger_, "There are no read/write permissions for database");
+ SDL_LOG_ERROR("There are no read/write permissions for database");
return false;
}
#endif // __QNX__
utils::dbms::SQLQuery query(db());
if (!query.Exec(kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Failed creating schema of database: " << query.LastError().text());
return false;
}
utils::dbms::SQLQuery query_checks_resumption(db());
if (!query_checks_resumption.Prepare(kChecksResumptionData) ||
!query_checks_resumption.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Failed verification or execution query kChecksResumptionData"
- << query_checks_resumption.LastError().text());
+ SDL_LOG_ERROR("Failed verification or execution query kChecksResumptionData"
+ << query_checks_resumption.LastError().text());
return false;
}
if (0 == query_checks_resumption.GetInteger(0)) {
utils::dbms::SQLQuery query_insert_resumption(db());
if (!query_insert_resumption.Prepare(kInsertInitData) ||
!query_insert_resumption.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Failed insert init data to database: "
- << query_insert_resumption.LastError().text());
+ SDL_LOG_ERROR("Failed insert init data to database: "
+ << query_insert_resumption.LastError().text());
return false;
}
}
@@ -147,56 +141,55 @@ void ResumptionDataDB::SaveApplication(
using namespace app_mngr;
using namespace mobile_api;
using namespace helpers;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
bool application_exist = false;
const std::string& policy_app_id = application->policy_app_id();
const std::string& device_mac = application->mac_address();
- LOG4CXX_INFO(logger_,
- "app_id : " << application->app_id() << " policy_app_id : "
+ SDL_LOG_INFO("app_id : " << application->app_id() << " policy_app_id : "
<< policy_app_id << " device_id : " << device_mac);
if (!CheckExistenceApplication(
policy_app_id, device_mac, application_exist)) {
- LOG4CXX_ERROR(logger_, "Problem with access to DB");
+ SDL_LOG_ERROR("Problem with access to DB");
return;
}
if (application->is_application_data_changed()) {
if (application_exist &&
!DeleteSavedApplication(policy_app_id, device_mac)) {
- LOG4CXX_ERROR(logger_, "Deleting of application data is not finished");
+ SDL_LOG_ERROR("Deleting of application data is not finished");
return;
}
if (!SaveApplicationToDB(application, policy_app_id, device_mac)) {
- LOG4CXX_ERROR(logger_, "Saving of application data is not finished");
+ SDL_LOG_ERROR("Saving of application data is not finished");
return;
}
- LOG4CXX_INFO(logger_, "All data from application were saved successfully");
+ SDL_LOG_INFO("All data from application were saved successfully");
application->set_is_application_data_changed(false);
} else if (application_exist) {
if (!UpdateApplicationData(application, policy_app_id, device_mac)) {
- LOG4CXX_ERROR(logger_, "Updating application data is failed");
+ SDL_LOG_ERROR("Updating application data is failed");
return;
}
- LOG4CXX_INFO(logger_, "Application data were updated successfully");
+ SDL_LOG_INFO("Application data were updated successfully");
} else if (!InsertApplicationData(application, policy_app_id, device_mac)) {
- LOG4CXX_ERROR(logger_, "Saving data of application is failed");
+ SDL_LOG_ERROR("Saving data of application is failed");
return;
}
WriteDb();
}
bool ResumptionDataDB::IsHMIApplicationIdExist(uint32_t hmi_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return CheckExistenceHMIId(hmi_app_id);
}
uint32_t ResumptionDataDB::GetHMIApplicationID(
const std::string& policy_app_id, const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t hmi_app_id = 0;
SelectHMIId(policy_app_id, device_id, hmi_app_id);
@@ -204,7 +197,7 @@ uint32_t ResumptionDataDB::GetHMIApplicationID(
}
void ResumptionDataDB::IncrementIgnOffCount() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query_update_suspend_data(db());
utils::dbms::SQLQuery query_update_last_ign_off_time(db());
@@ -215,45 +208,43 @@ void ResumptionDataDB::IncrementIgnOffCount() {
const int application_lifes = 3;
if (DeleteAppWithIgnCount(application_lifes)) {
- LOG4CXX_INFO(logger_,
- "Saved application with ign_off_count = " << application_lifes
+ SDL_LOG_INFO("Saved application with ign_off_count = " << application_lifes
<< " was deleted");
} else {
- LOG4CXX_WARN(logger_, "Problem with removing applications");
+ SDL_LOG_WARN("Problem with removing applications");
}
if (query_update_suspend_data.Prepare(kUpdateSuspendData)) {
if (query_update_suspend_data.Exec()) {
- LOG4CXX_INFO(logger_,
- "Data ign_off_count and suspend_count were updated");
+ SDL_LOG_INFO("Data ign_off_count and suspend_count were updated");
}
}
if (query_update_last_ign_off_time.Prepare(kUpdateLastIgnOffTime)) {
query_update_last_ign_off_time.Bind(0, static_cast<int64_t>(time(NULL)));
if (query_update_last_ign_off_time.Exec()) {
- LOG4CXX_INFO(logger_, "Data last_ign_off_time was updated");
+ SDL_LOG_INFO("Data last_ign_off_time was updated");
}
}
}
bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery select_apps_for_removing(db());
utils::dbms::SQLQuery count_app(db());
if (!select_apps_for_removing.Prepare(kSelectApplicationsIgnOffCount) ||
!count_app.Prepare(kCountApplicationsIgnOff)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification query select_apps_for_removing or"
- " query count_app");
+ SDL_LOG_WARN(
+ "Problem with verification query select_apps_for_removing or"
+ " query count_app");
return false;
}
/* Positions of binding data for "query count_app" :
field "ign_off_count" from table "application" = 0*/
count_app.Bind(0, application_lifes);
if (!count_app.Exec() || !count_app.GetInteger(0)) {
- LOG4CXX_WARN(logger_, "Problem with execution or count app=0");
+ SDL_LOG_WARN("Problem with execution or count app=0");
return false;
}
std::string policy_app_id;
@@ -265,11 +256,11 @@ bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) {
device_id = select_apps_for_removing.GetString(0);
policy_app_id = select_apps_for_removing.GetString(1);
if (!DeleteSavedApplication(policy_app_id, device_id)) {
- LOG4CXX_WARN(logger_, "Problem with removing application data");
+ SDL_LOG_WARN("Problem with removing application data");
return false;
}
}
- LOG4CXX_WARN(logger_, "Applications data were removed successfully");
+ SDL_LOG_WARN("Applications data were removed successfully");
WriteDb();
return true;
}
@@ -277,13 +268,13 @@ bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) {
bool ResumptionDataDB::GetHashId(const std::string& policy_app_id,
const std::string& device_id,
std::string& hash_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return SelectHashId(policy_app_id, device_id, hash_id);
}
void ResumptionDataDB::DecrementIgnOffCount() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
UpdateDataOnAwake();
}
@@ -292,65 +283,62 @@ bool ResumptionDataDB::GetSavedApplication(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool application_exist = false;
if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) ||
!application_exist) {
- LOG4CXX_ERROR(logger_,
- "Problem with access to DB or application does not exists");
+ SDL_LOG_ERROR("Problem with access to DB or application does not exists");
return false;
}
if (!SelectDataFromAppTable(policy_app_id, device_id, saved_app)) {
- LOG4CXX_ERROR(logger_,
- "Problem with restoring of data from application table");
+ SDL_LOG_ERROR("Problem with restoring of data from application table");
return false;
}
if (!SelectFilesData(policy_app_id, device_id, saved_app)) {
- LOG4CXX_ERROR(logger_, "Problem with restoring of files data");
+ SDL_LOG_ERROR("Problem with restoring of files data");
return false;
}
if (!SelectSubmenuData(policy_app_id, device_id, saved_app)) {
- LOG4CXX_ERROR(logger_, "Problem with restoring of submenu data");
+ SDL_LOG_ERROR("Problem with restoring of submenu data");
return false;
}
if (!SelectCommandData(policy_app_id, device_id, saved_app)) {
- LOG4CXX_ERROR(logger_, "Problem with restoring of command data");
+ SDL_LOG_ERROR("Problem with restoring of command data");
return false;
}
if (!SelectSubscriptionsData(policy_app_id, device_id, saved_app)) {
- LOG4CXX_ERROR(logger_, "Problem with restoring of subscriptions data");
+ SDL_LOG_ERROR("Problem with restoring of subscriptions data");
return false;
}
if (!SelectChoiceSetData(policy_app_id, device_id, saved_app)) {
- LOG4CXX_ERROR(logger_, "Problem with restoring of choice set data");
+ SDL_LOG_ERROR("Problem with restoring of choice set data");
return false;
}
if (!SelectGlobalPropertiesData(policy_app_id, device_id, saved_app)) {
- LOG4CXX_ERROR(logger_, "Problem with restoring of global properties data");
+ SDL_LOG_ERROR("Problem with restoring of global properties data");
return false;
}
- LOG4CXX_INFO(logger_,
- "Application data were successfully fetched from data base");
+ SDL_LOG_INFO("Application data were successfully fetched from data base");
return true;
}
bool ResumptionDataDB::RemoveApplicationFromSaved(
const std::string& policy_app_id, const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool application_exist = false;
if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) ||
!application_exist) {
- LOG4CXX_ERROR(logger_,
- "Problem with access to DB or application does not"
- " exist");
+ SDL_LOG_ERROR(
+ "Problem with access to DB or application does not"
+ " exist");
return false;
}
bool result = false;
@@ -362,42 +350,39 @@ bool ResumptionDataDB::RemoveApplicationFromSaved(
}
uint32_t ResumptionDataDB::GetIgnOffTime() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return SelectIgnOffTime();
}
uint32_t ResumptionDataDB::GetGlobalIgnOnCounter() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(resumption_lock_);
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kSelectGlobalIgnOnCounter)) {
- LOG4CXX_ERROR(logger_,
- "Problem with prepare query : " << kSelectGlobalIgnOnCounter);
+ SDL_LOG_ERROR("Problem with prepare query : " << kSelectGlobalIgnOnCounter);
return 1;
}
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Problem with exec query : " << kSelectGlobalIgnOnCounter);
+ SDL_LOG_ERROR("Problem with exec query : " << kSelectGlobalIgnOnCounter);
return 1;
}
const auto global_ign_on_counter = query.GetUInteger(0);
- LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter);
+ SDL_LOG_DEBUG("Global Ign On Counter = " << global_ign_on_counter);
return global_ign_on_counter;
}
void ResumptionDataDB::IncrementGlobalIgnOnCounter() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(resumption_lock_);
db_->BeginTransaction();
utils::dbms::SQLQuery query_update_global_ign_on_count(db());
if (query_update_global_ign_on_count.Prepare(kUpdateGlobalIgnOnCount)) {
if (query_update_global_ign_on_count.Exec()) {
- LOG4CXX_DEBUG(logger_,
- "Data query_update_global_ign_on_count was updated");
+ SDL_LOG_DEBUG("Data query_update_global_ign_on_count was updated");
}
}
db_->CommitTransaction();
@@ -405,26 +390,26 @@ void ResumptionDataDB::IncrementGlobalIgnOnCounter() {
}
void ResumptionDataDB::ResetGlobalIgnOnCount() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock autolock(resumption_lock_);
- LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting");
+ SDL_LOG_DEBUG("Global IGN ON counter resetting");
utils::dbms::SQLQuery query_update_global_ign_on_count(db());
if (query_update_global_ign_on_count.Prepare(kResetGlobalIgnOnCount)) {
if (query_update_global_ign_on_count.Exec()) {
- LOG4CXX_DEBUG(logger_, "Data was updated");
+ SDL_LOG_DEBUG("Data was updated");
}
}
}
ssize_t ResumptionDataDB::IsApplicationSaved(
const std::string& policy_app_id, const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool application_exist = false;
if (CheckExistenceApplication(policy_app_id, device_id, application_exist) &&
application_exist) {
- LOG4CXX_INFO(logger_, "Application exists in stored data");
+ SDL_LOG_INFO("Application exists in stored data");
return 0;
}
return -1;
@@ -432,14 +417,14 @@ ssize_t ResumptionDataDB::IsApplicationSaved(
void ResumptionDataDB::GetDataForLoadResumeData(
smart_objects::SmartObject& saved_data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SelectDataForLoadResumeData(saved_data);
}
bool ResumptionDataDB::SelectHMILevel(const std::string& policy_app_id,
const std::string& device_id,
int& hmi_level) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query_count(db());
utils::dbms::SQLQuery query_select(db());
if (query_count.Prepare(kSelectCountHMILevel) &&
@@ -463,25 +448,24 @@ bool ResumptionDataDB::SelectHMILevel(const std::string& policy_app_id,
}
bool ResumptionDataDB::CheckExistenceHMIId(uint32_t hmi_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (query.Prepare(kCheckHMIId)) {
query.Bind(0, static_cast<int64_t>(hmi_app_id));
if (query.Exec() && (query.GetInteger(0))) {
- LOG4CXX_INFO(logger_, "Saved data has HMI appID = " << hmi_app_id);
+ SDL_LOG_INFO("Saved data has HMI appID = " << hmi_app_id);
return true;
}
}
- LOG4CXX_FATAL(logger_,
- "HMI appID = " << hmi_app_id << " doesn't exist in saved data");
+ SDL_LOG_FATAL("HMI appID = " << hmi_app_id << " doesn't exist in saved data");
return false;
}
void ResumptionDataDB::SelectHMIId(const std::string& policy_app_id,
const std::string& device_id,
uint32_t& hmi_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query_select(db());
utils::dbms::SQLQuery query_check(db());
@@ -499,26 +483,26 @@ void ResumptionDataDB::SelectHMIId(const std::string& policy_app_id,
if (query_check.Exec() && query_check.GetInteger(0) &&
query_select.Exec()) {
hmi_id = query_select.GetUInteger(0);
- LOG4CXX_INFO(logger_, "HMI appID = " << hmi_id);
+ SDL_LOG_INFO("HMI appID = " << hmi_id);
return;
}
}
- LOG4CXX_FATAL(logger_,
- "Saved data doesn't have application with "
- "device id = "
- << device_id << " and policy appID = " << policy_app_id);
+ SDL_LOG_FATAL(
+ "Saved data doesn't have application with "
+ "device id = "
+ << device_id << " and policy appID = " << policy_app_id);
}
bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id,
const std::string& device_id,
std::string& hash_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery count(db());
utils::dbms::SQLQuery select_hash(db());
if (!select_hash.Prepare(kSelectHashId) || !count.Prepare(kCountHashId)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification count query or"
- " select_hash query");
+ SDL_LOG_WARN(
+ "Problem with verification count query or"
+ " select_hash query");
return false;
}
/* Positions of binding data for "count" and "select_hash" :
@@ -532,30 +516,29 @@ bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id,
field "hashID" from table "application" = 0 */
if (count.Exec() && count.GetInteger(0) && select_hash.Exec()) {
hash_id = select_hash.GetString(0);
- LOG4CXX_INFO(logger_, "Saved hash ID = " << hash_id);
+ SDL_LOG_INFO("Saved hash ID = " << hash_id);
return true;
}
- LOG4CXX_WARN(logger_,
- "Saved data doesn't have application with "
- "device id = "
- << device_id << " and policy appID = " << policy_app_id
- << "or hashID");
+ SDL_LOG_WARN(
+ "Saved data doesn't have application with "
+ "device id = "
+ << device_id << " and policy appID = " << policy_app_id << "or hashID");
return false;
}
uint32_t ResumptionDataDB::SelectIgnOffTime() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t ignOffTime = 0;
utils::dbms::SQLQuery query(db());
if (query.Prepare(kSelectIgnOffTime)) {
if (query.Exec()) {
ignOffTime = query.GetUInteger(0);
- LOG4CXX_INFO(logger_, "Last ign off time = " << ignOffTime);
+ SDL_LOG_INFO("Last ign off time = " << ignOffTime);
return ignOffTime;
}
}
- LOG4CXX_ERROR(logger_, "Problem with prepare query");
+ SDL_LOG_ERROR("Problem with prepare query");
return ignOffTime;
}
@@ -563,7 +546,7 @@ bool ResumptionDataDB::CheckExistenceApplication(
const std::string& policy_app_id,
const std::string& device_id,
bool& application_exist) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool result = false;
utils::dbms::SQLQuery query(db());
/* Positions of binding data for "query":
@@ -577,15 +560,14 @@ bool ResumptionDataDB::CheckExistenceApplication(
/* Position of data in "query" :
amount of application = 0 */
if (result && query.GetInteger(0)) {
- LOG4CXX_INFO(logger_,
- "Saved data has application with policy appID = "
- << policy_app_id << " and deviceID = " << device_id);
+ SDL_LOG_INFO("Saved data has application with policy appID = "
+ << policy_app_id << " and deviceID = " << device_id);
application_exist = true;
} else if (result) {
- LOG4CXX_INFO(logger_, "Saved data does not contain application");
+ SDL_LOG_INFO("Saved data does not contain application");
application_exist = false;
} else {
- LOG4CXX_ERROR(logger_, "Problem with access DB");
+ SDL_LOG_ERROR("Problem with access DB");
}
return result;
}
@@ -594,21 +576,21 @@ void ResumptionDataDB::SelectDataForLoadResumeData(
smart_objects::SmartObject& saved_data) const {
using namespace app_mngr;
using namespace smart_objects;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery select_data(db());
utils::dbms::SQLQuery count_application(db());
if (!select_data.Prepare(kSelectDataForLoadResumeData) ||
!count_application.Prepare(kCountApplications)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification select_data query"
- " or count application");
+ SDL_LOG_WARN(
+ "Problem with verification select_data query"
+ " or count application");
return;
}
if (!count_application.Exec() || !count_application.GetInteger(0)) {
- LOG4CXX_WARN(logger_,
- "Problem with execution count_application query"
- " or appliction table does not contain data");
+ SDL_LOG_WARN(
+ "Problem with execution count_application query"
+ " or appliction table does not contain data");
return;
}
SmartObject so_array_data(SmartType_Array);
@@ -634,7 +616,7 @@ void ResumptionDataDB::SelectDataForLoadResumeData(
void ResumptionDataDB::UpdateHmiLevel(const std::string& policy_app_id,
const std::string& device_id,
mobile_apis::HMILevel::eType hmi_level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
/* Positions of binding data for "query":
@@ -646,10 +628,9 @@ void ResumptionDataDB::UpdateHmiLevel(const std::string& policy_app_id,
query.Bind(1, device_id);
query.Bind(2, policy_app_id);
if (query.Exec()) {
- LOG4CXX_INFO(logger_,
- "Saved data has application with policy appID = "
- << policy_app_id << " and deviceID = " << device_id
- << " has new HMI level = " << hmi_level);
+ SDL_LOG_INFO("Saved data has application with policy appID = "
+ << policy_app_id << " and deviceID = " << device_id
+ << " has new HMI level = " << hmi_level);
WriteDb();
}
}
@@ -662,19 +643,16 @@ void ResumptionDataDB::Persist() {
bool ResumptionDataDB::RefreshDB() const {
utils::dbms::SQLQuery query(db());
if (!query.Exec(resumption::kDropSchema)) {
- LOG4CXX_WARN(logger_,
- "Failed dropping database: " << query.LastError().text());
+ SDL_LOG_WARN("Failed dropping database: " << query.LastError().text());
return false;
}
if (!query.Exec(resumption::kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Failed creating schema of database: " << query.LastError().text());
return false;
}
if (!query.Exec(resumption::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Failed insert init data to database: " << query.LastError().text());
return false;
}
@@ -682,10 +660,10 @@ bool ResumptionDataDB::RefreshDB() const {
}
bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(resumption::kSelectAllApps)) {
- LOG4CXX_ERROR(logger_, "Can't get applications data from DB.");
+ SDL_LOG_ERROR("Can't get applications data from DB.");
return false;
}
@@ -705,9 +683,9 @@ bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const {
}
bool ResumptionDataDB::SaveAllData(const smart_objects::SmartObject& data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (smart_objects::SmartType_Array != data.getType()) {
- LOG4CXX_ERROR(logger_, "Unexpected type for resumption data.");
+ SDL_LOG_ERROR("Unexpected type for resumption data.");
return false;
}
const smart_objects::SmartArray* apps = data.asArray();
@@ -723,18 +701,16 @@ bool ResumptionDataDB::SaveAllData(const smart_objects::SmartObject& data) {
}
bool ResumptionDataDB::IsDBVersionActual() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(resumption::kSelectDBVersion) || !query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Failed to get DB version: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed to get DB version: " << query.LastError().text());
return false;
}
const int32_t saved_db_version = query.GetInteger(0);
const int32_t current_db_version = GetDBVersion();
- LOG4CXX_DEBUG(logger_,
- "Saved DB version is: " << saved_db_version
+ SDL_LOG_DEBUG("Saved DB version is: " << saved_db_version
<< ". Current DB vesion is: "
<< current_db_version);
@@ -742,11 +718,10 @@ bool ResumptionDataDB::IsDBVersionActual() const {
}
bool ResumptionDataDB::UpdateDBVersion() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(resumption::kUpdateDBVersion)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Incorrect DB version update query: " << query.LastError().text());
return false;
}
@@ -754,8 +729,7 @@ bool ResumptionDataDB::UpdateDBVersion() const {
query.Bind(0, GetDBVersion());
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "DB version update failed: " << query.LastError().text());
+ SDL_LOG_ERROR("DB version update failed: " << query.LastError().text());
return false;
}
@@ -764,7 +738,7 @@ bool ResumptionDataDB::UpdateDBVersion() const {
bool ResumptionDataDB::DropAppDataResumption(const std::string& device_id,
const std::string& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::ScopeGuard guard =
utils::MakeObjGuard(*db_, &utils::dbms::SQLDatabase::RollbackTransaction);
@@ -805,7 +779,7 @@ bool ResumptionDataDB::SelectFilesData(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
uint32_t count_item = 0;
@@ -817,13 +791,13 @@ bool ResumptionDataDB::SelectFilesData(
saved_app[strings::application_files] = SmartObject(SmartType_Array);
if (0 == count_item) {
- LOG4CXX_INFO(logger_, "Application does not contain files data");
+ SDL_LOG_INFO("Application does not contain files data");
return true;
}
utils::dbms::SQLQuery select_files(db());
if (!PrepareSelectQuery(
select_files, policy_app_id, device_id, kSelectFiles)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_files");
+ SDL_LOG_WARN("Problem with verification select_files");
return false;
}
saved_app[strings::application_files] = SmartObject(SmartType_Array);
@@ -841,7 +815,7 @@ bool ResumptionDataDB::SelectFilesData(
array_item[strings::sync_file_name] = select_files.GetString(3);
saved_app[strings::application_files][i++] = array_item;
}
- LOG4CXX_INFO(logger_, "File data was restored successfully");
+ SDL_LOG_INFO("File data was restored successfully");
return true;
}
@@ -849,7 +823,7 @@ bool ResumptionDataDB::SelectSubmenuData(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
uint32_t count_item = 0;
@@ -861,13 +835,13 @@ bool ResumptionDataDB::SelectSubmenuData(
saved_app[strings::application_submenus] = SmartObject(SmartType_Array);
if (0 == count_item) {
- LOG4CXX_INFO(logger_, "Application does not contain submenu data");
+ SDL_LOG_INFO("Application does not contain submenu data");
return true;
}
utils::dbms::SQLQuery select_sub_menu(db());
if (!PrepareSelectQuery(
select_sub_menu, policy_app_id, device_id, kSelectSubMenu)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_sub_menu");
+ SDL_LOG_WARN("Problem with verification select_sub_menu");
return false;
}
saved_app[strings::application_submenus] = SmartObject(SmartType_Array);
@@ -885,7 +859,7 @@ bool ResumptionDataDB::SelectSubmenuData(
}
saved_app[strings::application_submenus][i++] = array_item;
}
- LOG4CXX_INFO(logger_, "Sub menu data was restored successfully");
+ SDL_LOG_INFO("Sub menu data was restored successfully");
return true;
}
@@ -893,7 +867,7 @@ bool ResumptionDataDB::SelectCommandData(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
uint32_t count_item = 0;
@@ -905,7 +879,7 @@ bool ResumptionDataDB::SelectCommandData(
saved_app[strings::application_commands] = SmartObject(SmartType_Array);
if (0 == count_item) {
- LOG4CXX_INFO(logger_, "Application does not contain commands data");
+ SDL_LOG_INFO("Application does not contain commands data");
return true;
}
@@ -973,7 +947,7 @@ bool ResumptionDataDB::SelectCommandData(
select_commands.GetString(7);
}
}
- LOG4CXX_INFO(logger_, "Commands were restored from DB successfully");
+ SDL_LOG_INFO("Commands were restored from DB successfully");
return true;
}
@@ -981,7 +955,7 @@ bool ResumptionDataDB::SelectSubscriptionsData(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
uint32_t count_item = 0;
@@ -993,7 +967,7 @@ bool ResumptionDataDB::SelectSubscriptionsData(
saved_app[strings::application_subscriptions] = SmartObject(SmartType_Map);
if (0 == count_item) {
- LOG4CXX_INFO(logger_, "Application does not contain subscriptions data");
+ SDL_LOG_INFO("Application does not contain subscriptions data");
return true;
}
utils::dbms::SQLQuery select_subscriptions(db());
@@ -1001,7 +975,7 @@ bool ResumptionDataDB::SelectSubscriptionsData(
policy_app_id,
device_id,
kSelectSubscriptions)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_subscriptions");
+ SDL_LOG_WARN("Problem with verification select_subscriptions");
return false;
}
SmartObject application_buttons(SmartType_Array);
@@ -1028,7 +1002,7 @@ bool ResumptionDataDB::SelectSubscriptionsData(
saved_app[strings::application_subscriptions]
[strings::application_vehicle_info] = application_vehicle_info;
}
- LOG4CXX_INFO(logger_, "Subscriptions were restored from DB successfully");
+ SDL_LOG_INFO("Subscriptions were restored from DB successfully");
return true;
}
@@ -1036,7 +1010,7 @@ bool ResumptionDataDB::SelectChoiceSetData(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
uint32_t count_item = 0;
@@ -1048,13 +1022,13 @@ bool ResumptionDataDB::SelectChoiceSetData(
saved_app[strings::application_choice_sets] = SmartObject(SmartType_Array);
if (0 == count_item) {
- LOG4CXX_INFO(logger_, "Application does not contain choice set data");
+ SDL_LOG_INFO("Application does not contain choice set data");
return true;
}
utils::dbms::SQLQuery select_choice_set(db());
if (!PrepareSelectQuery(
select_choice_set, policy_app_id, device_id, kSelectChoiceSets)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_choice_set");
+ SDL_LOG_WARN("Problem with verification select_choice_set");
return false;
}
@@ -1130,7 +1104,7 @@ bool ResumptionDataDB::SelectChoiceSetData(
[vr_cmd_idx++] = select_choice_set.GetString(10);
}
- LOG4CXX_INFO(logger_, "Choice sets were restored from DB successfully");
+ SDL_LOG_INFO("Choice sets were restored from DB successfully");
return true;
}
@@ -1138,7 +1112,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
uint32_t count_item = 0;
@@ -1151,8 +1125,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData(
SmartObject(SmartType_Map);
if (0 == count_item) {
- LOG4CXX_INFO(logger_,
- "Application does not contain global properties data");
+ SDL_LOG_INFO("Application does not contain global properties data");
return true;
}
utils::dbms::SQLQuery select_globalproperties(db());
@@ -1160,7 +1133,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData(
policy_app_id,
device_id,
kSelectGlobalProperties)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_globalproperties");
+ SDL_LOG_WARN("Problem with verification select_globalproperties");
return false;
}
saved_app[strings::application_global_properties] =
@@ -1259,26 +1232,26 @@ bool ResumptionDataDB::SelectGlobalPropertiesData(
bool ResumptionDataDB::SelectVrHelpItemsData(
int64_t global_properties_key,
smart_objects::SmartObject& global_properties) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
utils::dbms::SQLQuery checks_vrhelp_item(db());
if (!checks_vrhelp_item.Prepare(kChecksVrHelpItem)) {
- LOG4CXX_WARN(logger_, "Problem with verification checks_vrhelp_item query");
+ SDL_LOG_WARN("Problem with verification checks_vrhelp_item query");
return false;
}
checks_vrhelp_item.Bind(0, global_properties_key);
if (!checks_vrhelp_item.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution checks_vrhelp_item query");
+ SDL_LOG_WARN("Problem with execution checks_vrhelp_item query");
return false;
}
if (0 == checks_vrhelp_item.GetInteger(0)) {
- LOG4CXX_INFO(logger_, "Global properties doesn't contain vr help item");
+ SDL_LOG_INFO("Global properties doesn't contain vr help item");
return true;
}
utils::dbms::SQLQuery select_vrhelp_item(db());
if (!select_vrhelp_item.Prepare(kSelectVrHelpItem)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_vrhelp_item query");
+ SDL_LOG_WARN("Problem with verification select_vrhelp_item query");
return false;
}
global_properties[strings::vr_help] = SmartObject(SmartType_Array);
@@ -1302,35 +1275,34 @@ bool ResumptionDataDB::SelectVrHelpItemsData(
}
vr_help_items[vr_help_item_idx++] = item;
}
- LOG4CXX_INFO(logger_, "VR Help items were restored successfully");
+ SDL_LOG_INFO("VR Help items were restored successfully");
return true;
}
bool ResumptionDataDB::SelectCharactersData(
int64_t global_properties_key,
smart_objects::SmartObject& keyboard_properties) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
utils::dbms::SQLQuery checks_characters(db());
if (!checks_characters.Prepare(kChecksCharacter)) {
- LOG4CXX_WARN(logger_, "Problem with verification checks_characters query");
+ SDL_LOG_WARN("Problem with verification checks_characters query");
return false;
}
checks_characters.Bind(0, global_properties_key);
if (!checks_characters.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution checks_characters query");
+ SDL_LOG_WARN("Problem with execution checks_characters query");
return false;
}
if (0 == checks_characters.GetInteger(0)) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
"Keyboard properties doesn't contain table limited character list");
return true;
}
utils::dbms::SQLQuery select_characters(db());
if (!select_characters.Prepare(kSelectCharacter)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_characters query");
+ SDL_LOG_WARN("Problem with verification select_characters query");
return false;
}
@@ -1350,17 +1322,17 @@ bool ResumptionDataDB::SelectCharactersData(
bool ResumptionDataDB::SelectImageData(
int64_t image_key, smart_objects::SmartObject& image) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery select_image(db());
if (!select_image.Prepare(kSelectImage)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_image query");
+ SDL_LOG_WARN("Problem with verification select_image query");
return false;
}
select_image.Bind(0, image_key);
if (!select_image.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution select_image query");
+ SDL_LOG_WARN("Problem with execution select_image query");
return false;
}
/* Position of data in "select_image" :
@@ -1373,17 +1345,17 @@ bool ResumptionDataDB::SelectImageData(
bool ResumptionDataDB::SelectTTSChunkData(
int64_t tts_chunk_key, smart_objects::SmartObject& tts_chunk) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery select_tts_chunk(db());
if (!select_tts_chunk.Prepare(kSelectTTSChunk)) {
- LOG4CXX_WARN(logger_, "Problem with verification select_tts_chunk query");
+ SDL_LOG_WARN("Problem with verification select_tts_chunk query");
return false;
}
select_tts_chunk.Bind(0, tts_chunk_key);
if (!select_tts_chunk.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution select_tts_chunk query");
+ SDL_LOG_WARN("Problem with execution select_tts_chunk query");
return false;
}
/* Position of data in "select_tts_chunk" :
@@ -1398,17 +1370,17 @@ bool ResumptionDataDB::SelectDataFromAppTable(
const std::string& policy_app_id,
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kSelectAppTable)) {
- LOG4CXX_WARN(logger_, "Problem with verification kSelectAppTable query");
+ SDL_LOG_WARN("Problem with verification kSelectAppTable query");
return false;
}
query.Bind(0, policy_app_id);
query.Bind(1, device_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution kSelectAppTable query");
+ SDL_LOG_WARN("Problem with execution kSelectAppTable query");
return false;
}
@@ -1441,8 +1413,7 @@ bool ResumptionDataDB::SelectDataFromAppTable(
saved_app[strings::is_media_application] = query.GetBoolean(9);
saved_app[strings::subscribed_for_way_points] = query.GetBoolean(10);
- LOG4CXX_INFO(logger_,
- "Data from application table was restored successfully");
+ SDL_LOG_INFO("Data from application table was restored successfully");
return true;
}
@@ -1451,26 +1422,26 @@ bool ResumptionDataDB::SelectCountFromArray(
const std::string& text_query,
const std::string& policy_app_id,
const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(text_query)) {
- LOG4CXX_WARN(logger_, "Problem with verification query");
+ SDL_LOG_WARN("Problem with verification query");
return false;
}
query.Bind(0, policy_app_id);
query.Bind(1, device_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution query");
+ SDL_LOG_WARN("Problem with execution query");
return false;
}
count_item = query.GetInteger(0);
- LOG4CXX_INFO(logger_, "count_item=" << count_item);
+ SDL_LOG_INFO("count_item=" << count_item);
return true;
}
bool ResumptionDataDB::DeleteSavedApplication(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::ScopeGuard guard =
utils::MakeObjGuard(*db_, &utils::dbms::SQLDatabase::RollbackTransaction);
@@ -1505,15 +1476,15 @@ bool ResumptionDataDB::DeleteSavedApplication(const std::string& policy_app_id,
bool ResumptionDataDB::DeleteSavedFiles(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteFile)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from file.");
+ SDL_LOG_WARN("Incorrect delete from file.");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteApplicationFilesArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from applicationFilesArray.");
+ SDL_LOG_WARN("Incorrect delete from applicationFilesArray.");
return false;
}
return true;
@@ -1521,16 +1492,16 @@ bool ResumptionDataDB::DeleteSavedFiles(const std::string& policy_app_id,
bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteSubMenu)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from subMenu.");
+ SDL_LOG_WARN("Incorrect delete from subMenu.");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteApplicationSubMenuArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from applicationSubMenuArray.");
+ SDL_LOG_WARN("Incorrect delete from applicationSubMenuArray.");
return false;
}
return true;
@@ -1538,12 +1509,11 @@ bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id,
bool ResumptionDataDB::DeleteSavedSubscriptions(
const std::string& policy_app_id, const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteApplicationSubscriptionsArray)) {
- LOG4CXX_WARN(logger_,
- "Incorrect delete from applicationSubscriptionsArray.");
+ SDL_LOG_WARN("Incorrect delete from applicationSubscriptionsArray.");
return false;
}
return true;
@@ -1551,27 +1521,27 @@ bool ResumptionDataDB::DeleteSavedSubscriptions(
bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteImageFromCommands)) {
- LOG4CXX_WARN(logger_, "Incorrect delete image from commands.");
+ SDL_LOG_WARN("Incorrect delete image from commands.");
return false;
}
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteVrCommands)) {
- LOG4CXX_WARN(logger_, "Incorrect delete vrcommands from commands.");
+ SDL_LOG_WARN("Incorrect delete vrcommands from commands.");
return false;
}
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCommands)) {
- LOG4CXX_WARN(logger_, "Incorrect delete commands.");
+ SDL_LOG_WARN("Incorrect delete commands.");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteApplicationCommandsArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete applicationCommandsArray.");
+ SDL_LOG_WARN("Incorrect delete applicationCommandsArray.");
return false;
}
@@ -1580,39 +1550,39 @@ bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id,
bool ResumptionDataDB::DeleteSavedChoiceSet(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ExecUnionQueryToDeleteData(
policy_app_id, device_id, kDeleteImageFromChoiceSet)) {
- LOG4CXX_WARN(logger_, "Incorrect delete image from choice set");
+ SDL_LOG_WARN("Incorrect delete image from choice set");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteVrCommandsFromChoiceSet)) {
- LOG4CXX_WARN(logger_, "Incorrect delete vrCommands from choice set");
+ SDL_LOG_WARN("Incorrect delete vrCommands from choice set");
return false;
}
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoice)) {
- LOG4CXX_WARN(logger_, "Incorrect delete choiceSet");
+ SDL_LOG_WARN("Incorrect delete choiceSet");
return false;
}
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoiceArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from choiceArray");
+ SDL_LOG_WARN("Incorrect delete from choiceArray");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteApplicationChoiceSet)) {
- LOG4CXX_WARN(logger_, "Incorrect delete applicationChoiceSet");
+ SDL_LOG_WARN("Incorrect delete applicationChoiceSet");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteApplicationChoiceSetArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from ApplicationChoiceSetArray");
+ SDL_LOG_WARN("Incorrect delete from ApplicationChoiceSetArray");
return false;
}
@@ -1621,50 +1591,50 @@ bool ResumptionDataDB::DeleteSavedChoiceSet(const std::string& policy_app_id,
bool ResumptionDataDB::DeleteSavedGlobalProperties(
const std::string& policy_app_id, const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ExecUnionQueryToDeleteData(
policy_app_id, device_id, kDeleteImageFromGlobalProperties)) {
- LOG4CXX_WARN(logger_, "Incorrect delete image from globalProperties");
+ SDL_LOG_WARN("Incorrect delete image from globalProperties");
return false;
}
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeletevrHelpItem)) {
- LOG4CXX_WARN(logger_, "Incorrect delete vrHelpItem");
+ SDL_LOG_WARN("Incorrect delete vrHelpItem");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeletevrHelpItemArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete vrHelpItemArray");
+ SDL_LOG_WARN("Incorrect delete vrHelpItemArray");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteTableLimitedCharacterList)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from tableLimitedCharacterList");
+ SDL_LOG_WARN("Incorrect delete from tableLimitedCharacterList");
return false;
}
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCharacterArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from characterArray");
+ SDL_LOG_WARN("Incorrect delete from characterArray");
return false;
}
if (!ExecUnionQueryToDeleteData(policy_app_id, device_id, kDeleteTTSChunk)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from TTSChunk");
+ SDL_LOG_WARN("Incorrect delete from TTSChunk");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteHelpTimeoutPromptArray)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from HelpTimeoutPromptArray");
+ SDL_LOG_WARN("Incorrect delete from HelpTimeoutPromptArray");
return false;
}
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteGlobalProperties)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from GlobalProperties");
+ SDL_LOG_WARN("Incorrect delete from GlobalProperties");
return false;
}
@@ -1673,11 +1643,11 @@ bool ResumptionDataDB::DeleteSavedGlobalProperties(
bool ResumptionDataDB::DeleteDataFromApplicationTable(
const std::string& policy_app_id, const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ExecQueryToDeleteData(
policy_app_id, device_id, kDeleteFromApplicationTable)) {
- LOG4CXX_WARN(logger_, "Incorrect delete data from application table");
+ SDL_LOG_WARN("Incorrect delete data from application table");
return false;
}
@@ -1687,7 +1657,7 @@ bool ResumptionDataDB::DeleteDataFromApplicationTable(
bool ResumptionDataDB::ExecQueryToDeleteData(const std::string& policy_app_id,
const std::string& device_id,
const std::string& text_query) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
bool result = query.Prepare(text_query);
if (result) {
@@ -1702,7 +1672,7 @@ bool ResumptionDataDB::ExecUnionQueryToDeleteData(
const std::string& policy_app_id,
const std::string& device_id,
const std::string& text_query) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
bool result = query.Prepare(text_query);
if (result) {
@@ -1717,7 +1687,7 @@ bool ResumptionDataDB::ExecUnionQueryToDeleteData(
bool ResumptionDataDB::ExecInsertImage(
int64_t& image_primary_key, const smart_objects::SmartObject& image) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery count_image_query(db());
utils::dbms::SQLQuery query(db());
@@ -1731,8 +1701,7 @@ bool ResumptionDataDB::ExecInsertImage(
}
}
if (!result) {
- LOG4CXX_WARN(logger_,
- "Problem with preparing or execution count_image_query.");
+ SDL_LOG_WARN("Problem with preparing or execution count_image_query.");
return false;
}
if (count_image) {
@@ -1745,9 +1714,9 @@ bool ResumptionDataDB::ExecInsertImage(
}
}
if (!result) {
- LOG4CXX_WARN(logger_,
- "Problem with preparing or execution "
- "query for select primary key of image");
+ SDL_LOG_WARN(
+ "Problem with preparing or execution "
+ "query for select primary key of image");
}
} else {
result = query.Prepare(kInsertImage);
@@ -1760,9 +1729,9 @@ bool ResumptionDataDB::ExecInsertImage(
}
}
if (!result) {
- LOG4CXX_WARN(logger_,
- "Problem with preparing or execution "
- "query for insert image to image table");
+ SDL_LOG_WARN(
+ "Problem with preparing or execution "
+ "query for insert image to image table");
}
}
return result;
@@ -1771,12 +1740,12 @@ bool ResumptionDataDB::ExecInsertImage(
bool ResumptionDataDB::ExecInsertChoice(
int64_t choice_set_key,
const smart_objects::SmartObject& choice_array) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery insert_choice(db());
if (!insert_choice.Prepare(kInsertChoice)) {
- LOG4CXX_WARN(logger_, "Incorrect preparation insert_choice query");
+ SDL_LOG_WARN("Incorrect preparation insert_choice query");
return false;
}
/* Positions of binding data for "insert_choice":
@@ -1799,7 +1768,7 @@ bool ResumptionDataDB::ExecInsertChoice(
if (choice_array[i].keyExists(strings::image)) {
if (!ExecInsertImage(image_primary_key,
choice_array[i][strings::image])) {
- LOG4CXX_WARN(logger_, "Problem with insert image to choice");
+ SDL_LOG_WARN("Problem with insert image to choice");
return false;
}
insert_choice.Bind(4, image_primary_key);
@@ -1809,7 +1778,7 @@ bool ResumptionDataDB::ExecInsertChoice(
if (choice_array[i].keyExists(strings::secondary_image)) {
if (!ExecInsertImage(image_primary_key,
choice_array[i][strings::secondary_image])) {
- LOG4CXX_WARN(logger_, "Problem with insert secondary_image to choice");
+ SDL_LOG_WARN("Problem with insert secondary_image to choice");
return false;
}
insert_choice.Bind(5, image_primary_key);
@@ -1817,7 +1786,7 @@ bool ResumptionDataDB::ExecInsertChoice(
insert_choice.Bind(5);
}
if (!insert_choice.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution insert_choice query");
+ SDL_LOG_WARN("Problem with execution insert_choice query");
return false;
}
choice_primary_key = insert_choice.LastInsertId();
@@ -1826,17 +1795,17 @@ bool ResumptionDataDB::ExecInsertChoice(
choice_array[i][strings::vr_commands],
kVRCommandFromChoice)) ||
!insert_choice.Reset()) {
- LOG4CXX_WARN(logger_, "problemm with add vr commands to choice");
+ SDL_LOG_WARN("problemm with add vr commands to choice");
return false;
}
if (!ExecInsertDataToArray(
choice_set_key, choice_primary_key, kInsertChoiceArray)) {
- LOG4CXX_INFO(logger_, "Problem with insertion data to choiceArray table");
+ SDL_LOG_INFO("Problem with insertion data to choiceArray table");
return false;
}
}
- LOG4CXX_INFO(logger_, "Choice data were saved to DB successfully");
+ SDL_LOG_INFO("Choice data were saved to DB successfully");
return true;
}
@@ -1844,11 +1813,11 @@ bool ResumptionDataDB::ExecInsertVrCommands(
const int64_t primary_key,
const smart_objects::SmartObject& vr_commands_array,
AccessoryVRCommand value) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery insert_vr_command(db());
if (!insert_vr_command.Prepare(kInsertVrCommand)) {
- LOG4CXX_WARN(logger_, "Incorrect preparation insert_vr_command query");
+ SDL_LOG_WARN("Incorrect preparation insert_vr_command query");
return false;
}
size_t length_vr_commands = vr_commands_array.length();
@@ -1867,11 +1836,11 @@ bool ResumptionDataDB::ExecInsertVrCommands(
insert_vr_command.Bind(2, primary_key);
}
if (!insert_vr_command.Exec() || !insert_vr_command.Reset()) {
- LOG4CXX_WARN(logger_, "Problem with insert vr_command to DB");
+ SDL_LOG_WARN("Problem with insert vr_command to DB");
return false;
}
}
- LOG4CXX_INFO(logger_, "Insertion of Vr command were executed successfully");
+ SDL_LOG_INFO("Insertion of Vr command were executed successfully");
return true;
}
@@ -1879,7 +1848,7 @@ bool ResumptionDataDB::ExecInsertDataToArray(
int64_t first_primary_key,
int64_t second_primary_key,
const std::string& text_query) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool result;
utils::dbms::SQLQuery query_insert_array(db());
result = query_insert_array.Prepare(text_query);
@@ -1895,13 +1864,13 @@ bool ResumptionDataDB::SaveApplicationToDB(
app_mngr::ApplicationSharedPtr application,
const std::string& policy_app_id,
const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
int64_t application_primary_key = 0;
int64_t global_properties_key = 0;
db_->BeginTransaction();
if (!InsertGlobalPropertiesData(GetApplicationGlobalProperties(application),
global_properties_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert globalProperties data to DB.");
+ SDL_LOG_WARN("Incorrect insert globalProperties data to DB.");
db_->RollbackTransaction();
return false;
}
@@ -1911,38 +1880,38 @@ bool ResumptionDataDB::SaveApplicationToDB(
device_id,
&application_primary_key,
global_properties_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert application data to DB.");
+ SDL_LOG_WARN("Incorrect insert application data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertFilesData(GetApplicationFiles(application),
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert file data to DB.");
+ SDL_LOG_WARN("Incorrect insert file data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertSubMenuData(GetApplicationSubMenus(application),
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert submenu data to DB.");
+ SDL_LOG_WARN("Incorrect insert submenu data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertCommandsData(GetApplicationCommands(application),
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert commands data to DB.");
+ SDL_LOG_WARN("Incorrect insert commands data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertSubscriptionsData(GetApplicationSubscriptions(application),
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert subscriptions data to DB.");
+ SDL_LOG_WARN("Incorrect insert subscriptions data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertChoiceSetData(GetApplicationInteractionChoiseSets(application),
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert choiceset data to DB.");
+ SDL_LOG_WARN("Incorrect insert choiceset data to DB.");
db_->RollbackTransaction();
return false;
}
@@ -1954,14 +1923,14 @@ bool ResumptionDataDB::SaveApplicationToDB(
const smart_objects::SmartObject& application,
const std::string& policy_app_id,
const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
int64_t application_primary_key = 0;
int64_t global_properties_key = 0;
db_->BeginTransaction();
if (!InsertGlobalPropertiesData(application["globalProperties"],
global_properties_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert globalProperties data to DB.");
+ SDL_LOG_WARN("Incorrect insert globalProperties data to DB.");
db_->RollbackTransaction();
return false;
}
@@ -1970,38 +1939,38 @@ bool ResumptionDataDB::SaveApplicationToDB(
device_id,
&application_primary_key,
global_properties_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert application data to DB.");
+ SDL_LOG_WARN("Incorrect insert application data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertFilesData(application["applicationFiles"],
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert file data to DB.");
+ SDL_LOG_WARN("Incorrect insert file data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertSubMenuData(application["applicationSubMenus"],
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert submenu data to DB.");
+ SDL_LOG_WARN("Incorrect insert submenu data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertCommandsData(application["applicationCommands"],
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert commands data to DB.");
+ SDL_LOG_WARN("Incorrect insert commands data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertSubscriptionsData(application["subscriptions"],
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert subscriptions data to DB.");
+ SDL_LOG_WARN("Incorrect insert subscriptions data to DB.");
db_->RollbackTransaction();
return false;
}
if (!InsertChoiceSetData(application["applicationChoiceSets"],
application_primary_key)) {
- LOG4CXX_WARN(logger_, "Incorrect insert choiceset data to DB.");
+ SDL_LOG_WARN("Incorrect insert choiceset data to DB.");
db_->RollbackTransaction();
return false;
}
@@ -2011,20 +1980,19 @@ bool ResumptionDataDB::SaveApplicationToDB(
bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files,
int64_t application_primary_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
const size_t length_files_array = files.length();
if (0 == length_files_array) {
- LOG4CXX_INFO(logger_, "Application doesn't contain files");
+ SDL_LOG_INFO("Application doesn't contain files");
return true;
}
utils::dbms::SQLQuery query_insert_file(db());
if (!query_insert_file.Prepare(kInsertToFile)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification queries for insertion files");
+ SDL_LOG_WARN("Problem with verification queries for insertion files");
return false;
}
/* Positions of binding data for "query_insert_file":
@@ -2040,7 +2008,7 @@ bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files,
query_insert_file.Bind(3, (files[i][strings::sync_file_name]).asString());
if (!query_insert_file.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insertion of files data");
+ SDL_LOG_WARN("Incorrect insertion of files data");
return false;
}
@@ -2048,31 +2016,30 @@ bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files,
query_insert_file.LastInsertId(),
kInsertToApplicationFilesArray)) ||
!query_insert_file.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insertion to application files array");
+ SDL_LOG_WARN("Incorrect insertion to application files array");
return false;
}
}
- LOG4CXX_INFO(logger_, "Files data were inserted successfully to DB");
+ SDL_LOG_INFO("Files data were inserted successfully to DB");
return true;
}
bool ResumptionDataDB::InsertSubMenuData(
const smart_objects::SmartObject& submenus,
int64_t application_primary_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
const size_t length_submenu_array = submenus.length();
if (0 == length_submenu_array) {
- LOG4CXX_INFO(logger_, "Application doesn't contain submenu");
+ SDL_LOG_INFO("Application doesn't contain submenu");
return true;
}
utils::dbms::SQLQuery query_insert_submenu(db());
if (!query_insert_submenu.Prepare(kInsertToSubMenu)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification queries for insertion submenu");
+ SDL_LOG_WARN("Problem with verification queries for insertion submenu");
return false;
}
/* Positions of binding data for "query_insert_submenu":
@@ -2085,7 +2052,7 @@ bool ResumptionDataDB::InsertSubMenuData(
CustomBind(strings::position, submenus[i], query_insert_submenu, 2);
if (!query_insert_submenu.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insertion of submenu data");
+ SDL_LOG_WARN("Incorrect insertion of submenu data");
return false;
}
@@ -2093,24 +2060,24 @@ bool ResumptionDataDB::InsertSubMenuData(
query_insert_submenu.LastInsertId(),
kInsertToApplicationSubMenuArray)) ||
!query_insert_submenu.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insertion to application submenu array");
+ SDL_LOG_WARN("Incorrect insertion to application submenu array");
return false;
}
}
- LOG4CXX_INFO(logger_, "Data about submenu were inserted successfully to DB");
+ SDL_LOG_INFO("Data about submenu were inserted successfully to DB");
return true;
}
bool ResumptionDataDB::InsertCommandsData(
const smart_objects::SmartObject& commands,
int64_t application_primary_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
const size_t length_command_array = commands.length();
if (0 == length_command_array) {
- LOG4CXX_INFO(logger_, "Application doesn't contain command");
+ SDL_LOG_INFO("Application doesn't contain command");
return true;
}
utils::dbms::SQLQuery query_insert_command(db());
@@ -2118,8 +2085,7 @@ bool ResumptionDataDB::InsertCommandsData(
int64_t command_primary_key = 0;
if (!query_insert_command.Prepare(kInsertToCommand)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification queries for insertion commands");
+ SDL_LOG_WARN("Problem with verification queries for insertion commands");
return false;
}
/* Positions of binding data for "query_insert_command":
@@ -2132,7 +2098,7 @@ bool ResumptionDataDB::InsertCommandsData(
query_insert_command.Bind(0, commands[i][strings::cmd_id].asInt());
if (commands[i].keyExists(strings::cmd_icon)) {
if (!ExecInsertImage(image_primary_key, commands[i][strings::cmd_icon])) {
- LOG4CXX_WARN(logger_, "Problem with insert command image to DB");
+ SDL_LOG_WARN("Problem with insert command image to DB");
return false;
}
query_insert_command.Bind(1, image_primary_key);
@@ -2152,7 +2118,7 @@ bool ResumptionDataDB::InsertCommandsData(
query_insert_command.Bind(4);
}
if (!query_insert_command.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insertion of command data to DB");
+ SDL_LOG_WARN("Incorrect insertion of command data to DB");
return false;
}
command_primary_key = query_insert_command.LastInsertId();
@@ -2167,8 +2133,7 @@ bool ResumptionDataDB::InsertCommandsData(
command_primary_key,
kInsertApplicationCommandArray)) ||
!query_insert_command.Reset()) {
- LOG4CXX_WARN(logger_,
- "Incorrect insertion to application commands array");
+ SDL_LOG_WARN("Incorrect insertion to application commands array");
return false;
}
}
@@ -2178,12 +2143,12 @@ bool ResumptionDataDB::InsertCommandsData(
bool ResumptionDataDB::InsertSubscriptionsData(
const smart_objects::SmartObject& subscriptions,
int64_t application_primary_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
if (subscriptions.empty()) {
- LOG4CXX_INFO(logger_, "Application doesn't contain subscriptions");
+ SDL_LOG_INFO("Application doesn't contain subscriptions");
return true;
}
const SmartObject& btn_sub = subscriptions[strings::application_buttons];
@@ -2195,8 +2160,7 @@ bool ResumptionDataDB::InsertSubscriptionsData(
utils::dbms::SQLQuery insert_subscriptions(db());
if (!insert_subscriptions.Prepare(kInsertSubscriptions)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Problem with verification queries for insertion subscriptions");
return false;
}
@@ -2217,23 +2181,23 @@ bool ResumptionDataDB::InsertSubscriptionsData(
insert_subscriptions.Bind(2);
}
if (!insert_subscriptions.Exec() || !insert_subscriptions.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insertion of buttons to subscriptions");
+ SDL_LOG_WARN("Incorrect insertion of buttons to subscriptions");
return false;
}
}
- LOG4CXX_INFO(logger_, "Subscriptions data were saved successfully");
+ SDL_LOG_INFO("Subscriptions data were saved successfully");
return true;
}
bool ResumptionDataDB::InsertChoiceSetData(
const smart_objects::SmartObject& choicesets,
int64_t application_primary_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
if (choicesets.empty()) {
- LOG4CXX_INFO(logger_, "Application doesn't contain choiceSet");
+ SDL_LOG_INFO("Application doesn't contain choiceSet");
return true;
}
int64_t choice_set_key = 0;
@@ -2250,27 +2214,27 @@ bool ResumptionDataDB::InsertChoiceSetData(
if (!ExecInsertDataToArray(choice_set_key,
application_primary_key,
kInsertApplicationChoiceSetArray)) {
- LOG4CXX_WARN(logger_,
- "Problem with insertion data to"
- " applicationChoiceSetArray table");
+ SDL_LOG_WARN(
+ "Problem with insertion data to"
+ " applicationChoiceSetArray table");
return false;
}
}
- LOG4CXX_INFO(logger_, "Choice set data were saved to DB successfully");
+ SDL_LOG_INFO("Choice set data were saved to DB successfully");
return true;
}
bool ResumptionDataDB::ExecInsertApplicationChoiceSet(
int64_t& choice_set_primary_key,
const smart_objects::SmartObject& choiceset) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery insert_application_choice_set(db());
if (!insert_application_choice_set.Prepare(kInsertApplicationChoiceSet)) {
- LOG4CXX_WARN(logger_,
- "Problem with preparation insert "
- "application choice set query");
+ SDL_LOG_WARN(
+ "Problem with preparation insert "
+ "application choice set query");
return false;
}
/* Positions of binding data for "insert_application_choice_set":
@@ -2282,19 +2246,18 @@ bool ResumptionDataDB::ExecInsertApplicationChoiceSet(
1, choiceset[strings::interaction_choice_set_id].asInt());
if (!insert_application_choice_set.Exec()) {
- LOG4CXX_WARN(logger_,
- "Problem with execution insert application choice set query");
+ SDL_LOG_WARN("Problem with execution insert application choice set query");
return false;
}
choice_set_primary_key = insert_application_choice_set.LastInsertId();
- LOG4CXX_INFO(logger_, "Application choice data were saved successfully");
+ SDL_LOG_INFO("Application choice data were saved successfully");
return true;
}
bool ResumptionDataDB::InsertGlobalPropertiesData(
const smart_objects::SmartObject& global_properties,
int64_t& global_properties_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
SmartMap::iterator it_begin = global_properties.map_begin();
@@ -2302,22 +2265,22 @@ bool ResumptionDataDB::InsertGlobalPropertiesData(
bool data_exists = false;
while (it_begin != it_end) {
if (SmartType::SmartType_Null != ((it_begin->second).getType())) {
- LOG4CXX_INFO(logger_, "Global properties contains - " << it_begin->first);
+ SDL_LOG_INFO("Global properties contains - " << it_begin->first);
data_exists = true;
break;
}
++it_begin;
}
if (!data_exists) {
- LOG4CXX_INFO(logger_, "Application doesn't contain global properties");
+ SDL_LOG_INFO("Application doesn't contain global properties");
return true;
}
utils::dbms::SQLQuery insert_global_properties(db());
if (!insert_global_properties.Prepare(kInsertGlobalProperties)) {
- LOG4CXX_WARN(logger_,
- "Problem with preparation query "
- "insert_global_properties");
+ SDL_LOG_WARN(
+ "Problem with preparation query "
+ "insert_global_properties");
return false;
}
/* Positions of binding data for "insert_global_properties":
@@ -2342,7 +2305,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData(
if (ExecInsertImage(image_key, global_properties[strings::menu_icon])) {
insert_global_properties.Bind(2, image_key);
} else {
- LOG4CXX_WARN(logger_, "Problem with insert image to global properties");
+ SDL_LOG_WARN("Problem with insert image to global properties");
return false;
}
}
@@ -2365,8 +2328,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData(
strings::auto_complete_text, kb_prop, insert_global_properties, 6);
}
if (!insert_global_properties.Exec()) {
- LOG4CXX_WARN(logger_,
- "Problem with insert data to global properties table");
+ SDL_LOG_WARN("Problem with insert data to global properties table");
return false;
}
@@ -2379,8 +2341,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData(
global_properties_key,
global_properties[strings::keyboard_properties]
[strings::limited_character_list])) {
- LOG4CXX_WARN(logger_,
- "Problem with insert data to limited_character table");
+ SDL_LOG_WARN("Problem with insert data to limited_character table");
return false;
}
}
@@ -2389,25 +2350,24 @@ bool ResumptionDataDB::InsertGlobalPropertiesData(
global_properties[strings::vr_help].getType()) {
if (!ExecInsertVRHelpItem(global_properties_key,
global_properties[strings::vr_help])) {
- LOG4CXX_WARN(logger_, "Problem with insert data to vrHelpItem table");
+ SDL_LOG_WARN("Problem with insert data to vrHelpItem table");
return false;
}
}
if (!ExecInsertHelpTimeoutArray(global_properties, global_properties_key)) {
- LOG4CXX_WARN(logger_,
- "Problem with insert data to HelpTimeoutPromptArray table");
+ SDL_LOG_WARN("Problem with insert data to HelpTimeoutPromptArray table");
return false;
}
- LOG4CXX_INFO(logger_, "Global properties data were saved successfully");
+ SDL_LOG_INFO("Global properties data were saved successfully");
return true;
}
bool ResumptionDataDB::ExecInsertHelpTimeoutArray(
const smart_objects::SmartObject& global_properties,
int64_t global_properties_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
using namespace smart_objects;
size_t timeout_prompt_length = 0;
@@ -2423,16 +2383,14 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray(
timeout_prompt_length = global_properties[strings::timeout_prompt].length();
}
if (0 == timeout_prompt_length && 0 == help_prompt_length) {
- LOG4CXX_INFO(logger_,
- "Application doesn't HelpPrompt and timoutPrompt data");
+ SDL_LOG_INFO("Application doesn't HelpPrompt and timoutPrompt data");
return true;
}
utils::dbms::SQLQuery insert_help_prompt_array(db());
if (!insert_help_prompt_array.Prepare(kInsertHelpTimeoutPromptArray)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification query insert_help_prompt_array");
+ SDL_LOG_WARN("Problem with verification query insert_help_prompt_array");
return false;
}
int64_t tts_chunk_key = 0;
@@ -2449,8 +2407,7 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray(
if (i < timeout_prompt_length) {
if (!ExecInsertTTSChunks(global_properties[strings::timeout_prompt][i],
tts_chunk_key)) {
- LOG4CXX_WARN(logger_,
- "Problem with insertion timeoutPrompt's ttsChunk");
+ SDL_LOG_WARN("Problem with insertion timeoutPrompt's ttsChunk");
return false;
}
insert_help_prompt_array.Bind(1, tts_chunk_key);
@@ -2461,7 +2418,7 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray(
if (i < help_prompt_length) {
if (!ExecInsertTTSChunks(global_properties[strings::help_prompt][i],
tts_chunk_key)) {
- LOG4CXX_WARN(logger_, "Problem with insertion helpPrompt's ttsChunk");
+ SDL_LOG_WARN("Problem with insertion helpPrompt's ttsChunk");
return false;
}
insert_help_prompt_array.Bind(2, tts_chunk_key);
@@ -2469,23 +2426,22 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray(
insert_help_prompt_array.Bind(2);
}
if (!insert_help_prompt_array.Exec() || !insert_help_prompt_array.Reset()) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Problem with execution or resetting insert_help_prompt_array query");
return false;
}
}
- LOG4CXX_INFO(logger_, "Data were saved to helpTimeoutPromptArray table");
+ SDL_LOG_INFO("Data were saved to helpTimeoutPromptArray table");
return true;
}
bool ResumptionDataDB::ExecInsertTTSChunks(
const smart_objects::SmartObject& tts_chunk, int64_t& tts_chunk_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery insert_tts_chunk(db());
if (!insert_tts_chunk.Prepare(kInsertTTSChunk)) {
- LOG4CXX_WARN(logger_, "Problem with verification insert_tts_chunk query");
+ SDL_LOG_WARN("Problem with verification insert_tts_chunk query");
return false;
}
/* Positions of binding data for "insert_tts_chunk":
@@ -2494,24 +2450,24 @@ bool ResumptionDataDB::ExecInsertTTSChunks(
insert_tts_chunk.Bind(0, tts_chunk[strings::type].asInt());
insert_tts_chunk.Bind(1, tts_chunk[strings::text].asString());
if (!insert_tts_chunk.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution insert_tts_chunk query");
+ SDL_LOG_WARN("Problem with execution insert_tts_chunk query");
return false;
}
tts_chunk_key = insert_tts_chunk.LastInsertId();
- LOG4CXX_WARN(logger_, "TTSChunk was saved successfully");
+ SDL_LOG_WARN("TTSChunk was saved successfully");
return true;
}
bool ResumptionDataDB::ExecInsertLimitedCharacters(
int64_t global_properties_key,
const smart_objects::SmartObject& characters_array) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery insert_characters(db());
if (!insert_characters.Prepare(kInsertTableLimitedCharacter)) {
- LOG4CXX_WARN(logger_,
- "Problem with preparation query "
- "insert_characters");
+ SDL_LOG_WARN(
+ "Problem with preparation query "
+ "insert_characters");
return false;
}
size_t length_characters_array = characters_array.length();
@@ -2521,31 +2477,29 @@ bool ResumptionDataDB::ExecInsertLimitedCharacters(
insert_characters.Bind(0, characters_array[i].asString());
if (!insert_characters.Exec()) {
- LOG4CXX_WARN(logger_,
- "Problem with insert data to limited_character table");
+ SDL_LOG_WARN("Problem with insert data to limited_character table");
return false;
}
if ((!ExecInsertDataToArray(global_properties_key,
insert_characters.LastInsertId(),
kInsertCharacterArray)) ||
(!insert_characters.Reset())) {
- LOG4CXX_WARN(logger_, "Problem with insert data to characterArray table");
+ SDL_LOG_WARN("Problem with insert data to characterArray table");
return false;
}
}
- LOG4CXX_INFO(logger_,
- "Data were saved successfully to limited_character table");
+ SDL_LOG_INFO("Data were saved successfully to limited_character table");
return true;
}
bool ResumptionDataDB::ExecInsertVRHelpItem(
int64_t global_properties_key,
const smart_objects::SmartObject& vrhelp_array) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery insert_vrhelp_item(db());
if (!insert_vrhelp_item.Prepare(kInsertVRHelpItem)) {
- LOG4CXX_WARN(logger_, "Problem with preparation query insert_vrhelp_item");
+ SDL_LOG_WARN("Problem with preparation query insert_vrhelp_item");
return false;
}
int64_t image_primary_key = 0;
@@ -2560,7 +2514,7 @@ bool ResumptionDataDB::ExecInsertVRHelpItem(
if (vrhelp_array[i].keyExists(strings::image)) {
if (!ExecInsertImage(image_primary_key,
vrhelp_array[i][strings::image])) {
- LOG4CXX_INFO(logger_, "Problem with insert image to vrHelpItem table");
+ SDL_LOG_INFO("Problem with insert image to vrHelpItem table");
return false;
}
insert_vrhelp_item.Bind(2, image_primary_key);
@@ -2569,7 +2523,7 @@ bool ResumptionDataDB::ExecInsertVRHelpItem(
}
if (!insert_vrhelp_item.Exec()) {
- LOG4CXX_INFO(logger_, "Problem with insert data vrHelpItem table");
+ SDL_LOG_INFO("Problem with insert data vrHelpItem table");
return false;
}
@@ -2577,13 +2531,11 @@ bool ResumptionDataDB::ExecInsertVRHelpItem(
insert_vrhelp_item.LastInsertId(),
kInsertVRHelpItemArray)) ||
(!insert_vrhelp_item.Reset())) {
- LOG4CXX_WARN(logger_,
- "Problem with insert data to vrHelpItemArray table");
+ SDL_LOG_WARN("Problem with insert data to vrHelpItemArray table");
return false;
}
}
- LOG4CXX_INFO(logger_,
- "Data were saved successfully to vrHelpItem array table");
+ SDL_LOG_INFO("Data were saved successfully to vrHelpItem array table");
return true;
}
@@ -2591,7 +2543,7 @@ bool ResumptionDataDB::InsertApplicationData(
app_mngr::ApplicationSharedPtr application,
const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationParams app(application);
return InsertApplicationData(app, policy_app_id, device_id, NULL, 0);
}
@@ -2602,12 +2554,12 @@ bool ResumptionDataDB::InsertApplicationData(
const std::string& device_id,
int64_t* application_primary_key,
int64_t global_properties_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery query(db());
if (!application.m_is_valid) {
- LOG4CXX_ERROR(logger_, "Invalid application params passed.");
+ SDL_LOG_ERROR("Invalid application params passed.");
return false;
}
@@ -2619,12 +2571,12 @@ bool ResumptionDataDB::InsertApplicationData(
const mobile_apis::HMILevel::eType hmi_level = application.m_hmi_level;
bool is_media_application = application.m_is_media_application;
bool is_subscribed_for_way_points =
- application_manager_.IsAppSubscribedForWayPoints(application.app_ptr);
+ application_manager_.IsAppSubscribedForWayPoints(*(application.app_ptr));
if (!query.Prepare(kInsertApplication)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification query "
- "for insert to table application");
+ SDL_LOG_WARN(
+ "Problem with verification query "
+ "for insert to table application");
return false;
}
@@ -2659,13 +2611,13 @@ bool ResumptionDataDB::InsertApplicationData(
query.Bind(11, is_subscribed_for_way_points);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution query");
+ SDL_LOG_WARN("Problem with execution query");
return false;
}
if (NULL != application_primary_key) {
*application_primary_key = query.LastInsertId();
}
- LOG4CXX_INFO(logger_, "Data were saved successfully to application table");
+ SDL_LOG_INFO("Data were saved successfully to application table");
return true;
}
@@ -2673,7 +2625,7 @@ void ResumptionDataDB::CustomBind(const std::string& key,
const smart_objects::SmartObject& so,
utils::dbms::SQLQuery& query,
const int pos) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
if (so.keyExists(key) && SmartType::SmartType_Null != so[key].getType()) {
switch (so[key].getType()) {
@@ -2686,7 +2638,7 @@ void ResumptionDataDB::CustomBind(const std::string& key,
break;
}
default: {
- LOG4CXX_WARN(logger_, "Incorrect type");
+ SDL_LOG_WARN("Incorrect type");
break;
}
}
@@ -2699,9 +2651,9 @@ bool ResumptionDataDB::PrepareSelectQuery(utils::dbms::SQLQuery& query,
const std::string& policy_app_id,
const std::string& device_id,
const std::string& text_query) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!query.Prepare(text_query)) {
- LOG4CXX_WARN(logger_, "Problem with verification query");
+ SDL_LOG_WARN("Problem with verification query");
return false;
}
query.Bind(0, policy_app_id);
@@ -2710,13 +2662,12 @@ bool ResumptionDataDB::PrepareSelectQuery(utils::dbms::SQLQuery& query,
}
void ResumptionDataDB::UpdateDataOnAwake() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (query.Prepare(kUpdateIgnOffCount)) {
if (query.Exec()) {
- LOG4CXX_INFO(logger_,
- "Values of ignition off counts were updated successfully");
+ SDL_LOG_INFO("Values of ignition off counts were updated successfully");
WriteDb();
}
}
@@ -2726,7 +2677,7 @@ bool ResumptionDataDB::UpdateApplicationData(
app_mngr::ApplicationConstSharedPtr application,
const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery query(db());
@@ -2735,9 +2686,9 @@ bool ResumptionDataDB::UpdateApplicationData(
application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (!query.Prepare(kUpdateApplicationData)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification query "
- "for updating some application data");
+ SDL_LOG_WARN(
+ "Problem with verification query "
+ "for updating some application data");
return false;
}
@@ -2752,28 +2703,27 @@ bool ResumptionDataDB::UpdateApplicationData(
query.Bind(3, device_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution query");
+ SDL_LOG_WARN("Problem with execution query");
return false;
}
- LOG4CXX_INFO(logger_, "Data were updated successfully in application table");
+ SDL_LOG_INFO("Data were updated successfully in application table");
return true;
}
void ResumptionDataDB::WriteDb() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
db_->Backup();
}
bool ResumptionDataDB::UpdateGrammarID(const std::string& policy_app_id,
const std::string& device_id,
const uint32_t grammar_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
utils::dbms::SQLQuery query(db());
if (!query.Prepare(kUpdateGrammarID)) {
- LOG4CXX_WARN(logger_,
- "Problem with verification query for updating grammar id.");
+ SDL_LOG_WARN("Problem with verification query for updating grammar id.");
return false;
}
@@ -2786,10 +2736,10 @@ bool ResumptionDataDB::UpdateGrammarID(const std::string& policy_app_id,
query.Bind(2, device_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Problem with execution query");
+ SDL_LOG_WARN("Problem with execution query");
return false;
}
- LOG4CXX_INFO(logger_, "Data were updated successfully in application table");
+ SDL_LOG_INFO("Data were updated successfully in application table");
return true;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index 3623c18b90..f3d417d128 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -43,7 +43,7 @@ namespace resumption {
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
-CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+SDL_CREATE_LOG_VARIABLE("Resumption")
ResumptionDataJson::ResumptionDataJson(
resumption::LastStateWrapperPtr last_state_wrapper,
@@ -54,12 +54,11 @@ ResumptionDataJson::ResumptionDataJson(
void ResumptionDataJson::SaveApplication(
app_mngr::ApplicationSharedPtr application) {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
const std::string& policy_app_id = application->policy_app_id();
- LOG4CXX_DEBUG(logger_,
- "app_id : " << application->app_id()
+ SDL_LOG_DEBUG("app_id : " << application->app_id()
<< " policy_app_id : " << policy_app_id);
const std::string hash = application->curHash();
const uint32_t grammar_id = application->get_grammar_id();
@@ -68,7 +67,7 @@ void ResumptionDataJson::SaveApplication(
const mobile_apis::HMILevel::eType hmi_level =
application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
const bool is_subscribed_for_way_points =
- application_manager_.IsAppSubscribedForWayPoints(application);
+ application_manager_.IsAppSubscribedForWayPoints(*application);
Json::Value tmp;
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
@@ -110,12 +109,12 @@ void ResumptionDataJson::SaveApplication(
json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points;
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(logger_, "SaveApplication : " << json_app.toStyledString());
+ SDL_LOG_DEBUG("SaveApplication : " << json_app.toStyledString());
}
bool ResumptionDataJson::IsHMIApplicationIdExist(uint32_t hmi_app_id) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -134,13 +133,13 @@ bool ResumptionDataJson::IsHMIApplicationIdExist(uint32_t hmi_app_id) const {
uint32_t ResumptionDataJson::GetHMIApplicationID(
const std::string& policy_app_id, const std::string& device_id) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t hmi_app_id = 0;
const int idx = GetObjectIndex(policy_app_id, device_id);
if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
+ SDL_LOG_WARN("Application not saved");
return hmi_app_id;
}
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
@@ -150,13 +149,13 @@ uint32_t ResumptionDataJson::GetHMIApplicationID(
json_app.isMember(strings::device_id)) {
hmi_app_id = json_app[strings::hmi_app_id].asUInt();
}
- LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
+ SDL_LOG_DEBUG("hmi_app_id :" << hmi_app_id);
return hmi_app_id;
}
void ResumptionDataJson::IncrementIgnOffCount() {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Json::Value to_save = Json::arrayValue;
Json::Value dictionary;
@@ -169,7 +168,7 @@ void ResumptionDataJson::IncrementIgnOffCount() {
const uint32_t counter_value = ign_off_count.asUInt();
ign_off_count = counter_value + 1;
} else {
- LOG4CXX_WARN(logger_, "Unknown key among saved applications");
+ SDL_LOG_WARN("Unknown key among saved applications");
Json::Value& ign_off_count = json_app[strings::ign_off_count];
ign_off_count = 1;
}
@@ -178,12 +177,12 @@ void ResumptionDataJson::IncrementIgnOffCount() {
SetSavedApplication(to_save, dictionary);
SetLastIgnOffTime(time(nullptr), dictionary);
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(logger_, GetResumptionData(dictionary).toStyledString());
+ SDL_LOG_DEBUG(GetResumptionData(dictionary).toStyledString());
}
void ResumptionDataJson::DecrementIgnOffCount() {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -192,12 +191,12 @@ void ResumptionDataJson::DecrementIgnOffCount() {
if (saved_app.isMember(strings::ign_off_count)) {
const uint32_t ign_off_count = saved_app[strings::ign_off_count].asUInt();
if (0 == ign_off_count) {
- LOG4CXX_WARN(logger_, "Application has not been suspended");
+ SDL_LOG_WARN("Application has not been suspended");
} else {
saved_app[strings::ign_off_count] = ign_off_count - 1;
}
} else {
- LOG4CXX_WARN(logger_, "Unknown key among saved applications");
+ SDL_LOG_WARN("Unknown key among saved applications");
saved_app[strings::ign_off_count] = 0;
}
}
@@ -208,25 +207,24 @@ bool ResumptionDataJson::GetHashId(const std::string& policy_app_id,
const std::string& device_id,
std::string& hash_id) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int idx = GetObjectIndex(policy_app_id, device_id);
if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
+ SDL_LOG_WARN("Application not saved");
return false;
}
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
const Json::Value& json_app = GetSavedApplications(dictionary)[idx];
- LOG4CXX_DEBUG(logger_,
- "Saved_application_data: " << json_app.toStyledString());
+ SDL_LOG_DEBUG("Saved_application_data: " << json_app.toStyledString());
if (json_app.isMember(strings::hash_id) &&
json_app.isMember(strings::time_stamp)) {
hash_id = json_app[strings::hash_id].asString();
return true;
}
- LOG4CXX_WARN(logger_, "There are some unknown keys in the dictionary.");
+ SDL_LOG_WARN("There are some unknown keys in the dictionary.");
return false;
}
@@ -235,7 +233,7 @@ bool ResumptionDataJson::GetSavedApplication(
const std::string& device_id,
smart_objects::SmartObject& saved_app) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int idx = GetObjectIndex(policy_app_id, device_id);
if (-1 == idx) {
@@ -252,7 +250,7 @@ bool ResumptionDataJson::GetSavedApplication(
bool ResumptionDataJson::RemoveApplicationFromSaved(
const std::string& policy_app_id, const std::string& device_id) {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool result = false;
std::vector<Json::Value> temp;
@@ -273,7 +271,7 @@ bool ResumptionDataJson::RemoveApplicationFromSaved(
}
if (false == result) {
- LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
+ SDL_LOG_TRACE("EXIT result: " << (result ? "true" : "false"));
accessor.GetMutableData().set_dictionary(dictionary);
return result;
}
@@ -282,14 +280,14 @@ bool ResumptionDataJson::RemoveApplicationFromSaved(
for (auto& app : temp) {
GetSavedApplications(dictionary).append(app);
}
- LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
+ SDL_LOG_TRACE("EXIT result: " << (result ? "true" : "false"));
accessor.GetMutableData().set_dictionary(dictionary);
return result;
}
uint32_t ResumptionDataJson::GetIgnOffTime() const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -297,14 +295,14 @@ uint32_t ResumptionDataJson::GetIgnOffTime() const {
if (!resumption.isMember(strings::last_ign_off_time)) {
resumption[strings::last_ign_off_time] = 0;
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_WARN(logger_, "last_save_time section is missed");
+ SDL_LOG_WARN("last_save_time section is missed");
}
return resumption[strings::last_ign_off_time].asUInt();
}
uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -312,7 +310,7 @@ uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const {
if (resumption.isMember(strings::global_ign_on_counter)) {
const uint32_t global_ign_on_counter =
resumption[strings::global_ign_on_counter].asUInt();
- LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter);
+ SDL_LOG_DEBUG("Global Ign On Counter = " << global_ign_on_counter);
return global_ign_on_counter;
}
return 1;
@@ -320,7 +318,7 @@ uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const {
void ResumptionDataJson::IncrementGlobalIgnOnCounter() {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -328,13 +326,11 @@ void ResumptionDataJson::IncrementGlobalIgnOnCounter() {
if (resumption.isMember(strings::global_ign_on_counter)) {
const uint32_t global_ign_on_counter =
resumption[strings::global_ign_on_counter].asUInt();
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Global IGN ON counter in resumption data: " << global_ign_on_counter);
resumption[strings::global_ign_on_counter] = global_ign_on_counter + 1;
- LOG4CXX_DEBUG(logger_,
- "Global IGN ON counter new value: "
- << resumption[strings::global_ign_on_counter].asUInt());
+ SDL_LOG_DEBUG("Global IGN ON counter new value: "
+ << resumption[strings::global_ign_on_counter].asUInt());
} else {
resumption[strings::global_ign_on_counter] = 1;
}
@@ -344,7 +340,7 @@ void ResumptionDataJson::IncrementGlobalIgnOnCounter() {
void ResumptionDataJson::ResetGlobalIgnOnCount() {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -352,12 +348,12 @@ void ResumptionDataJson::ResetGlobalIgnOnCount() {
resumption[strings::global_ign_on_counter] = 0;
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting");
+ SDL_LOG_DEBUG("Global IGN ON counter resetting");
}
ssize_t ResumptionDataJson::IsApplicationSaved(
const std::string& policy_app_id, const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return GetObjectIndex(policy_app_id, device_id);
}
@@ -367,7 +363,7 @@ Json::Value& ResumptionDataJson::GetFromSavedOrAppend(
const std::string& device_id,
Json::Value& dictionary) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Json::Value& saved_apps = GetSavedApplications(dictionary);
for (auto& saved_app : saved_apps) {
@@ -383,7 +379,7 @@ Json::Value& ResumptionDataJson::GetFromSavedOrAppend(
void ResumptionDataJson::GetDataForLoadResumeData(
smart_objects::SmartObject& saved_data) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject so_array_data(smart_objects::SmartType_Array);
int i = 0;
@@ -417,14 +413,13 @@ void ResumptionDataJson::UpdateHmiLevel(
const std::string& policy_app_id,
const std::string& device_id,
mobile_apis::HMILevel::eType hmi_level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
int idx = GetObjectIndex(policy_app_id, device_id);
if (-1 == idx) {
- LOG4CXX_WARN(logger_,
- "Application isn't saved with mobile_app_id = "
- << policy_app_id << " device_id = " << device_id);
+ SDL_LOG_WARN("Application isn't saved with mobile_app_id = "
+ << policy_app_id << " device_id = " << device_id);
return;
}
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
@@ -436,16 +431,16 @@ void ResumptionDataJson::UpdateHmiLevel(
Json::Value& ResumptionDataJson::GetSavedApplications(
Json::Value& dictionary) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Json::Value& resumption = GetResumptionData(dictionary);
if (!resumption.isMember(strings::resume_app_list)) {
resumption[strings::resume_app_list] = Json::Value(Json::arrayValue);
- LOG4CXX_WARN(logger_, "app_list section is missed");
+ SDL_LOG_WARN("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");
+ SDL_LOG_ERROR("resume_app_list type INVALID rewrite");
resume_app_list = Json::Value(Json::arrayValue);
}
return resume_app_list;
@@ -454,15 +449,15 @@ Json::Value& ResumptionDataJson::GetSavedApplications(
Json::Value& ResumptionDataJson::GetResumptionData(
Json::Value& dictionary) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!dictionary.isMember(strings::resumption)) {
dictionary[strings::resumption] = Json::Value(Json::objectValue);
- LOG4CXX_WARN(logger_, "resumption section is missed");
+ SDL_LOG_WARN("resumption section is missed");
}
Json::Value& resumption = dictionary[strings::resumption];
if (!resumption.isObject()) {
- LOG4CXX_ERROR(logger_, "resumption type INVALID rewrite");
+ SDL_LOG_ERROR("resumption type INVALID rewrite");
resumption = Json::Value(Json::objectValue);
}
return resumption;
@@ -471,7 +466,7 @@ Json::Value& ResumptionDataJson::GetResumptionData(
ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id,
const std::string& device_id) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -485,7 +480,7 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id,
const std::string& saved_device_id =
apps[idx][strings::device_id].asString();
if (device_id == saved_device_id && policy_app_id == saved_app_id) {
- LOG4CXX_DEBUG(logger_, "Found " << idx);
+ SDL_LOG_DEBUG("Found " << idx);
return idx;
}
}
@@ -495,7 +490,7 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id,
bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -506,13 +501,13 @@ bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const {
!json_app.isMember(strings::hmi_app_id) ||
!json_app.isMember(strings::time_stamp) ||
!json_app.isMember(strings::device_id)) {
- LOG4CXX_ERROR(logger_, "Wrong resumption data");
+ SDL_LOG_ERROR("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");
+ SDL_LOG_ERROR("Wrong resumption hmi app ID");
return false;
}
@@ -521,7 +516,7 @@ bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const {
void ResumptionDataJson::SetSavedApplication(Json::Value& apps_json,
Json::Value& dictionary) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Json::Value& app_list = GetSavedApplications(dictionary);
app_list = apps_json;
@@ -530,21 +525,21 @@ void ResumptionDataJson::SetSavedApplication(Json::Value& apps_json,
void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time,
Json::Value& dictionary) {
using namespace app_mngr;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_WARN(logger_, "ign_off_time = " << ign_off_time);
+ SDL_LOG_WARN("ign_off_time = " << ign_off_time);
Json::Value& resumption = GetResumptionData(dictionary);
resumption[strings::last_ign_off_time] = static_cast<uint32_t>(ign_off_time);
}
bool ResumptionDataJson::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return true;
}
bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
const std::string& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace app_mngr;
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
@@ -552,8 +547,7 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
Json::Value& application =
GetFromSavedOrAppend(app_id, device_id, dictionary);
if (application.isNull()) {
- LOG4CXX_DEBUG(logger_,
- "Application " << app_id << " with device_id " << device_id
+ SDL_LOG_DEBUG("Application " << app_id << " with device_id " << device_id
<< " hasn't been found in resumption data.");
return false;
}
@@ -565,10 +559,9 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
application[strings::application_files].clear();
application.removeMember(strings::grammar_id);
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_DEBUG(logger_,
- "Resumption data for application "
- << app_id << " with device_id " << device_id
- << " has been dropped.");
+ SDL_LOG_DEBUG("Resumption data for application "
+ << app_id << " with device_id " << device_id
+ << " has been dropped.");
return true;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
new file mode 100644
index 0000000000..c067167041
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
@@ -0,0 +1,1209 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <algorithm>
+
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resumption_data_processor_impl.h"
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h"
+#include "application_manager/smart_object_keys.h"
+
+namespace resumption {
+
+using app_mngr::AppFile;
+using app_mngr::ApplicationSharedPtr;
+using app_mngr::ButtonSubscriptions;
+using app_mngr::ChoiceSetMap;
+using app_mngr::MessageHelper;
+namespace strings = app_mngr::strings;
+namespace event_engine = app_mngr::event_engine;
+namespace commands = app_mngr::commands;
+namespace message_params = rc_rpc_plugin::message_params;
+
+SDL_CREATE_LOG_VARIABLE("Resumption")
+std::map<hmi_apis::Common_ModuleType::eType, std::string>
+ module_types_str_mapping{
+ {hmi_apis::Common_ModuleType::eType::CLIMATE, {"CLIMATE"}},
+ {hmi_apis::Common_ModuleType::eType::RADIO, {"RADIO"}},
+ {hmi_apis::Common_ModuleType::eType::SEAT, {"SEAT"}},
+ {hmi_apis::Common_ModuleType::eType::AUDIO, {"AUDIO"}},
+ {hmi_apis::Common_ModuleType::eType::LIGHT, {"LIGHT"}},
+ {hmi_apis::Common_ModuleType::eType::HMI_SETTINGS, {"HMI_SETTINGS"}}};
+
+bool ResumptionRequestID::operator<(const ResumptionRequestID& other) const {
+ return correlation_id < other.correlation_id ||
+ function_id < other.function_id;
+}
+
+ResumptionDataProcessorImpl::ResumptionDataProcessorImpl(
+ app_mngr::ApplicationManager& application_manager)
+ : event_engine::EventObserver(application_manager.event_dispatcher())
+ , application_manager_(application_manager)
+ , resumption_status_lock_()
+ , register_callbacks_lock_()
+ , request_app_ids_lock_() {}
+
+ResumptionDataProcessorImpl::~ResumptionDataProcessorImpl() {}
+
+void ResumptionDataProcessorImpl::Restore(
+ ApplicationSharedPtr application,
+ smart_objects::SmartObject& saved_app,
+ ResumeCtrl::ResumptionCallBack callback) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!HasDataToRestore(saved_app)) {
+ SDL_LOG_DEBUG("No data to restore, resumption is successful");
+ callback(mobile_apis::Result::SUCCESS, "Data resumption succesful");
+ return;
+ }
+
+ AddFiles(application, saved_app);
+ AddSubmenus(application, saved_app);
+ AddCommands(application, saved_app);
+ AddChoicesets(application, saved_app);
+ SetGlobalProperties(application, saved_app);
+ AddSubscriptions(application, saved_app);
+ AddWindows(application, saved_app);
+
+ resumption_status_lock_.AcquireForReading();
+ const auto app_id = application->app_id();
+ bool is_requests_list_empty = true;
+ if (resumption_status_.find(app_id) != resumption_status_.end()) {
+ is_requests_list_empty =
+ resumption_status_[app_id].list_of_sent_requests.empty();
+ }
+ resumption_status_lock_.Release();
+
+ if (!is_requests_list_empty) {
+ sync_primitives::AutoWriteLock lock(register_callbacks_lock_);
+ register_callbacks_[app_id] = callback;
+ } else {
+ SDL_LOG_DEBUG("No requests to HMI for " << app_id
+ << " , resumption is successful");
+ callback(mobile_apis::Result::SUCCESS, "Data resumption successful");
+ }
+}
+
+bool ResumptionDataProcessorImpl::HasDataToRestore(
+ const smart_objects::SmartObject& saved_app) const {
+ SDL_LOG_AUTO_TRACE();
+
+ auto has_data_to_restore = [&saved_app]() -> bool {
+ return !saved_app[strings::application_files].empty() ||
+ !saved_app[strings::application_submenus].empty() ||
+ !saved_app[strings::application_commands].empty() ||
+ !saved_app[strings::application_choice_sets].empty() ||
+ !saved_app[strings::windows_info].empty();
+ };
+
+ auto has_gp_to_restore = [&saved_app]() -> bool {
+ const smart_objects::SmartObject& global_properties =
+ saved_app[strings::application_global_properties];
+
+ return !global_properties[strings::help_prompt].empty() ||
+ !global_properties[strings::keyboard_properties].empty() ||
+ !global_properties[strings::menu_icon].empty() ||
+ !global_properties[strings::menu_title].empty() ||
+ !global_properties[strings::timeout_prompt].empty() ||
+ !global_properties[strings::vr_help].empty() ||
+ !global_properties[strings::vr_help_title].empty();
+ };
+
+ auto has_subscriptions_to_restore = [&saved_app]() -> bool {
+ const smart_objects::SmartObject& subscriptions =
+ saved_app[strings::application_subscriptions];
+
+ const bool has_ivi_subscriptions =
+ !subscriptions[strings::application_vehicle_info].empty();
+
+ const bool has_button_subscriptions =
+ !subscriptions[strings::application_buttons].empty() &&
+ !(subscriptions[strings::application_buttons].length() == 1 &&
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ subscriptions[strings::application_buttons][0].asInt()) ==
+ hmi_apis::Common_ButtonName::CUSTOM_BUTTON);
+
+ const bool has_waypoints_subscriptions =
+ subscriptions[strings::subscribed_for_way_points].asBool();
+
+ const bool has_appservice_subscriptions =
+ subscriptions.keyExists(app_mngr::hmi_interface::app_service) &&
+ !subscriptions[app_mngr::hmi_interface::app_service].empty();
+
+ const bool has_system_capability_subscriptions =
+ subscriptions.keyExists(strings::system_capability) &&
+ !subscriptions[strings::system_capability].empty();
+
+ return has_ivi_subscriptions || has_button_subscriptions ||
+ has_waypoints_subscriptions || has_appservice_subscriptions ||
+ has_system_capability_subscriptions;
+ };
+
+ if (has_data_to_restore()) {
+ SDL_LOG_DEBUG("Application has data to restore");
+ return true;
+ }
+
+ if (has_gp_to_restore()) {
+ SDL_LOG_DEBUG("Application has global properties to restore");
+ return true;
+ }
+
+ if (has_subscriptions_to_restore()) {
+ SDL_LOG_DEBUG("Application has subscriptions to restore");
+ return true;
+ }
+
+ SDL_LOG_DEBUG("Application does not have any data to restore");
+ return false;
+}
+
+utils::Optional<uint32_t>
+ResumptionDataProcessorImpl::GetAppIdWaitingForResponse(
+ const hmi_apis::FunctionID::eType function_id, const int32_t corr_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ auto predicate =
+ [function_id,
+ corr_id](const std::pair<ResumptionRequestID, std::uint32_t>& item) {
+ return item.first.function_id == function_id &&
+ item.first.correlation_id == corr_id;
+ };
+
+ sync_primitives::AutoReadLock lock(request_app_ids_lock_);
+ auto app_id_ptr =
+ std::find_if(request_app_ids_.begin(), request_app_ids_.end(), predicate);
+
+ if (app_id_ptr == request_app_ids_.end()) {
+ return utils::Optional<uint32_t>::OptionalEmpty::EMPTY;
+ }
+ return utils::Optional<uint32_t>(app_id_ptr->second);
+}
+
+utils::Optional<ResumptionRequest> ResumptionDataProcessorImpl::GetRequest(
+ const uint32_t app_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const int32_t corr_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ sync_primitives::AutoReadLock lock(resumption_status_lock_);
+ std::vector<ResumptionRequest>& list_of_sent_requests =
+ resumption_status_[app_id].list_of_sent_requests;
+
+ if (resumption_status_.find(app_id) == resumption_status_.end()) {
+ SDL_LOG_ERROR("No resumption status info found for app_id: " << app_id);
+ return utils::Optional<ResumptionRequest>::OptionalEmpty::EMPTY;
+ }
+
+ auto request_iter =
+ std::find_if(list_of_sent_requests.begin(),
+ list_of_sent_requests.end(),
+ [function_id, corr_id](const ResumptionRequest& request) {
+ return request.request_id.correlation_id == corr_id &&
+ request.request_id.function_id == function_id;
+ });
+
+ if (list_of_sent_requests.end() == request_iter) {
+ return utils::Optional<ResumptionRequest>::OptionalEmpty::EMPTY;
+ }
+ return utils::Optional<ResumptionRequest>(*request_iter);
+}
+
+void ResumptionDataProcessorImpl::ProcessResumptionStatus(
+ const uint32_t app_id,
+ const smart_objects::SmartObject& response,
+ const ResumptionRequest& found_request) {
+ SDL_LOG_AUTO_TRACE();
+
+ sync_primitives::AutoWriteLock lock(resumption_status_lock_);
+ ApplicationResumptionStatus& status = resumption_status_[app_id];
+
+ if (IsResponseSuccessful(response)) {
+ status.successful_requests.push_back(found_request);
+ } else {
+ status.error_requests.push_back(found_request);
+ }
+
+ if (hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData ==
+ found_request.request_id.function_id) {
+ CheckVehicleDataResponse(found_request.message, response, status);
+ }
+
+ if (hmi_apis::FunctionID::UI_CreateWindow ==
+ found_request.request_id.function_id) {
+ CheckCreateWindowResponse(found_request.message, response);
+ }
+
+ if (hmi_apis::FunctionID::RC_GetInteriorVehicleData ==
+ found_request.request_id.function_id) {
+ CheckModuleDataSubscription(found_request.message, response, status);
+ }
+}
+
+bool ResumptionDataProcessorImpl::IsResumptionFinished(
+ const uint32_t app_id, const ResumptionRequest& found_request) {
+ SDL_LOG_AUTO_TRACE();
+
+ sync_primitives::AutoWriteLock lock(resumption_status_lock_);
+ auto& list_of_sent_requests =
+ resumption_status_[app_id].list_of_sent_requests;
+ auto request_iter =
+ std::find_if(list_of_sent_requests.begin(),
+ list_of_sent_requests.end(),
+ [found_request](const ResumptionRequest& request) {
+ return request.request_id.correlation_id ==
+ found_request.request_id.correlation_id &&
+ request.request_id.function_id ==
+ found_request.request_id.function_id;
+ });
+ list_of_sent_requests.erase(request_iter);
+
+ return list_of_sent_requests.empty();
+}
+
+utils::Optional<ResumeCtrl::ResumptionCallBack>
+ResumptionDataProcessorImpl::GetResumptionCallback(const uint32_t app_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ sync_primitives::AutoReadLock lock(register_callbacks_lock_);
+ auto it = register_callbacks_.find(app_id);
+ if (it == register_callbacks_.end()) {
+ return utils::Optional<
+ ResumeCtrl::ResumptionCallBack>::OptionalEmpty::EMPTY;
+ }
+ return utils::Optional<ResumeCtrl::ResumptionCallBack>(it->second);
+}
+
+bool ResumptionDataProcessorImpl::IsResumptionSuccessful(
+ const uint32_t app_id) {
+ sync_primitives::AutoReadLock lock(resumption_status_lock_);
+ auto it = resumption_status_.find(app_id);
+ if (resumption_status_.end() == it) {
+ return false;
+ }
+
+ const ApplicationResumptionStatus& status = it->second;
+ return status.error_requests.empty() &&
+ status.unsuccessful_vehicle_data_subscriptions_.empty() &&
+ status.unsuccessful_module_subscriptions_.empty();
+}
+
+void ResumptionDataProcessorImpl::EraseAppResumptionData(
+ const uint32_t app_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const int32_t corr_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ resumption_status_lock_.AcquireForWriting();
+ resumption_status_.erase(app_id);
+ resumption_status_lock_.Release();
+
+ request_app_ids_lock_.AcquireForWriting();
+ request_app_ids_.erase({function_id, corr_id});
+ request_app_ids_lock_.Release();
+
+ register_callbacks_lock_.AcquireForWriting();
+ register_callbacks_.erase(app_id);
+ register_callbacks_lock_.Release();
+}
+
+void ResumptionDataProcessorImpl::ProcessResponseFromHMI(
+ const smart_objects::SmartObject& response,
+ const hmi_apis::FunctionID::eType function_id,
+ const int32_t corr_id) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("Now processing event with function id: "
+ << function_id << " correlation id: " << corr_id);
+
+ auto found_app_id = GetAppIdWaitingForResponse(function_id, corr_id);
+ if (!found_app_id) {
+ SDL_LOG_ERROR("Application id for correlation id "
+ << corr_id << " and function id: " << function_id
+ << " was not found, such response is not expected.");
+ return;
+ }
+ const uint32_t app_id = *found_app_id;
+ SDL_LOG_DEBUG("app_id is: " << app_id);
+
+ auto found_request = GetRequest(app_id, function_id, corr_id);
+ if (!found_request) {
+ SDL_LOG_ERROR("Request with function id " << function_id << " and corr id "
+ << corr_id << " not found");
+ return;
+ }
+ auto request = *found_request;
+
+ ProcessResumptionStatus(app_id, response, request);
+
+ if (!IsResumptionFinished(app_id, request)) {
+ SDL_LOG_DEBUG("Resumption app "
+ << app_id << " not finished. Some requests are still waited");
+ return;
+ }
+
+ auto found_callback = GetResumptionCallback(app_id);
+ if (!found_callback) {
+ SDL_LOG_ERROR("Callback for app_id: " << app_id << " not found");
+ return;
+ }
+ auto callback = *found_callback;
+
+ if (IsResumptionSuccessful(app_id)) {
+ SDL_LOG_DEBUG("Resumption for app " << app_id << " successful");
+ callback(mobile_apis::Result::SUCCESS, "Data resumption successful");
+ application_manager_.state_controller().ResumePostponedWindows(app_id);
+ } else {
+ SDL_LOG_ERROR("Resumption for app " << app_id << " failed");
+ callback(mobile_apis::Result::RESUME_FAILED, "Data resumption failed");
+ RevertRestoredData(application_manager_.application(app_id));
+ application_manager_.state_controller().DropPostponedWindows(app_id);
+ }
+
+ EraseAppResumptionData(app_id, function_id, corr_id);
+}
+
+void ResumptionDataProcessorImpl::HandleOnTimeOut(
+ const uint32_t corr_id, const hmi_apis::FunctionID::eType function_id) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Handling timeout with corr id: "
+ << corr_id << " and function_id: " << function_id);
+
+ auto error_response = MessageHelper::CreateNegativeResponseFromHmi(
+ function_id,
+ corr_id,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ std::string());
+ ProcessResponseFromHMI(*error_response, function_id, corr_id);
+}
+
+void ResumptionDataProcessorImpl::on_event(const event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG(
+ "Handling response message from HMI "
+ << event.id() << " "
+ << event.smart_object()[strings::params][strings::correlation_id]
+ .asInt());
+ ProcessResponseFromHMI(
+ event.smart_object(), event.id(), event.smart_object_correlation_id());
+}
+
+std::vector<ResumptionRequest> GetAllFailedRequests(
+ uint32_t app_id,
+ const std::map<std::int32_t, ApplicationResumptionStatus>&
+ resumption_status,
+ sync_primitives::RWLock& resumption_status_lock) {
+ resumption_status_lock.AcquireForReading();
+ std::vector<ResumptionRequest> failed_requests;
+ std::vector<ResumptionRequest> missed_requests;
+ auto it = resumption_status.find(app_id);
+ if (it != resumption_status.end()) {
+ failed_requests = it->second.error_requests;
+ missed_requests = it->second.list_of_sent_requests;
+ }
+ resumption_status_lock.Release();
+
+ failed_requests.insert(
+ failed_requests.end(), missed_requests.begin(), missed_requests.end());
+ return failed_requests;
+}
+
+void ResumptionDataProcessorImpl::RevertRestoredData(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Reverting for app: " << application->app_id());
+ DeleteSubmenus(application);
+ DeleteCommands(application);
+ DeleteChoicesets(application);
+ DeleteGlobalProperties(application);
+ DeleteSubscriptions(application);
+ DeleteWindowsSubscriptions(application);
+
+ resumption_status_lock_.AcquireForWriting();
+ resumption_status_.erase(application->app_id());
+ resumption_status_lock_.Release();
+
+ register_callbacks_lock_.AcquireForWriting();
+ register_callbacks_.erase(application->app_id());
+ register_callbacks_lock_.Release();
+}
+
+void ResumptionDataProcessorImpl::SubscribeToResponse(
+ const int32_t app_id, const ResumptionRequest& request) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("App " << app_id << " subscribe on "
+ << request.request_id.function_id << " "
+ << request.request_id.correlation_id);
+ subscribe_on_event(request.request_id.function_id,
+ request.request_id.correlation_id);
+
+ resumption_status_lock_.AcquireForWriting();
+ resumption_status_[app_id].list_of_sent_requests.push_back(request);
+ resumption_status_lock_.Release();
+
+ request_app_ids_lock_.AcquireForWriting();
+ request_app_ids_.insert(std::make_pair(request.request_id, app_id));
+ request_app_ids_lock_.Release();
+}
+
+void ResumptionDataProcessorImpl::ProcessMessageToHMI(
+ smart_objects::SmartObjectSPtr message, bool subscribe_on_response) {
+ SDL_LOG_AUTO_TRACE();
+ if (subscribe_on_response) {
+ auto function_id = static_cast<hmi_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
+
+ const int32_t hmi_correlation_id =
+ (*message)[strings::params][strings::correlation_id].asInt();
+
+ const int32_t app_id =
+ (*message)[strings::msg_params][strings::app_id].asInt();
+
+ ResumptionRequest wait_for_response;
+ wait_for_response.request_id.correlation_id = hmi_correlation_id;
+ wait_for_response.request_id.function_id = function_id;
+ wait_for_response.message = *message;
+
+ SubscribeToResponse(app_id, wait_for_response);
+ }
+ if (!application_manager_.GetRPCService().ManageHMICommand(message)) {
+ SDL_LOG_ERROR("Unable to send request");
+ }
+}
+
+void ResumptionDataProcessorImpl::ProcessMessagesToHMI(
+ const smart_objects::SmartObjectList& messages) {
+ SDL_LOG_AUTO_TRACE();
+ for (const auto& message : messages) {
+ const bool is_request_message =
+ application_manager::MessageType::kRequest ==
+ (*message)[strings::params][strings::message_type].asInt();
+
+ ProcessMessageToHMI(message, is_request_message);
+ }
+}
+
+void ResumptionDataProcessorImpl::AddFiles(
+ app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+ if (!saved_app.keyExists(strings::application_files)) {
+ SDL_LOG_ERROR("application_files section is not exists");
+ return;
+ }
+
+ const auto application_files =
+ saved_app[strings::application_files].asArray();
+
+ for (const auto file_data : *application_files) {
+ const bool is_persistent = file_data.keyExists(strings::persistent_file) &&
+ file_data[strings::persistent_file].asBool();
+ if (is_persistent) {
+ AppFile file;
+ file.is_persistent = is_persistent;
+ file.is_download_complete =
+ file_data[strings::is_download_complete].asBool();
+ file.file_name = file_data[strings::sync_file_name].asString();
+ file.file_type = static_cast<mobile_apis::FileType::eType>(
+ file_data[strings::file_type].asInt());
+ application->AddFile(file);
+ }
+ }
+}
+
+void ResumptionDataProcessorImpl::AddWindows(
+ application_manager::ApplicationSharedPtr application,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!saved_app.keyExists(strings::windows_info)) {
+ SDL_LOG_ERROR("windows_info section does not exist");
+ return;
+ }
+
+ const auto& windows_info = saved_app[strings::windows_info];
+ auto request_list = MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application, application_manager_, windows_info);
+
+ ProcessMessagesToHMI(request_list);
+}
+
+void ResumptionDataProcessorImpl::AddSubmenus(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!saved_app.keyExists(strings::application_submenus)) {
+ SDL_LOG_ERROR("application_submenus section is not exists");
+ return;
+ }
+
+ const smart_objects::SmartObject& app_submenus =
+ saved_app[strings::application_submenus];
+
+ for (size_t i = 0; i < app_submenus.length(); ++i) {
+ const smart_objects::SmartObject& submenu = app_submenus[i];
+ application->AddSubMenu(submenu[strings::menu_id].asUInt(), submenu);
+ }
+
+ ProcessMessagesToHMI(MessageHelper::CreateAddSubMenuRequestsToHMI(
+ application, application_manager_));
+}
+
+utils::Optional<ResumptionRequest> FindResumptionSubmenuRequest(
+ uint32_t menu_id, std::vector<ResumptionRequest>& requests) {
+ using namespace utils;
+
+ auto request_it = std::find_if(
+ requests.begin(),
+ requests.end(),
+ [menu_id](const ResumptionRequest& request) {
+ auto& msg_params = request.message[strings::msg_params];
+ if (hmi_apis::FunctionID::UI_AddSubMenu ==
+ request.request_id.function_id) {
+ uint32_t failed_menu_id = msg_params[strings::menu_id].asUInt();
+ return failed_menu_id == menu_id;
+ }
+ return false;
+ });
+ if (requests.end() != request_it) {
+ return Optional<ResumptionRequest>(*request_it);
+ }
+ return Optional<ResumptionRequest>::OptionalEmpty::EMPTY;
+}
+
+void ResumptionDataProcessorImpl::DeleteSubmenus(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+
+ auto failed_requests = GetAllFailedRequests(
+ application->app_id(), resumption_status_, resumption_status_lock_);
+
+ auto accessor = application->sub_menu_map();
+ const auto& sub_menu_map = accessor.GetData();
+
+ for (const auto& smenu : sub_menu_map) {
+ auto failed_submenu_request =
+ FindResumptionSubmenuRequest(smenu.first, failed_requests);
+ if (!failed_submenu_request) {
+ MessageHelper::SendDeleteSubmenuRequest(
+ smenu.second, application, application_manager_);
+ }
+ application->RemoveSubMenu(smenu.first);
+ }
+}
+
+void ResumptionDataProcessorImpl::AddCommands(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+ if (!saved_app.keyExists(strings::application_commands)) {
+ SDL_LOG_ERROR("application_commands section is not exists");
+ return;
+ }
+
+ const smart_objects::SmartObject& app_commands =
+ saved_app[strings::application_commands];
+
+ for (size_t cmd_num = 0; cmd_num < app_commands.length(); ++cmd_num) {
+ const smart_objects::SmartObject& command = app_commands[cmd_num];
+ const uint32_t cmd_id = command[strings::cmd_id].asUInt();
+ const uint32_t consecutive_num =
+ commands::CommandImpl::CalcCommandInternalConsecutiveNumber(
+ application);
+
+ application->AddCommand(consecutive_num, command);
+ application->help_prompt_manager().OnVrCommandAdded(
+ cmd_id, command, true); // is_resumption =true
+ }
+
+ ProcessMessagesToHMI(MessageHelper::CreateAddCommandRequestToHMI(
+ application, application_manager_));
+}
+
+utils::Optional<ResumptionRequest> FindCommandResumptionRequest(
+ uint32_t command_id, std::vector<ResumptionRequest>& requests) {
+ using namespace utils;
+
+ auto request_it = std::find_if(
+ requests.begin(),
+ requests.end(),
+ [command_id](const ResumptionRequest& request) {
+ auto& msg_params = request.message[strings::msg_params];
+ const bool is_vr_command = hmi_apis::FunctionID::VR_AddCommand ==
+ request.request_id.function_id &&
+ hmi_apis::Common_VRCommandType::Command ==
+ msg_params[strings::type].asInt();
+ const bool is_ui_command = hmi_apis::FunctionID::UI_AddCommand ==
+ request.request_id.function_id;
+
+ if (is_vr_command || is_ui_command) {
+ uint32_t cmd_id = msg_params[strings::cmd_id].asUInt();
+ return cmd_id == command_id;
+ }
+
+ return false;
+ });
+
+ if (requests.end() != request_it) {
+ return Optional<ResumptionRequest>(*request_it);
+ }
+ return Optional<ResumptionRequest>::OptionalEmpty::EMPTY;
+}
+
+void ResumptionDataProcessorImpl::DeleteCommands(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+
+ auto failed_requests = GetAllFailedRequests(
+ application->app_id(), resumption_status_, resumption_status_lock_);
+
+ auto is_vr_command_failed = [](const ResumptionRequest& failed_command) {
+ return failed_command.message[strings::msg_params].keyExists(
+ strings::vr_commands);
+ };
+
+ auto extract_cmd_id =
+ [](const smart_objects::SmartObject* const so_ptr) -> uint32_t {
+ if (so_ptr->keyExists(strings::cmd_id)) {
+ return so_ptr->getElement(strings::cmd_id).asUInt();
+ }
+
+ return 0;
+ };
+
+ auto accessor = application->commands_map();
+ const auto& commands_map = accessor.GetData();
+
+ for (const auto& cmd : commands_map) {
+ const auto cmd_id = extract_cmd_id(cmd.second);
+ if (0 == cmd_id) {
+ SDL_LOG_ERROR("Can't extract cmd_id for command with internal number: "
+ << cmd.first);
+ continue;
+ }
+
+ auto failed_command = FindCommandResumptionRequest(cmd_id, failed_requests);
+
+ SDL_LOG_DEBUG(std::boolalpha << "Command with internal ID: " << cmd.first
+ << " and cmdID: " << cmd_id << " was failed: "
+ << static_cast<bool>(failed_command));
+ if (!failed_command || (!is_vr_command_failed(*failed_command))) {
+ auto delete_VR_command_msg = MessageHelper::CreateDeleteVRCommandRequest(
+ cmd.second,
+ application,
+ application_manager_.GetNextHMICorrelationID());
+ application_manager_.GetRPCService().ManageHMICommand(
+ delete_VR_command_msg);
+ }
+
+ if (!failed_command || (is_vr_command_failed(*failed_command))) {
+ auto delete_UI_command_msg = MessageHelper::CreateDeleteUICommandRequest(
+ cmd.second,
+ application->app_id(),
+ application_manager_.GetNextHMICorrelationID());
+ application_manager_.GetRPCService().ManageHMICommand(
+ delete_UI_command_msg);
+ }
+
+ application->RemoveCommand(cmd_id);
+ application->help_prompt_manager().OnVrCommandDeleted(cmd_id, true);
+ }
+}
+
+void ResumptionDataProcessorImpl::AddChoicesets(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+ if (!saved_app.keyExists(strings::application_choice_sets)) {
+ SDL_LOG_ERROR("There is no any choicesets");
+ return;
+ }
+
+ const smart_objects::SmartObject& app_choice_sets =
+ saved_app[strings::application_choice_sets];
+
+ for (size_t i = 0; i < app_choice_sets.length(); ++i) {
+ const smart_objects::SmartObject& choice_set = app_choice_sets[i];
+ const int32_t choice_set_id =
+ choice_set[strings::interaction_choice_set_id].asInt();
+ application->AddChoiceSet(choice_set_id, choice_set);
+ }
+
+ ProcessMessagesToHMI(MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
+ application, application_manager_));
+}
+
+utils::Optional<ResumptionRequest> FindResumptionChoiceSetRequest(
+ uint32_t command_id, std::vector<ResumptionRequest>& requests) {
+ using namespace utils;
+
+ auto request_it =
+ std::find_if(requests.begin(),
+ requests.end(),
+ [command_id](const ResumptionRequest& request) {
+ auto& msg_params = request.message[strings::msg_params];
+ if (msg_params.keyExists(strings::cmd_id) &&
+ (msg_params[strings::type] ==
+ hmi_apis::Common_VRCommandType::Choice)) {
+ uint32_t cmd_id = msg_params[strings::cmd_id].asUInt();
+ return cmd_id == command_id;
+ }
+ return false;
+ });
+ if (requests.end() != request_it) {
+ return Optional<ResumptionRequest>(*request_it);
+ }
+ return Optional<ResumptionRequest>::OptionalEmpty::EMPTY;
+}
+
+void ResumptionDataProcessorImpl::DeleteChoicesets(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+
+ auto failed_requests = GetAllFailedRequests(
+ application->app_id(), resumption_status_, resumption_status_lock_);
+
+ auto accessor = application->choice_set_map();
+ const auto& choices = accessor.GetData();
+ for (const auto& choice : choices) {
+ auto failed_choice_set =
+ FindResumptionChoiceSetRequest(choice.first, failed_requests);
+ if (!failed_choice_set) {
+ MessageHelper::SendDeleteChoiceSetRequest(
+ choice.second, application, application_manager_);
+ }
+ application->RemoveChoiceSet(choice.first);
+ }
+}
+
+void ResumptionDataProcessorImpl::SetGlobalProperties(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+ if (!saved_app.keyExists(strings::application_global_properties)) {
+ SDL_LOG_DEBUG("application_global_properties section is not exists");
+ return;
+ }
+
+ const smart_objects::SmartObject& properties_so =
+ saved_app[strings::application_global_properties];
+ application->load_global_properties(properties_so);
+
+ ProcessMessagesToHMI(MessageHelper::CreateGlobalPropertiesRequestsToHMI(
+ application, application_manager_));
+}
+
+void ResumptionDataProcessorImpl::DeleteGlobalProperties(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+ const uint32_t app_id = application->app_id();
+ const auto result =
+ application_manager_.ResetAllApplicationGlobalProperties(app_id);
+
+ resumption_status_lock_.AcquireForReading();
+ std::vector<ResumptionRequest> requests;
+ if (resumption_status_.find(app_id) != resumption_status_.end()) {
+ requests = resumption_status_[app_id].successful_requests;
+ }
+ resumption_status_lock_.Release();
+
+ auto check_if_successful =
+ [requests](hmi_apis::FunctionID::eType function_id) {
+ for (auto& resumption_request : requests) {
+ auto request_func =
+ resumption_request.message[strings::params][strings::function_id]
+ .asInt();
+ if (request_func == function_id) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ if (result.HasUIPropertiesReset() &&
+ check_if_successful(hmi_apis::FunctionID::UI_SetGlobalProperties)) {
+ smart_objects::SmartObjectSPtr msg_params =
+ MessageHelper::CreateUIResetGlobalPropertiesRequest(result,
+ application);
+ auto msg = MessageHelper::CreateMessageForHMI(
+ hmi_apis::messageType::request,
+ application_manager_.GetNextHMICorrelationID());
+ (*msg)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::UI_SetGlobalProperties;
+ (*msg)[strings::msg_params] = *msg_params;
+ ProcessMessageToHMI(msg, false);
+ }
+
+ if (result.HasTTSPropertiesReset() &&
+ check_if_successful(hmi_apis::FunctionID::TTS_SetGlobalProperties)) {
+ smart_objects::SmartObjectSPtr msg_params =
+ MessageHelper::CreateTTSResetGlobalPropertiesRequest(result,
+ application);
+ auto msg = MessageHelper::CreateMessageForHMI(
+ hmi_apis::messageType::request,
+ application_manager_.GetNextHMICorrelationID());
+ (*msg)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::TTS_SetGlobalProperties;
+
+ (*msg)[strings::msg_params] = *msg_params;
+ ProcessMessageToHMI(msg, false);
+ }
+}
+
+void ResumptionDataProcessorImpl::AddSubscriptions(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ AddButtonsSubscriptions(application, saved_app);
+ AddPluginsSubscriptions(application, saved_app);
+}
+
+void ResumptionDataProcessorImpl::AddButtonsSubscriptions(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!saved_app.keyExists(strings::application_subscriptions)) {
+ SDL_LOG_DEBUG("application_subscriptions section is not exists");
+ return;
+ }
+
+ const smart_objects::SmartObject& subscriptions =
+ saved_app[strings::application_subscriptions];
+
+ if (subscriptions.keyExists(strings::application_buttons)) {
+ const smart_objects::SmartObject& subscriptions_buttons =
+ subscriptions[strings::application_buttons];
+ mobile_apis::ButtonName::eType btn;
+ for (size_t i = 0; i < subscriptions_buttons.length(); ++i) {
+ btn = static_cast<mobile_apis::ButtonName::eType>(
+ (subscriptions_buttons[i]).asInt());
+ application->SubscribeToButton(btn);
+ }
+
+ ButtonSubscriptions button_subscriptions =
+ GetButtonSubscriptionsToResume(application);
+
+ ProcessMessagesToHMI(
+ MessageHelper::CreateOnButtonSubscriptionNotificationsForApp(
+ application, application_manager_, button_subscriptions));
+ }
+}
+
+ButtonSubscriptions ResumptionDataProcessorImpl::GetButtonSubscriptionsToResume(
+ ApplicationSharedPtr application) const {
+ ButtonSubscriptions button_subscriptions =
+ application->SubscribedButtons().GetData();
+ auto it = button_subscriptions.find(mobile_apis::ButtonName::CUSTOM_BUTTON);
+
+ if (it != button_subscriptions.end()) {
+ button_subscriptions.erase(it);
+ }
+
+ return button_subscriptions;
+}
+
+void ResumptionDataProcessorImpl::AddPluginsSubscriptions(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ SDL_LOG_AUTO_TRACE();
+
+ for (auto& extension : application->Extensions()) {
+ extension->ProcessResumption(saved_app);
+ }
+}
+
+void ResumptionDataProcessorImpl::DeleteSubscriptions(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+ DeleteButtonsSubscriptions(application);
+ DeletePluginsSubscriptions(application);
+}
+
+void ResumptionDataProcessorImpl::DeleteButtonsSubscriptions(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+ const ButtonSubscriptions button_subscriptions =
+ application->SubscribedButtons().GetData();
+ for (auto& btn : button_subscriptions) {
+ const auto hmi_btn = static_cast<hmi_apis::Common_ButtonName::eType>(btn);
+ if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == hmi_btn) {
+ continue;
+ }
+ auto notification = MessageHelper::CreateOnButtonSubscriptionNotification(
+ application->hmi_app_id(), hmi_btn, false);
+ // is_subscribed = false
+ ProcessMessageToHMI(notification, false);
+ application->UnsubscribeFromButton(btn);
+ }
+}
+
+void ResumptionDataProcessorImpl::DeleteWindowsSubscriptions(
+ ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+
+ const auto window_ids = application->GetWindowIds();
+ for (const auto& window_id : window_ids) {
+ const auto hmi_state = application->CurrentHmiState(window_id);
+ if (mobile_apis::WindowType::WIDGET != hmi_state->window_type()) {
+ continue;
+ }
+
+ SDL_LOG_DEBUG("Reverting CreateWindow for: " << window_id);
+
+ auto delete_request = MessageHelper::CreateUIDeleteWindowRequestToHMI(
+ application, application_manager_, window_id);
+ const bool subscribe_on_request_events = false;
+ ProcessMessageToHMI(delete_request, subscribe_on_request_events);
+
+ application->RemoveWindowInfo(window_id);
+ application->RemoveHMIState(window_id,
+ app_mngr::HmiState::StateID::STATE_ID_REGULAR);
+ application->remove_window_capability(window_id);
+ }
+}
+
+void ResumptionDataProcessorImpl::DeletePluginsSubscriptions(
+ application_manager::ApplicationSharedPtr application) {
+ SDL_LOG_AUTO_TRACE();
+
+ resumption_status_lock_.AcquireForReading();
+ auto it = resumption_status_.find(application->app_id());
+ if (it == resumption_status_.end()) {
+ resumption_status_lock_.Release();
+ return;
+ }
+
+ const ApplicationResumptionStatus& status = it->second;
+ smart_objects::SmartObject extension_vd_subscriptions;
+ for (auto ivi : status.successful_vehicle_data_subscriptions_) {
+ SDL_LOG_DEBUG("ivi " << ivi << " should be deleted");
+ extension_vd_subscriptions[ivi] = true;
+ }
+
+ smart_objects::SmartObject extension_modules_subscriptions(
+ smart_objects::SmartType_Map);
+
+ if (!status.successful_module_subscriptions_.empty()) {
+ extension_modules_subscriptions[message_params::kModuleData] =
+ new smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ auto& module_data_so =
+ extension_modules_subscriptions[message_params::kModuleData];
+
+ uint32_t index = 0;
+ for (const auto& module : status.successful_module_subscriptions_) {
+ module_data_so[index] =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ module_data_so[index][message_params::kModuleType] = module.first;
+ module_data_so[index][message_params::kModuleId] = module.second;
+ index++;
+ }
+ }
+
+ smart_objects::SmartObject resumption_data_to_revert(
+ smart_objects::SmartType_Map);
+ resumption_data_to_revert[application_manager::hmi_interface::vehicle_info] =
+ extension_vd_subscriptions;
+ resumption_data_to_revert[application_manager::hmi_interface::rc] =
+ extension_modules_subscriptions;
+
+ resumption_status_lock_.Release();
+
+ auto extensions = application->Extensions();
+ for (auto& extension : extensions) {
+ extension->RevertResumption(resumption_data_to_revert);
+ }
+}
+
+bool IsResponseSuccessful(const smart_objects::SmartObject& response) {
+ return !response[strings::params].keyExists(strings::error_msg);
+}
+
+void ResumptionDataProcessorImpl::CheckVehicleDataResponse(
+ const smart_objects::SmartObject& request,
+ const smart_objects::SmartObject& response,
+ ApplicationResumptionStatus& status) {
+ SDL_LOG_AUTO_TRACE();
+ const auto request_keys = request[strings::msg_params].enumerate();
+
+ if (!IsResponseSuccessful(response)) {
+ SDL_LOG_TRACE("Vehicle data request not successful");
+ for (const auto key : request_keys) {
+ status.unsuccessful_vehicle_data_subscriptions_.push_back(key);
+ }
+ return;
+ }
+
+ const auto& response_params = response[strings::msg_params];
+ const auto response_keys = response_params.enumerate();
+ for (auto& ivi : request_keys) {
+ const auto it = response_keys.find(ivi);
+ const auto kSuccess = hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS;
+ const auto vd_result_code =
+ (response_keys.end() == it)
+ ? kSuccess
+ : response_params[ivi][strings::result_code].asInt();
+ if (kSuccess != vd_result_code) {
+ SDL_LOG_TRACE("ivi " << ivi << " was NOT successfuly subscribed");
+
+ status.unsuccessful_vehicle_data_subscriptions_.push_back(ivi);
+ } else {
+ SDL_LOG_TRACE("ivi " << ivi << " was successfuly subscribed");
+ status.successful_vehicle_data_subscriptions_.push_back(ivi);
+ }
+ }
+}
+
+void ResumptionDataProcessorImpl::CheckModuleDataSubscription(
+ const ns_smart_device_link::ns_smart_objects::SmartObject& request,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& response,
+ ApplicationResumptionStatus& status) {
+ SDL_LOG_AUTO_TRACE();
+
+ const auto& msg_params_so = request[strings::msg_params];
+ const auto requested_module_type =
+ msg_params_so[message_params::kModuleType].asString();
+ const auto requested_module_id =
+ msg_params_so[message_params::kModuleId].asString();
+ const ModuleUid requested_module{requested_module_type, requested_module_id};
+
+ if (!IsResponseSuccessful(response)) {
+ SDL_LOG_TRACE("Module data subscription request NOT successful");
+ status.unsuccessful_module_subscriptions_.push_back(requested_module);
+ return;
+ }
+
+ const auto& response_module_data_so =
+ response[strings::msg_params][message_params::kModuleData];
+
+ if (0 == response_module_data_so.length()) {
+ SDL_LOG_TRACE("Module data subscription request not successful");
+ status.unsuccessful_module_subscriptions_.push_back(requested_module);
+ return;
+ }
+
+ const auto responsed_module_type_int =
+ static_cast<hmi_apis::Common_ModuleType::eType>(
+ response_module_data_so[message_params::kModuleType].asUInt());
+
+ const auto responsed_module_type_str =
+ module_types_str_mapping[responsed_module_type_int];
+
+ const auto response_module_id =
+ response_module_data_so[message_params::kModuleId].asString();
+ const ModuleUid responsed_module{responsed_module_type_str,
+ response_module_id};
+
+ bool is_subscribe_success = false;
+ if (response[application_manager::strings::msg_params].keyExists(
+ rc_rpc_plugin::message_params::kIsSubscribed)) {
+ is_subscribe_success =
+ response[application_manager::strings::msg_params]
+ [rc_rpc_plugin::message_params::kIsSubscribed]
+ .asBool();
+ }
+
+ const bool is_the_same_module = requested_module == responsed_module;
+
+ if (is_the_same_module && is_subscribe_success) {
+ SDL_LOG_TRACE("Module [" << requested_module.first << ":"
+ << requested_module.second
+ << "] was successfuly subscribed");
+ status.successful_module_subscriptions_.push_back(requested_module);
+ } else {
+ SDL_LOG_TRACE("Module [" << requested_module.first << ":"
+ << requested_module.second
+ << "] was NOT successfuly subscribed");
+ status.unsuccessful_module_subscriptions_.push_back(requested_module);
+ }
+}
+
+void ResumptionDataProcessorImpl::CheckCreateWindowResponse(
+ const smart_objects::SmartObject& request,
+ const smart_objects::SmartObject& response) const {
+ SDL_LOG_AUTO_TRACE();
+ const auto correlation_id =
+ response[strings::params][strings::correlation_id].asInt();
+
+ const auto& msg_params = request[strings::msg_params];
+ const auto app_id = msg_params[strings::app_id].asInt();
+
+ auto application = application_manager_.application(app_id);
+ if (!application) {
+ SDL_LOG_ERROR("Application is not registered by hmi id: " << app_id);
+ return;
+ }
+
+ const auto window_id = msg_params[strings::window_id].asInt();
+ if (!IsResponseSuccessful(response)) {
+ SDL_LOG_ERROR("UI_CreateWindow for correlation id: " << correlation_id
+ << " has failed");
+ auto& builder = application->display_capabilities_builder();
+ builder.ResetDisplayCapabilities();
+ return;
+ }
+
+ smart_objects::SmartObject window_info(smart_objects::SmartType_Map);
+ auto fill_optional_param = [&window_info,
+ &msg_params](const std::string& key) {
+ if (msg_params.keyExists(key)) {
+ window_info[key] = msg_params[key].asString();
+ }
+ };
+ fill_optional_param(strings::associated_service_type);
+ fill_optional_param(strings::duplicate_updates_from_window_id);
+
+ const auto window_name = msg_params[strings::window_name].asString();
+ window_info[strings::window_name] = window_name;
+ application->SetWindowInfo(window_id, window_info);
+
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ msg_params[strings::window_type].asInt());
+
+ // State should be initialized with INVALID_ENUM value to let state
+ // controller trigger OnHmiStatus notification sending
+ auto initial_state = application_manager_.CreateRegularState(
+ application,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_apis::SystemContext::INVALID_ENUM);
+ application->SetInitialState(window_id, window_name, initial_state);
+
+ // Default HMI level for all windows except the main one is always NONE
+ application_manager_.state_controller().OnAppWindowAdded(
+ application, window_id, window_type, mobile_apis::HMILevel::HMI_NONE);
+}
+
+} // namespace resumption
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 44a5af6f41..b8dad59830 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -37,7 +37,7 @@
namespace application_manager {
namespace rpc_handler {
-CREATE_LOGGERPTR_LOCAL(logger_, "RPCHandlerImpl")
+SDL_CREATE_LOG_VARIABLE("RPCHandlerImpl")
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
namespace jhs = ns_smart_device_link::ns_json_handler::strings;
namespace plugin_names = application_manager::plugin_manager::plugin_names;
@@ -60,7 +60,7 @@ RPCHandlerImpl::~RPCHandlerImpl() {}
void RPCHandlerImpl::ProcessMessageFromMobile(
const std::shared_ptr<Message> message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef TELEMETRY_MONITOR
AMTelemetryObserver::MessageMetricSharedPtr metric(
new AMTelemetryObserver::MessageMetric());
@@ -71,13 +71,13 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
bool allow_unknown_parameters = false;
DCHECK_OR_RETURN_VOID(so_from_mobile);
if (!so_from_mobile) {
- LOG4CXX_ERROR(logger_, "Null pointer");
+ SDL_LOG_ERROR("Null pointer");
return;
}
if (message->type() == application_manager::MessageType::kRequest &&
message->correlation_id() < 0) {
- LOG4CXX_ERROR(logger_, "Request correlation id < 0. Returning INVALID_ID");
+ SDL_LOG_ERROR("Request correlation id < 0. Returning INVALID_ID");
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(message->connection_key(),
message->function_id(),
@@ -102,9 +102,8 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
if (app_manager_.GetRPCService().IsAppServiceRPC(
message->function_id(), commands::Command::SOURCE_MOBILE) ||
rpc_passing) {
- LOG4CXX_DEBUG(logger_,
- "Allowing unknown parameters for request function "
- << message->function_id());
+ SDL_LOG_DEBUG("Allowing unknown parameters for request function "
+ << message->function_id());
allow_unknown_parameters = true;
}
@@ -114,7 +113,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
warning_info,
allow_unknown_parameters,
!rpc_passing)) {
- LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
+ SDL_LOG_ERROR("Cannot create smart object from message");
return;
}
@@ -136,7 +135,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
message_type)) {
// Since PassThrough failed, refiltering the message
if (!ConvertMessageToSO(*message, *so_from_mobile, warning_info)) {
- LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
+ SDL_LOG_ERROR("Cannot create smart object from message");
return;
}
}
@@ -148,7 +147,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
if (!app_manager_.GetRPCService().ManageMobileCommand(
so_from_mobile, commands::Command::SOURCE_MOBILE, warning_info)) {
- LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
+ SDL_LOG_ERROR("Received command didn't run successfully");
}
#ifdef TELEMETRY_MONITOR
metric->end = date_time::getCurrentTime();
@@ -160,7 +159,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
void RPCHandlerImpl::ProcessMessageFromHMI(
const std::shared_ptr<Message> message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr smart_object =
std::make_shared<smart_objects::SmartObject>();
bool allow_unknown_parameters = false;
@@ -174,9 +173,8 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
converted_result[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
if (app_manager_.GetRPCService().IsAppServiceRPC(
function_id, commands::Command::SOURCE_HMI)) {
- LOG4CXX_DEBUG(
- logger_,
- "Allowing unknown parameters for request function " << function_id);
+ SDL_LOG_DEBUG("Allowing unknown parameters for request function "
+ << function_id);
allow_unknown_parameters = true;
}
@@ -191,36 +189,35 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
(*smart_object)[strings::msg_params][strings::info] =
std::string("Invalid message received from vehicle");
} else {
- LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
+ SDL_LOG_ERROR("Cannot create smart object from message");
return;
}
}
if (!warning_info.empty()) {
- LOG4CXX_WARN(logger_,
- "Warning while parsing HMI message: " << warning_info);
+ SDL_LOG_WARN("Warning while parsing HMI message: " << warning_info);
}
- LOG4CXX_DEBUG(logger_, "Converted message, trying to create hmi command");
+ SDL_LOG_DEBUG("Converted message, trying to create hmi command");
if (!app_manager_.GetRPCService().ManageHMICommand(
smart_object, commands::Command::SOURCE_HMI, warning_info)) {
- LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
+ SDL_LOG_ERROR("Received command didn't run successfully");
}
}
void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_ERROR(logger_, "Null-pointer message received.");
+ SDL_LOG_ERROR("Null-pointer message received.");
return;
}
if (app_manager_.is_stopping()) {
- LOG4CXX_INFO(logger_, "Application manager is stopping");
+ SDL_LOG_INFO("Application manager is stopping");
return;
}
if (app_manager_.IsLowVoltage()) {
- LOG4CXX_ERROR(logger_, "Low Voltage is active.");
+ SDL_LOG_ERROR("Low Voltage is active.");
return;
}
@@ -228,14 +225,14 @@ void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) {
}
void RPCHandlerImpl::Handle(const impl::MessageFromHmi message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_ERROR(logger_, "Null-pointer message received.");
+ SDL_LOG_ERROR("Null-pointer message received.");
return;
}
if (app_manager_.IsLowVoltage()) {
- LOG4CXX_ERROR(logger_, "Low Voltage is active.");
+ SDL_LOG_ERROR("Low Voltage is active.");
return;
}
@@ -244,15 +241,15 @@ void RPCHandlerImpl::Handle(const impl::MessageFromHmi message) {
void RPCHandlerImpl::OnMessageReceived(
const protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app_manager_.IsLowVoltage()) {
- LOG4CXX_ERROR(logger_, "Low Voltage is active.");
+ SDL_LOG_ERROR("Low Voltage is active.");
return;
}
if (!message) {
- LOG4CXX_ERROR(logger_, "Null-pointer message received.");
+ SDL_LOG_ERROR("Null-pointer message received.");
NOTREACHED();
return;
}
@@ -260,7 +257,7 @@ void RPCHandlerImpl::OnMessageReceived(
std::shared_ptr<Message> outgoing_message = ConvertRawMsgToMessage(message);
if (outgoing_message) {
- LOG4CXX_DEBUG(logger_, "Posting new Message");
+ SDL_LOG_DEBUG("Posting new Message");
messages_from_mobile_.PostMessage(
impl::MessageFromMobile(outgoing_message));
}
@@ -268,15 +265,15 @@ void RPCHandlerImpl::OnMessageReceived(
void RPCHandlerImpl::OnMobileMessageSent(
const protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void RPCHandlerImpl::OnMessageReceived(
hmi_message_handler::MessageSharedPointer message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_ERROR(logger_, "Null-pointer message received.");
+ SDL_LOG_ERROR("Null-pointer message received.");
NOTREACHED();
return;
}
@@ -335,11 +332,10 @@ bool RPCHandlerImpl::ConvertMessageToSO(
std::string& out_warning_info,
const bool allow_unknown_parameters,
const bool validate_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "\t\t\tMessage to convert: protocol "
- << message.protocol_version() << "; json "
- << message.json_message());
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("\t\t\tMessage to convert: protocol "
+ << message.protocol_version() << "; json "
+ << message.json_message());
switch (message.protocol_version()) {
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5:
@@ -371,10 +367,9 @@ bool RPCHandlerImpl::ConvertMessageToSO(
(validate_params &&
!ValidateRpcSO(
output, msg_version, report, allow_unknown_parameters))) {
- LOG4CXX_WARN(logger_,
- "Failed to parse string to smart object with API version "
- << msg_version.toString() << " : "
- << message.json_message());
+ SDL_LOG_WARN("Failed to parse string to smart object with API version "
+ << msg_version.toString() << " : "
+ << message.json_message());
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
@@ -391,9 +386,8 @@ bool RPCHandlerImpl::ConvertMessageToSO(
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Convertion result for sdl object is true function_id "
- << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ SDL_LOG_DEBUG("Convertion result for sdl object is true function_id "
+ << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
// Populate any warning info generated during the validation process
out_warning_info = rpc::PrettyFormat(report);
@@ -404,11 +398,9 @@ bool RPCHandlerImpl::ConvertMessageToSO(
message.protocol_version();
if (message.binary_data()) {
if (message.payload_size() < message.data_size()) {
- LOG4CXX_ERROR(logger_,
- "Incomplete binary"
- << " binary size should be " << message.data_size()
- << " payload data size is "
- << message.payload_size());
+ SDL_LOG_ERROR("Incomplete binary"
+ << " binary size should be " << message.data_size()
+ << " payload data size is " << message.payload_size());
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
message.connection_key(),
@@ -431,12 +423,11 @@ bool RPCHandlerImpl::ConvertMessageToSO(
formatters::FormatterJsonRpc::FromString<
hmi_apis::FunctionID::eType,
hmi_apis::messageType::eType>(message.json_message(), output);
- LOG4CXX_DEBUG(logger_,
- "Convertion result: "
- << result << " function id "
- << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ SDL_LOG_DEBUG("Convertion result: "
+ << result << " function id "
+ << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
if (!hmi_so_factory().attachSchema(output, true)) {
- LOG4CXX_WARN(logger_, "Failed to attach schema to object.");
+ SDL_LOG_WARN("Failed to attach schema to object.");
return false;
}
@@ -447,9 +438,8 @@ bool RPCHandlerImpl::ConvertMessageToSO(
smart_objects::errors::OK !=
output.validate(
&report, empty_version, allow_unknown_parameters)) {
- LOG4CXX_ERROR(
- logger_,
- "Incorrect parameter from HMI - " << rpc::PrettyFormat(report));
+ SDL_LOG_ERROR("Incorrect parameter from HMI - "
+ << rpc::PrettyFormat(report));
return HandleWrongMessageType(output, report);
}
@@ -459,7 +449,7 @@ bool RPCHandlerImpl::ConvertMessageToSO(
static ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra v1_shema;
if (message.function_id() == 0 || message.type() == kUnknownType) {
- LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION");
+ SDL_LOG_ERROR("Message received: UNSUPPORTED_VERSION");
int32_t conversation_result =
formatters::CFormatterJsonSDLRPCv1::fromString<
@@ -493,27 +483,26 @@ bool RPCHandlerImpl::ConvertMessageToSO(
break;
}
default:
- LOG4CXX_WARN(logger_,
- "Application used unsupported protocol :"
- << message.protocol_version() << ".");
+ SDL_LOG_WARN("Application used unsupported protocol :"
+ << message.protocol_version() << ".");
return false;
}
output[strings::params][strings::protection] = message.is_message_encrypted();
- LOG4CXX_DEBUG(logger_, "Successfully parsed message into smart object");
+ SDL_LOG_DEBUG("Successfully parsed message into smart object");
return true;
}
bool RPCHandlerImpl::HandleWrongMessageType(
smart_objects::SmartObject& output, rpc::ValidationReport report) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (output[strings::params][strings::message_type].asInt()) {
case application_manager::MessageType::kNotification: {
- LOG4CXX_ERROR(logger_, "Ignore wrong HMI notification");
+ SDL_LOG_ERROR("Ignore wrong HMI notification");
return false;
}
case application_manager::MessageType::kRequest: {
- LOG4CXX_ERROR(logger_, "Received invalid data on HMI request");
+ SDL_LOG_ERROR("Received invalid data on HMI request");
output.erase(strings::msg_params);
output[strings::params].erase(hmi_response::message);
output[strings::params][hmi_response::code] =
@@ -524,15 +513,15 @@ bool RPCHandlerImpl::HandleWrongMessageType(
return true;
}
case application_manager::MessageType::kResponse: {
- LOG4CXX_ERROR(logger_, "Received invalid data on HMI response");
+ SDL_LOG_ERROR("Received invalid data on HMI response");
break;
}
case application_manager::MessageType::kUnknownType: {
- LOG4CXX_ERROR(logger_, "Received unknown type data on HMI");
+ SDL_LOG_ERROR("Received unknown type data on HMI");
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received error response on HMI");
+ SDL_LOG_ERROR("Received error response on HMI");
break;
}
}
@@ -553,7 +542,7 @@ bool RPCHandlerImpl::ValidateRpcSO(smart_objects::SmartObject& message,
message, !allow_unknown_parameters, msg_version, &report_out) ||
message.validate(&report_out, msg_version, allow_unknown_parameters) !=
smart_objects::errors::OK) {
- LOG4CXX_WARN(logger_, "Failed to parse string to smart object");
+ SDL_LOG_WARN("Failed to parse string to smart object");
return false;
}
return true;
@@ -561,15 +550,15 @@ bool RPCHandlerImpl::ValidateRpcSO(smart_objects::SmartObject& message,
std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage(
const protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(message);
std::shared_ptr<Message> outgoing_message;
- LOG4CXX_DEBUG(logger_, "Service type." << message->service_type());
+ SDL_LOG_DEBUG("Service type." << message->service_type());
if (message->service_type() != protocol_handler::kRpc &&
message->service_type() != protocol_handler::kBulk) {
// skip this message, not under handling of ApplicationManager
- LOG4CXX_TRACE(logger_, "Skipping message; not the under AM handling.");
+ SDL_LOG_TRACE("Skipping message; not the under AM handling.");
return outgoing_message;
}
@@ -579,7 +568,7 @@ std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage(
if (convertion_result) {
outgoing_message = std::shared_ptr<Message>(convertion_result);
} else {
- LOG4CXX_ERROR(logger_, "Received invalid message");
+ SDL_LOG_ERROR("Received invalid message");
}
return outgoing_message;
diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc
index 7f72632bb1..74a865ff4f 100644
--- a/src/components/application_manager/src/rpc_passing_handler.cc
+++ b/src/components/application_manager/src/rpc_passing_handler.cc
@@ -52,7 +52,7 @@
#include "smart_objects/enum_schema_item.h"
#include "utils/timer_task_impl.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "RPCPassingHandler")
+SDL_CREATE_LOG_VARIABLE("RPCPassingHandler")
namespace application_manager {
@@ -98,12 +98,12 @@ bool RPCPassingHandler::ExtractRPCParams(
const smart_objects::SmartObject& s_map,
const ApplicationSharedPtr app,
const std::string& function_id_str) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RPCParams params;
if (smart_objects::SmartType_Map == s_map.getType()) {
for (auto iter = s_map.map_begin(); iter != s_map.map_end(); ++iter) {
- LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
+ SDL_LOG_DEBUG("Request's param: " << iter->first);
params.insert(iter->first);
}
}
@@ -131,7 +131,7 @@ bool RPCPassingHandler::ExtractRPCParams(
bool RPCPassingHandler::IsPassthroughAllowed(
smart_objects::SmartObject rpc_message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t connection_key =
rpc_message[strings::params][strings::connection_key].asUInt();
ApplicationSharedPtr app = app_manager_.application(connection_key);
@@ -162,31 +162,30 @@ bool RPCPassingHandler::IsPassthroughAllowed(
}
bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t correlation_id =
rpc_message[strings::params][strings::correlation_id].asUInt();
int32_t message_type =
rpc_message[strings::params][strings::message_type].asInt();
- LOG4CXX_DEBUG(logger_, "RPC_PASSING: ");
+ SDL_LOG_DEBUG("RPC_PASSING: ");
MessageHelper::PrintSmartObject(rpc_message);
// Clear timers for timed out requests
ClearCompletedTimers();
switch (message_type) {
case MessageType::kRequest: {
- LOG4CXX_DEBUG(logger_, "Handle request");
+ SDL_LOG_DEBUG("Handle request");
rpc_request_queue_lock_.Acquire();
if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
rpc_request_queue_lock_.Release();
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Correlation id DOES NOT exist in map. Constructing request queue");
PopulateRPCRequestQueue(rpc_message);
} else {
rpc_request_queue_lock_.Release();
- LOG4CXX_DEBUG(logger_, "Correlation id DOES exist in map. Returning");
+ SDL_LOG_DEBUG("Correlation id DOES exist in map. Returning");
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
rpc_message[strings::params][strings::connection_key].asUInt(),
@@ -204,8 +203,7 @@ bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) {
rpc_request_queue_lock_.Acquire();
if (rpc_request_queue[correlation_id].second.empty()) {
- LOG4CXX_DEBUG(logger_,
- "No services left in map. Using core to handle request");
+ SDL_LOG_DEBUG("No services left in map. Using core to handle request");
rpc_request_queue.erase(correlation_id);
rpc_request_queue_lock_.Release();
return false;
@@ -219,7 +217,7 @@ bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) {
}
case MessageType::kResponse: {
- LOG4CXX_DEBUG(logger_, "Handle response");
+ SDL_LOG_DEBUG("Handle response");
rpc_request_queue_lock_.Acquire();
if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
rpc_request_queue_lock_.Release();
@@ -235,11 +233,11 @@ bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) {
&result_code);
if (result_code == mobile_apis::Result::UNSUPPORTED_REQUEST) {
- LOG4CXX_DEBUG(logger_, "Service sent UNSUPPORTED_REQUEST");
+ SDL_LOG_DEBUG("Service sent UNSUPPORTED_REQUEST");
PerformNextRequest(correlation_id);
return true;
} else {
- LOG4CXX_DEBUG(logger_, "Valid RPC passing response");
+ SDL_LOG_DEBUG("Valid RPC passing response");
ForwardResponseToMobile(correlation_id, rpc_message);
return true;
}
@@ -285,16 +283,14 @@ void RPCPassingHandler::PopulateRPCRequestQueue(
sync_primitives::AutoLock lock(rpc_request_queue_lock_);
rpc_request_queue[correlation_id] = entry;
- LOG4CXX_DEBUG(logger_,
- "Added " << rpc_request_queue[correlation_id].second.size()
+ SDL_LOG_DEBUG("Added " << rpc_request_queue[correlation_id].second.size()
<< " requests to the queue");
}
void RPCPassingHandler::ForwardRequestToMobile(uint32_t correlation_id) {
rpc_request_queue_lock_.Acquire();
uint32_t connection_key =
rpc_request_queue[correlation_id].second.front().connection_key;
- LOG4CXX_DEBUG(logger_,
- "Forwarding request to service with app id " << connection_key);
+ SDL_LOG_DEBUG("Forwarding request to service with app id " << connection_key);
smart_objects::SmartObject message(rpc_request_queue[correlation_id].first);
message[strings::params][strings::connection_key] = connection_key;
@@ -306,8 +302,7 @@ void RPCPassingHandler::ForwardRequestToMobile(uint32_t correlation_id) {
}
void RPCPassingHandler::ForwardRequestToCore(uint32_t correlation_id) {
- LOG4CXX_DEBUG(logger_,
- "No services left in map. using core to handle request");
+ SDL_LOG_DEBUG("No services left in map. using core to handle request");
rpc_request_queue_lock_.Acquire();
smart_objects::SmartObject message(rpc_request_queue[correlation_id].first);
smart_objects::SmartObjectSPtr result =
@@ -354,8 +349,7 @@ void RPCPassingHandler::ForwardResponseToMobile(
.asUInt();
rpc_request_queue_lock_.Release();
- LOG4CXX_DEBUG(logger_,
- "Forwarding response to mobile app " << origin_connection_key);
+ SDL_LOG_DEBUG("Forwarding response to mobile app " << origin_connection_key);
smart_objects::SmartObject message(response_message);
message[strings::params][strings::connection_key] = origin_connection_key;
smart_objects::SmartObjectSPtr result =
@@ -364,10 +358,10 @@ void RPCPassingHandler::ForwardResponseToMobile(
}
bool RPCPassingHandler::PerformNextRequest(uint32_t correlation_id) {
- LOG4CXX_DEBUG(logger_, "Performing next request in queue");
+ SDL_LOG_DEBUG("Performing next request in queue");
rpc_request_queue_lock_.Acquire();
if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
- LOG4CXX_ERROR(logger_, "Correlation id does NOT exist in map");
+ SDL_LOG_ERROR("Correlation id does NOT exist in map");
rpc_request_queue_lock_.Release();
return false;
}
@@ -386,7 +380,7 @@ bool RPCPassingHandler::PerformNextRequest(uint32_t correlation_id) {
void RPCPassingHandler::OnPassThroughRequestTimeout() {
timeout_queue_lock_.Acquire();
- LOG4CXX_DEBUG(logger_, "Request Timed out");
+ SDL_LOG_DEBUG("Request Timed out");
auto timeout_entry = timeout_queue_.front();
uint32_t correlation_id = timeout_entry.second;
timeout_queue_lock_.Release();
@@ -396,13 +390,12 @@ void RPCPassingHandler::OnPassThroughRequestTimeout() {
void RPCPassingHandler::ClearCompletedTimers() {
sync_primitives::AutoLock lock(timeout_queue_lock_);
- LOG4CXX_DEBUG(logger_, "Clearing Completed Timers");
+ SDL_LOG_DEBUG("Clearing Completed Timers");
for (auto it = timeout_queue_.begin(); it != timeout_queue_.end();) {
TimerSPtr timer = it->first;
if (timer->is_completed()) {
- LOG4CXX_DEBUG(
- logger_,
- "Removing completed timer for correlation id " << it->second);
+ SDL_LOG_DEBUG("Removing completed timer for correlation id "
+ << it->second);
it = timeout_queue_.erase(it);
} else {
++it;
@@ -418,9 +411,8 @@ void RPCPassingHandler::AddRequestTimer(uint32_t correlation_id) {
const uint32_t timeout_ms =
app_manager_.get_settings().rpc_pass_through_timeout();
rpc_passing_timer->Start(timeout_ms, timer::kSingleShot);
- LOG4CXX_DEBUG(
- logger_,
- "Adding and starting timer for correlation id " << correlation_id);
+ SDL_LOG_DEBUG("Adding and starting timer for correlation id "
+ << correlation_id);
sync_primitives::AutoLock lock(timeout_queue_lock_);
timeout_queue_.push_back(std::make_pair(rpc_passing_timer, correlation_id));
}
@@ -432,8 +424,7 @@ void RPCPassingHandler::RemoveRequestTimer(uint32_t correlation_id) {
TimerSPtr timer = it->first;
uint32_t cid = it->second;
if (cid == correlation_id) {
- LOG4CXX_DEBUG(logger_,
- "Removing timer for correlation id " << correlation_id);
+ SDL_LOG_DEBUG("Removing timer for correlation id " << correlation_id);
it = timeout_queue_.erase(it);
} else {
++it;
diff --git a/src/components/application_manager/src/rpc_protection_manager_impl.cc b/src/components/application_manager/src/rpc_protection_manager_impl.cc
index 4afceb9e5b..64b732ddb2 100644
--- a/src/components/application_manager/src/rpc_protection_manager_impl.cc
+++ b/src/components/application_manager/src/rpc_protection_manager_impl.cc
@@ -35,7 +35,7 @@
#include "application_manager/message_helper.h"
#include "utils/helpers.h"
-CREATE_LOGGERPTR_LOCAL(logger_, "RPCProtectionManagerImpl");
+SDL_CREATE_LOG_VARIABLE("RPCProtectionManagerImpl");
namespace application_manager {
@@ -51,33 +51,33 @@ std::vector<std::string> kExceptionRPCs = {"RegisterAppInterface",
RPCProtectionManagerImpl::RPCProtectionManagerImpl(
policy::PolicyHandlerInterface& policy_handler)
: policy_handler_(policy_handler) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool RPCProtectionManagerImpl::CheckPolicyEncryptionFlag(
const uint32_t function_id,
const ApplicationSharedPtr app,
const bool is_rpc_service_secure) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto& policy_encryption_flag_getter =
policy_handler_.PolicyEncryptionFlagGetter();
if (!policy_encryption_flag_getter) {
- LOG4CXX_ERROR(logger_, "Policy Encryption Flag getter is not inited");
+ SDL_LOG_ERROR("Policy Encryption Flag getter is not inited");
return false;
}
const std::string function_name =
policy_encryption_flag_getter->GetPolicyFunctionName(function_id);
- LOG4CXX_DEBUG(logger_, "Function for check is " << function_name);
+ SDL_LOG_DEBUG("Function for check is " << function_name);
if (!is_rpc_service_secure && IsExceptionRPC(function_id)) {
- LOG4CXX_WARN(logger_,
- "Exception RPC can be sent in an non secure service despite "
- "encryption required flag");
+ SDL_LOG_WARN(
+ "Exception RPC can be sent in an non secure service despite "
+ "encryption required flag");
return false;
}
if (!app) {
- LOG4CXX_WARN(logger_, "Received app nullptr");
+ SDL_LOG_WARN("Received app nullptr");
return false;
}
@@ -88,14 +88,13 @@ bool RPCProtectionManagerImpl::CheckPolicyEncryptionFlag(
bool RPCProtectionManagerImpl::IsEncryptionRequiredByPolicy(
const std::string& policy_app_id, const std::string& function_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto it = encrypted_rpcs_.find(policy_app_id);
if (encrypted_rpcs_.end() == it) {
- LOG4CXX_WARN(
- logger_,
- "App specific policies for app: " << policy_app_id << " not found");
+ SDL_LOG_WARN("App specific policies for app: " << policy_app_id
+ << " not found");
it = encrypted_rpcs_.find(policy_table::kDefaultApp);
return encrypted_rpcs_.end() != it
? (*it).second.find(function_name) != (*it).second.end()
@@ -107,8 +106,8 @@ bool RPCProtectionManagerImpl::IsEncryptionRequiredByPolicy(
bool RPCProtectionManagerImpl::IsInEncryptionNeededCache(
const uint32_t app_id, const uint32_t correlation_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "correlation_id is " << correlation_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("correlation_id is " << correlation_id);
return encryption_needed_cache_.find(std::make_pair(
app_id, correlation_id)) != encryption_needed_cache_.end();
@@ -124,44 +123,43 @@ bool RPCProtectionManagerImpl::IsExceptionRPC(
void RPCProtectionManagerImpl::AddToEncryptionNeededCache(
const uint32_t app_id, const uint32_t correlation_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(message_needed_encryption_lock_);
- LOG4CXX_DEBUG(logger_, "Adding rpc with correlation id: " << correlation_id);
+ SDL_LOG_DEBUG("Adding rpc with correlation id: " << correlation_id);
encryption_needed_cache_.insert(std::make_pair(app_id, correlation_id));
}
void RPCProtectionManagerImpl::RemoveFromEncryptionNeededCache(
const uint32_t app_id, const uint32_t correlation_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(message_needed_encryption_lock_);
- LOG4CXX_DEBUG(logger_,
- "Removing rpc with correlation id: " << correlation_id);
+ SDL_LOG_DEBUG("Removing rpc with correlation id: " << correlation_id);
encryption_needed_cache_.erase(std::make_pair(app_id, correlation_id));
}
void RPCProtectionManagerImpl::OnPTUFinished(const bool ptu_result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(encrypted_rpcs_lock_);
if (ptu_result) {
- LOG4CXX_TRACE(logger_,
- "PTU finished successfully, commencing internal encrypted "
- "RPC cache update");
+ SDL_LOG_TRACE(
+ "PTU finished successfully, commencing internal encrypted "
+ "RPC cache update");
encrypted_rpcs_.clear();
SaveEncryptedRPC();
} else {
- LOG4CXX_WARN(logger_,
- "PTU was unsuccessful. Keeping internal RPC cache from "
- "current snapshot");
+ SDL_LOG_WARN(
+ "PTU was unsuccessful. Keeping internal RPC cache from "
+ "current snapshot");
}
}
void RPCProtectionManagerImpl::SaveEncryptedRPC() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto policy_encryption_flag_getter =
policy_handler_.PolicyEncryptionFlagGetter();
@@ -170,14 +168,14 @@ void RPCProtectionManagerImpl::SaveEncryptedRPC() {
policy_encryption_flag_getter->GetApplicationPolicyIDs();
for (const auto& app : policy_policy_app_ids) {
- LOG4CXX_DEBUG(logger_, "Processing app name: " << app);
+ SDL_LOG_DEBUG("Processing app name: " << app);
encrypted_rpcs_[app] = GetEncryptedRPCsForApp(app);
}
}
void RPCProtectionManagerImpl::OnPTInited() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
encrypted_rpcs_.clear();
@@ -187,7 +185,7 @@ void RPCProtectionManagerImpl::OnPTInited() {
RPCProtectionManagerImpl::FunctionNames
RPCProtectionManagerImpl::GetEncryptedRPCsForApp(
const std::string& policy_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionNames encrypted_rpcs;
const auto policy_encryption_flag_getter =
@@ -200,11 +198,11 @@ RPCProtectionManagerImpl::GetEncryptedRPCsForApp(
const auto function_groups =
policy_encryption_flag_getter->GetFunctionalGroupsForApp(policy_app_id);
- auto fill_encrypted_rpcs = [&encrypted_rpcs](
- const std::string& function_name) {
- LOG4CXX_DEBUG(logger_, "Adding required encryprion rpc: " << function_name);
- encrypted_rpcs.insert(function_name);
- };
+ auto fill_encrypted_rpcs =
+ [&encrypted_rpcs](const std::string& function_name) {
+ SDL_LOG_DEBUG("Adding required encryprion rpc: " << function_name);
+ encrypted_rpcs.insert(function_name);
+ };
for (const auto& function_group : function_groups) {
if (policy_encryption_flag_getter->FunctionGroupNeedEncryption(
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index c7959c2386..248db00729 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -41,7 +41,7 @@
namespace application_manager {
namespace rpc_service {
-CREATE_LOGGERPTR_LOCAL(logger_, "RPCServiceImpl")
+SDL_CREATE_LOG_VARIABLE("RPCServiceImpl")
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
namespace jhs = ns_smart_device_link::ns_json_handler::strings;
namespace plugin_names = application_manager::plugin_manager::plugin_names;
@@ -69,7 +69,7 @@ RPCServiceImpl::RPCServiceImpl(
RPCServiceImpl::~RPCServiceImpl() {}
void RPCServiceImpl::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
messages_to_mobile_.Shutdown();
messages_to_hmi_.Shutdown();
@@ -79,7 +79,7 @@ EncryptionFlagCheckResult RPCServiceImpl::IsEncryptionRequired(
const smart_objects::SmartObject& message,
std::shared_ptr<Application> app,
const bool is_rpc_service_secure) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto function_id =
message[strings::params][strings::function_id].asUInt();
const auto correlation_id =
@@ -122,15 +122,15 @@ bool RPCServiceImpl::ManageMobileCommand(
const commands::MessageSharedPtr message,
commands::Command::CommandSource source,
const std::string warning_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_WARN(logger_, "Null-pointer message received.");
+ SDL_LOG_WARN("Null-pointer message received.");
return false;
}
if (app_manager_.IsLowVoltage()) {
- LOG4CXX_WARN(logger_, "Low Voltage is active");
+ SDL_LOG_WARN("Low Voltage is active");
return false;
}
@@ -165,7 +165,7 @@ bool RPCServiceImpl::ManageMobileCommand(
(mobile_apis::FunctionID::UnregisterAppInterfaceID != function_id)) {
app = app_manager_.application(connection_key);
if (!app) {
- LOG4CXX_ERROR(logger_, "RET APPLICATION_NOT_REGISTERED");
+ SDL_LOG_ERROR("RET APPLICATION_NOT_REGISTERED");
smart_objects::SmartObjectSPtr response =
MessageHelper::CreateNegativeResponse(
connection_key,
@@ -197,7 +197,7 @@ bool RPCServiceImpl::ManageMobileCommand(
auto plugin =
app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
if (!plugin) {
- LOG4CXX_WARN(logger_, "Failed to find plugin : " << plugin.error());
+ SDL_LOG_WARN("Failed to find plugin : " << plugin.error());
CheckSourceForUnsupportedRequest(message, source);
return false;
}
@@ -205,7 +205,7 @@ bool RPCServiceImpl::ManageMobileCommand(
auto command = factory.CreateCommand(message, source);
if (!command) {
- LOG4CXX_WARN(logger_, "Failed to create mobile command from smart object");
+ SDL_LOG_WARN("Failed to create mobile command from smart object");
return false;
}
@@ -257,12 +257,11 @@ bool RPCServiceImpl::ManageMobileCommand(
request_ctrl_.addMobileRequest(command, app_hmi_level);
if (result == request_controller::RequestController::SUCCESS) {
- LOG4CXX_DEBUG(logger_, "Perform request");
+ SDL_LOG_DEBUG("Perform request");
} else if (result == request_controller::RequestController::
TOO_MANY_PENDING_REQUESTS) {
- LOG4CXX_ERROR(logger_,
- "RET Unable top perform request: "
- << "TOO_MANY_PENDING_REQUESTS");
+ SDL_LOG_ERROR("RET Unable top perform request: "
+ << "TOO_MANY_PENDING_REQUESTS");
smart_objects::SmartObjectSPtr response =
MessageHelper::CreateNegativeResponse(
@@ -280,9 +279,8 @@ bool RPCServiceImpl::ManageMobileCommand(
return false;
} else if (result ==
request_controller::RequestController::TOO_MANY_REQUESTS) {
- LOG4CXX_ERROR(logger_,
- "RET Unable to perform request: "
- << "TOO_MANY_REQUESTS");
+ SDL_LOG_ERROR("RET Unable to perform request: "
+ << "TOO_MANY_REQUESTS");
ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
@@ -301,9 +299,8 @@ bool RPCServiceImpl::ManageMobileCommand(
return false;
} else if (result == request_controller::RequestController::
NONE_HMI_LEVEL_MANY_REQUESTS) {
- LOG4CXX_ERROR(logger_,
- "RET Unable to perform request: "
- << "REQUEST_WHILE_IN_NONE_HMI_LEVEL");
+ SDL_LOG_ERROR("RET Unable to perform request: "
+ << "REQUEST_WHILE_IN_NONE_HMI_LEVEL");
ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
@@ -320,13 +317,13 @@ bool RPCServiceImpl::ManageMobileCommand(
connection_key, mobile_apis::Result::INVALID_ENUM, false);
return false;
} else {
- LOG4CXX_ERROR(logger_, "RET Unable to perform request: Unknown case");
+ SDL_LOG_ERROR("RET Unable to perform request: Unknown case");
return false;
}
return true;
}
- LOG4CXX_ERROR(logger_, "RET UNKNOWN MESSAGE TYPE " << message_type);
+ SDL_LOG_ERROR("RET UNKNOWN MESSAGE TYPE " << message_type);
return false;
}
@@ -338,15 +335,15 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
commands::Command::CommandSource source,
const std::string warning_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_WARN(logger_, "Null-pointer message received.");
+ SDL_LOG_WARN("Null-pointer message received.");
return false;
}
if (app_manager_.IsLowVoltage()) {
- LOG4CXX_WARN(logger_, "Low Voltage is active");
+ SDL_LOG_WARN("Low Voltage is active");
return false;
}
@@ -356,7 +353,7 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
auto plugin =
app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
if (!plugin) {
- LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error());
+ SDL_LOG_WARN("Filed to find plugin : " << plugin.error());
return false;
}
@@ -364,7 +361,7 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
auto command = factory.CreateCommand(message, source);
if (!command) {
- LOG4CXX_WARN(logger_, "Failed to create command from smart object");
+ SDL_LOG_WARN("Failed to create command from smart object");
return false;
}
@@ -386,7 +383,7 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
(*(message.get()))[strings::params][strings::message_type].asInt();
if (kRequest == message_type) {
- LOG4CXX_DEBUG(logger_, "ManageHMICommand");
+ SDL_LOG_DEBUG("ManageHMICommand");
command->set_warning_info(warning_info);
request_ctrl_.addHMIRequest(command);
}
@@ -406,21 +403,20 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
}
void RPCServiceImpl::Handle(const impl::MessageToHmi message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!hmi_handler_) {
- LOG4CXX_ERROR(logger_, "Observer is not set for HMIMessageHandler");
+ SDL_LOG_ERROR("Observer is not set for HMIMessageHandler");
return;
}
hmi_handler_->SendMessageToHMI(message);
- LOG4CXX_INFO(logger_, "Message for HMI given away");
+ SDL_LOG_INFO("Message for HMI given away");
}
void RPCServiceImpl::Handle(const impl::MessageToMobile message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!protocol_handler_) {
- LOG4CXX_WARN(logger_,
- "Protocol Handler is not set; cannot send message to mobile.");
+ SDL_LOG_WARN("Protocol Handler is not set; cannot send message to mobile.");
return;
}
@@ -428,7 +424,7 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) {
MobileMessageHandler::HandleOutgoingMessageProtocol(message));
if (!rawMessage) {
- LOG4CXX_ERROR(logger_, "Failed to create raw message.");
+ SDL_LOG_ERROR("Failed to create raw message.");
return;
}
@@ -458,9 +454,9 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) {
correlation_id);
if (needs_encryption && !is_service_secure) {
- LOG4CXX_WARN(logger_,
- "Unable to send rpc that requires encryption without secure "
- "rpc service");
+ SDL_LOG_WARN(
+ "Unable to send rpc that requires encryption without secure "
+ "rpc service");
return;
};
@@ -468,7 +464,7 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) {
rawMessage, needs_encryption, is_final);
rpc_protection_manager_->RemoveFromEncryptionNeededCache(app_id,
correlation_id);
- LOG4CXX_INFO(logger_, "Message for mobile given away");
+ SDL_LOG_INFO("Message for mobile given away");
if (close_session) {
app_manager_.connection_handler().CloseSession(message->connection_key(),
@@ -479,16 +475,16 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) {
void RPCServiceImpl::SendMessageToMobile(
const application_manager::commands::MessageSharedPtr message,
bool final_message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_ERROR(logger_, "Null-pointer message received.");
+ SDL_LOG_ERROR("Null-pointer message received.");
NOTREACHED();
return;
}
if (!protocol_handler_) {
- LOG4CXX_WARN(logger_, "No Protocol Handler set");
+ SDL_LOG_WARN("No Protocol Handler set");
return;
}
@@ -500,7 +496,7 @@ void RPCServiceImpl::SendMessageToMobile(
bool allow_unknown_parameters = false;
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with connection key");
+ SDL_LOG_ERROR("No application associated with connection key");
if (is_result_code_exists &&
((*message)[strings::msg_params][strings::result_code] ==
ns_smart_device_link_rpc::V1::Result::UNSUPPORTED_VERSION)) {
@@ -532,9 +528,8 @@ void RPCServiceImpl::SendMessageToMobile(
if (IsAppServiceRPC(function_id,
commands::Command::CommandSource::SOURCE_SDL) ||
rpc_passing) {
- LOG4CXX_DEBUG(
- logger_,
- "Allowing unknown parameters for response function " << function_id);
+ SDL_LOG_DEBUG("Allowing unknown parameters for response function "
+ << function_id);
allow_unknown_parameters = true;
}
@@ -552,13 +547,12 @@ void RPCServiceImpl::SendMessageToMobile(
(*message)[strings::params][strings::function_id].asUInt());
mobile_so_factory().attachSchema(*message, false);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Attached schema to message, result if valid: " << message->isValid());
if (!ConvertSOtoMessage(
(*message), (*message_to_send), allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string");
+ SDL_LOG_WARN("Can't send msg to Mobile: failed to create string");
return;
}
@@ -582,7 +576,7 @@ void RPCServiceImpl::SendMessageToMobile(
for (; iter != iter_end; ++iter) {
if (true == iter->second.asBool()) {
- LOG4CXX_INFO(logger_, "Request's param: " << iter->first);
+ SDL_LOG_INFO("Request's param: " << iter->first);
params.insert(iter->first);
}
}
@@ -593,8 +587,7 @@ void RPCServiceImpl::SendMessageToMobile(
app_manager_.CheckPolicyPermissions(
app, window_id, string_functionID, params);
if (mobile_apis::Result::SUCCESS != check_result) {
- LOG4CXX_WARN(logger_,
- "Function \"" << string_functionID << "\" (#"
+ SDL_LOG_WARN("Function \"" << string_functionID << "\" (#"
<< api_function_id
<< ") not allowed by policy");
return;
@@ -612,8 +605,7 @@ void RPCServiceImpl::SendMessageToMobile(
}
if (message_to_send->binary_data()) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Binary data size: " << message_to_send->binary_data()->size());
}
messages_to_mobile_.PostMessage(
@@ -622,15 +614,15 @@ void RPCServiceImpl::SendMessageToMobile(
void RPCServiceImpl::SendMessageToHMI(
const commands::MessageSharedPtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_WARN(logger_, "Null-pointer message received.");
+ SDL_LOG_WARN("Null-pointer message received.");
NOTREACHED();
return;
}
if (!hmi_handler_) {
- LOG4CXX_WARN(logger_, "No HMI Handler set");
+ SDL_LOG_WARN("No HMI Handler set");
return;
}
@@ -639,28 +631,25 @@ void RPCServiceImpl::SendMessageToHMI(
std::shared_ptr<Message> message_to_send(
new Message(protocol_handler::MessagePriority::kDefault));
if (!message_to_send) {
- LOG4CXX_ERROR(logger_, "Null pointer");
+ SDL_LOG_ERROR("Null pointer");
return;
}
hmi_so_factory().attachSchema(*message, false);
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
"Attached schema to message, result if valid: " << message->isValid());
if (IsAppServiceRPC((*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt(),
commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) {
- LOG4CXX_DEBUG(logger_,
- "Allowing unknown parameters for response function "
- << (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ SDL_LOG_DEBUG("Allowing unknown parameters for response function "
+ << (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
allow_unknown_parameters = true;
}
if (!ConvertSOtoMessage(
*message, *message_to_send, allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_,
- "Cannot send message to HMI: failed to create string");
+ SDL_LOG_WARN("Cannot send message to HMI: failed to create string");
return;
}
messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send));
@@ -716,16 +705,15 @@ bool RPCServiceImpl::ConvertSOtoMessage(
const ns_smart_device_link::ns_smart_objects::SmartObject& message,
Message& output,
const bool allow_unknown_parameters) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (smart_objects::SmartType_Null == message.getType() ||
smart_objects::SmartType_Invalid == message.getType()) {
- LOG4CXX_WARN(logger_, "Invalid smart object received.");
+ SDL_LOG_WARN("Invalid smart object received.");
return false;
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Message with protocol: " << message.getElement(jhs::S_PARAMS)
.getElement(jhs::S_PROTOCOL_TYPE)
.asInt());
@@ -742,7 +730,7 @@ bool RPCServiceImpl::ConvertSOtoMessage(
if (protocol_version == 1) {
if (!formatters::CFormatterJsonSDLRPCv1::toString(
message, output_string, !allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ SDL_LOG_WARN("Failed to serialize smart object");
return false;
}
output.set_protocol_version(
@@ -750,7 +738,7 @@ bool RPCServiceImpl::ConvertSOtoMessage(
} else {
if (!formatters::CFormatterJsonSDLRPCv2::toString(
message, output_string, !allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ SDL_LOG_WARN("Failed to serialize smart object");
return false;
}
output.set_protocol_version(
@@ -763,7 +751,7 @@ bool RPCServiceImpl::ConvertSOtoMessage(
case 1: {
if (!formatters::FormatterJsonRpc::ToString(
message, output_string, !allow_unknown_parameters)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ SDL_LOG_WARN("Failed to serialize smart object");
return false;
}
output.set_protocol_version(
@@ -775,7 +763,7 @@ bool RPCServiceImpl::ConvertSOtoMessage(
return false;
}
- LOG4CXX_DEBUG(logger_, "Conversion result: " << output_string);
+ SDL_LOG_DEBUG("Conversion result: " << output_string);
output.set_connection_key(message.getElement(jhs::S_PARAMS)
.getElement(strings::connection_key)
@@ -810,7 +798,7 @@ bool RPCServiceImpl::ConvertSOtoMessage(
output.set_binary_data(&binaryData);
}
- LOG4CXX_DEBUG(logger_, "Successfully parsed smart object into message");
+ SDL_LOG_DEBUG("Successfully parsed smart object into message");
return true;
}
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index b07a5bcc13..ec77e30db7 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -40,7 +40,7 @@
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "StateControllerImpl")
+SDL_CREATE_LOG_VARIABLE("StateControllerImpl")
namespace {
bool IsStateChanged(const HmiState& old_state, const HmiState& new_state) {
@@ -70,13 +70,12 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
const WindowID window_id,
HmiStatePtr state,
const bool request_hmi_state_change) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(HmiState::STATE_ID_REGULAR == state->state_id());
- LOG4CXX_DEBUG(logger_,
- "Set window #" << window_id << " regular state " << *state);
+ SDL_LOG_DEBUG("Set window #" << window_id << " regular state " << *state);
if (state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM ||
state->audio_streaming_state() ==
@@ -84,11 +83,14 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
state->video_streaming_state() ==
mobile_apis::VideoStreamingState::INVALID_ENUM ||
state->system_context() == mobile_apis::SystemContext::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "Got invalid state");
+ SDL_LOG_ERROR("Got invalid state");
return;
}
- if (app->is_resuming() && !IsResumptionAllowed(app, state)) {
+ const bool app_is_resuming = app->is_resuming();
+ const bool is_resumption_allowed = IsResumptionAllowed(app, state);
+
+ if (app_is_resuming && !is_resumption_allowed) {
return;
}
@@ -99,7 +101,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
return;
}
- LOG4CXX_DEBUG(logger_, "Resolved state: " << *resolved_state);
+ SDL_LOG_DEBUG("Resolved state: " << *resolved_state);
const hmi_apis::Common_HMILevel::eType hmi_level =
static_cast<hmi_apis::Common_HMILevel::eType>(
resolved_state->hmi_level());
@@ -117,7 +119,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
app_mngr_.set_application_id(corr_id, app->hmi_app_id());
return;
}
- LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp");
+ SDL_LOG_ERROR("Unable to send BC.ActivateApp");
return;
}
ApplyRegularState(app, window_id, resolved_state);
@@ -130,7 +132,7 @@ void StateControllerImpl::SetRegularState(
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const bool request_hmi_state_change) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
@@ -151,7 +153,7 @@ void StateControllerImpl::SetRegularState(
const mobile_apis::HMILevel::eType hmi_level,
const bool request_hmi_state_change) {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_regular = app->RegularHmiState(window_id);
@@ -177,7 +179,7 @@ void StateControllerImpl::SetRegularState(
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
const bool request_hmi_state_change) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_regular = app->RegularHmiState(window_id);
@@ -199,7 +201,7 @@ void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_state = app->RegularHmiState(window_id);
HmiStatePtr hmi_state =
@@ -218,7 +220,7 @@ void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
const WindowID window_id,
const mobile_apis::SystemContext::eType system_context) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
@@ -240,7 +242,7 @@ void StateControllerImpl::SetRegularState(
const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
@@ -258,7 +260,7 @@ void StateControllerImpl::SetRegularState(
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
const WindowID window_id,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
@@ -333,27 +335,25 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
DCHECK_OR_RETURN_VOID(state_to_resolve);
// If applied HMI state is FULL:
- // - all NOT audio/video applications becomes BACKGROUND
+ // - all NOT audio/video applications become BACKGROUND
// - all audio/video applications with other app type
- // (navi, vc, media, projection) in FULL becomes LIMMITED
- // - all audio/video applications with same app type becomes BACKGROUND
+ // (navi, vc, media, projection) in FULL become LIMITED
+ // - all audio/video applications with the same app type become BACKGROUND
//
// If applied HMI state is LIMITED:
- // - all NOT audio/video applications saves their's HMI states
- // - all applications with other app types saves their's HMI states
- // - all audio/video applications with same app type becomes BACKGROUND
+ // - all NOT audio/video applications saves their HMI states
+ // - all applications with the other app types saves their HMI states
+ // - all audio/video applications with the same app type become BACKGROUND
if (!IsStreamableHMILevel(state_->hmi_level())) {
- LOG4CXX_DEBUG(logger_,
- "Applied for app " << applied_->app_id() << " HMI level "
+ SDL_LOG_DEBUG("Applied for app " << applied_->app_id() << " HMI level "
<< state_->hmi_level()
<< " is NOT streamable. Exit.");
return;
}
if (!IsStreamableHMILevel(state_to_resolve->hmi_level())) {
- LOG4CXX_DEBUG(logger_,
- "To resolve app " << app_to_resolve->app_id() << " HMI level "
+ SDL_LOG_DEBUG("To resolve app " << app_to_resolve->app_id() << " HMI level "
<< state_to_resolve->hmi_level()
<< " is NOT streamable. Exit.");
return;
@@ -402,7 +402,11 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
result_audio_state,
mobile_apis::AudioStreamingState::AUDIBLE,
mobile_apis::AudioStreamingState::ATTENUATED)) {
- result_hmi_level = mobile_apis::HMILevel::HMI_LIMITED;
+ result_hmi_level =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id_ &&
+ applied_->IsFullscreen()
+ ? mobile_apis::HMILevel::HMI_LIMITED
+ : to_resolve_hmi_level;
} else {
result_hmi_level = mobile_apis::HMILevel::HMI_BACKGROUND;
}
@@ -412,8 +416,7 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
state_to_resolve->video_streaming_state()) !=
std::make_tuple(
result_hmi_level, result_audio_state, result_video_state)) {
- LOG4CXX_DEBUG(logger_,
- "Application " << app_to_resolve->app_id() << " window "
+ SDL_LOG_DEBUG("Application " << app_to_resolve->app_id() << " window "
<< window_id_ << " will change state to: "
<< "HMI level " << to_resolve_hmi_level
<< " --> " << result_hmi_level << ", audio "
@@ -427,8 +430,7 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
result_audio_state,
result_video_state);
} else {
- LOG4CXX_DEBUG(logger_,
- "Application " << app_to_resolve->app_id() << " window "
+ SDL_LOG_DEBUG("Application " << app_to_resolve->app_id() << " window "
<< window_id_ << " will NOT change HMI level");
}
}
@@ -436,8 +438,8 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app,
HmiStatePtr state) const {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "State to resolve: " << *state);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("State to resolve: " << *state);
HmiStatePtr available_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -463,26 +465,28 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app,
bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app,
HmiStatePtr state) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
if (!app->is_resuming() || !IsStreamableHMILevel(state->hmi_level())) {
- LOG4CXX_DEBUG(logger_, "Application is not in resuming mode.");
+ SDL_LOG_DEBUG("Application is not in resuming mode.");
return true;
}
if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) &&
app->is_media_application()) {
- LOG4CXX_DEBUG(logger_,
- "Resumption for media app is not allowed. "
- << "AUDIO_SOURCE event is active");
+ SDL_LOG_DEBUG("Resumption for media app is not allowed. "
+ << "AUDIO_SOURCE event is active");
return false;
}
+ const bool is_navi_app = app->is_navi();
+ const bool is_mob_projection_app = app->mobile_projection_enabled();
+ const bool is_wep_app = app->webengine_projection_enabled();
+
if (IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI) &&
- (app->is_navi() || app->mobile_projection_enabled())) {
- LOG4CXX_DEBUG(logger_,
- "Resumption for navi or projection app is not allowed. "
- << "EMBEDDED_NAVI event is active");
+ (is_navi_app || is_mob_projection_app || is_wep_app)) {
+ SDL_LOG_DEBUG("Resumption for navi and projection apps is not allowed. "
+ << "EMBEDDED_NAVI event is active");
return false;
}
@@ -490,13 +494,13 @@ bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app,
}
mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
- ApplicationSharedPtr app, mobile_apis::HMILevel::eType hmi_level) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app,
+ mobile_apis::HMILevel::eType desired_hmi_level) const {
+ SDL_LOG_AUTO_TRACE();
- mobile_apis::HMILevel::eType result = hmi_level;
- LOG4CXX_DEBUG(logger_, "HMI Level: " << hmi_level);
+ mobile_apis::HMILevel::eType result = desired_hmi_level;
- if (!IsStreamableHMILevel(hmi_level)) {
+ if (!IsStreamableHMILevel(desired_hmi_level)) {
return result;
}
@@ -504,8 +508,11 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
const bool does_audio_app_with_same_type_exist =
app_mngr_.IsAppTypeExistsInFullOrLimited(app);
- if (mobile_apis::HMILevel::HMI_LIMITED == hmi_level) {
+ if (mobile_apis::HMILevel::HMI_LIMITED == desired_hmi_level) {
if (!is_audio_app || does_audio_app_with_same_type_exist) {
+ SDL_LOG_DEBUG(
+ "Not audio application trying to resume in limited or "
+ "audio application with the same type active");
result = app_mngr_.GetDefaultHmiLevel(app);
}
return result;
@@ -516,20 +523,21 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
(active_app.use_count() != 0) && active_app->app_id() != app->app_id();
if (is_audio_app) {
if (does_audio_app_with_same_type_exist) {
+ SDL_LOG_DEBUG("Audio application with the same type active");
result = app_mngr_.GetDefaultHmiLevel(app);
} else if (is_active_app_exist) {
result = mobile_apis::HMILevel::HMI_LIMITED;
} else if (app->is_navi() &&
IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE)) {
- LOG4CXX_DEBUG(logger_,
- "Navigation app will be resumed to LIMITED, "
- "because of AUDIO_SOURCE ia active.");
+ SDL_LOG_DEBUG(
+ "Navigation app will be resumed to LIMITED, "
+ "because of AUDIO_SOURCE ia active.");
result = mobile_apis::HMILevel::HMI_LIMITED;
} else if (app->is_media_application() &&
IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) {
- LOG4CXX_DEBUG(logger_,
- "Media app will be resumed to LIMITED, "
- "because of EMBEDDED_NAVI is active.");
+ SDL_LOG_DEBUG(
+ "Media app will be resumed to LIMITED, "
+ "because of EMBEDDED_NAVI is active.");
result = mobile_apis::HMILevel::HMI_LIMITED;
}
} else if (is_active_app_exist) {
@@ -542,61 +550,63 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
bool StateControllerImpl::IsStateAvailable(ApplicationSharedPtr app,
HmiStatePtr state) const {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Checking state: " << *state);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Checking state: " << *state);
if (app->is_resuming()) {
return IsStateAvailableForResumption(app, state);
}
- if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) ||
- IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) {
- if (HMILevel::HMI_FULL == state->hmi_level()) {
- LOG4CXX_DEBUG(logger_,
- "AUDIO_SOURCE or EMBEDDED_NAVI is active."
- << " Requested state is not available");
+ if (HMILevel::HMI_FULL == state->hmi_level()) {
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) &&
+ app->is_media_application()) {
+ SDL_LOG_DEBUG("Media app is not allowed to activate due"
+ << " to AUDIO_SOURCE event is active");
+ return false;
+ }
+
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI) &&
+ app->is_navi()) {
+ SDL_LOG_DEBUG("Navi app is not allowed to activate due"
+ << " to EMBEDDED_NAVI event is active");
return false;
}
}
- LOG4CXX_DEBUG(logger_, "Requested state is available");
+ SDL_LOG_DEBUG("Requested state is available");
return true;
}
bool StateControllerImpl::IsStateAvailableForResumption(
ApplicationSharedPtr app, HmiStatePtr state) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
if (!app->is_resuming() || !IsStreamableHMILevel(state->hmi_level())) {
- LOG4CXX_DEBUG(logger_,
- "Application is not in resuming mode."
- << " Requested state is available");
+ SDL_LOG_DEBUG("Application is not in resuming mode."
+ << " Requested state is available");
return true;
}
if (IsTempStateActive(HmiState::StateID::STATE_ID_VR_SESSION) ||
IsTempStateActive(HmiState::StateID::STATE_ID_SAFETY_MODE)) {
- LOG4CXX_DEBUG(logger_,
- "Requested state is not available. "
- << "VR session or emergency event is active");
+ SDL_LOG_DEBUG("Requested state is not available. "
+ << "VR session or emergency event is active");
return false;
}
if (IsTempStateActive(HmiState::StateID::STATE_ID_PHONE_CALL) &&
app->is_media_application()) {
- LOG4CXX_DEBUG(logger_,
- "Requested state for media application "
- << "is not available. Phone call is active");
+ SDL_LOG_DEBUG("Requested state for media application "
+ << "is not available. Phone call is active");
return false;
}
if (IsTempStateActive(HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) {
- LOG4CXX_DEBUG(logger_,
- "Requested state is not available. "
- << "Deactivate HMI event is active");
+ SDL_LOG_DEBUG("Requested state is not available. "
+ << "Deactivate HMI event is active");
return false;
}
- LOG4CXX_DEBUG(logger_, "Requested state is available");
+ SDL_LOG_DEBUG("Requested state is available");
return true;
}
@@ -604,10 +614,9 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
const WindowID window_id,
HmiStatePtr state) {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(state);
- LOG4CXX_DEBUG(logger_,
- "Setup window #" << window_id << " regular state: " << *state);
+ SDL_LOG_DEBUG("Setup window #" << window_id << " regular state: " << *state);
HmiStatePtr curr_state = app->CurrentHmiState(window_id);
HmiStatePtr old_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -621,9 +630,8 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
- LOG4CXX_DEBUG(logger_,
- "Resuming to LIMITED level. "
- << "Send OnResumeAudioSource notification");
+ SDL_LOG_DEBUG("Resuming to LIMITED level. "
+ << "Send OnResumeAudioSource notification");
MessageHelper::SendOnResumeAudioSourceToHMI(app->app_id(), app_mngr_);
}
@@ -637,7 +645,7 @@ void StateControllerImpl::SetupRegularHmiState(
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
@@ -655,39 +663,36 @@ void StateControllerImpl::SetupRegularHmiState(
void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app,
const WindowID window_id,
HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR);
- LOG4CXX_DEBUG(logger_,
- "Applying to app " << app->app_id() << " window #" << window_id
+ SDL_LOG_DEBUG("Applying to app " << app->app_id() << " window #" << window_id
<< " state " << *state);
SetupRegularHmiState(app, window_id, state);
if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
- LOG4CXX_DEBUG(logger_, "No need to resolve conflicts for a widget");
+ SDL_LOG_DEBUG("No need to resolve conflicts for a widget");
return;
}
- LOG4CXX_DEBUG(logger_,
- "Resolving HMI level conflicts for app " << app->app_id());
+ SDL_LOG_DEBUG("Resolving HMI level conflicts for app " << app->app_id());
ForEachApplication(HmiLevelConflictResolver(app, window_id, state, this));
}
void StateControllerImpl::UpdateAppWindowsStreamingState(
ApplicationSharedPtr app, HmiStatePtr state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto window_ids = app->GetWindowIds();
for (auto window_id : window_ids) {
HmiStatePtr window_hmi_state = app->RegularHmiState(window_id);
- LOG4CXX_DEBUG(
- logger_, "State: " << *state << " window state: " << *window_hmi_state);
+ SDL_LOG_DEBUG("State: " << *state
+ << " window state: " << *window_hmi_state);
if (window_hmi_state->audio_streaming_state() !=
state->audio_streaming_state() ||
window_hmi_state->video_streaming_state() !=
state->video_streaming_state()) {
- LOG4CXX_DEBUG(logger_,
- "Updating streaming state for window #" << window_id);
+ SDL_LOG_DEBUG("Updating streaming state for window #" << window_id);
HmiStatePtr new_window_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -701,7 +706,10 @@ void StateControllerImpl::UpdateAppWindowsStreamingState(
new_window_state->set_window_type(window_hmi_state->window_type());
app->SetRegularState(window_id, new_window_state);
- MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+ auto notification =
+ MessageHelper::CreateHMIStatusNotification(app, window_id);
+ app_mngr_.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::SOURCE_SDL);
}
}
}
@@ -714,7 +722,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
using namespace hmi_apis;
namespace FunctionID = hmi_apis::FunctionID;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const SmartObject& message = event.smart_object();
const FunctionID::eType id = static_cast<FunctionID::eType>(event.id());
switch (id) {
@@ -799,8 +807,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
}
}
- LOG4CXX_WARN(logger_,
- "Couldn't recognize state id (val='" << state_id << "')");
+ SDL_LOG_WARN("Couldn't recognize state id (val='" << state_id << "')");
break;
}
default:
@@ -809,7 +816,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
}
void StateControllerImpl::ActivateDefaultWindow(ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
@@ -831,7 +838,7 @@ void StateControllerImpl::ActivateDefaultWindow(ApplicationSharedPtr app) {
}
void StateControllerImpl::ExitDefaultWindow(ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace mobile_apis;
const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
@@ -854,26 +861,27 @@ void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app,
const WindowID window_id,
HmiStatePtr old_state,
HmiStatePtr new_state) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(old_state);
DCHECK_OR_RETURN_VOID(new_state);
- LOG4CXX_DEBUG(logger_,
- "Window #" << window_id << " old state: " << *old_state);
- LOG4CXX_DEBUG(logger_,
- "Window #" << window_id << " new state: " << *new_state);
+ SDL_LOG_DEBUG("Window #" << window_id << " old state: " << *old_state);
+ SDL_LOG_DEBUG("Window #" << window_id << " new state: " << *new_state);
if (!IsStateChanged(*old_state, *new_state)) {
- LOG4CXX_DEBUG(logger_, "State has NOT been changed.");
+ SDL_LOG_DEBUG("State has NOT been changed.");
return;
}
- MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+ auto notification =
+ MessageHelper::CreateHMIStatusNotification(app, window_id);
+ app_mngr_.GetRPCService().ManageMobileCommand(notification,
+ commands::Command::SOURCE_SDL);
if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
- LOG4CXX_DEBUG(logger_,
- "State was changed not for a main application window. No "
- "additional actions required");
+ SDL_LOG_DEBUG(
+ "State was changed not for a main application window. No "
+ "additional actions required");
return;
}
@@ -890,12 +898,52 @@ bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const {
return helpers::in_range(active_states_, id);
}
+void StateControllerImpl::ResumePostponedWindows(const uint32_t app_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ auto it_postponed_windows = postponed_app_widgets_.find(app_id);
+ if (it_postponed_windows != postponed_app_widgets_.end()) {
+ const WindowStatePairs& window_pairs = it_postponed_windows->second;
+ SDL_LOG_DEBUG("Application " << app_id << " has " << window_pairs.size()
+ << " postponed windows. Restoring...");
+
+ auto application = app_mngr_.application(app_id);
+ if (!application) {
+ SDL_LOG_ERROR("Application " << app_id << " is not registered");
+ postponed_app_widgets_.erase(it_postponed_windows);
+ return;
+ }
+
+ for (const WindowStatePair& pair : window_pairs) {
+ const WindowID window_id = pair.first;
+ HmiStatePtr postponed_state = pair.second;
+
+ OnAppWindowAdded(application,
+ window_id,
+ postponed_state->window_type(),
+ postponed_state->hmi_level());
+ }
+
+ postponed_app_widgets_.erase(it_postponed_windows);
+ }
+}
+
+void StateControllerImpl::DropPostponedWindows(const uint32_t app_id) {
+ SDL_LOG_AUTO_TRACE();
+ auto it_postponed_windows = postponed_app_widgets_.find(app_id);
+ if (it_postponed_windows != postponed_app_widgets_.end()) {
+ SDL_LOG_DEBUG("Dropping postponed windows information for application "
+ << app_id);
+ postponed_app_widgets_.erase(it_postponed_windows);
+ }
+}
+
void StateControllerImpl::OnApplicationRegistered(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- // After app registration HMI level should be set for DEFAUL_WINDOW only
+ // After app registration HMI level should be set for DEFAULT_WINDOW only
OnAppWindowAdded(app,
mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::WindowType::MAIN,
@@ -910,9 +958,28 @@ void StateControllerImpl::OnAppWindowAdded(
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
+ if (mobile_apis::WindowType::WIDGET == window_type) {
+ auto main_state =
+ app->CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if (mobile_apis::HMILevel::INVALID_ENUM == main_state->hmi_level()) {
+ SDL_LOG_DEBUG("Application " << app->app_id()
+ << " is not registered. Widget with ID: "
+ << window_id << " has been postponed");
+
+ HmiStatePtr postponed_state =
+ CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
+ postponed_state->set_window_type(window_type);
+ postponed_state->set_hmi_level(default_level);
+
+ WindowStatePair pair = std::make_pair(window_id, postponed_state);
+ postponed_app_widgets_[app->app_id()].push_back(pair);
+ return;
+ }
+ }
+
{
sync_primitives::AutoLock lck(active_states_lock_);
for (const auto state_id : active_states_) {
@@ -949,7 +1016,7 @@ int64_t StateControllerImpl::RequestHMIStateChange(
ApplicationConstSharedPtr app,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectSPtr request = NULL;
if (hmi_apis::Common_HMILevel::NONE == level) {
request = MessageHelper::GetBCCloseApplicationRequestToHMI(app, app_mngr_);
@@ -962,11 +1029,11 @@ int64_t StateControllerImpl::RequestHMIStateChange(
app_mngr_);
}
if (!request) {
- LOG4CXX_ERROR(logger_, "Unable to create request");
+ SDL_LOG_ERROR("Unable to create request");
return -1;
}
if (!app_mngr_.GetRPCService().ManageHMICommand(request)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
+ SDL_LOG_ERROR("Unable to send request");
return -1;
}
const uint32_t corr_id =
@@ -975,7 +1042,7 @@ int64_t StateControllerImpl::RequestHMIStateChange(
}
void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
const WindowIds window_ids = app->GetWindowIds();
@@ -990,7 +1057,7 @@ void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
}
void StateControllerImpl::TempStateStarted(HmiState::StateID id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock autolock(active_states_lock_);
@@ -1000,11 +1067,11 @@ void StateControllerImpl::TempStateStarted(HmiState::StateID id) {
}
}
- LOG4CXX_ERROR(logger_, "StateID '" << id << "' is already active");
+ SDL_LOG_ERROR("StateID '" << id << "' is already active");
}
void StateControllerImpl::TempStateStopped(HmiState::StateID ID) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock autolock(active_states_lock_);
active_states_.remove(ID);
@@ -1016,15 +1083,14 @@ void StateControllerImpl::TempStateStopped(HmiState::StateID ID) {
void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app,
const WindowID window_id) {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(app);
const HmiStatePtr regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(regular);
HmiStatePtr new_regular = std::make_shared<HmiState>(*regular);
- LOG4CXX_DEBUG(logger_,
- "Window #" << window_id << " current HMI level: '"
+ SDL_LOG_DEBUG("Window #" << window_id << " current HMI level: '"
<< app->hmi_level(window_id) << "'");
const bool is_audio_app = app->IsAudioApplication();
const bool is_video_app = app->IsVideoApplication();
@@ -1076,12 +1142,12 @@ void StateControllerImpl::OnHMIResponse(
void StateControllerImpl::OnAppActivated(
const smart_objects::SmartObject& message) {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt();
ApplicationSharedPtr app = app_mngr_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found");
+ SDL_LOG_ERROR("Application with id " << app_id << " not found");
return;
}
@@ -1092,9 +1158,8 @@ void StateControllerImpl::OnAppActivated(
const auto window_ids = app->GetWindowIds();
if (!helpers::in_range(window_ids, window_id)) {
- LOG4CXX_ERROR(
- logger_,
- "Application " << app_id << " does not contain window #" << window_id);
+ SDL_LOG_ERROR("Application " << app_id << " does not contain window #"
+ << window_id);
return;
}
@@ -1117,12 +1182,12 @@ void StateControllerImpl::OnAppActivated(
void StateControllerImpl::OnAppDeactivated(
const smart_objects::SmartObject& message) {
using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt();
ApplicationSharedPtr app = app_mngr_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found");
+ SDL_LOG_ERROR("Application with id " << app_id << " not found");
return;
}
@@ -1133,9 +1198,8 @@ void StateControllerImpl::OnAppDeactivated(
const auto window_ids = app->GetWindowIds();
if (!helpers::in_range(window_ids, window_id)) {
- LOG4CXX_ERROR(
- logger_,
- "Application " << app_id << " does not contain window #" << window_id);
+ SDL_LOG_ERROR("Application " << app_id << " does not contain window #"
+ << window_id);
return;
}
@@ -1180,7 +1244,7 @@ void StateControllerImpl::OnVideoStreamingStopped(
}
bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (state_id) {
case HmiState::STATE_ID_CURRENT:
case HmiState::STATE_ID_REGULAR:
@@ -1194,7 +1258,7 @@ bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const {
HmiStatePtr StateControllerImpl::CreateHmiState(
std::shared_ptr<Application> app, HmiState::StateID state_id) const {
using namespace utils;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
HmiStatePtr new_state;
switch (state_id) {
case HmiState::STATE_ID_PHONE_CALL: {
@@ -1242,7 +1306,7 @@ HmiStatePtr StateControllerImpl::CreateHmiState(
break;
}
default:
- LOG4CXX_FATAL(logger_, "Invalid state_id " << state_id);
+ SDL_LOG_FATAL("Invalid state_id " << state_id);
NOTREACHED();
break;
}
@@ -1257,10 +1321,9 @@ mobile_apis::AudioStreamingState::eType StateControllerImpl::CalcAudioState(
state = mobile_apis::AudioStreamingState::AUDIBLE;
}
- LOG4CXX_DEBUG(logger_,
- "Calculated audio state of app "
- << app->app_id() << " for " << hmi_level << " HMI level is "
- << state);
+ SDL_LOG_DEBUG("Calculated audio state of app "
+ << app->app_id() << " for " << hmi_level << " HMI level is "
+ << state);
return state;
}
@@ -1268,14 +1331,14 @@ mobile_apis::VideoStreamingState::eType StateControllerImpl::CalcVideoState(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level) const {
auto state = mobile_apis::VideoStreamingState::NOT_STREAMABLE;
- if (IsStreamableHMILevel(hmi_level) && app->IsVideoApplication()) {
+
+ if (app->IsVideoApplication() && IsStreamableHMILevel(hmi_level)) {
state = mobile_apis::VideoStreamingState::STREAMABLE;
}
- LOG4CXX_DEBUG(logger_,
- "Calculated video state of app "
- << app->app_id() << " for " << hmi_level << " HMI level is "
- << state);
+ SDL_LOG_DEBUG("Calculated video state of app "
+ << app->app_id() << " for " << hmi_level << " HMI level is "
+ << state);
return state;
}
diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
index deb92d5d81..3aee6d7e21 100644
--- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc
+++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
@@ -41,7 +41,7 @@
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SystemTimeHandler")
+SDL_CREATE_LOG_VARIABLE("SystemTimeHandler")
SystemTimeHandlerImpl::SystemTimeHandlerImpl(
ApplicationManager& application_manager)
@@ -51,66 +51,65 @@ SystemTimeHandlerImpl::SystemTimeHandlerImpl(
, last_time_(0)
, system_time_listener_(NULL)
, app_manager_(application_manager) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
subscribe_on_event(
hmi_apis::FunctionID::BasicCommunication_OnSystemTimeReady);
}
SystemTimeHandlerImpl::~SystemTimeHandlerImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
unsubscribe_from_all_hmi_events();
}
void SystemTimeHandlerImpl::DoSystemTimeQuery() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace application_manager;
sync_primitives::AutoLock lock(state_lock_);
if (!utc_time_can_be_received_) {
- LOG4CXX_INFO(logger_,
- "Navi module is not yet ready."
- << "Will process request once it became ready.");
+ SDL_LOG_INFO("Navi module is not yet ready."
+ << " Will process request once it became ready.");
return;
}
SendTimeRequest();
}
void SystemTimeHandlerImpl::DoSubscribe(utils::SystemTimeListener* listener) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(listener);
sync_primitives::AutoLock lock(system_time_listener_lock_);
system_time_listener_ = listener;
}
void SystemTimeHandlerImpl::ResetPendingSystemTimeRequests() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
unsubscribe_from_event(
hmi_apis::FunctionID::BasicCommunication_GetSystemTime);
awaiting_get_system_time_ = false;
}
void SystemTimeHandlerImpl::DoUnsubscribe(utils::SystemTimeListener* listener) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(system_time_listener_lock_);
system_time_listener_ = NULL;
}
time_t SystemTimeHandlerImpl::FetchSystemTime() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return last_time_;
}
bool SystemTimeHandlerImpl::utc_time_can_be_received() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(state_lock_);
return utc_time_can_be_received_;
}
void SystemTimeHandlerImpl::SendTimeRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (awaiting_get_system_time_) {
- LOG4CXX_WARN(logger_, "Another GetSystemTime request in progress. Skipped");
+ SDL_LOG_WARN("Another GetSystemTime request in progress. Skipped");
return;
}
@@ -124,7 +123,7 @@ void SystemTimeHandlerImpl::SendTimeRequest() {
void SystemTimeHandlerImpl::on_event(
const application_manager::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace application_manager;
using namespace hmi_apis::FunctionID;
switch (event.id()) {
@@ -135,13 +134,13 @@ void SystemTimeHandlerImpl::on_event(
ProcessSystemTimeResponse(event);
break;
default:
- LOG4CXX_ERROR(logger_, "Unknown Event received");
+ SDL_LOG_ERROR("Unknown Event received");
break;
}
}
void SystemTimeHandlerImpl::ProcessSystemTimeReadyNotification() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(state_lock_);
utc_time_can_be_received_ = true;
unsubscribe_from_event(
@@ -150,7 +149,7 @@ void SystemTimeHandlerImpl::ProcessSystemTimeReadyNotification() {
void SystemTimeHandlerImpl::ProcessSystemTimeResponse(
const application_manager::event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
const auto result = static_cast<hmi_apis::Common_Result::eType>(
diff --git a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
index b3bb8dd705..08868a239f 100644
--- a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
+++ b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
@@ -37,6 +37,7 @@
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "connection_handler/mock_connection_handler.h"
#include "gtest/gtest.h"
#include "utils/macro.h"
@@ -162,7 +163,7 @@ class AppLaunchCtrlTest : public ::testing::Test {
NiceMock<am_test::MockApplicationManager> app_mngr_mock_;
NiceMock<app_launch_test::AppLaunchDataMock> app_launch_data_mock_;
NiceMock<ch_test::MockConnectionHandler> connection_handler_mock_;
- NiceMock<resumprion_test::MockResumeCtrl> resume_ctrl_mock_;
+ NiceMock<resumption_test::MockResumeCtrl> resume_ctrl_mock_;
NiceMock<app_launch_test::MockAppLaunchSettings> settings_;
std::unique_ptr<app_launch::AppLaunchCtrlImpl> app_launch_ctrl_;
};
diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc
index ec84acc697..4c451ab072 100644
--- a/src/components/application_manager/test/application_helper_test.cc
+++ b/src/components/application_manager/test/application_helper_test.cc
@@ -151,10 +151,12 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
const uint32_t choice_set_id = 3;
const mobile_apis::ButtonName::eType button = mobile_apis::ButtonName::AC;
- smart_objects::SmartObject cmd;
+ smart_objects::SmartObject cmd(smart_objects::SmartType_Map);
cmd[strings::msg_params][strings::cmd_id] = cmd_id;
cmd[strings::msg_params][strings::vr_commands][0] = "vrCmd";
cmd[strings::msg_params][strings::menu_id] = menu_id;
+ cmd[strings::menu_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
cmd[strings::msg_params][strings::interaction_choice_set_id] = choice_set_id;
app_impl_->AddCommand(cmd_id, cmd[strings::msg_params]);
@@ -182,9 +184,12 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
app_impl_->AddFile(file);
- EXPECT_TRUE(NULL != app_impl_->FindCommand(cmd_id));
- EXPECT_TRUE(NULL != app_impl_->FindSubMenu(menu_id));
- EXPECT_TRUE(NULL != app_impl_->FindChoiceSet(choice_set_id));
+ const auto command1 = app_impl_->FindCommand(cmd_id);
+ EXPECT_TRUE(smart_objects::SmartType_Null != command1.getType());
+ const auto sub_menu1 = app_impl_->FindSubMenu(menu_id);
+ EXPECT_TRUE(smart_objects::SmartType_Null != sub_menu1.getType());
+ const auto choice_set1 = app_impl_->FindChoiceSet(choice_set_id);
+ EXPECT_TRUE(smart_objects::SmartType_Null != choice_set1.getType());
EXPECT_TRUE(app_impl_->IsSubscribedToButton(button));
auto help_prompt = app_impl_->help_prompt();
EXPECT_TRUE(help_prompt->asString() == some_string);
@@ -204,11 +209,24 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
EXPECT_TRUE(NULL != file_ptr);
EXPECT_TRUE(file_ptr->file_name == filename);
+ EXPECT_CALL(*mock_message_helper_, CreateUnsubscribeWayPointsRequest(_))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+
+ EXPECT_CALL(*mock_message_helper_, CreateDeleteUICommandRequest(_, _, _))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+
+ EXPECT_CALL(*mock_message_helper_, CreateDeleteVRCommandRequest(_, _, _))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+
// Act
application_manager::DeleteApplicationData(app_impl_, app_manager_impl_);
- EXPECT_FALSE(NULL != app_impl_->FindCommand(cmd_id));
- EXPECT_FALSE(NULL != app_impl_->FindSubMenu(menu_id));
- EXPECT_FALSE(NULL != app_impl_->FindChoiceSet(choice_set_id));
+
+ const auto command2 = app_impl_->FindCommand(cmd_id);
+ EXPECT_TRUE(smart_objects::SmartType_Null == command2.getType());
+ const auto sub_menu2 = app_impl_->FindSubMenu(menu_id);
+ EXPECT_TRUE(smart_objects::SmartType_Null == sub_menu2.getType());
+ const auto choice_set2 = app_impl_->FindChoiceSet(choice_set_id);
+ EXPECT_TRUE(smart_objects::SmartType_Null == choice_set2.getType());
EXPECT_FALSE(app_impl_->IsSubscribedToButton(button));
help_prompt = app_impl_->help_prompt();
EXPECT_FALSE(help_prompt->asString() == some_string);
@@ -243,9 +261,14 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) {
app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]);
app_impl_->SubscribeToButton(mobile_apis::ButtonName::AC);
- EXPECT_CALL(*mock_message_helper_, SendUnsubscribedWayPoints(_));
+ EXPECT_CALL(*mock_message_helper_, CreateUnsubscribeWayPointsRequest(_))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+
+ EXPECT_CALL(*mock_message_helper_, CreateDeleteUICommandRequest(_, _, _))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
- EXPECT_CALL(*mock_message_helper_, SendDeleteCommandRequest(_, _, _));
+ EXPECT_CALL(*mock_message_helper_, CreateDeleteVRCommandRequest(_, _, _))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
EXPECT_CALL(*mock_message_helper_, SendDeleteSubmenuRequest(_, _, _));
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index 485f0f3b5b..717df8f482 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -47,6 +47,7 @@
#include "application_manager/mock_resume_ctrl.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
#include "application_manager/state_controller.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
#include "resumption/last_state.h"
@@ -260,8 +261,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) {
app_impl->RemoveHMIState(kDefaultWindowId, state2->state_id());
HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
- // HMI level is equal to parent hmi_level
- EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
+ // HMI level is equal to state3 hmi_level
+ EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id());
EXPECT_EQ(state1, current_state->parent());
}
@@ -270,10 +271,9 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) {
HmiStatePtr state1 = TestAddHmiState(HMILevel::HMI_FULL,
HmiState::STATE_ID_PHONE_CALL,
&ApplicationImpl::AddHMIState);
- // Second state
- TestAddHmiState(HMILevel::HMI_NONE,
- HmiState::STATE_ID_VIDEO_STREAMING,
- &ApplicationImpl::AddHMIState);
+ HmiStatePtr state2 = TestAddHmiState(HMILevel::HMI_NONE,
+ HmiState::STATE_ID_VIDEO_STREAMING,
+ &ApplicationImpl::AddHMIState);
HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
HmiState::STATE_ID_TTS_SESSION,
&ApplicationImpl::AddHMIState);
@@ -286,7 +286,7 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) {
// Last state does not have a parent
EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id());
- EXPECT_EQ(nullptr, current_state->parent());
+ EXPECT_EQ(state2, current_state->parent());
}
TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) {
@@ -307,7 +307,7 @@ TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) {
HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// Last state has a parent
- EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
+ EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id());
EXPECT_EQ(state2, current_state->parent());
}
@@ -597,6 +597,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeNotNaviNotVoice) {
EXPECT_FALSE(app_impl->is_navi());
EXPECT_FALSE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
app_impl->set_app_types(type_media);
app_impl->ChangeSupportingAppHMIType();
@@ -604,6 +605,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeNotNaviNotVoice) {
EXPECT_FALSE(app_impl->is_navi());
EXPECT_FALSE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
}
TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) {
@@ -613,6 +615,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) {
EXPECT_FALSE(app_impl->is_navi());
EXPECT_FALSE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
app_impl->set_app_types(type_comm);
app_impl->ChangeSupportingAppHMIType();
@@ -620,6 +623,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) {
EXPECT_FALSE(app_impl->is_navi());
EXPECT_TRUE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
}
TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) {
@@ -629,6 +633,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) {
EXPECT_FALSE(app_impl->is_navi());
EXPECT_FALSE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
app_impl->set_app_types(type_navi);
app_impl->ChangeSupportingAppHMIType();
@@ -636,6 +641,71 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) {
EXPECT_TRUE(app_impl->is_navi());
EXPECT_FALSE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
+}
+
+TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsWebView) {
+ smart_objects::SmartObject app_types;
+ app_types[0] = mobile_apis::AppHMIType::WEB_VIEW;
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+ EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
+
+ app_impl->set_app_types(app_types);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_FALSE(app_impl->is_navi());
+ EXPECT_FALSE(app_impl->is_voice_communication_supported());
+ EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_TRUE(app_impl->webengine_projection_enabled());
+}
+
+TEST_F(ApplicationImplTest,
+ ChangeSupportingAppHMIType_TypeFromWebViewToProjection) {
+ smart_objects::SmartObject app_types;
+ app_types[0] = mobile_apis::AppHMIType::WEB_VIEW;
+
+ EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
+
+ app_impl->set_app_types(app_types);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_TRUE(app_impl->webengine_projection_enabled());
+
+ app_types[0] = mobile_apis::AppHMIType::PROJECTION;
+
+ app_impl->set_app_types(app_types);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
+ EXPECT_TRUE(app_impl->mobile_projection_enabled());
+}
+
+TEST_F(ApplicationImplTest,
+ ChangeSupportingAppHMIType_TypeFromProjectionToWebView) {
+ smart_objects::SmartObject app_types;
+ app_types[0] = mobile_apis::AppHMIType::PROJECTION;
+
+ EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
+
+ app_impl->set_app_types(app_types);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
+ EXPECT_TRUE(app_impl->mobile_projection_enabled());
+
+ app_types[0] = mobile_apis::AppHMIType::WEB_VIEW;
+
+ app_impl->set_app_types(app_types);
+ app_impl->ChangeSupportingAppHMIType();
+
+ EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_TRUE(app_impl->webengine_projection_enabled());
}
TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) {
@@ -647,6 +717,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) {
EXPECT_FALSE(app_impl->is_navi());
EXPECT_FALSE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
app_impl->set_app_types(app_types);
app_impl->ChangeSupportingAppHMIType();
@@ -654,6 +725,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) {
EXPECT_TRUE(app_impl->is_navi());
EXPECT_TRUE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
}
TEST_F(ApplicationImplTest,
@@ -667,6 +739,7 @@ TEST_F(ApplicationImplTest,
EXPECT_FALSE(app_impl->is_navi());
EXPECT_FALSE(app_impl->is_voice_communication_supported());
EXPECT_FALSE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
app_impl->set_app_types(app_types);
app_impl->ChangeSupportingAppHMIType();
@@ -674,13 +747,14 @@ TEST_F(ApplicationImplTest,
EXPECT_TRUE(app_impl->is_navi());
EXPECT_TRUE(app_impl->is_voice_communication_supported());
EXPECT_TRUE(app_impl->mobile_projection_enabled());
+ EXPECT_FALSE(app_impl->webengine_projection_enabled());
}
TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) {
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendHashUpdateNotification(app_id, _))
.Times(1);
- resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
EXPECT_CALL(mock_application_manager_, resume_controller())
.WillOnce(ReturnRef(mock_resume_ctrl));
EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(false));
@@ -693,7 +767,7 @@ TEST_F(ApplicationImplTest, UpdateHash_AppMngrSuspended) {
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendHashUpdateNotification(app_id, _))
.Times(0);
- resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
EXPECT_CALL(mock_application_manager_, resume_controller())
.WillOnce(ReturnRef(mock_resume_ctrl));
EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(true));
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index b311d5fd5e..0484b0cb32 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -66,9 +66,6 @@
#include "utils/lock.h"
#include "encryption/hashing.h"
-#ifdef ENABLE_LOG
-#include "utils/push_log.h"
-#endif
namespace test {
namespace components {
@@ -180,9 +177,6 @@ class ApplicationManagerImplTest
NiceMock<usage_statistics_test::MockStatisticsManager> >())
{
-#ifdef ENABLE_LOG
- logger::create_log_message_loop_thread();
-#endif
Mock::VerifyAndClearExpectations(mock_message_helper_);
}
~ApplicationManagerImplTest() OVERRIDE {
@@ -338,6 +332,44 @@ class ApplicationManagerImplTest
void CreatePendingApplication();
#endif
+ void ExpectedHmiState(
+ const ApplicationSharedPtr wep_app,
+ const WindowID main_window_id,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::VideoStreamingState::eType vss,
+ const mobile_apis::AudioStreamingState::eType audio_str_st,
+ const mobile_apis::SystemContext::eType system_ctx) {
+ EXPECT_EQ(hmi_level, wep_app->hmi_level(main_window_id));
+ EXPECT_EQ(vss, wep_app->video_streaming_state());
+ EXPECT_EQ(audio_str_st, wep_app->audio_streaming_state());
+ EXPECT_EQ(system_ctx, wep_app->system_context(main_window_id));
+ }
+
+ smart_objects::SmartObjectSPtr CreateRAI(const std::string app_hmi_type,
+ const bool is_media_application) {
+ smart_objects::SmartObject rai(smart_objects::SmartType_Map);
+ smart_objects::SmartObject& params = rai[strings::msg_params];
+ params[strings::app_id] = kAppId;
+ params[strings::language_desired] = mobile_api::Language::EN_US;
+ params[strings::hmi_display_language_desired] = mobile_api::Language::EN_US;
+
+ rai[strings::params][strings::connection_key] = kConnectionKey;
+ rai[strings::msg_params][strings::app_name] = kAppName;
+ rai[strings::msg_params][strings::app_hmi_type] = app_hmi_type;
+ rai[strings::msg_params][strings::is_media_application] =
+ is_media_application;
+ rai[strings::msg_params][strings::sync_msg_version]
+ [strings::minor_version] = APIVersion::kAPIV2;
+ rai[strings::msg_params][strings::sync_msg_version]
+ [strings::major_version] = APIVersion::kAPIV6;
+
+ rai[strings::params][strings::protocol_version] =
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2;
+
+ const auto rai_ptr = std::make_shared<smart_objects::SmartObject>(rai);
+ return rai_ptr;
+ }
+
void CreatePendingLocalApplication(const std::string& policy_app_id);
uint32_t app_id_;
@@ -463,16 +495,16 @@ TEST_F(ApplicationManagerImplTest,
SubscribeAppForWayPoints_ExpectSubscriptionApp) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
- EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr));
+ EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
}
TEST_F(ApplicationManagerImplTest,
UnsubscribeAppForWayPoints_ExpectUnsubscriptionApp) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
- EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr));
+ EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr);
- EXPECT_FALSE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr));
+ EXPECT_FALSE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
const std::set<uint32_t> result =
app_manager_impl_->GetAppsSubscribedForWayPoints();
EXPECT_TRUE(result.empty());
@@ -2046,6 +2078,209 @@ TEST_F(
EXPECT_EQ(1u, app_list.size());
}
+TEST_F(
+ ApplicationManagerImplTest,
+ RegisterApplication_WEPNonMediaAppRegisterActivateDeactivateExit_EXPECT_CORRECT_HMI_STATES) {
+ using namespace mobile_apis;
+ EXPECT_CALL(
+ mock_session_observer_,
+ GetDataOnSessionKey(kConnectionKey,
+ _,
+ _,
+ testing::An<connection_handler::DeviceHandle*>()))
+ .WillOnce(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
+
+ const std::string app_hmi_type{"WEB_VIEW"};
+ const bool is_media_app = false;
+ const auto rai_ptr = CreateRAI(app_hmi_type, is_media_app);
+
+ std::unique_ptr<plugin_manager::RPCPluginManager> rpc_plugin_manager(
+ new MockRPCPluginManager());
+ app_manager_impl_->SetPluginManager(rpc_plugin_manager);
+ auto wep_nonmedia_app = app_manager_impl_->RegisterApplication(rai_ptr);
+ wep_nonmedia_app->set_is_media_application(false);
+
+ EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2,
+ wep_nonmedia_app->protocol_version());
+ EXPECT_EQ(APIVersion::kAPIV2,
+ wep_nonmedia_app->version().min_supported_api_version);
+ EXPECT_EQ(APIVersion::kAPIV6,
+ wep_nonmedia_app->version().max_supported_api_version);
+
+ // Initial HMI level, audio, video streaming states and system context
+ // set after app registration
+ ExpectedHmiState(wep_nonmedia_app,
+ kDefaultWindowId,
+ HMILevel::INVALID_ENUM,
+ VideoStreamingState::INVALID_ENUM,
+ AudioStreamingState::INVALID_ENUM,
+ SystemContext::SYSCTXT_MAIN);
+
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ EXPECT_CALL(*mock_message_helper_,
+ CreateHMIStatusNotification(_, kDefaultWindowId))
+ .WillOnce(Return(notification));
+ EXPECT_CALL(*mock_rpc_service_, ManageMobileCommand(notification, _));
+
+ // Const shared ptr is required for OnAppActivated due to its signature
+ ApplicationConstSharedPtr const_wep_app = wep_nonmedia_app;
+ EXPECT_CALL(*mock_app_service_manager_, OnAppActivated(const_wep_app));
+
+ // Activate Webengine projection non-media app
+ // to check its audio & video streaming states in FULL Hmi level
+ app_manager_impl_->ActivateApplication(wep_nonmedia_app);
+
+ // WEP non-media app should be always not_streamable
+ // and not_audible even in FULL HMI Level
+ ExpectedHmiState(wep_nonmedia_app,
+ kDefaultWindowId,
+ HMILevel::HMI_FULL,
+ VideoStreamingState::NOT_STREAMABLE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN);
+
+ EXPECT_CALL(*mock_message_helper_,
+ CreateHMIStatusNotification(_, kDefaultWindowId))
+ .WillOnce(Return(notification));
+ EXPECT_CALL(*mock_rpc_service_, ManageMobileCommand(notification, _));
+
+ // Deactivate Webengine projection non-media app
+ // to check its new HMI level and audio & video streaming states
+ app_manager_impl_->state_controller().DeactivateApp(wep_nonmedia_app,
+ kDefaultWindowId);
+
+ // WEP non-media app should be deactivated to BACKGROUND
+ // WEP non-media app should be not audible and not streamable
+ // in BACKGROUND HMI Level
+
+ ExpectedHmiState(wep_nonmedia_app,
+ kDefaultWindowId,
+ HMILevel::HMI_BACKGROUND,
+ VideoStreamingState::NOT_STREAMABLE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN);
+
+ EXPECT_CALL(*mock_message_helper_,
+ CreateHMIStatusNotification(_, kDefaultWindowId))
+ .WillOnce(Return(notification));
+ EXPECT_CALL(*mock_rpc_service_, ManageMobileCommand(notification, _));
+
+ // Exit of Webengine projection non-media app
+ // to check its new HMI level and audio & video streaming states
+ app_manager_impl_->state_controller().ExitDefaultWindow(wep_nonmedia_app);
+ // WEP non-media app should be deactivated to NONE
+ // WEP non-media app should be not audible and not streamable
+ // in NONE HMI Level
+ ExpectedHmiState(wep_nonmedia_app,
+ kDefaultWindowId,
+ HMILevel::HMI_NONE,
+ VideoStreamingState::NOT_STREAMABLE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN);
+}
+
+TEST_F(
+ ApplicationManagerImplTest,
+ RegisterApplication_WEPMediaAppRegisterActivateDeactivateExit_EXPECT_CORRECT_HMI_STATES) {
+ using namespace mobile_apis;
+
+ EXPECT_CALL(
+ mock_session_observer_,
+ GetDataOnSessionKey(kConnectionKey,
+ _,
+ _,
+ testing::An<connection_handler::DeviceHandle*>()))
+ .WillOnce(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
+
+ const std::string app_hmi_type{"WEB_VIEW"};
+ const bool is_media_app = true;
+ const auto rai_ptr = CreateRAI(app_hmi_type, is_media_app);
+
+ std::unique_ptr<plugin_manager::RPCPluginManager> rpc_plugin_manager(
+ new MockRPCPluginManager());
+ app_manager_impl_->SetPluginManager(rpc_plugin_manager);
+ auto wep_media_app = app_manager_impl_->RegisterApplication(rai_ptr);
+ wep_media_app->set_is_media_application(true);
+
+ EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2,
+ wep_media_app->protocol_version());
+ EXPECT_EQ(APIVersion::kAPIV2,
+ wep_media_app->version().min_supported_api_version);
+ EXPECT_EQ(APIVersion::kAPIV6,
+ wep_media_app->version().max_supported_api_version);
+
+ // Initial HMI level, audio, video streaming states and system context
+ // set after app registration
+ ExpectedHmiState(wep_media_app,
+ kDefaultWindowId,
+ HMILevel::INVALID_ENUM,
+ VideoStreamingState::INVALID_ENUM,
+ AudioStreamingState::INVALID_ENUM,
+ SystemContext::SYSCTXT_MAIN);
+
+ // Const shared ptr is required for OnAppActivated due to its signature
+ ApplicationConstSharedPtr const_wep_app = wep_media_app;
+ EXPECT_CALL(*mock_app_service_manager_, OnAppActivated(const_wep_app));
+
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ EXPECT_CALL(*mock_message_helper_,
+ CreateHMIStatusNotification(_, kDefaultWindowId))
+ .WillOnce(Return(notification));
+ EXPECT_CALL(*mock_rpc_service_, ManageMobileCommand(notification, _));
+
+ // Activate Webengine projection media app
+ // to check its audio & video streaming states in FULL Hmi level
+ app_manager_impl_->ActivateApplication(wep_media_app);
+
+ // WEP media app should be always not_streamable
+ // but audible even in FULL HMI Level
+ ExpectedHmiState(wep_media_app,
+ kDefaultWindowId,
+ HMILevel::HMI_FULL,
+ VideoStreamingState::NOT_STREAMABLE,
+ AudioStreamingState::AUDIBLE,
+ SystemContext::SYSCTXT_MAIN);
+
+ EXPECT_CALL(*mock_message_helper_,
+ CreateHMIStatusNotification(_, kDefaultWindowId))
+ .WillOnce(Return(notification));
+ EXPECT_CALL(*mock_rpc_service_, ManageMobileCommand(notification, _));
+
+ // Deactivate Webengine projection media app
+ // to check its new HMI level and audio & video streaming states
+ app_manager_impl_->state_controller().DeactivateApp(wep_media_app,
+ kDefaultWindowId);
+
+ // WEP media app should be deactivated to LIMITED
+ // WEP media app should be audible but not streamable in LIMITED HMI Level
+ ExpectedHmiState(wep_media_app,
+ kDefaultWindowId,
+ HMILevel::HMI_LIMITED,
+ VideoStreamingState::NOT_STREAMABLE,
+ AudioStreamingState::AUDIBLE,
+ SystemContext::SYSCTXT_MAIN);
+
+ EXPECT_CALL(*mock_message_helper_,
+ CreateHMIStatusNotification(_, kDefaultWindowId))
+ .WillOnce(Return(notification));
+ EXPECT_CALL(*mock_rpc_service_, ManageMobileCommand(notification, _));
+
+ // Exit of Webengine projection media app
+ // to check its new HMI level and audio & video streaming states
+ app_manager_impl_->state_controller().ExitDefaultWindow(wep_media_app);
+ // WEP media app should be exited to NONE
+ ExpectedHmiState(wep_media_app,
+ kDefaultWindowId,
+ HMILevel::HMI_NONE,
+ VideoStreamingState::NOT_STREAMABLE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN);
+}
+
TEST_F(ApplicationManagerImplTest, AddAndRemoveQueryAppDevice_SUCCESS) {
const connection_handler::DeviceHandle device_handle = 1u;
ASSERT_FALSE(app_manager_impl_->IsAppsQueriedFrom(device_handle));
diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc
index 22d111f926..b45b078ab3 100644
--- a/src/components/application_manager/test/application_state_test.cc
+++ b/src/components/application_manager/test/application_state_test.cc
@@ -47,6 +47,7 @@ namespace application_manager_test {
using namespace application_manager;
using namespace mobile_apis;
+using ::testing::Return;
typedef HmiState::StateID StateID;
namespace {
@@ -57,6 +58,7 @@ const std::string kDefaultWindowName = "DefaultName";
std::vector<StateID> GenerateCurrentStates() {
std::vector<StateID> states;
+ states.push_back(StateID::STATE_ID_REGULAR);
states.push_back(StateID::STATE_ID_PHONE_CALL);
states.push_back(StateID::STATE_ID_SAFETY_MODE);
states.push_back(StateID::STATE_ID_VR_SESSION);
@@ -71,11 +73,13 @@ class ApplicationStateTest : public ::testing::Test {
public:
void SetUp() OVERRIDE {
mock_app_.reset(new MockApplication);
+ EXPECT_CALL(*mock_app_, hmi_app_id()).WillRepeatedly(Return(0));
}
protected:
static std::vector<StateID> added_states_;
ApplicationState app_state;
+ HmiStatePtr initial_state_;
const StateID current_id = StateID::STATE_ID_CURRENT;
const StateID postponed_id = StateID::STATE_ID_POSTPONED;
std::shared_ptr<MockApplication> mock_app_;
@@ -87,6 +91,12 @@ std::vector<StateID> ApplicationStateTest::added_states_ =
TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) {
std::vector<StateID>::iterator new_state = added_states_.begin();
+ initial_state_ = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
+ app_mngr_,
+ *new_state);
+ app_state.InitState(kDefaultWindowId, std::string(), initial_state_);
+ ++new_state;
for (; new_state != added_states_.end(); ++new_state) {
HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
@@ -99,6 +109,12 @@ TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) {
TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) {
std::vector<StateID>::iterator new_state = added_states_.begin();
+ initial_state_ = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
+ app_mngr_,
+ *new_state);
+ app_state.InitState(kDefaultWindowId, std::string(), initial_state_);
+ ++new_state;
for (; new_state != added_states_.end(); ++new_state) {
HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
@@ -122,6 +138,12 @@ TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) {
TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) {
// Added some states
std::vector<StateID>::iterator new_state = added_states_.begin();
+ initial_state_ = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
+ app_mngr_,
+ *new_state);
+ app_state.InitState(kDefaultWindowId, std::string(), initial_state_);
+ ++new_state;
for (; new_state != added_states_.end(); ++new_state) {
HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
@@ -147,16 +169,16 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) {
TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
// Add state
std::vector<StateID>::iterator new_state = added_states_.begin();
- HmiStatePtr state = std::make_shared<HmiState>(
+ initial_state_ = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- state->set_hmi_level(HMILevel::HMI_FULL);
- app_state.AddState(kDefaultWindowId, state);
+ initial_state_->set_hmi_level(HMILevel::HMI_FULL);
+ app_state.InitState(kDefaultWindowId, std::string(), initial_state_);
++new_state;
// Add some other
for (; new_state != added_states_.end(); ++new_state) {
- state = std::make_shared<HmiState>(
+ HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
@@ -165,24 +187,25 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
}
// Regular state will be the first added state
- new_state = added_states_.begin();
HmiStatePtr reg_state =
app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
- EXPECT_EQ(*new_state, reg_state->state_id());
+ EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level());
}
-TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
+TEST_F(ApplicationStateTest,
+ AddRegularState_ReplaceFirstState_GetRegularState) {
std::vector<StateID>::iterator new_state = added_states_.begin();
- HmiStatePtr state = std::make_shared<HmiState>(
+ initial_state_ = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(kDefaultWindowId, state);
+ initial_state_->set_hmi_level(HMILevel::HMI_FULL);
+ app_state.InitState(kDefaultWindowId, std::string(), initial_state_);
++new_state;
// Add postponed state
- state = std::make_shared<HmiState>(
+ HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
@@ -201,91 +224,92 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
}
// Regular state will be the first added state
- new_state = added_states_.begin();
HmiStatePtr reg_state =
app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
- ASSERT_EQ(*new_state, reg_state->state_id());
+ ASSERT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
+ EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level());
- app_state.RemoveState(kDefaultWindowId, *new_state);
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
+ app_mngr_,
+ StateID::STATE_ID_REGULAR);
+ state->set_hmi_level(HMILevel::HMI_BACKGROUND);
+ app_state.AddState(kDefaultWindowId, state);
- ++new_state;
- // Now regular state is the next state except postponed
+ // Regular state was replaced
reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
- EXPECT_EQ(*new_state, reg_state->state_id());
+ EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
+ EXPECT_EQ(HMILevel::HMI_BACKGROUND, reg_state->hmi_level());
}
TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) {
- // Add some state
- StateID first_state = StateID::STATE_ID_PHONE_CALL;
- HmiStatePtr state = std::make_shared<HmiState>(
+ // Add initial state
+ StateID first_state = StateID::STATE_ID_REGULAR;
+ initial_state_ = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
first_state);
- app_state.AddState(kDefaultWindowId, state);
+ initial_state_->set_hmi_level(HMILevel::HMI_BACKGROUND);
+ app_state.InitState(kDefaultWindowId, std::string(), initial_state_);
// Add postponed state
- state = std::make_shared<HmiState>(
+ HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
+ state->set_hmi_level(HMILevel::HMI_LIMITED);
app_state.AddState(kDefaultWindowId, state);
// Add new postponed state
- std::shared_ptr<MockApplication> mock_app_2(new MockApplication);
state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
+ state->set_hmi_level(HMILevel::HMI_FULL);
app_state.AddState(kDefaultWindowId, state);
- // Add regular state
- state = std::make_shared<HmiState>(
- static_cast<std::shared_ptr<Application> >(mock_app_),
- app_mngr_,
- StateID::STATE_ID_REGULAR);
- app_state.AddState(kDefaultWindowId, state);
-
- // Postponed state is the first
- HmiStatePtr reg_state =
- app_state.GetState(kDefaultWindowId, StateID::STATE_ID_POSTPONED);
+ // Postponed state is returned
+ HmiStatePtr reg_state = app_state.GetState(kDefaultWindowId, postponed_id);
ASSERT_EQ(postponed_id, reg_state->state_id());
+ EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level());
- // Regular state is the second one
+ // Regular state is returned
reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
+ EXPECT_EQ(HMILevel::HMI_BACKGROUND, reg_state->hmi_level());
}
TEST_F(ApplicationStateTest, InitState_GetRegularState) {
StateID init_state = StateID::STATE_ID_REGULAR;
- HmiStatePtr state = std::make_shared<HmiState>(
+ initial_state_ = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
init_state);
- app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, initial_state_);
HmiStatePtr reg_state =
app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
- EXPECT_EQ(state, reg_state);
+ EXPECT_EQ(initial_state_, reg_state);
HmiStatePtr curr_state =
app_state.GetState(kDefaultWindowId, StateID::STATE_ID_CURRENT);
- EXPECT_EQ(state, curr_state);
+ EXPECT_EQ(initial_state_, curr_state);
}
-TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) {
+TEST_F(ApplicationStateTest, AddPostponedState_DeletePosponedState) {
// Precondition
StateID init_state = StateID::STATE_ID_REGULAR;
- HmiStatePtr state = std::make_shared<HmiState>(
+ initial_state_ = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
init_state);
- state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ initial_state_->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
- app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, initial_state_);
// Add postponed state
- state = std::make_shared<HmiState>(
+ HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
@@ -305,19 +329,19 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) {
TEST_F(ApplicationStateTest,
AddRegularState_RemoveRegularState_RegularStateNotDeleted) {
- StateID reg_state = StateID::STATE_ID_REGULAR;
- HmiStatePtr state = std::make_shared<HmiState>(
+ StateID init_state = StateID::STATE_ID_REGULAR;
+ initial_state_ = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
- reg_state);
- app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
+ init_state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, initial_state_);
// Try deleting regular state
- app_state.RemoveState(kDefaultWindowId, reg_state);
+ app_state.RemoveState(kDefaultWindowId, init_state);
// Get regular state
- HmiStatePtr get_reg_state = app_state.GetState(kDefaultWindowId, reg_state);
- EXPECT_EQ(state, get_reg_state);
+ HmiStatePtr get_reg_state = app_state.GetState(kDefaultWindowId, init_state);
+ EXPECT_EQ(initial_state_, get_reg_state);
}
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index 175c39513e..2aab8cf727 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -67,6 +67,8 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(set_is_navi, void(bool allow));
MOCK_CONST_METHOD0(mobile_projection_enabled, bool());
MOCK_METHOD1(set_mobile_projection_enabled, void(bool allow));
+ MOCK_CONST_METHOD0(webengine_projection_enabled, bool());
+ MOCK_METHOD1(set_webengine_projection_enabled, void(const bool allow));
MOCK_CONST_METHOD0(video_streaming_approved, bool());
MOCK_METHOD1(set_video_streaming_approved, void(bool state));
MOCK_CONST_METHOD0(audio_streaming_approved, bool());
@@ -315,12 +317,11 @@ class MockApplication : public ::application_manager::Application {
void(uint32_t cmd_id,
const smart_objects::SmartObject& command));
MOCK_METHOD1(RemoveCommand, void(uint32_t cmd_id));
- MOCK_METHOD1(FindCommand, smart_objects::SmartObject*(uint32_t cmd_id));
+ MOCK_METHOD1(FindCommand, smart_objects::SmartObject(uint32_t cmd_id));
MOCK_METHOD2(AddSubMenu,
void(uint32_t menu_id, const smart_objects::SmartObject& menu));
MOCK_METHOD1(RemoveSubMenu, void(uint32_t menu_id));
- MOCK_CONST_METHOD1(FindSubMenu,
- smart_objects::SmartObject*(uint32_t menu_id));
+ MOCK_CONST_METHOD1(FindSubMenu, smart_objects::SmartObject(uint32_t menu_id));
MOCK_METHOD2(IsSubMenuNameAlreadyExist,
bool(const std::string& name, const uint32_t parent_id));
MOCK_METHOD2(AddChoiceSet,
@@ -328,7 +329,7 @@ class MockApplication : public ::application_manager::Application {
const smart_objects::SmartObject& choice_set));
MOCK_METHOD1(RemoveChoiceSet, void(uint32_t choice_set_id));
MOCK_METHOD1(FindChoiceSet,
- smart_objects::SmartObject*(uint32_t choice_set_id));
+ smart_objects::SmartObject(uint32_t choice_set_id));
MOCK_METHOD3(AddPerformInteractionChoiceSet,
void(uint32_t correlation_id,
uint32_t choice_set_id,
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index a4cb20993e..d7919a374b 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -119,10 +119,17 @@ class MockMessageHelper {
MOCK_METHOD2(CreateMessageForHMI,
smart_objects::SmartObjectSPtr(hmi_apis::messageType::eType,
const uint32_t));
- MOCK_METHOD3(SendHMIStatusNotification,
- void(ApplicationSharedPtr application,
- const WindowID window_id,
- ApplicationManager& application_manager));
+ MOCK_METHOD2(CreateMessageForHMI,
+ smart_objects::SmartObjectSPtr(hmi_apis::FunctionID::eType,
+ const uint32_t));
+ MOCK_METHOD2(CreateHMIStatusNotification,
+ smart_objects::SmartObjectSPtr(ApplicationSharedPtr application,
+ const WindowID window_id));
+ MOCK_METHOD3(CreateOnButtonSubscriptionNotificationsForApp,
+ smart_objects::SmartObjectList(
+ ApplicationConstSharedPtr application,
+ ApplicationManager& app_mngr,
+ const ButtonSubscriptions& button_subscriptions));
MOCK_METHOD4(SendPolicyUpdate,
void(const std::string& file_path,
const uint32_t timeout,
@@ -166,17 +173,39 @@ class MockMessageHelper {
MOCK_METHOD2(SendAllOnButtonSubscriptionNotificationsForApp,
void(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr));
+ MOCK_METHOD2(CreateUIResetGlobalPropertiesRequest,
+ smart_objects::SmartObjectSPtr(
+ const ResetGlobalPropertiesResult& reset_result,
+ ApplicationSharedPtr application));
+
+ MOCK_METHOD2(CreateTTSResetGlobalPropertiesRequest,
+ smart_objects::SmartObjectSPtr(
+ const ResetGlobalPropertiesResult& reset_result,
+ ApplicationSharedPtr application));
+ MOCK_METHOD2(CreateGlobalPropertiesRequestsToHMI,
+ smart_objects::SmartObjectList(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD1(CreateSubscribeWayPointsMessageToHMI,
+ smart_objects::SmartObjectSPtr(const uint32_t correlation_id));
+
+ MOCK_METHOD3(
+ CreateOnButtonSubscriptionNotification,
+ smart_objects::SmartObjectSPtr(uint32_t app_id,
+ hmi_apis::Common_ButtonName::eType button,
+ bool is_subscribed));
MOCK_METHOD2(SendOnResumeAudioSourceToHMI,
void(uint32_t app_id, ApplicationManager& app_mngr));
- MOCK_METHOD2(CreateAddSubMenuRequestToHMI,
+ MOCK_METHOD2(CreateAddSubMenuRequestsToHMI,
smart_objects::SmartObjectList(ApplicationConstSharedPtr app,
- const uint32_t correlation_id));
+ ApplicationManager& app_mngr));
MOCK_METHOD2(CreateAddCommandRequestToHMI,
smart_objects::SmartObjectList(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr));
MOCK_METHOD1(CreateAddVRCommandRequestFromChoiceToHMI,
smart_objects::SmartObjectList(ApplicationConstSharedPtr app));
- MOCK_METHOD1(SendGlobalPropertiesToHMI, void(ApplicationConstSharedPtr app));
+ MOCK_METHOD2(SendGlobalPropertiesToHMI,
+ void(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
MOCK_METHOD3(VerifyTtsFiles,
mobile_apis::Result::eType(smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
@@ -264,7 +293,8 @@ class MockMessageHelper {
const std::string& urlSchema,
const std::string& packageName,
ApplicationManager& app_man));
- MOCK_METHOD1(SendUnsubscribedWayPoints, bool(ApplicationManager& app_mngr));
+ MOCK_METHOD1(CreateUnsubscribeWayPointsRequest,
+ smart_objects::SmartObjectSPtr(const uint32_t correlation_id));
MOCK_METHOD2(SendQueryApps,
void(const uint32_t connection_key,
@@ -295,10 +325,14 @@ class MockMessageHelper {
MOCK_METHOD2(GetDeviceMacAddressForHandle,
std::string(const transport_manager::DeviceHandle device_handle,
const ApplicationManager& app_mngr));
- MOCK_METHOD3(SendDeleteCommandRequest,
- void(smart_objects::SmartObject* cmd,
- ApplicationSharedPtr application,
- ApplicationManager& app_mngr));
+ MOCK_METHOD3(CreateDeleteUICommandRequest,
+ smart_objects::SmartObjectSPtr(smart_objects::SmartObject* cmd,
+ const uint32_t app_id,
+ const uint32_t corr_id));
+ MOCK_METHOD3(CreateDeleteVRCommandRequest,
+ smart_objects::SmartObjectSPtr(smart_objects::SmartObject* cmd,
+ ApplicationSharedPtr application,
+ const uint32_t corr_id));
MOCK_METHOD3(SendDeleteSubmenuRequest,
void(smart_objects::SmartObject* cmd,
ApplicationSharedPtr application,
@@ -336,6 +370,21 @@ class MockMessageHelper {
const hmi_apis::Common_ServiceStatusUpdateReason::eType
service_update_reason,
const uint32_t app_id));
+ MOCK_METHOD4(CreateNegativeResponseFromHmi,
+ smart_objects::SmartObjectSPtr(const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code,
+ const std::string& info));
+
+ MOCK_METHOD3(CreateResponseMessageFromHmi,
+ smart_objects::SmartObjectSPtr(const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code));
+ MOCK_METHOD3(CreateUIDeleteWindowRequestToHMI,
+ smart_objects::SmartObjectSPtr(
+ application_manager::ApplicationSharedPtr application,
+ application_manager::ApplicationManager& app_mngr,
+ const application_manager::WindowID window_id));
static MockMessageHelper* message_helper_mock();
};
diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
index 3935ab7924..6b2d31f72f 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
@@ -38,7 +38,7 @@
namespace test {
namespace components {
-namespace resumprion_test {
+namespace resumption_test {
class MockResumeCtrl : public resumption::ResumeCtrl {
public:
@@ -59,12 +59,16 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_CONST_METHOD0(is_suspended, bool());
MOCK_METHOD0(StopSavePersistentDataTimer, void());
MOCK_METHOD0(StartSavePersistentDataTimer, void());
- MOCK_METHOD2(StartResumption,
+ MOCK_METHOD3(StartResumption,
bool(app_mngr::ApplicationSharedPtr application,
- const std::string& hash));
+ const std::string& hash,
+ resumption::ResumeCtrl::ResumptionCallBack));
MOCK_METHOD1(StartResumptionOnlyHMILevel,
bool(app_mngr::ApplicationSharedPtr application));
MOCK_METHOD1(RetryResumption, void(const uint32_t app_id));
+ MOCK_METHOD2(HandleOnTimeOut,
+ void(const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType));
MOCK_METHOD1(CheckPersistenceFilesForResumption,
bool(app_mngr::ApplicationSharedPtr application));
MOCK_METHOD2(CheckApplicationHash,
@@ -103,15 +107,11 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
bool check_policy));
MOCK_CONST_METHOD0(LaunchTime, time_t());
- MOCK_METHOD2(RestoreAppWidgets,
- size_t(app_mngr::ApplicationSharedPtr application,
- const smart_objects::SmartObject& saved_app));
-
- MOCK_METHOD1(RestoreWidgetsHMIState,
- void(const smart_objects::SmartObject& response_message));
-
- MOCK_METHOD1(StartWaitingForDisplayCapabilitiesUpdate,
- void(application_manager::ApplicationSharedPtr application));
+ MOCK_METHOD2(StartWaitingForDisplayCapabilitiesUpdate,
+ void(application_manager::ApplicationSharedPtr application,
+ const bool is_resume_app));
+ MOCK_METHOD0(resumption_data_processor,
+ resumption::ResumptionDataProcessor&());
#ifdef BUILD_TESTS
MOCK_METHOD1(set_resumption_storage,
@@ -120,7 +120,7 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
#endif // BUILD_TESTS
};
-} // namespace resumprion_test
+} // namespace resumption_test
} // namespace components
} // namespace test
diff --git a/src/components/utils/test/log_message_loop_thread_test.cc b/src/components/application_manager/test/include/application_manager/mock_resumption_data_processor.h
index 74b1f5094f..11ca5949c5 100644
--- a/src/components/utils/test/log_message_loop_thread_test.cc
+++ b/src/components/application_manager/test/include/application_manager/mock_resumption_data_processor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2018, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,49 +30,35 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/log_message_loop_thread.h"
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_PROCESSOR_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_PROCESSOR_H
+
+#include "application_manager/application.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+
#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-#include "utils/logger_status.h"
namespace test {
namespace components {
-namespace utils_test {
-
-using namespace ::logger;
-using ::testing::_;
-
-TEST(LogMessageLoopThread, DestroyLogMessage_loggerStatusDeletingLogger) {
- logger::logger_status = CreatingLoggerThread;
- LogMessageLoopThread* loop_thread = new LogMessageLoopThread();
- // assert
- EXPECT_EQ(CreatingLoggerThread, logger::logger_status);
-
- // act
- delete loop_thread;
-
- // assert
- EXPECT_EQ(DeletingLoggerThread, logger::logger_status);
+namespace resumption_test {
- logger::logger_status = LoggerThreadNotCreated;
-}
-
-class MockLogMessageTest : public LogMessageLoopThread {
+class MockResumptionDataProcessor : public resumption::ResumptionDataProcessor {
public:
- MOCK_CONST_METHOD1(Handle, void(const LogMessage message));
+ MOCK_METHOD3(Restore,
+ void(application_manager::ApplicationSharedPtr application,
+ smart_objects::SmartObject& saved_app,
+ resumption::ResumeCtrl::ResumptionCallBack callback));
+ MOCK_METHOD2(HandleOnTimeOut,
+ void(const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id));
+ MOCK_METHOD2(SubscribeToResponse,
+ void(const int32_t app_id,
+ const resumption::ResumptionRequest& request));
};
-TEST(LogMessageLoopThread, HandleNeverCalled) {
- logger::logger_status = CreatingLoggerThread;
-
- MockLogMessageTest mmock;
- EXPECT_CALL(mmock, Handle(_)).Times(0);
- LogMessageLoopThread* loop_thread = new LogMessageLoopThread();
-
- delete loop_thread;
- logger::logger_status = LoggerThreadNotCreated;
-}
-
-} // namespace utils_test
+} // namespace resumption_test
} // namespace components
} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_PROCESSOR_H
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
index 358e1af4d5..c380805bc2 100644
--- a/src/components/application_manager/test/message_helper/message_helper_test.cc
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -167,8 +167,10 @@ TEST(MessageHelperTestCreate,
EXPECT_CALL(*mock_help_prompt_manager, GetSendingType())
.WillRepeatedly(Return(HelpPromptManager::SendingType::kSendBoth));
+ application_manager_test::MockApplicationManager mock_application_manager;
smart_objects::SmartObjectList ptr =
- MessageHelper::CreateGlobalPropertiesRequestsToHMI(appSharedMock, 0u);
+ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
+ appSharedMock, mock_application_manager);
EXPECT_TRUE(ptr.empty());
}
@@ -217,8 +219,10 @@ TEST(MessageHelperTestCreate,
EXPECT_CALL(*mock_help_prompt_manager, GetSendingType())
.WillRepeatedly(Return(HelpPromptManager::SendingType::kSendBoth));
+ application_manager_test::MockApplicationManager mock_application_manager;
smart_objects::SmartObjectList ptr =
- MessageHelper::CreateGlobalPropertiesRequestsToHMI(appSharedMock, 0u);
+ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
+ appSharedMock, mock_application_manager);
EXPECT_FALSE(ptr.empty());
@@ -407,9 +411,10 @@ TEST(MessageHelperTestCreate, CreateAddSubMenuRequestToHMI_SendObject_Equal) {
EXPECT_CALL(*appSharedMock, sub_menu_map()).WillOnce(Return(data_accessor));
EXPECT_CALL(*appSharedMock, app_id()).Times(AtLeast(1)).WillOnce(Return(1u));
- const uint32_t cor_id = 0u;
+ application_manager_test::MockApplicationManager mock_application_manager;
smart_objects::SmartObjectList ptr =
- MessageHelper::CreateAddSubMenuRequestToHMI(appSharedMock, cor_id);
+ MessageHelper::CreateAddSubMenuRequestsToHMI(appSharedMock,
+ mock_application_manager);
EXPECT_FALSE(ptr.empty());
@@ -437,9 +442,10 @@ TEST(MessageHelperTestCreate,
EXPECT_CALL(*appSharedMock, sub_menu_map()).WillOnce(Return(data_accessor));
- const uint32_t cor_id = 0u;
+ application_manager_test::MockApplicationManager mock_application_manager;
smart_objects::SmartObjectList ptr =
- MessageHelper::CreateAddSubMenuRequestToHMI(appSharedMock, cor_id);
+ MessageHelper::CreateAddSubMenuRequestsToHMI(appSharedMock,
+ mock_application_manager);
EXPECT_TRUE(ptr.empty());
}
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 37afecee6e..91f953eaf5 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -238,12 +238,16 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
message_type, correlation_id);
}
-void MessageHelper::SendHMIStatusNotification(
- ApplicationSharedPtr application,
- const WindowID window_id,
- ApplicationManager& application_manager) {
- MockMessageHelper::message_helper_mock()->SendHMIStatusNotification(
- application, window_id, application_manager);
+smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
+ hmi_apis::FunctionID::eType function_id, const uint32_t correlation_id) {
+ return MockMessageHelper::message_helper_mock()->CreateMessageForHMI(
+ function_id, correlation_id);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateHMIStatusNotification(
+ ApplicationSharedPtr application, const WindowID window_id) {
+ return MockMessageHelper::message_helper_mock()->CreateHMIStatusNotification(
+ application, window_id);
}
void MessageHelper::SendUpdateSDLResponse(const std::string& result,
@@ -275,10 +279,10 @@ void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
app_id, app_mngr);
}
-smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
- ApplicationConstSharedPtr app, const uint32_t correlation_id) {
- return MockMessageHelper::message_helper_mock()->CreateAddSubMenuRequestToHMI(
- app, correlation_id);
+smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestsToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateAddSubMenuRequestsToHMI(app, app_mngr);
}
smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
@@ -297,7 +301,7 @@ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()->SendGlobalPropertiesToHMI(
- app);
+ app, app_mngr);
}
mobile_apis::Result::eType MessageHelper::VerifyTtsFiles(
@@ -466,9 +470,10 @@ void MessageHelper::SendLaunchApp(const uint32_t connection_key,
connection_key, urlSchema, packageName, app_man);
}
-bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) {
- return MockMessageHelper::message_helper_mock()->SendUnsubscribedWayPoints(
- app_mngr);
+smart_objects::SmartObjectSPtr MessageHelper::CreateUnsubscribeWayPointsRequest(
+ const uint32_t correlation_id) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateUnsubscribeWayPointsRequest(correlation_id);
}
void MessageHelper::SendQueryApps(const uint32_t connection_key,
@@ -525,11 +530,20 @@ std::string MessageHelper::GetDeviceMacAddressForHandle(
device_handle, app_mngr);
}
-void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd,
- ApplicationSharedPtr application,
- ApplicationManager& app_mngr) {
- return MockMessageHelper::message_helper_mock()->SendDeleteCommandRequest(
- cmd, application, app_mngr);
+smart_objects::SmartObjectSPtr MessageHelper::CreateDeleteUICommandRequest(
+ smart_objects::SmartObject* cmd,
+ const uint32_t app_id,
+ const uint32_t corr_id) {
+ return MockMessageHelper::message_helper_mock()->CreateDeleteUICommandRequest(
+ cmd, app_id, corr_id);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateDeleteVRCommandRequest(
+ smart_objects::SmartObject* cmd,
+ ApplicationSharedPtr application,
+ const uint32_t corr_id) {
+ return MockMessageHelper::message_helper_mock()->CreateDeleteVRCommandRequest(
+ cmd, application, corr_id);
}
void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd,
@@ -552,6 +566,48 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application,
application, app_mngr);
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateUIResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ ApplicationSharedPtr application) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateUIResetGlobalPropertiesRequest(reset_result, application);
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateTTSResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ ApplicationSharedPtr application) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateTTSResetGlobalPropertiesRequest(reset_result, application);
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateGlobalPropertiesRequestsToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateGlobalPropertiesRequestsToHMI(app, app_mngr);
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateOnButtonSubscriptionNotification(
+ uint32_t app_id,
+ hmi_apis::Common_ButtonName::eType button,
+ bool is_subscribed) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateOnButtonSubscriptionNotification(app_id, button, is_subscribed);
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr application,
+ ApplicationManager& app_mngr,
+ const ButtonSubscriptions& button_subscriptions) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateOnButtonSubscriptionNotificationsForApp(
+ application, app_mngr, button_subscriptions);
+}
+
void MessageHelper::SendUnsubscribeButtonNotification(
mobile_apis::ButtonName::eType button,
ApplicationSharedPtr application,
@@ -597,4 +653,30 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateOnServiceUpdateNotification(
->CreateOnServiceUpdateNotification(
service_type, service_event, service_update_reason, app_id);
}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateUIDeleteWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const WindowID window_id) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateUIDeleteWindowRequestToHMI(application, app_mngr, window_id);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponseFromHmi(
+ const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code,
+ const std::string& info) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateNegativeResponseFromHmi(
+ function_id, correlation_id, result_code, info);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateResponseMessageFromHmi(
+ const int32_t function_id,
+ const uint32_t correlation_id,
+ const int32_t result_code) {
+ return MockMessageHelper::message_helper_mock()->CreateResponseMessageFromHmi(
+ function_id, correlation_id, result_code);
+}
} // namespace application_manager
diff --git a/src/components/application_manager/test/rc_policy_handler_test.cc b/src/components/application_manager/test/rc_policy_handler_test.cc
index cc9f741d28..c4d6b11f5a 100644
--- a/src/components/application_manager/test/rc_policy_handler_test.cc
+++ b/src/components/application_manager/test/rc_policy_handler_test.cc
@@ -211,7 +211,7 @@ TEST_F(RCPolicyHandlerTest, OnUpdateHMILevel_HmiLevelChanged_SUCCESS) {
EXPECT_CALL(app_manager_,
ChangeAppsHMILevel(kAppId1_, mobile_apis::HMILevel::HMI_LIMITED));
- EXPECT_CALL(mock_message_helper_, SendHMIStatusNotification(_, _));
+ EXPECT_CALL(mock_message_helper_, CreateHMIStatusNotification(_, _));
policy_handler_.OnUpdateHMILevel(kDeviceId_, kPolicyAppId_, hmi_level);
}
@@ -276,7 +276,7 @@ TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_ValidAppAndHmiLevel_SUCCESS) {
EXPECT_CALL(app_manager_,
ChangeAppsHMILevel(kAppId1_, mobile_apis::HMILevel::HMI_NONE));
- EXPECT_CALL(mock_message_helper_, SendHMIStatusNotification(_, _));
+ EXPECT_CALL(mock_message_helper_, CreateHMIStatusNotification(_, _));
policy_handler_.OnUpdateHMIStatus(kDeviceId_, kPolicyAppId_, hmi_level);
}
@@ -307,7 +307,7 @@ TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_ValidParams_SUCCESS) {
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(app_manager_,
ChangeAppsHMILevel(kAppId1_, mobile_apis::HMILevel::HMI_NONE));
- EXPECT_CALL(mock_message_helper_, SendHMIStatusNotification(_, _));
+ EXPECT_CALL(mock_message_helper_, CreateHMIStatusNotification(_, _));
policy_handler_.OnUpdateHMIStatus(kDeviceId_, kPolicyAppId_, hmi_level);
}
diff --git a/src/components/application_manager/test/request_info_test.cc b/src/components/application_manager/test/request_info_test.cc
index a0b1793cf5..118ca1e41e 100644
--- a/src/components/application_manager/test/request_info_test.cc
+++ b/src/components/application_manager/test/request_info_test.cc
@@ -90,7 +90,6 @@ class RequestInfoTest : public ::testing::Test {
};
TEST_F(RequestInfoTest, RequestInfoEqualEndTime) {
- std::vector<std::shared_ptr<TestRequestInfo> > requests;
const date_time::TimeDuration& time = date_time::getCurrentTime();
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
std::shared_ptr<TestRequestInfo> request = CreateTestInfo(
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index b4e5e85376..ded6aa956e 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -35,7 +35,6 @@
#include "application_manager/application.h"
#include "application_manager/application_manager_impl.h"
-#include "application_manager/display_capabilities_builder.h"
#include "application_manager/mock_app_extension.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_help_prompt_manager.h"
@@ -154,6 +153,9 @@ class ResumeCtrlTest : public ::testing::Test {
EXPECT_CALL(*mock_app_, deferred_resumption_hmi_level())
.Times(AtLeast(0))
.WillRepeatedly(Return(kDefaultDeferredTestLevel_));
+
+ callback_ = [](mobile_apis::Result::eType result_code,
+ const std::string& info) {};
}
void TearDown() OVERRIDE {
Mock::VerifyAndClearExpectations(&mock_app_mngr_);
@@ -242,6 +244,7 @@ class ResumeCtrlTest : public ::testing::Test {
const std::string kProjectionLowbandwidthLevel_;
const std::string kMediaLowbandwidthLevel_;
NiceMock<application_manager_test::MockRPCService> mock_rpc_service_;
+ resumption::ResumeCtrl::ResumptionCallBack callback_;
};
/**
@@ -260,10 +263,10 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithGrammarId) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*mock_app_, UpdateHash());
+
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
@@ -285,10 +288,9 @@ TEST_F(ResumeCtrlTest, StartResumption_WithoutGrammarId) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*mock_app_, UpdateHash());
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)).Times(0);
- bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_FALSE(res);
}
@@ -332,7 +334,17 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*mock_app_, UpdateHash());
+
+ smart_objects::SmartObjectList requests;
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAddCommandRequestToHMI(_, _))
+ .WillRepeatedly(Return(requests));
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAddVRCommandRequestFromChoiceToHMI(_))
+ .WillRepeatedly(Return(requests));
+ std::list<application_manager::AppExtensionPtr> extensions;
+ extensions.insert(extensions.begin(), mock_app_extension_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_files; ++i) {
EXPECT_CALL(*mock_app_,
@@ -343,7 +355,7 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) {
static_cast<mobile_apis::FileType::eType>(file_types[i]))));
}
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
@@ -376,16 +388,23 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubmenues) {
for (uint32_t i = 0; i < count_of_submenues; ++i) {
EXPECT_CALL(*mock_app_, AddSubMenu(i, test_application_submenues[i]));
}
- smart_objects::SmartObjectList requests;
- EXPECT_CALL(mock_app_mngr_, GetNextHMICorrelationID())
- .WillRepeatedly(Return(kCorId_));
+ smart_objects::SmartObjectList requests;
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateAddSubMenuRequestToHMI(_, kCorId_))
+ CreateAddSubMenuRequestsToHMI(_, _))
.WillRepeatedly(Return(requests));
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAddCommandRequestToHMI(_, _))
+ .WillRepeatedly(Return(requests));
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAddVRCommandRequestFromChoiceToHMI(_))
+ .WillRepeatedly(Return(requests));
+
+ std::list<application_manager::AppExtensionPtr> extensions;
+ extensions.insert(extensions.begin(), mock_app_extension_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
- EXPECT_CALL(*mock_app_, UpdateHash());
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
@@ -412,7 +431,6 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*mock_app_, UpdateHash());
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
ON_CALL(*mock_app_, help_prompt_manager())
.WillByDefault(ReturnRef(*mock_help_prompt_manager_));
@@ -451,7 +469,14 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
CreateAddCommandRequestToHMI(_, _))
.WillRepeatedly(Return(requests));
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAddVRCommandRequestFromChoiceToHMI(_))
+ .WillRepeatedly(Return(requests));
+ std::list<application_manager::AppExtensionPtr> extensions;
+ extensions.insert(extensions.begin(), mock_app_extension_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
@@ -491,7 +516,6 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*mock_app_, UpdateHash());
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_choice_sets; ++i) {
@@ -502,14 +526,24 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) {
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
CreateAddVRCommandRequestFromChoiceToHMI(_))
.WillRepeatedly(Return(requests));
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAddCommandRequestToHMI(_, _))
+ .WillRepeatedly(Return(requests));
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ std::list<application_manager::AppExtensionPtr> extensions;
+ extensions.insert(extensions.begin(), mock_app_extension_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
TEST_F(ResumeCtrlTest, StartResumption_AppWithGlobalProperties) {
// Prepare Data
smart_objects::SmartObject test_global_properties;
+ test_global_properties[application_manager::strings::vr_help_title] =
+ "VR help title";
+
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hash_id] = kHash_;
saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
@@ -526,13 +560,19 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithGlobalProperties) {
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- SendGlobalPropertiesToHMI(_));
-
EXPECT_CALL(*mock_app_, load_global_properties(test_global_properties));
- EXPECT_CALL(*mock_app_, UpdateHash());
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ smart_objects::SmartObjectList requests;
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateGlobalPropertiesRequestsToHMI(_, _))
+ .WillRepeatedly(Return(requests));
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAddCommandRequestToHMI(_, _))
+ .WillRepeatedly(Return(requests));
+ std::list<application_manager::AppExtensionPtr> extensions;
+ extensions.insert(extensions.begin(), mock_app_extension_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
@@ -563,6 +603,19 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ std::shared_ptr<sync_primitives::Lock> button_lock_ptr =
+ std::make_shared<sync_primitives::Lock>();
+ ButtonSubscriptions button_subscriptions;
+ DataAccessor<ButtonSubscriptions> button_subscription_accessor(
+ button_subscriptions, button_lock_ptr);
+ ON_CALL(*mock_app_, SubscribedButtons())
+ .WillByDefault(Return(button_subscription_accessor));
+
+ smart_objects::SmartObjectList button_subscription_notifications;
+ ON_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateOnButtonSubscriptionNotificationsForApp(_, _, _))
+ .WillByDefault(Return(button_subscription_notifications));
+
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_buttons; ++i) {
@@ -570,20 +623,17 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
*mock_app_,
SubscribeToButton(static_cast<mobile_apis::ButtonName::eType>(i)));
}
- EXPECT_CALL(*mock_app_, UpdateHash());
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
- EXPECT_CALL(*mock_app_extension_, ProcessResumption(test_subscriptions));
-
+ EXPECT_CALL(*mock_app_extension_, ProcessResumption(saved_app));
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- SendAllOnButtonSubscriptionNotificationsForApp(_, _))
- .Times(2);
+ CreateOnButtonSubscriptionNotificationsForApp(_, _, _));
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
@@ -620,19 +670,19 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
smart_objects::SmartObjectList requests;
- EXPECT_CALL(*mock_app_, UpdateHash());
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
- EXPECT_CALL(*mock_app_extension_, ProcessResumption(test_subscriptions));
- const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
+ EXPECT_CALL(*mock_app_extension_, ProcessResumption(saved_app));
+ const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
-TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToWayPoints) {
+TEST_F(ResumeCtrlTest,
+ DISABLED_StartResumption_AppWithSubscriptionToWayPoints) {
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hash_id] = kHash_;
saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
@@ -644,6 +694,16 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToWayPoints) {
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
+
+ smart_objects::SmartObjectSPtr subscribe_waypoints_msg;
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateSubscribeWayPointsMessageToHMI(_))
+ .WillRepeatedly(Return(subscribe_waypoints_msg));
+ std::list<application_manager::AppExtensionPtr> extensions;
+ // It will work only for WayPointsAppExtension, need to rework this test
+ extensions.insert(extensions.begin(), mock_app_extension_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+
EXPECT_CALL(
mock_app_mngr_,
SubscribeAppForWayPoints(A<application_manager::ApplicationSharedPtr>()));
@@ -654,228 +714,10 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToWayPoints) {
EXPECT_CALL(mock_state_controller_,
SetRegularState(_, kDefaultWindowId, hmi_test_level));
- const bool result = res_ctrl_->StartResumption(mock_app_, kHash_);
+ const bool result = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(result);
}
-TEST_F(ResumeCtrlTest,
- RestoreAppWidgets_AppWithWidgets_SendCreateWindowRequests) {
- using namespace smart_objects;
- using namespace application_manager;
- GetInfoFromApp();
- const uint32_t count_of_widgets = 10u;
-
- auto create_window_info_so = []() -> SmartObject {
- SmartObject widgets_info(SmartType_Array);
- for (uint32_t i = 0; i < count_of_widgets; ++i) {
- SmartObject widget_info(SmartType_Map);
- widget_info[strings::associated_service_type] = "ServiceType";
- widget_info[strings::duplicate_updates_from_window_id] = 0;
- widget_info[strings::window_name] =
- std::string("Widget ") + std::to_string(i + 1);
- widget_info[strings::window_type] =
- static_cast<int32_t>(mobile_apis::WindowType::WIDGET);
- widget_info[strings::window_id] = i + 1;
- widgets_info[widgets_info.length()] = widget_info;
- }
- return widgets_info;
- };
-
- auto create_saved_app_so = [&create_window_info_so, this]() -> SmartObject {
- smart_objects::SmartObject saved_app;
- const auto test_app_widgets = create_window_info_so();
- saved_app[strings::hash_id] = kHash_;
- saved_app[strings::windows_info] = test_app_widgets;
- saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
- saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
- return saved_app;
- };
-
- const auto saved_app = create_saved_app_so();
-
- const auto hmi_request = std::make_shared<smart_objects::SmartObject>(
- smart_objects::SmartType_Map);
- const auto hmi_requests =
- smart_objects::SmartObjectList(count_of_widgets, hmi_request);
-
- DisplayCapabilitiesBuilder builder(*mock_app_);
- ON_CALL(*mock_app_, display_capabilities_builder())
- .WillByDefault(ReturnRef(builder));
- EXPECT_CALL(
- *application_manager::MockMessageHelper::message_helper_mock(),
- CreateUICreateWindowRequestsToHMI(_, _, saved_app[strings::windows_info]))
- .WillOnce(Return(hmi_requests));
-
- ON_CALL(mock_app_mngr_, GetRPCService())
- .WillByDefault(ReturnRef(mock_rpc_service_));
-
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
- .Times(count_of_widgets)
- .WillRepeatedly(Return(true));
-
- res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
-}
-
-TEST_F(ResumeCtrlTest,
- RestoreWidgetsHMIState_AppWithWidgets_AddWidgetsInternally) {
- const uint32_t count_of_widgets = 10u;
-
- smart_objects::SmartObject saved_app;
- saved_app[strings::hash_id] = kHash_;
- saved_app[strings::windows_info] = smart_objects::SmartObject();
- saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
- saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
-
- ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
- .WillByDefault(Return(mock_app_));
- DisplayCapabilitiesBuilder builder(*mock_app_);
- ON_CALL(*mock_app_, display_capabilities_builder())
- .WillByDefault(ReturnRef(builder));
-
- smart_objects::SmartObjectList requests;
- smart_objects::SmartObjectList responses;
- for (uint32_t i = 0; i < count_of_widgets; ++i) {
- const auto window_type = mobile_apis::WindowType::WIDGET;
- const WindowID window_id = i + 1;
- const auto window_name = std::string("Widget ") + std::to_string(window_id);
- requests.push_back(
- CreateStubCreateWindowRequest(window_name, window_id, window_type));
- responses.push_back(CreateStubCreateWindowResponse(
- window_id, hmi_apis::Common_Result::SUCCESS));
- EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
- .WillRepeatedly(Return(nullptr));
- EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _));
- EXPECT_CALL(mock_state_controller_,
- OnAppWindowAdded(_, window_id, window_type, _));
- }
-
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateUICreateWindowRequestsToHMI(_, _, _))
- .WillOnce(Return(requests));
-
- ON_CALL(mock_app_mngr_, GetRPCService())
- .WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
- .Times(count_of_widgets)
- .WillRepeatedly(Return(true));
- res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
- for (const auto& response : responses) {
- res_ctrl_->RestoreWidgetsHMIState(*response);
- }
-}
-
-TEST_F(ResumeCtrlTest,
- RestoreAppWidgets_AppWithoutWidgets_NoCreateWindowRqSent) {
- smart_objects::SmartObject saved_app;
- saved_app[strings::hash_id] = kHash_;
- saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
- saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
-
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateUICreateWindowRequestsToHMI(_, _, _))
- .Times(0);
-
- res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
-}
-
-TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_InvalidCorrId) {
- smart_objects::SmartObject saved_app;
- saved_app[strings::hash_id] = kHash_;
- saved_app[strings::windows_info] = smart_objects::SmartObject();
- saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
- saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
-
- const int32_t invalid_corr_id = -1;
- auto response = CreateStubCreateWindowResponse(
- invalid_corr_id, hmi_apis::Common_Result::SUCCESS);
-
- ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
- .WillByDefault(Return(mock_app_));
-
- DisplayCapabilitiesBuilder builder(*mock_app_);
- ON_CALL(*mock_app_, display_capabilities_builder())
- .WillByDefault(ReturnRef(builder));
-
- smart_objects::SmartObjectList requests;
-
- const auto window_type = mobile_apis::WindowType::WIDGET;
- const WindowID window_id = 1;
- const auto window_name = std::string("Widget ") + std::to_string(window_id);
- requests.push_back(
- CreateStubCreateWindowRequest(window_name, window_id, window_type));
-
- EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
- .Times(0);
- EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
- EXPECT_CALL(mock_state_controller_,
- OnAppWindowAdded(_, window_id, window_type, _))
- .Times(0);
-
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateUICreateWindowRequestsToHMI(_, _, _))
- .WillOnce(Return(requests));
-
- ON_CALL(mock_app_mngr_, GetRPCService())
- .WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
- .WillRepeatedly(Return(true));
- res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
- res_ctrl_->RestoreWidgetsHMIState(*response);
-}
-
-TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_Unsuccess) {
- smart_objects::SmartObject saved_app;
- saved_app[strings::hash_id] = kHash_;
- saved_app[strings::windows_info] = smart_objects::SmartObject();
- saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
- saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
-
- const int32_t correlation_id = 1;
- auto response = CreateStubCreateWindowResponse(
- correlation_id, hmi_apis::Common_Result::GENERIC_ERROR);
-
- ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
- .WillByDefault(Return(mock_app_));
-
- DisplayCapabilitiesBuilder builder(*mock_app_);
- smart_objects::SmartObject stub_window_info(smart_objects::SmartType_Null);
- auto stub_resume_cb = [](Application&, const smart_objects::SmartObject&) {};
- builder.InitBuilder(stub_resume_cb, stub_window_info);
- ON_CALL(*mock_app_, display_capabilities_builder())
- .WillByDefault(ReturnRef(builder));
-
- smart_objects::SmartObjectList requests;
- smart_objects::SmartObjectList responses;
-
- const auto window_type = mobile_apis::WindowType::WIDGET;
- const WindowID window_id = 1;
- const auto window_name = std::string("Widget ") + std::to_string(window_id);
- requests.push_back(
- CreateStubCreateWindowRequest(window_name, window_id, window_type));
-
- EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
- .Times(0);
- EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
- EXPECT_CALL(mock_state_controller_,
- OnAppWindowAdded(_, window_id, window_type, _))
- .Times(0);
-
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateUICreateWindowRequestsToHMI(_, _, _))
- .WillOnce(Return(requests));
-
- ON_CALL(mock_app_mngr_, GetRPCService())
- .WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
- .WillRepeatedly(Return(true));
- res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
- res_ctrl_->RestoreWidgetsHMIState(*response);
-}
-
TEST_F(ResumeCtrlTest, StartResumptionOnlyHMILevel) {
smart_objects::SmartObject saved_app;
diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
index d67c229cc3..ec390e4be0 100644
--- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
@@ -61,10 +61,6 @@ using namespace file_system;
using namespace resumption;
using namespace mobile_apis;
-namespace {
-const std::string kPath =
- file_system::CurrentWorkingDirectory() + "/" + "test_storage";
-}
class ResumptionDataDBTest : public ResumptionDataTest {
protected:
void SetUp() OVERRIDE {
@@ -88,10 +84,11 @@ class ResumptionDataDBTest : public ResumptionDataTest {
kDatabaseName = "resumption";
if (is_in_file) {
path_ = "test_storage";
- CreateDirectory(file_system::CurrentWorkingDirectory() + "/" + path_);
- CreateDirectory(kPath);
+ std::string test_storage_path =
+ file_system::CurrentWorkingDirectory() + "/" + "test_storage";
+ CreateDirectory(test_storage_path);
test_db_ = new utils::dbms::SQLDatabase(kDatabaseName);
- test_db_->set_path(kPath + "/");
+ test_db_->set_path(test_storage_path + "/");
res_db_ = new TestResumptionDataDB(In_File_Storage);
} else {
res_db_ = new TestResumptionDataDB(In_Memory_Storage);
@@ -137,6 +134,7 @@ class ResumptionDataDBTest : public ResumptionDataTest {
// Check that db includes tables with given elements
void CheckSavedDB();
static const bool is_in_file = false;
+
const std::string tables_exist =
"SELECT COUNT(*) FROM sqlite_master WHERE `type` = 'table';";
const std::string init_last_ign_count =
diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index 93565b8719..a2de6f399c 100644
--- a/src/components/application_manager/test/state_controller/state_controller_test.cc
+++ b/src/components/application_manager/test/state_controller/state_controller_test.cc
@@ -83,6 +83,15 @@ const uint32_t kHMIAppID = 2718u;
const am::WindowID kDefaultWindowId =
mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
const am::WindowID kCustomWindowId = 2;
+
+const uint32_t kAppIdInFull = 1761;
+const uint32_t kHMIAppIdInFull = 15685;
+const uint32_t kAppIdMovedToFull = 1796;
+const uint32_t kHMIAppIdMovedToFull = 30093;
+const uint32_t kAppIdLimited = 1762;
+const uint32_t kHMIAppIdLimited = 17559;
+const uint32_t kAppIDMovedToLimited = 1763;
+const uint32_t kHMIAppIdMovedToLimited = 17663;
} // namespace
struct HmiStatesComparator {
@@ -131,6 +140,8 @@ struct HmiStatesIDComparator {
#define NOT_VC false
#define NAVI true
#define NOT_NAVI false
+#define WEP true
+#define NOT_WEP false
enum ApplicationType {
APP_TYPE_NON_MEDIA,
@@ -211,12 +222,23 @@ class StateControllerImplTest : public ::testing::Test {
uint32_t media_navi_vc_app_id_ = 1922;
uint32_t media_navi_vc_hmi_app_id_ = 21419;
+ am::ApplicationSharedPtr media_wep_app_;
+ NiceMock<application_manager_test::MockApplication>* media_wep_app_ptr_;
+ uint32_t media_wep_app_id_ = 1977;
+ uint32_t media_wep_app_hmi_app_id_ = 21491;
+
+ am::ApplicationSharedPtr non_media_wep_app_;
+ NiceMock<application_manager_test::MockApplication>* non_media_wep_app_ptr_;
+ uint32_t non_media_wep_app_id_ = 1979;
+ uint32_t non_media_wep_app_hmi_app_id_ = 21599;
+
std::vector<am::HmiStatePtr> valid_states_for_audio_app_;
std::vector<am::HmiStatePtr> valid_states_for_not_audio_app_;
std::vector<am::HmiStatePtr> common_invalid_states_;
std::vector<am::HmiStatePtr> invalid_states_for_not_audio_app;
std::vector<am::HmiStatePtr> invalid_states_for_audio_app;
std::vector<am::HmiState::StateID> valid_state_ids_;
+ std::vector<am::HmiState::StateID> valid_non_navi_state_ids_;
typedef std::map<am::ApplicationSharedPtr,
NiceMock<application_manager_test::MockApplication>*>
@@ -503,7 +525,7 @@ class StateControllerImplTest : public ::testing::Test {
SystemContext::SYSCTXT_MAIN));
result_hmi_state.push_back(
createHmiState(HMILevel::HMI_LIMITED,
- AudioStreamingState::ATTENUATED,
+ AudioStreamingState::NOT_AUDIBLE,
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
result_hmi_state.push_back(
@@ -522,6 +544,10 @@ class StateControllerImplTest : public ::testing::Test {
result_hmi_state = valid_states_for_audio_app_;
break;
}
+ case APP_TYPE_ATTENUATED: {
+ PrepareStateResultsForAttenuated(result_hmi_state);
+ break;
+ }
default: { break; }
}
}
@@ -557,7 +583,7 @@ class StateControllerImplTest : public ::testing::Test {
}
}
- ApplicationType AppType(uint32_t app_id) {
+ ApplicationType AppType(const uint32_t app_id) {
// TODO(AOleynik): Currently there is ongoing discussion regarding mixed
// application properties, i.e. is_media_application flag from RAI and
// AppHmiTypes (NAVIGATION, etc.). Most likely logic should be changed
@@ -573,7 +599,7 @@ class StateControllerImplTest : public ::testing::Test {
return APP_TYPE_NON_MEDIA;
}
- auto app = it->first;
+ const auto app = it->first;
if (app->is_navi()) {
return APP_TYPE_NAVI;
}
@@ -682,18 +708,21 @@ class StateControllerImplTest : public ::testing::Test {
NiceMock<application_manager_test::MockApplication>** app_mock,
uint32_t app_id,
uint32_t hmi_app_id,
- bool media,
- bool navi,
- bool vc) {
+ const bool media,
+ const bool navi,
+ const bool vc,
+ const bool wep) {
*app_mock = new NiceMock<application_manager_test::MockApplication>;
- Mock::AllowLeak(*app_mock); // WorkAround for gogletest bug
+ Mock::AllowLeak(*app_mock); // WorkAround for googletest bug
am::ApplicationSharedPtr app(*app_mock);
ON_CALL(**app_mock, app_id()).WillByDefault(Return(app_id));
ON_CALL(**app_mock, hmi_app_id()).WillByDefault(Return(hmi_app_id));
ON_CALL(**app_mock, is_media_application()).WillByDefault(Return(media));
ON_CALL(**app_mock, is_navi()).WillByDefault(Return(navi));
+ ON_CALL(**app_mock, webengine_projection_enabled())
+ .WillByDefault(Return(wep));
ON_CALL(**app_mock, is_voice_communication_supported())
.WillByDefault(Return(vc));
ON_CALL(**app_mock, IsAudioApplication())
@@ -890,6 +919,15 @@ class StateControllerImplTest : public ::testing::Test {
valid_state_ids_.push_back(am::HmiState::StateID::STATE_ID_PHONE_CALL);
valid_state_ids_.push_back(am::HmiState::StateID::STATE_ID_SAFETY_MODE);
valid_state_ids_.push_back(am::HmiState::StateID::STATE_ID_NAVI_STREAMING);
+
+ valid_non_navi_state_ids_.push_back(
+ am::HmiState::StateID::STATE_ID_VR_SESSION);
+ valid_non_navi_state_ids_.push_back(
+ am::HmiState::StateID::STATE_ID_TTS_SESSION);
+ valid_non_navi_state_ids_.push_back(
+ am::HmiState::StateID::STATE_ID_PHONE_CALL);
+ valid_non_navi_state_ids_.push_back(
+ am::HmiState::StateID::STATE_ID_SAFETY_MODE);
}
void ConfigureApps() {
@@ -898,45 +936,72 @@ class StateControllerImplTest : public ::testing::Test {
simple_hmi_app_id_,
NOT_MEDIA,
NOT_NAVI,
- NOT_VC);
+ NOT_VC,
+ NOT_WEP);
media_app_ = ConfigureApp(&media_app_ptr_,
media_app_id_,
media_hmi_app_id_,
MEDIA,
NOT_NAVI,
- NOT_VC);
+ NOT_VC,
+ NOT_WEP);
navi_app_ = ConfigureApp(&navi_app_ptr_,
navi_app_id_,
navi_hmi_app_id_,
NOT_MEDIA,
NAVI,
- NOT_VC);
- vc_app_ = ConfigureApp(
- &vc_app_ptr_, vc_app_id_, vc_hmi_app_id_, NOT_MEDIA, NOT_NAVI, VC);
+ NOT_VC,
+ NOT_WEP);
+ vc_app_ = ConfigureApp(&vc_app_ptr_,
+ vc_app_id_,
+ vc_hmi_app_id_,
+ NOT_MEDIA,
+ NOT_NAVI,
+ VC,
+ NOT_WEP);
media_navi_app_ = ConfigureApp(&media_navi_app_ptr_,
media_navi_app_id_,
media_navi_hmi_app_id_,
MEDIA,
NAVI,
- NOT_VC);
+ NOT_VC,
+ NOT_WEP);
media_vc_app_ = ConfigureApp(&media_vc_app_ptr_,
media_vc_app_id_,
media_vc_hmi_app_id_,
MEDIA,
NOT_NAVI,
- VC);
+ VC,
+ NOT_WEP);
navi_vc_app_ = ConfigureApp(&navi_vc_app_ptr_,
navi_vc_app_id_,
navi_vc_hmi_app_id_,
NOT_MEDIA,
NAVI,
- VC);
+ VC,
+ NOT_WEP);
media_navi_vc_app_ = ConfigureApp(&media_navi_vc_app_ptr_,
media_navi_vc_app_id_,
media_navi_vc_hmi_app_id_,
MEDIA,
NAVI,
- VC);
+ VC,
+ NOT_WEP);
+ media_wep_app_ = ConfigureApp(&media_wep_app_ptr_,
+ media_wep_app_id_,
+ media_wep_app_hmi_app_id_,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ WEP);
+ non_media_wep_app_ = ConfigureApp(&non_media_wep_app_ptr_,
+ non_media_wep_app_id_,
+ non_media_wep_app_hmi_app_id_,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ WEP);
+
applications_list_[simple_app_] = simple_app_ptr_;
applications_list_[media_app_] = media_app_ptr_;
applications_list_[navi_app_] = navi_app_ptr_;
@@ -945,7 +1010,10 @@ class StateControllerImplTest : public ::testing::Test {
applications_list_[media_vc_app_] = media_vc_app_ptr_;
applications_list_[navi_vc_app_] = navi_vc_app_ptr_;
applications_list_[media_navi_vc_app_] = media_navi_vc_app_ptr_;
+ applications_list_[media_wep_app_] = media_wep_app_ptr_;
+ applications_list_[non_media_wep_app_] = non_media_wep_app_ptr_;
}
+
void CheckAppConfiguration() {
ASSERT_EQ(simple_app_.get(), simple_app_ptr_);
ASSERT_EQ(media_app_.get(), media_app_ptr_);
@@ -955,6 +1023,8 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_EQ(media_vc_app_.get(), media_vc_app_ptr_);
ASSERT_EQ(navi_vc_app_.get(), navi_vc_app_ptr_);
ASSERT_EQ(media_navi_vc_app_.get(), media_navi_vc_app_ptr_);
+ ASSERT_EQ(media_wep_app_.get(), media_wep_app_ptr_);
+ ASSERT_EQ(non_media_wep_app_.get(), non_media_wep_app_ptr_);
ASSERT_EQ(simple_app_->app_id(), simple_app_id_);
ASSERT_EQ(media_app_->app_id(), media_app_id_);
@@ -964,6 +1034,8 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_EQ(media_vc_app_->app_id(), media_vc_app_id_);
ASSERT_EQ(navi_vc_app_->app_id(), navi_vc_app_id_);
ASSERT_EQ(media_navi_vc_app_->app_id(), media_navi_vc_app_id_);
+ ASSERT_EQ(media_wep_app_->app_id(), media_wep_app_id_);
+ ASSERT_EQ(non_media_wep_app_->app_id(), non_media_wep_app_id_);
ASSERT_EQ(simple_app_->hmi_app_id(), simple_hmi_app_id_);
ASSERT_EQ(media_app_->hmi_app_id(), media_hmi_app_id_);
@@ -973,6 +1045,8 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_EQ(media_vc_app_->hmi_app_id(), media_vc_hmi_app_id_);
ASSERT_EQ(navi_vc_app_->hmi_app_id(), navi_vc_hmi_app_id_);
ASSERT_EQ(media_navi_vc_app_->hmi_app_id(), media_navi_vc_hmi_app_id_);
+ ASSERT_EQ(media_wep_app_->hmi_app_id(), media_wep_app_hmi_app_id_);
+ ASSERT_EQ(non_media_wep_app_->hmi_app_id(), non_media_wep_app_hmi_app_id_);
ASSERT_FALSE(simple_app_->IsAudioApplication());
ASSERT_TRUE(media_app_->IsAudioApplication());
@@ -982,6 +1056,8 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_TRUE(media_vc_app_->IsAudioApplication());
ASSERT_TRUE(navi_vc_app_->IsAudioApplication());
ASSERT_TRUE(media_navi_vc_app_->IsAudioApplication());
+ ASSERT_TRUE(media_wep_app_->IsAudioApplication());
+ ASSERT_FALSE(non_media_wep_app_->IsAudioApplication());
ASSERT_FALSE(simple_app_->is_media_application());
ASSERT_TRUE(media_app_->is_media_application());
@@ -991,6 +1067,8 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_TRUE(media_vc_app_->is_media_application());
ASSERT_FALSE(navi_vc_app_->is_media_application());
ASSERT_TRUE(media_navi_vc_app_->is_media_application());
+ ASSERT_TRUE(media_wep_app_->is_media_application());
+ ASSERT_FALSE(non_media_wep_app_->is_media_application());
ASSERT_FALSE(simple_app_->is_navi());
ASSERT_TRUE(navi_app_->is_navi());
@@ -1000,6 +1078,8 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_FALSE(media_vc_app_->is_navi());
ASSERT_TRUE(navi_vc_app_->is_navi());
ASSERT_TRUE(media_navi_vc_app_->is_navi());
+ ASSERT_FALSE(media_wep_app_->is_navi());
+ ASSERT_FALSE(non_media_wep_app_->is_navi());
ASSERT_FALSE(simple_app_->is_voice_communication_supported());
ASSERT_FALSE(navi_app_->is_voice_communication_supported());
@@ -1009,6 +1089,8 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_TRUE(media_vc_app_->is_voice_communication_supported());
ASSERT_TRUE(navi_vc_app_->is_voice_communication_supported());
ASSERT_TRUE(media_navi_vc_app_->is_voice_communication_supported());
+ ASSERT_FALSE(media_wep_app_->is_voice_communication_supported());
+ ASSERT_FALSE(non_media_wep_app_->is_voice_communication_supported());
}
virtual void SetUp() OVERRIDE {
@@ -1021,6 +1103,11 @@ class StateControllerImplTest : public ::testing::Test {
CheckAppConfiguration();
FillStatesLists();
SetConnection();
+
+ ON_CALL(message_helper_mock_, CreateHMIStatusNotification(_, _))
+ .WillByDefault(Return(std::make_shared<smart_objects::SmartObject>()));
+ ON_CALL(app_manager_mock_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
}
void TearDown() OVERRIDE {
@@ -1089,12 +1176,14 @@ class StateControllerImplTest : public ::testing::Test {
EXPECT_CALL(*app_mock, CurrentHmiState(window_id))
.WillOnce(Return(old_state))
.WillOnce(Return(new_state));
+ ON_CALL(*app_mock, IsFullscreen()).WillByDefault(Return(true));
EXPECT_CALL(
*app_mock,
SetRegularState(window_id, Truly(HmiStatesComparator(new_state))));
if (!HmiStatesComparator(old_state)(new_state)) {
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(app, window_id, _));
+ CreateHMIStatusNotification(app, window_id))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
if (kDefaultWindowId == window_id) {
EXPECT_CALL(app_manager_mock_,
OnHMIStateChanged(app->app_id(), _, new_state));
@@ -1110,6 +1199,7 @@ class StateControllerImplTest : public ::testing::Test {
EXPECT_CALL(*app_mock, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(old_state))
.WillOnce(Return(old_state));
+ ON_CALL(*app_mock, IsFullscreen()).WillByDefault(Return(true));
ExpectSuccessfulSetHmiState(app, app_mock, old_state, new_state);
}
@@ -1120,7 +1210,7 @@ class StateControllerImplTest : public ::testing::Test {
am::HmiStatePtr state) {
ON_CALL(*app_mock, RegularHmiState(window_id)).WillByDefault(Return(state));
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(app, window_id, _))
+ CreateHMIStatusNotification(app, window_id))
.Times(0);
EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(app->app_id(), _, _))
.Times(0);
@@ -1156,6 +1246,13 @@ class StateControllerImplTest : public ::testing::Test {
mobile_apis::SystemContext::SYSCTXT_MAIN);
}
+ am::HmiStatePtr FullAudibleStreamableState() {
+ return createHmiState(mobile_apis::HMILevel::HMI_FULL,
+ mobile_apis::AudioStreamingState::AUDIBLE,
+ mobile_apis::VideoStreamingState::STREAMABLE,
+ mobile_apis::SystemContext::SYSCTXT_MAIN);
+ }
+
am::HmiStatePtr FullNotAudibleState() {
return createHmiState(mobile_apis::HMILevel::HMI_FULL,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
@@ -1364,7 +1461,6 @@ class StateControllerImplTest : public ::testing::Test {
};
TEST_F(StateControllerImplTest, OnStateChangedWithEqualStates) {
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
@@ -1381,9 +1477,9 @@ TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
for (uint32_t j = 0; j < valid_states_for_not_audio_app_.size(); ++j) {
HmiStatesComparator comp(valid_states_for_not_audio_app_[i]);
if (!comp(valid_states_for_not_audio_app_[j])) {
- EXPECT_CALL(
- message_helper_mock_,
- SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
+ EXPECT_CALL(message_helper_mock_,
+ CreateHMIStatusNotification(simple_app_, kDefaultWindowId))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
EXPECT_CALL(app_manager_mock_,
OnHMIStateChanged(simple_app_id_,
valid_states_for_not_audio_app_[i],
@@ -1398,7 +1494,7 @@ TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
valid_states_for_not_audio_app_[i],
valid_states_for_not_audio_app_[j]);
- EXPECT_CALL(message_helper_mock_, SendHMIStatusNotification(_, _, _))
+ EXPECT_CALL(message_helper_mock_, CreateHMIStatusNotification(_, _))
.Times(0);
EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
@@ -1421,11 +1517,18 @@ TEST_F(StateControllerImplTest, OnStateChangedToNone) {
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN);
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .Times(2)
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(2);
+
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
+
state_ctrl_->OnStateChanged(
simple_app_, kDefaultWindowId, none_state, not_none_state);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
+
state_ctrl_->OnStateChanged(
simple_app_, kDefaultWindowId, not_none_state, none_state);
}
@@ -1449,7 +1552,9 @@ TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
+ CreateHMIStatusNotification(simple_app_, kDefaultWindowId))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+
EXPECT_CALL(app_manager_mock_,
OnHMIStateChanged(simple_app_id_,
Truly(HmiStatesComparator(initial_state)),
@@ -1488,7 +1593,9 @@ TEST_F(StateControllerImplTest, MoveAudioNotResumeAppToValidStates) {
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(audio_app, kDefaultWindowId, _));
+ CreateHMIStatusNotification(audio_app, kDefaultWindowId))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+ ;
EXPECT_CALL(app_manager_mock_,
OnHMIStateChanged(audio_app->app_id(), _, state_to_setup));
@@ -1542,8 +1649,6 @@ TEST_F(StateControllerImplTest, MoveAudioResumeAppToValidStates) {
}
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(audio_app))
- .Times(AtLeast(0));
EXPECT_CALL(app_manager_mock_,
OnHMIStateChanged(audio_app->app_id(), _, state_to_setup))
.Times(AtLeast(0));
@@ -1601,10 +1706,21 @@ TEST_F(StateControllerImplTest,
am::ApplicationSharedPtr app_moved_to_full;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- app_in_full =
- ConfigureApp(&app_in_full_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, NOT_VC);
- app_moved_to_full = ConfigureApp(
- &app_moved_to_full_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ app_in_full = ConfigureApp(&app_in_full_mock,
+ kAppIdInFull,
+ kHMIAppIdInFull,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
+
+ app_moved_to_full = ConfigureApp(&app_moved_to_full_mock,
+ kAppIdMovedToFull,
+ kHMIAppIdMovedToFull,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
@@ -1678,12 +1794,23 @@ TEST_F(StateControllerImplTest,
namespace HMILevel = mobile_apis::HMILevel;
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_in_full_mock;
- am::ApplicationSharedPtr app_in_full =
- ConfigureApp(&app_in_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_in_full = ConfigureApp(&app_in_full_mock,
+ kAppIdInFull,
+ kHMIAppIdInFull,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
- &app_moved_to_full_mock, 1796, 30093, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full =
+ ConfigureApp(&app_moved_to_full_mock,
+ kAppIdMovedToFull,
+ kHMIAppIdMovedToFull,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
@@ -1705,12 +1832,23 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_in_limited_mock;
- am::ApplicationSharedPtr app_in_limited =
- ConfigureApp(&app_in_limited_mock, 1761, 15685, NOT_MEDIA, NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_in_limited = ConfigureApp(&app_in_limited_mock,
+ kAppIdLimited,
+ kHMIAppIdLimited,
+ NOT_MEDIA,
+ NAVI,
+ NOT_VC,
+ NOT_WEP);
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1796, 30093, NOT_MEDIA, NAVI, VC);
+ ConfigureApp(&app_moved_to_full_mock,
+ kAppIdMovedToFull,
+ kHMIAppIdMovedToFull,
+ NOT_MEDIA,
+ NAVI,
+ VC,
+ NOT_WEP);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_full);
@@ -1731,13 +1869,24 @@ TEST_F(StateControllerImplTest,
namespace HMILevel = mobile_apis::HMILevel;
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_in_limited_mock;
- am::ApplicationSharedPtr app_in_limited =
- ConfigureApp(&app_in_limited_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, VC);
+ am::ApplicationSharedPtr app_in_limited = ConfigureApp(&app_in_limited_mock,
+ kAppIdLimited,
+ kHMIAppIdLimited,
+ NOT_MEDIA,
+ NOT_NAVI,
+ VC,
+ NOT_WEP);
NiceMock<application_manager_test::MockApplication>*
app_moved_to_limited_mock;
- am::ApplicationSharedPtr app_moved_to_limited = ConfigureApp(
- &app_moved_to_limited_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, VC);
+ am::ApplicationSharedPtr app_moved_to_limited =
+ ConfigureApp(&app_moved_to_limited_mock,
+ kAppIDMovedToLimited,
+ kHMIAppIdMovedToLimited,
+ NOT_MEDIA,
+ NOT_NAVI,
+ VC,
+ NOT_WEP);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
@@ -1886,16 +2035,27 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
- &app_moved_to_full_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full =
+ ConfigureApp(&app_moved_to_full_mock,
+ kAppIdMovedToFull,
+ kHMIAppIdMovedToFull,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
am::ApplicationSharedPtr limited_app = media_app_;
NiceMock<application_manager_test::MockApplication>* limited_app_mock =
media_app_ptr_;
NiceMock<application_manager_test::MockApplication>* full_app_mock;
- am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr full_app = ConfigureApp(&full_app_mock,
+ kAppIdInFull,
+ kHMIAppIdInFull,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
@@ -1924,16 +2084,32 @@ TEST_F(
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
- &app_moved_to_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full =
+ ConfigureApp(&app_moved_to_full_mock,
+ kAppIdMovedToFull,
+ kHMIAppIdMovedToFull,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
NiceMock<application_manager_test::MockApplication>* limited_app_mock;
- am::ApplicationSharedPtr limited_app =
- ConfigureApp(&limited_app_mock, 1762, 17559, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr limited_app = ConfigureApp(&limited_app_mock,
+ kAppIdLimited,
+ kHMIAppIdLimited,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
NiceMock<application_manager_test::MockApplication>* full_app_mock;
- am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr full_app = ConfigureApp(&full_app_mock,
+ kAppIdInFull,
+ kHMIAppIdInFull,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
@@ -1962,16 +2138,32 @@ TEST_F(
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
- &app_moved_to_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full =
+ ConfigureApp(&app_moved_to_full_mock,
+ kAppIdMovedToFull,
+ kHMIAppIdMovedToFull,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
NiceMock<application_manager_test::MockApplication>* limited_app_mock;
- am::ApplicationSharedPtr limited_app =
- ConfigureApp(&limited_app_mock, 1762, 17559, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr limited_app = ConfigureApp(&limited_app_mock,
+ kAppIdLimited,
+ kHMIAppIdLimited,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC,
+ NOT_WEP);
NiceMock<application_manager_test::MockApplication>* full_app_mock;
- am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NAVI, NOT_VC);
+ am::ApplicationSharedPtr full_app = ConfigureApp(&full_app_mock,
+ kAppIdInFull,
+ kHMIAppIdInFull,
+ NOT_MEDIA,
+ NAVI,
+ NOT_VC,
+ NOT_WEP);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
@@ -2044,8 +2236,7 @@ TEST_F(StateControllerImplTest,
media_navi_vc_app_, kDefaultWindowId, FullAudibleState(), false);
}
-// TODO {AKozoriz} Changed logic in state_controller
-TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
+TEST_F(StateControllerImplTest, ActivateAppSuccessReceivedFromHMI) {
using namespace hmi_apis;
using namespace mobile_apis;
@@ -2147,8 +2338,6 @@ TEST_F(StateControllerImplTest, SendEventBCActivateApp_HMIReceivesError) {
EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _))
.Times(0);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
- .Times(0);
EXPECT_CALL(app_manager_mock_,
OnHMIStateChanged(simple_app_->app_id(), _, _))
.Times(0);
@@ -2172,8 +2361,6 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) {
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
- .Times(0);
EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(simple_app_->app_id(), _, _))
.Times(0);
SetBCActivateAppRequestToHMI(Common_HMILevel::FULL, corr_id);
@@ -2187,16 +2374,16 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) {
state_ctrl_->on_event(event);
}
-TEST_F(StateControllerImplTest, DISABLED_ApplyTempStatesForSimpleApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForSimpleApp) {
InsertApplication(simple_app_);
CheckStateApplyingForApplication(
- simple_app_, *simple_app_ptr_, valid_state_ids_);
+ simple_app_, *simple_app_ptr_, valid_non_navi_state_ids_);
}
-TEST_F(StateControllerImplTest, DISABLED_ApplyTempStatesForMediaApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForMediaApp) {
InsertApplication(media_app_);
CheckStateApplyingForApplication(
- media_app_, *media_app_ptr_, valid_state_ids_);
+ media_app_, *media_app_ptr_, valid_non_navi_state_ids_);
}
TEST_F(StateControllerImplTest, ApplyTempStatesForNaviApp) {
@@ -2204,9 +2391,10 @@ TEST_F(StateControllerImplTest, ApplyTempStatesForNaviApp) {
CheckStateApplyingForApplication(navi_app_, *navi_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerImplTest, DISABLED_ApplyTempStatesForVCApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForVCApp) {
InsertApplication(vc_app_);
- CheckStateApplyingForApplication(vc_app_, *vc_app_ptr_, valid_state_ids_);
+ CheckStateApplyingForApplication(
+ vc_app_, *vc_app_ptr_, valid_non_navi_state_ids_);
}
TEST_F(StateControllerImplTest, ApplyTempStatesForMediaNaviApp) {
@@ -2215,10 +2403,10 @@ TEST_F(StateControllerImplTest, ApplyTempStatesForMediaNaviApp) {
media_navi_app_, *media_navi_app_ptr_, valid_state_ids_);
}
-TEST_F(StateControllerImplTest, DISABLED_ApplyTempStatesForMediaVCApp) {
+TEST_F(StateControllerImplTest, ApplyTempStatesForMediaVCApp) {
InsertApplication(media_vc_app_);
CheckStateApplyingForApplication(
- media_vc_app_, *media_vc_app_ptr_, valid_state_ids_);
+ media_vc_app_, *media_vc_app_ptr_, valid_non_navi_state_ids_);
}
TEST_F(StateControllerImplTest, ApplyTempStatesForNaviVCApp) {
@@ -2360,82 +2548,80 @@ TEST_F(StateControllerImplTest,
}
TEST_F(StateControllerImplTest, SetNaviStreamingStateForNonMediaApplication) {
- am::HmiStatePtr state_navi_streming =
- std::make_shared<am::VideoStreamingHmiState>(simple_app_,
- app_manager_mock_);
+ am::HmiStatePtr state_navi_streaming =
+ std::make_shared<am::NaviStreamingHmiState>(simple_app_,
+ app_manager_mock_);
TestSetState(simple_app_,
- state_navi_streming,
+ state_navi_streaming,
APP_TYPE_NON_MEDIA,
&StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
}
TEST_F(StateControllerImplTest,
- DISABLED_SetNaviStreamingStateMediaApplicationAttenuatedNotSupported) {
- am::HmiStatePtr state_navi_streming =
- std::make_shared<am::VideoStreamingHmiState>(media_app_,
- app_manager_mock_);
+ SetNaviStreamingStateMediaApplicationAttenuatedNotSupported) {
+ am::HmiStatePtr state_navi_streaming =
+ std::make_shared<am::NaviStreamingHmiState>(media_app_,
+ app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(false));
TestSetState(media_app_,
- state_navi_streming,
+ state_navi_streaming,
APP_TYPE_MEDIA,
&StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
}
TEST_F(StateControllerImplTest,
- DISABLED_SetNaviStreamingStateMediaApplicationAttenuatedSupported) {
- am::HmiStatePtr state_navi_streming =
- std::make_shared<am::VideoStreamingHmiState>(media_app_,
- app_manager_mock_);
+ SetNaviStreamingStateMediaApplicationAttenuatedSupported) {
+ am::HmiStatePtr state_navi_streaming =
+ std::make_shared<am::NaviStreamingHmiState>(media_app_,
+ app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(true));
TestSetState(media_app_,
- state_navi_streming,
+ state_navi_streaming,
APP_TYPE_ATTENUATED,
- &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+ &StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
}
TEST_F(StateControllerImplTest,
- DISABLED_SetNaviStreamingStateVCApplicationAttenuatedNotSupported) {
- am::HmiStatePtr state_navi_streming =
- std::make_shared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_);
+ SetNaviStreamingStateVCApplicationAttenuatedNotSupported) {
+ am::HmiStatePtr state_navi_streaming =
+ std::make_shared<am::NaviStreamingHmiState>(vc_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(false));
TestSetState(vc_app_,
- state_navi_streming,
+ state_navi_streaming,
APP_TYPE_MEDIA,
&StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
}
TEST_F(StateControllerImplTest,
- DISABLED_SetNaviStreamingStateVCApplicationAttenuatedSupported) {
- am::HmiStatePtr state_navi_streming =
- std::make_shared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_);
+ SetNaviStreamingStateVCApplicationAttenuatedSupported) {
+ am::HmiStatePtr state_navi_streaming =
+ std::make_shared<am::NaviStreamingHmiState>(vc_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(true));
TestSetState(vc_app_,
- state_navi_streming,
+ state_navi_streaming,
APP_TYPE_ATTENUATED,
- &StateControllerImplTest::PrepareVRTTSHMIStateResults);
+ &StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
}
-TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateNaviApplication) {
- am::HmiStatePtr state_navi_streming =
- std::make_shared<am::VideoStreamingHmiState>(navi_app_,
- app_manager_mock_);
+TEST_F(StateControllerImplTest, SetNaviStreamingStateNaviApplication) {
+ am::HmiStatePtr state_navi_streaming =
+ std::make_shared<am::NaviStreamingHmiState>(navi_app_, app_manager_mock_);
TestSetState(navi_app_,
- state_navi_streming,
+ state_navi_streaming,
APP_TYPE_NAVI,
&StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
}
-TEST_F(StateControllerImplTest,
- DISABLED_SetNaviStreamingStateMediaNaviApplication) {
- am::HmiStatePtr state_navi_streming =
- std::make_shared<am::VideoStreamingHmiState>(media_navi_app_,
- app_manager_mock_);
+TEST_F(StateControllerImplTest, SetNaviStreamingStateMediaNaviApplication) {
+ am::HmiStatePtr state_navi_streaming =
+ std::make_shared<am::NaviStreamingHmiState>(media_navi_app_,
+ app_manager_mock_);
TestSetState(media_navi_app_,
- state_navi_streming,
+ state_navi_streaming,
APP_TYPE_NAVI,
&StateControllerImplTest::PrepareNaviStreamingHMIStateResults);
}
@@ -3011,6 +3197,8 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(*simple_app_ptr_, keep_context()).WillOnce(Return(true));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
+ EXPECT_CALL(*simple_app_ptr_, is_media_application())
+ .WillRepeatedly(Return(true));
EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(FullAudibleState()));
EXPECT_CALL(*simple_app_ptr_, set_keep_context(false));
@@ -3045,6 +3233,8 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) {
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
+ EXPECT_CALL(*simple_app_ptr_, is_media_application())
+ .WillRepeatedly(Return(true));
EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
@@ -3062,6 +3252,40 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) {
mobile_apis::AudioStreamingState::NOT_AUDIBLE);
}
+TEST_F(StateControllerImplTest, OnEventChangedAudioSourceNavAppToLimited) {
+ const uint32_t app_id = navi_app_->app_id();
+ InsertApplication(navi_app_);
+ smart_objects::SmartObject msg;
+ msg[am::strings::msg_params][am::strings::app_id] = app_id;
+ msg[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ msg[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+
+ const hmi_apis::FunctionID::eType event_id =
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged;
+ am::event_engine::Event event(event_id);
+ event.set_smart_object(msg);
+
+ EXPECT_CALL(*navi_app_ptr_, is_navi()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
+ .WillOnce(Return(FullAudibleStreamableState()));
+
+ HmiStatePtr new_state;
+ EXPECT_CALL(*navi_app_ptr_, AddHMIState(kDefaultWindowId, _))
+ .WillOnce(SaveArg<1>(&new_state));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*navi_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
+ state_ctrl_->on_event(event);
+
+ EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_LIMITED);
+ EXPECT_EQ(new_state->audio_streaming_state(),
+ mobile_apis::AudioStreamingState::AUDIBLE);
+ EXPECT_EQ(new_state->video_streaming_state(),
+ mobile_apis::VideoStreamingState::STREAMABLE);
+}
+
TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) {
smart_objects::SmartObject msg;
const uint32_t app_id = simple_app_->app_id();
@@ -3309,7 +3533,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
+ CreateHMIStatusNotification(simple_app_, kDefaultWindowId))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+ ;
EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _));
state_ctrl_->OnApplicationRegistered(simple_app_,
@@ -3360,7 +3586,6 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
.WillRepeatedly(Return(default_state));
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
state_ctrl_->OnApplicationRegistered(simple_app_,
@@ -3388,6 +3613,29 @@ TEST_F(
media_app_, kDefaultWindowId, new_state, send_activate_app);
}
+TEST_F(
+ StateControllerImplTest,
+ SetRegularState_WEPAppIsInResumingModeEmbeddedNaviIsActive_HmiStateIsNotChanged) {
+ am::event_engine::Event embedded_navi_event(
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::EMBEDDED_NAVI;
+ embedded_navi_event.set_smart_object(message);
+ state_ctrl_->on_event(embedded_navi_event);
+
+ EXPECT_CALL(*media_wep_app_ptr_, is_resuming())
+ .Times(2)
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(*media_wep_app_ptr_, SetRegularState(_, _)).Times(0);
+
+ const auto new_state = FullAudibleState();
+ const bool send_activate_app = true;
+ state_ctrl_->SetRegularState(
+ media_wep_app_, kDefaultWindowId, new_state, send_activate_app);
+}
+
TEST_F(StateControllerImplTest,
SetRegularState_BcActivateAppSendFailed_HmiLevelIsNotChanged) {
const am::HmiStatePtr new_state = FullAudibleState();
@@ -3611,7 +3859,9 @@ TEST_F(
SetRegularState(kCustomWindowId,
Truly(HmiStatesComparator(expected_window_state))));
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+ CreateHMIStatusNotification(media_app_, kCustomWindowId))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+ ;
state_ctrl_->ActivateDefaultWindow(media_app_);
}
@@ -3644,7 +3894,9 @@ TEST_F(StateControllerImplTest,
SetRegularState(kCustomWindowId,
Truly(HmiStatesComparator(expected_window_state))));
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+ CreateHMIStatusNotification(media_app_, kCustomWindowId))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+ ;
state_ctrl_->ExitDefaultWindow(media_app_);
}
@@ -3676,11 +3928,16 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(*simple_app_ptr_,
SetRegularState(kCustomWindowId,
Truly(HmiStatesComparator(expected_state))));
+ EXPECT_CALL(*simple_app_ptr_,
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillOnce(Return(expected_state));
EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kCustomWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(expected_state));
EXPECT_CALL(message_helper_mock_,
- SendHMIStatusNotification(simple_app_, kCustomWindowId, _));
+ CreateHMIStatusNotification(simple_app_, kCustomWindowId))
+ .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
+ ;
EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
state_ctrl_->OnAppWindowAdded(simple_app_,
diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc
index 024c75de3e..f549f4b915 100644
--- a/src/components/config_profile/src/ini_file.cc
+++ b/src/components/config_profile/src/ini_file.cc
@@ -55,7 +55,7 @@
namespace profile {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Profile")
+SDL_CREATE_LOG_VARIABLE("Profile")
char* ini_write_inst(const char* fname, uint8_t flag) {
FILE* fp = 0;
@@ -278,8 +278,8 @@ char ini_write_value(const char* fname,
if (0 != rename(temp_fname, fname)) {
if (0 != remove(temp_fname)) {
- LOG4CXX_WARN_WITH_ERRNO(
- logger_, "Unable to remove temp file: " << std::string(temp_fname));
+ SDL_LOG_WARN_WITH_ERRNO(
+ "Unable to remove temp file: " << std::string(temp_fname));
}
return FALSE;
}
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 26e5bb0c54..a86d09da94 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -53,15 +53,13 @@
namespace {
#define LOG_UPDATED_VALUE(value, key, section) \
{ \
- LOG4CXX_INFO(logger_, \
- "Setting value '" << value << "' for key '" << key \
+ SDL_LOG_INFO("Setting value '" << value << "' for key '" << key \
<< "' in section '" << section << "'."); \
}
#define LOG_UPDATED_BOOL_VALUE(value, key, section) \
{ \
- LOG4CXX_INFO(logger_, \
- "Setting value '" << std::boolalpha << value << "' for key '" \
+ SDL_LOG_INFO("Setting value '" << std::boolalpha << value << "' for key '" \
<< key << "' in section '" << section \
<< "'."); \
}
@@ -445,7 +443,7 @@ const char* kDefaultAOAFilterSerialNumber = "N000000";
namespace profile {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Profile")
+SDL_CREATE_LOG_VARIABLE("Profile")
Profile::Profile()
: sdl_version_(kDefaultSDLVersion)
@@ -1247,7 +1245,7 @@ const std::string Profile::hmi_origin_id() const {
}
void Profile::UpdateValues() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// SDL version
ReadStringValue(
@@ -2853,7 +2851,7 @@ bool Profile::StringToNumber(const std::string& input, uint64_t& output) const {
bool Profile::IsRelativePath(const std::string& path) {
if (path.empty()) {
- LOG4CXX_ERROR(logger_, "Empty path passed.");
+ SDL_LOG_ERROR("Empty path passed.");
return false;
}
return '/' != path[0];
diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h
index 7e4ab6a24e..1a93509aca 100644
--- a/src/components/connection_handler/include/connection_handler/connection.h
+++ b/src/components/connection_handler/include/connection_handler/connection.h
@@ -41,6 +41,7 @@
#include "protocol/service_type.h"
#include "protocol_handler/protocol_packet.h"
#include "utils/lock.h"
+#include "utils/semantic_version.h"
#include "utils/threads/thread.h"
#ifdef ENABLE_SECURITY
@@ -98,12 +99,14 @@ typedef std::vector<Service> ServiceList;
struct Session {
ServiceList service_list;
uint8_t protocol_version;
+ utils::SemanticVersion full_protocol_version;
#ifdef ENABLE_SECURITY
security_manager::SSLContext* ssl_context;
#endif // ENABLE_SECURITY
Session()
: service_list()
, protocol_version(::protocol_handler::PROTOCOL_VERSION_2)
+ , full_protocol_version(utils::SemanticVersion(2, 0, 0))
#ifdef ENABLE_SECURITY
, ssl_context(NULL)
#endif // ENABLE_SECURITY
@@ -112,6 +115,7 @@ struct Session {
explicit Session(const ServiceList& services, uint8_t protocol_version)
: service_list(services)
, protocol_version(protocol_version)
+ , full_protocol_version(utils::SemanticVersion(protocol_version, 0, 0))
#ifdef ENABLE_SECURITY
, ssl_context(NULL)
#endif // ENABLE_SECURITY
@@ -184,7 +188,8 @@ class Connection {
bool AddNewService(uint8_t session_id,
protocol_handler::ServiceType service_type,
const bool is_protected,
- transport_manager::ConnectionUID connection_id);
+ transport_manager::ConnectionUID connection_id,
+ std::string* err_reason = nullptr);
/**
* @brief Removes service from session
* @param session_id session ID
@@ -290,6 +295,15 @@ class Connection {
uint8_t protocol_version);
/**
+ * @brief changes protocol version in session
+ * @param session_id session id
+ * @param full_protocol_version full protocol version of the registered
+ * application
+ */
+ void UpdateProtocolVersionSession(
+ uint8_t session_id, const utils::SemanticVersion& full_protocol_version);
+
+ /**
* @brief checks if session supports heartbeat
* @param session_id session id
* @return TRUE on success, otherwise FALSE
@@ -306,6 +320,17 @@ class Connection {
bool ProtocolVersion(uint8_t session_id, uint8_t& protocol_version);
/**
+ * @brief find protocol version for session
+ * @param session_id id of session which is launched on mobile side
+ * @param full_protocol_version where to write the full protocol version
+ * output
+ * @return TRUE if session exists otherwise
+ * return FALSE
+ */
+ bool ProtocolVersion(uint8_t session_id,
+ utils::SemanticVersion& full_protocol_version);
+
+ /**
* @brief Returns the primary connection handle associated with this
* connection
* @return ConnectionHandle
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
index b2b4c5a970..fb859330b9 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
@@ -247,13 +247,16 @@ class ConnectionHandlerImpl
* \param hashCode Hash used only in second version of SmartDeviceLink
* protocol. (Set to HASH_ID_WRONG if the hash is incorrect)
* If not equal to hash assigned to session on start then operation fails.
- * \return uint32_t 0 if operation fails, session key otherwise
+ * \param err_reason where to write reason for the End Session failure if the
+ * operation fails \return uint32_t 0 if operation fails, session key
+ * otherwise
*/
uint32_t OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
uint32_t* hashCode,
- const protocol_handler::ServiceType& service_type) OVERRIDE;
+ const protocol_handler::ServiceType& service_type,
+ std::string* err_reason = nullptr) OVERRIDE;
/**
* \brief Callback function used by ProtocolHandler
@@ -490,6 +493,17 @@ class ConnectionHandlerImpl
uint8_t protocol_version) OVERRIDE;
/**
+ * @brief binds protocol version with session
+ *
+ * @param connection_key pair of connection and session id
+ * @param full_protocol_version contains full protocol version of registered
+ * application.
+ */
+ void BindProtocolVersionWithSession(
+ uint32_t connection_key,
+ const utils::SemanticVersion& full_protocol_version) OVERRIDE;
+
+ /**
* \brief returns TRUE if session supports sending HEART BEAT ACK to mobile
* side
* \param connection_handle Connection identifier whithin which session
@@ -513,6 +527,19 @@ class ConnectionHandlerImpl
uint8_t& protocol_version) const OVERRIDE;
/**
+ * @brief find protocol version which application supports
+ * @param connection_id id of connection
+ * @param session_id id of session
+ * @param full_protocol_version where to write the full protocol version
+ * output
+ * @return TRUE if session and connection exist otherwise returns FALSE
+ */
+ bool ProtocolVersionUsed(
+ uint32_t connection_id,
+ uint8_t session_id,
+ utils::SemanticVersion& full_protocol_version) const OVERRIDE;
+
+ /**
* \brief information about given Connection Key.
* \param key Unique key used by other components as session identifier
* \param app_id Returned: ApplicationID
diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc
index 304be9ddb0..14e2b83848 100644
--- a/src/components/connection_handler/src/connection.cc
+++ b/src/components/connection_handler/src/connection.cc
@@ -52,7 +52,7 @@
*/
namespace connection_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler")
+SDL_CREATE_LOG_VARIABLE("ConnectionHandler")
Service* Session::FindService(
const protocol_handler::ServiceType& service_type) {
@@ -83,18 +83,18 @@ Connection::Connection(ConnectionHandle connection_handle,
, connection_device_handle_(connection_device_handle)
, primary_connection_handle_(0)
, heartbeat_timeout_(heartbeat_timeout) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(connection_handler_);
heartbeat_monitor_ = new HeartBeatMonitor(heartbeat_timeout_, this);
heart_beat_monitor_thread_ =
threads::CreateThread("HeartBeatMonitor", heartbeat_monitor_);
- heart_beat_monitor_thread_->start();
+ heart_beat_monitor_thread_->Start();
}
Connection::~Connection() {
- LOG4CXX_AUTO_TRACE(logger_);
- heart_beat_monitor_thread_->join();
+ SDL_LOG_AUTO_TRACE();
+ heart_beat_monitor_thread_->Stop(threads::Thread::kThreadSoftStop);
delete heartbeat_monitor_;
threads::DeleteThread(heart_beat_monitor_thread_);
@@ -106,11 +106,9 @@ Connection::~Connection() {
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.begin();
while (session_it != session_map_.end()) {
- LOG4CXX_INFO(
- logger_,
- "Removed Session ID "
- << static_cast<int>(session_it->first)
- << " from Session/Connection Map in Connection Destructor");
+ SDL_LOG_INFO("Removed Session ID "
+ << static_cast<int>(session_it->first)
+ << " from Session/Connection Map in Connection Destructor");
connection_handler_->RemoveSession(session_it->first);
session_it++;
}
@@ -120,7 +118,7 @@ Connection::~Connection() {
uint32_t Connection::AddNewSession(
const transport_manager::ConnectionUID connection_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// NESTED LOCK: make sure to lock session_map_lock_ then ConnectionHandler's
// session_connection_map_lock_ptr_ (which will be taken in AddSession)
@@ -144,7 +142,7 @@ uint32_t Connection::AddNewSession(
}
uint32_t Connection::RemoveSession(uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Again, a NESTED lock, but it follows the rules.
sync_primitives::AutoLock lock(session_map_lock_);
@@ -155,7 +153,7 @@ uint32_t Connection::RemoveSession(uint8_t session_id) {
SessionMap::iterator it = session_map_.find(session_id);
if (session_map_.end() == it) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return 0;
}
heartbeat_monitor_->RemoveSession(session_id);
@@ -167,16 +165,19 @@ uint32_t Connection::RemoveSession(uint8_t session_id) {
bool Connection::AddNewService(uint8_t session_id,
protocol_handler::ServiceType service_type,
const bool request_protection,
- transport_manager::ConnectionUID connection_id) {
+ transport_manager::ConnectionUID connection_id,
+ std::string* err_reason) {
// Ignore wrong services
if (protocol_handler::kControl == service_type ||
protocol_handler::kInvalidServiceType == service_type) {
- LOG4CXX_WARN(logger_, "Wrong service " << static_cast<int>(service_type));
+ SDL_LOG_WARN("Wrong service " << static_cast<int>(service_type));
+ if (err_reason) {
+ *err_reason = "Wrong service type " + std::to_string(service_type);
+ }
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Add service " << service_type << " for session "
+ SDL_LOG_DEBUG("Add service " << service_type << " for session "
<< static_cast<uint32_t>(session_id)
<< " using connection ID "
<< static_cast<uint32_t>(connection_id));
@@ -184,7 +185,12 @@ bool Connection::AddNewService(uint8_t session_id,
SessionMap::iterator session_it = session_map_.find(session_id);
if (session_it == session_map_.end()) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
+ if (err_reason) {
+ *err_reason = "Session " + std::to_string(session_id) +
+ " not found for connection " +
+ std::to_string(connection_id);
+ }
return false;
}
Session& session = session_it->second;
@@ -195,9 +201,9 @@ bool Connection::AddNewService(uint8_t session_id,
service_type,
protocol_handler::ServiceType::kAudio,
protocol_handler::ServiceType::kMobileNav)) {
- LOG4CXX_WARN(logger_,
- "Audio and video services are disallowed for protocol version "
- "2 or lower");
+ SDL_LOG_WARN(
+ "Audio and video services are disallowed for protocol version "
+ "2 or lower");
return false;
}
@@ -206,17 +212,25 @@ bool Connection::AddNewService(uint8_t session_id,
if (service) {
#ifdef ENABLE_SECURITY
if (!request_protection) {
- LOG4CXX_WARN(logger_,
- "Session " << static_cast<int>(session_id)
+ SDL_LOG_WARN("Session " << static_cast<int>(session_id)
<< " already has unprotected service "
<< static_cast<int>(service_type));
+ if (err_reason) {
+ *err_reason = "Session " + std::to_string(session_id) +
+ " already has an unprotected service of type " +
+ std::to_string(service_type);
+ }
return false;
}
if (service->is_protected_) {
- LOG4CXX_WARN(logger_,
- "Session " << static_cast<int>(session_id)
+ SDL_LOG_WARN("Session " << static_cast<int>(session_id)
<< " already has protected service "
<< static_cast<int>(service_type));
+ if (err_reason) {
+ *err_reason = "Session " + std::to_string(session_id) +
+ " already has a protected service of type " +
+ std::to_string(service_type);
+ }
return false;
}
// For unproteced service could be start protection
@@ -247,15 +261,14 @@ bool Connection::RemoveService(uint8_t session_id,
protocol_handler::ServiceType service_type) {
// Ignore wrong and required for Session services
if (is_incorrect_for_remove_service(service_type)) {
- LOG4CXX_WARN(logger_,
- "Could not remove service " << static_cast<int>(service_type));
+ SDL_LOG_WARN("Could not remove service " << static_cast<int>(service_type));
return false;
}
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.find(session_id);
if (session_map_.end() == session_it) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return false;
}
@@ -263,8 +276,7 @@ bool Connection::RemoveService(uint8_t session_id,
ServiceList::iterator service_it =
find(service_list.begin(), service_list.end(), service_type);
if (service_list.end() == service_it) {
- LOG4CXX_WARN(logger_,
- "Session " << session_id
+ SDL_LOG_WARN("Session " << session_id
<< " didn't established"
" service "
<< service_type);
@@ -277,14 +289,13 @@ bool Connection::RemoveService(uint8_t session_id,
uint8_t Connection::RemoveSecondaryServices(
transport_manager::ConnectionUID secondary_connection_handle,
std::list<protocol_handler::ServiceType>& removed_services_list) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint8_t found_session_id = 0;
sync_primitives::AutoLock lock(session_map_lock_);
- LOG4CXX_INFO(logger_,
- "RemoveSecondaryServices looking for services on Connection ID "
- << static_cast<int>(secondary_connection_handle));
+ SDL_LOG_INFO("RemoveSecondaryServices looking for services on Connection ID "
+ << static_cast<int>(secondary_connection_handle));
// Walk the SessionMap in the primary connection, and for each
// Session, we walk its ServiceList, looking for all the services
@@ -292,9 +303,8 @@ uint8_t Connection::RemoveSecondaryServices(
for (SessionMap::iterator session_it = session_map_.begin();
session_map_.end() != session_it;
++session_it) {
- LOG4CXX_INFO(logger_,
- "RemoveSecondaryServices found session ID "
- << static_cast<int>(session_it->first));
+ SDL_LOG_INFO("RemoveSecondaryServices found session ID "
+ << static_cast<int>(session_it->first));
// Now, for each session, walk the its ServiceList, looking for services
// that were using secondary)_connection_handle. If we find such a service,
@@ -302,17 +312,14 @@ uint8_t Connection::RemoveSecondaryServices(
ServiceList& service_list = session_it->second.service_list;
ServiceList::iterator service_it = service_list.begin();
for (; service_it != service_list.end();) {
- LOG4CXX_INFO(logger_,
- "RemoveSecondaryServices found service ID "
- << static_cast<int>(service_it->service_type));
+ SDL_LOG_INFO("RemoveSecondaryServices found service ID "
+ << static_cast<int>(service_it->service_type));
if (service_it->connection_id == secondary_connection_handle) {
found_session_id = session_it->first;
- LOG4CXX_INFO(logger_,
- "RemoveSecondaryServices removing Service "
- << static_cast<int>(service_it->service_type)
- << " in session "
- << static_cast<int>(found_session_id));
+ SDL_LOG_INFO("RemoveSecondaryServices removing Service "
+ << static_cast<int>(service_it->service_type)
+ << " in session " << static_cast<int>(found_session_id));
removed_services_list.push_back(service_it->service_type);
service_it = service_list.erase(service_it);
@@ -337,7 +344,7 @@ int Connection::SetSSLContext(uint8_t session_id,
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.find(session_id);
if (session_it == session_map_.end()) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return security_manager::SecurityManager::ERROR_INTERNAL;
}
Session& session = session_it->second;
@@ -348,11 +355,11 @@ int Connection::SetSSLContext(uint8_t session_id,
security_manager::SSLContext* Connection::GetSSLContext(
const uint8_t session_id,
const protocol_handler::ServiceType& service_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::const_iterator session_it = session_map_.find(session_id);
if (session_it == session_map_.end()) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return NULL;
}
const Session& session = session_it->second;
@@ -361,29 +368,29 @@ security_manager::SSLContext* Connection::GetSSLContext(
return session.ssl_context;
const Service* service = session.FindService(service_type);
if (!service) {
- LOG4CXX_WARN(logger_, "Service not found in this session!");
+ SDL_LOG_WARN("Service not found in this session!");
return NULL;
}
if (!service->is_protected_)
return NULL;
- LOG4CXX_TRACE(logger_, "SSLContext is " << session.ssl_context);
+ SDL_LOG_TRACE("SSLContext is " << session.ssl_context);
return session.ssl_context;
}
void Connection::SetProtectionFlag(
const uint8_t session_id,
const protocol_handler::ServiceType& service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.find(session_id);
if (session_it == session_map_.end()) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return;
}
Session& session = session_it->second;
Service* service = session.FindService(service_type);
if (!service) {
- LOG4CXX_WARN(logger_, "Service not found in this session!");
+ SDL_LOG_WARN("Service not found in this session!");
return;
}
service->is_protected_ = true;
@@ -404,12 +411,12 @@ void Connection::SetProtectionFlag(
bool Connection::SessionServiceExists(
const uint8_t session_id,
const protocol_handler::ServiceType& service_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::const_iterator session_it = session_map_.find(session_id);
if (session_it == session_map_.end()) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return false;
}
@@ -449,19 +456,46 @@ void Connection::UpdateProtocolVersionSession(uint8_t session_id,
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.find(session_id);
if (session_map_.end() == session_it) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return;
}
Session& session = session_it->second;
session.protocol_version = protocol_version;
+ if (session.full_protocol_version.major_version_ !=
+ session.protocol_version) {
+ session.full_protocol_version =
+ utils::SemanticVersion(protocol_version, 0, 0);
+ }
+}
+
+void Connection::UpdateProtocolVersionSession(
+ uint8_t session_id, const utils::SemanticVersion& full_protocol_version) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!full_protocol_version.isValid()) {
+ SDL_LOG_WARN("Invalid version: " << full_protocol_version.toString());
+ return;
+ }
+
+ sync_primitives::AutoLock lock(session_map_lock_);
+ SessionMap::iterator session_it = session_map_.find(session_id);
+ if (session_map_.end() == session_it) {
+ SDL_LOG_WARN("Session not found in this connection!");
+ return;
+ }
+
+ Session& session = session_it->second;
+ session.protocol_version =
+ static_cast<uint8_t>(full_protocol_version.major_version_);
+ session.full_protocol_version = full_protocol_version;
}
bool Connection::SupportHeartBeat(uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.find(session_id);
if (session_map_.end() == session_it) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return false;
}
Session& session = session_it->second;
@@ -472,17 +506,30 @@ bool Connection::SupportHeartBeat(uint8_t session_id) {
bool Connection::ProtocolVersion(uint8_t session_id,
uint8_t& protocol_version) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.find(session_id);
if (session_map_.end() == session_it) {
- LOG4CXX_WARN(logger_, "Session not found in this connection!");
+ SDL_LOG_WARN("Session not found in this connection!");
return false;
}
protocol_version = (session_it->second).protocol_version;
return true;
}
+bool Connection::ProtocolVersion(
+ uint8_t session_id, utils::SemanticVersion& full_protocol_version) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(session_map_lock_);
+ SessionMap::iterator session_it = session_map_.find(session_id);
+ if (session_map_.end() == session_it) {
+ SDL_LOG_WARN("Session not found in this connection!");
+ return false;
+ }
+ full_protocol_version = (session_it->second).full_protocol_version;
+ return true;
+}
+
ConnectionHandle Connection::primary_connection_handle() const {
return primary_connection_handle_;
}
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index 1ad938332a..b9d1de8332 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -50,7 +50,7 @@
*/
namespace connection_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler")
+SDL_CREATE_LOG_VARIABLE("ConnectionHandler")
ConnectionHandle HandleFromConnectionUID(transport_manager::ConnectionUID uid) {
return ConnectionHandle(uid);
@@ -78,11 +78,11 @@ ConnectionHandlerImpl::ConnectionHandlerImpl(
, ending_connection_(NULL) {}
ConnectionHandlerImpl::~ConnectionHandlerImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void ConnectionHandlerImpl::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ConnectionList::iterator itr = connection_list_.begin();
while (itr != connection_list_.end()) {
RemoveConnection(itr->second->connection_handle());
@@ -95,30 +95,28 @@ void ConnectionHandlerImpl::Stop() {
void ConnectionHandlerImpl::set_connection_handler_observer(
ConnectionHandlerObserver* observer) {
- LOG4CXX_DEBUG(
- logger_,
- "ConnectionHandlerImpl::set_connection_handler_observer() " << observer);
+ SDL_LOG_DEBUG("ConnectionHandlerImpl::set_connection_handler_observer() "
+ << observer);
sync_primitives::AutoWriteLock write_lock(connection_handler_observer_lock_);
if (!observer) {
- LOG4CXX_WARN(logger_, "Set Null pointer to observer.");
+ SDL_LOG_WARN("Set Null pointer to observer.");
}
connection_handler_observer_ = observer;
}
void ConnectionHandlerImpl::set_protocol_handler(
protocol_handler::ProtocolHandler* protocol_handler) {
- LOG4CXX_DEBUG(
- logger_,
- "ConnectionHandlerImpl::set_protocol_handler()" << protocol_handler);
+ SDL_LOG_DEBUG("ConnectionHandlerImpl::set_protocol_handler() "
+ << protocol_handler);
if (!protocol_handler) {
- LOG4CXX_WARN(logger_, "Set Null pointer to protocol handler.");
+ SDL_LOG_WARN("Set Null pointer to protocol handler.");
}
protocol_handler_ = protocol_handler;
}
void ConnectionHandlerImpl::OnDeviceListUpdated(
const std::vector<transport_manager::DeviceInfo>&) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
sync_primitives::AutoReadLock lock(device_list_lock_);
if (connection_handler_observer_) {
@@ -135,16 +133,15 @@ void ConnectionHandlerImpl::OnFindNewApplicationsRequest() {
void ConnectionHandlerImpl::OnDeviceFound(
const transport_manager::DeviceInfo&) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void ConnectionHandlerImpl::OnDeviceAdded(
const transport_manager::DeviceInfo& device_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto handle = device_info.device_handle();
- LOG4CXX_DEBUG(logger_,
- "OnDeviceAdded!!!: " << handle << " " << device_info.name()
+ SDL_LOG_DEBUG("OnDeviceAdded!!!: " << handle << " " << device_info.name()
<< " " << device_info.mac_address() << " "
<< device_info.connection_type());
@@ -158,8 +155,7 @@ void ConnectionHandlerImpl::OnDeviceAdded(
auto result = device_list_.insert(std::make_pair(handle, device));
if (!result.second) {
- LOG4CXX_ERROR(logger_,
- "Device with handle " << handle
+ SDL_LOG_ERROR("Device with handle " << handle
<< " is known already. "
"Information won't be updated.");
return;
@@ -173,7 +169,7 @@ void ConnectionHandlerImpl::OnDeviceAdded(
void ConnectionHandlerImpl::OnDeviceRemoved(
const transport_manager::DeviceInfo& device_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Device has been removed. Perform all needed actions.
// 1. Delete all the connections and sessions of this device
// 2. Delete device from a list
@@ -252,12 +248,12 @@ void ConnectionHandlerImpl::OnDeviceSwitchingStart(
}
void ConnectionHandlerImpl::OnScanDevicesFinished() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void ConnectionHandlerImpl::OnScanDevicesFailed(
const transport_manager::SearchDeviceError& error) {
- LOG4CXX_WARN(logger_, "Scan devices failed. " << error.text());
+ SDL_LOG_WARN("Scan devices failed. " << error.text());
}
void ConnectionHandlerImpl::OnConnectionStatusUpdated() {
@@ -267,9 +263,8 @@ void ConnectionHandlerImpl::OnConnectionStatusUpdated() {
void ConnectionHandlerImpl::OnConnectionPending(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "OnConnectionPending!!!: " << device_info.device_handle() << " "
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("OnConnectionPending!!!: " << device_info.device_handle() << " "
<< device_info.name() << " "
<< device_info.mac_address() << " "
<< device_info.connection_type());
@@ -278,12 +273,11 @@ void ConnectionHandlerImpl::OnConnectionPending(
auto it = device_list_.find(device_info.device_handle());
if (device_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown device!");
+ SDL_LOG_ERROR("Unknown device!");
return;
}
}
- LOG4CXX_DEBUG(logger_,
- "Add Pending Connection #" << connection_id << " to the list.");
+ SDL_LOG_DEBUG("Add Pending Connection #" << connection_id << " to the list.");
std::string endpoint = device_info.mac_address();
cloud_app_id_map_lock_.Acquire();
@@ -321,23 +315,21 @@ void ConnectionHandlerImpl::OnConnectionPending(
void ConnectionHandlerImpl::OnConnectionEstablished(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "OnConnectionEstablished!!!: "
- << device_info.device_handle() << " " << device_info.name()
- << " " << device_info.mac_address() << " "
- << device_info.connection_type());
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("OnConnectionEstablished!!!: "
+ << device_info.device_handle() << " " << device_info.name()
+ << " " << device_info.mac_address() << " "
+ << device_info.connection_type());
{
sync_primitives::AutoReadLock lock(device_list_lock_);
auto it = device_list_.find(device_info.device_handle());
if (device_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown device!");
+ SDL_LOG_ERROR("Unknown device!");
return;
}
}
- LOG4CXX_DEBUG(logger_,
- "Add Connection #" << connection_id << " to the list.");
+ SDL_LOG_DEBUG("Add Connection #" << connection_id << " to the list.");
sync_primitives::AutoWriteLock lock(connection_list_lock_);
if (connection_list_.find(connection_id) == connection_list_.end()) {
connection_list_.insert(ConnectionList::value_type(
@@ -353,12 +345,12 @@ void ConnectionHandlerImpl::OnConnectionFailed(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectError& error) {
// TODO(PV): implement
- LOG4CXX_ERROR(logger_, "Failed connecting.");
+ SDL_LOG_ERROR("Failed connecting.");
}
void ConnectionHandlerImpl::OnConnectionClosed(
transport_manager::ConnectionUID connection_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
OnConnectionEnded(connection_id);
}
@@ -367,13 +359,13 @@ void ConnectionHandlerImpl::OnConnectionClosedFailure(
transport_manager::ConnectionUID connection_id,
const transport_manager::DisconnectError& error) {
// TODO(PV): implement
- LOG4CXX_ERROR(logger_, "ConnectionHandlerImpl::OnConnectionClosedFailure");
+ SDL_LOG_ERROR("ConnectionHandlerImpl::OnConnectionClosedFailure");
}
void ConnectionHandlerImpl::OnUnexpectedDisconnect(
transport_manager::ConnectionUID connection_id,
const transport_manager::CommunicationError& error) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
OnConnectionEnded(connection_id);
}
@@ -382,19 +374,19 @@ void ConnectionHandlerImpl::OnDeviceConnectionLost(
const transport_manager::DeviceHandle& device,
const transport_manager::DisconnectDeviceError& error) {
// TODO(PV): implement
- LOG4CXX_ERROR(logger_, "Lost connection with device " << device);
+ SDL_LOG_ERROR("Lost connection with device " << device);
}
void ConnectionHandlerImpl::OnDisconnectFailed(
const transport_manager::DeviceHandle& device,
const transport_manager::DisconnectDeviceError& error) {
// TODO(PV): implement
- LOG4CXX_ERROR(logger_, "Trying to Disconnect device failed.");
+ SDL_LOG_ERROR("Trying to Disconnect device failed.");
}
void ConnectionHandlerImpl::RemoveConnection(
const ConnectionHandle connection_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
OnConnectionEnded(connection_handle);
}
@@ -403,7 +395,7 @@ void ConnectionHandlerImpl::RemoveConnection(
bool AllowProtection(const ConnectionHandlerSettings& settings,
const protocol_handler::ServiceType& service_type,
const bool is_protected) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::vector<int>& force_unprotected_list =
is_protected ? settings.force_unprotected_service()
: settings.force_protected_service();
@@ -411,13 +403,12 @@ bool AllowProtection(const ConnectionHandlerSettings& settings,
if (std::find(force_unprotected_list.begin(),
force_unprotected_list.end(),
service_type) != force_unprotected_list.end()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Service " << static_cast<int>(service_type) << " shall be protected");
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Service " << static_cast<int>(service_type) << " allowed");
+ SDL_LOG_DEBUG("Service " << static_cast<int>(service_type) << " allowed");
return true;
}
#endif // ENABLE_SECURITY
@@ -428,7 +419,7 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
const protocol_handler::ServiceType& service_type,
const bool is_protected,
const BsonObject* params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<std::string> rejected_params;
@@ -442,17 +433,16 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
SessionTransports st = GetSessionTransports(session_id);
if (session_id != 0) {
if (st.primary_transport == 0) {
- LOG4CXX_WARN(logger_,
- "OnSessionStartedCallback could not find Session in the "
- "Session/Connection Map!");
+ SDL_LOG_WARN(
+ "OnSessionStartedCallback could not find Session in the "
+ "Session/Connection Map!");
} else {
- LOG4CXX_INFO(logger_,
- "OnSessionStartedCallback found session "
- << static_cast<int>(session_id)
- << " with primary connection "
- << static_cast<int>(st.primary_transport)
- << " and secondary connection "
- << static_cast<int>(st.secondary_transport));
+ SDL_LOG_INFO("OnSessionStartedCallback found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
primary_connection_handle = st.primary_transport;
}
}
@@ -467,7 +457,11 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
#ifdef ENABLE_SECURITY
if (!AllowProtection(get_settings(), service_type, is_protected)) {
- protocol_handler_->NotifySessionStarted(context, rejected_params);
+ protocol_handler_->NotifySessionStarted(
+ context,
+ rejected_params,
+ "Service of type " + std::to_string(service_type) + " cannot be " +
+ (is_protected ? "protected" : "unprotected"));
return;
}
#endif // ENABLE_SECURITY
@@ -475,8 +469,11 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
ConnectionList::iterator it =
connection_list_.find(primary_connection_handle);
if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown connection!");
- protocol_handler_->NotifySessionStarted(context, rejected_params);
+ SDL_LOG_ERROR("Unknown connection!");
+ protocol_handler_->NotifySessionStarted(
+ context,
+ rejected_params,
+ "Unknown connection " + std::to_string(primary_connection_handle));
return;
}
@@ -488,23 +485,34 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
context.new_session_id_ =
connection->AddNewSession(primary_connection_handle);
if (0 == context.new_session_id_) {
- LOG4CXX_ERROR(logger_, "Couldn't start new session!");
- protocol_handler_->NotifySessionStarted(context, rejected_params);
+ SDL_LOG_ERROR("Couldn't start new session!");
+ protocol_handler_->NotifySessionStarted(
+ context, rejected_params, "Unable to create new session");
return;
}
context.hash_id_ =
KeyFromPair(primary_connection_handle, context.new_session_id_);
} else { // Could be create new service or protected exists one
- if (!connection->AddNewService(
- session_id, service_type, is_protected, connection_handle)) {
- LOG4CXX_ERROR(logger_,
- "Couldn't establish "
+ std::string err_reason;
+ if (!connection->AddNewService(session_id,
+ service_type,
+ is_protected,
+ connection_handle,
+ &err_reason)) {
+ SDL_LOG_ERROR("Couldn't establish "
#ifdef ENABLE_SECURITY
- << (is_protected ? "protected" : "non-protected")
+ << (is_protected ? "protected" : "non-protected")
#endif // ENABLE_SECURITY
- << " service " << static_cast<int>(service_type)
- << " for session " << static_cast<int>(session_id));
- protocol_handler_->NotifySessionStarted(context, rejected_params);
+ << " service " << static_cast<int>(service_type)
+ << " for session " << static_cast<int>(session_id));
+
+ protocol_handler_->NotifySessionStarted(
+ context,
+ rejected_params,
+ "Cannot start " +
+ std::string(is_protected ? "a protected" : " an unprotected") +
+ " service of type " + std::to_string(service_type) + ". " +
+ err_reason);
return;
}
context.new_session_id_ = session_id;
@@ -541,14 +549,14 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult(
uint32_t session_key,
bool result,
std::vector<std::string>& rejected_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
protocol_handler::SessionContext context;
{
sync_primitives::AutoLock auto_lock(start_service_context_map_lock_);
auto it = start_service_context_map_.find(session_key);
if (it == start_service_context_map_.end()) {
- LOG4CXX_ERROR(logger_, "context for start service not found!");
+ SDL_LOG_ERROR("context for start service not found!");
return;
}
context = it->second;
@@ -563,15 +571,14 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult(
ConnectionList::iterator it =
connection_list_.find(context.primary_connection_id_);
if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "connection not found");
+ SDL_LOG_ERROR("connection not found");
return;
}
connection = it->second;
}
if (!result) {
- LOG4CXX_WARN(logger_,
- "Service starting forbidden by connection_handler_observer");
+ SDL_LOG_WARN("Service starting forbidden by connection_handler_observer");
if (protocol_handler::kRpc == context.service_type_) {
connection->RemoveSession(context.new_session_id_);
} else {
@@ -588,7 +595,7 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult(
void ConnectionHandlerImpl::OnApplicationFloodCallBack(
const uint32_t& connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_handle = 0;
uint8_t session_id = 0;
@@ -601,22 +608,21 @@ void ConnectionHandlerImpl::OnApplicationFloodCallBack(
if (session_id != 0) {
SessionTransports st = GetSessionTransports(session_id);
if (st.primary_transport == 0) {
- LOG4CXX_WARN(logger_,
- "OnApplicationFloodCallBack could not find Session in the "
- "Session/Connection Map!");
+ SDL_LOG_WARN(
+ "OnApplicationFloodCallBack could not find Session in the "
+ "Session/Connection Map!");
} else {
- LOG4CXX_INFO(logger_,
- "OnApplicationFloodCallBack found session "
- << static_cast<int>(session_id)
- << " with primary connection "
- << static_cast<int>(st.primary_transport)
- << " and secondary connection "
- << static_cast<int>(st.secondary_transport));
+ SDL_LOG_INFO("OnApplicationFloodCallBack found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
connection_handle = st.primary_transport;
}
}
- LOG4CXX_INFO(logger_, "Disconnect flooding application");
+ SDL_LOG_INFO("Disconnect flooding application");
if (session_id != 0) {
CloseSession(connection_handle, session_id, kFlood);
} else {
@@ -627,7 +633,7 @@ void ConnectionHandlerImpl::OnApplicationFloodCallBack(
void ConnectionHandlerImpl::OnMalformedMessageCallback(
const uint32_t& connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_handle = 0;
uint8_t session_id = 0;
@@ -640,22 +646,21 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback(
if (session_id != 0) {
SessionTransports st = GetSessionTransports(session_id);
if (st.primary_transport == 0) {
- LOG4CXX_WARN(logger_,
- "OnMalformedMessageCallback could not find Session in the "
- "Session/Connection Map!");
+ SDL_LOG_WARN(
+ "OnMalformedMessageCallback could not find Session in the "
+ "Session/Connection Map!");
} else {
- LOG4CXX_INFO(logger_,
- "OnMalformedMessageCallback found session "
- << static_cast<int>(session_id)
- << " with primary connection "
- << static_cast<int>(st.primary_transport)
- << " and secondary connection "
- << static_cast<int>(st.secondary_transport));
+ SDL_LOG_INFO("OnMalformedMessageCallback found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
connection_handle = st.primary_transport;
}
}
- LOG4CXX_INFO(logger_, "Disconnect malformed messaging application");
+ SDL_LOG_INFO("Disconnect malformed messaging application");
CloseConnectionSessions(connection_handle, kMalformed);
CloseConnection(connection_handle);
}
@@ -664,8 +669,9 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
uint32_t* hashCode,
- const protocol_handler::ServiceType& service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ const protocol_handler::ServiceType& service_type,
+ std::string* err_reason) {
+ SDL_LOG_AUTO_TRACE();
// In case this is a Session running on a Secondary Transport, we need to
// find the Sessions's primary transport. In this case, "connection_handle"
@@ -677,17 +683,19 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
if (session_id != 0) {
SessionTransports st = GetSessionTransports(session_id);
if (st.primary_transport == 0) {
- LOG4CXX_WARN(logger_,
- "OnSessionEndedCallback could not find Session in the "
- "Session/Connection Map!");
+ SDL_LOG_WARN(
+ "OnSessionEndedCallback could not find Session in the "
+ "Session/Connection Map!");
+ if (err_reason) {
+ *err_reason = "Could not find Session in the Session/Connection Map!";
+ }
} else {
- LOG4CXX_INFO(logger_,
- "OnSessionEndedCallback found session "
- << static_cast<int>(session_id)
- << " with primary connection "
- << static_cast<int>(st.primary_transport)
- << " and secondary connection "
- << static_cast<int>(st.secondary_transport));
+ SDL_LOG_INFO("OnSessionEndedCallback found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
primary_connection_handle = st.primary_transport;
}
}
@@ -696,8 +704,11 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
ConnectionList::iterator it =
connection_list_.find(primary_connection_handle);
if (connection_list_.end() == it) {
- LOG4CXX_WARN(logger_, "Unknown connection!");
+ SDL_LOG_WARN("Unknown connection!");
connection_list_lock_.Release();
+ if (err_reason) {
+ *err_reason = "Could not find Connection in the Connection Map!";
+ }
return 0;
}
std::pair<int32_t, Connection*> connection_item = *it;
@@ -708,34 +719,46 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
KeyFromPair(primary_connection_handle, session_id);
if (protocol_handler::kRpc == service_type) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Session " << static_cast<uint32_t>(session_id) << " to be removed");
// old version of protocol doesn't support hash
if (protocol_handler::HASH_ID_NOT_SUPPORTED != *hashCode) {
if (protocol_handler::HASH_ID_WRONG == *hashCode ||
session_key != *hashCode) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Wrong hash_id for session " << static_cast<uint32_t>(session_id));
*hashCode = protocol_handler::HASH_ID_WRONG;
+
+ if (err_reason) {
+ *err_reason = "Wrong hash_id for session " +
+ std::to_string(static_cast<uint32_t>(session_id));
+ }
return 0;
}
}
if (!connection->RemoveSession(session_id)) {
- LOG4CXX_WARN(
- logger_,
- "Couldn't remove session " << static_cast<uint32_t>(session_id));
+ SDL_LOG_WARN("Couldn't remove session "
+ << static_cast<uint32_t>(session_id));
+ if (err_reason) {
+ *err_reason = "Couldn't remove session " +
+ std::to_string(static_cast<uint32_t>(session_id));
+ }
return 0;
}
} else {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Service " << static_cast<uint32_t>(service_type) << " to be removed");
if (!connection->RemoveService(session_id, service_type)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Couldn't remove service " << static_cast<uint32_t>(service_type));
+ if (err_reason) {
+ *err_reason = "Couldn't remove service " +
+ std::to_string(static_cast<uint32_t>(service_type));
+ }
return 0;
}
}
@@ -752,10 +775,10 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted(
transport_manager::ConnectionUID& primary_connection_handle,
const transport_manager::ConnectionUID secondary_connection_handle,
const uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (session_id == 0) {
- LOG4CXX_WARN(logger_, "Session id for secondary transport is invalid");
+ SDL_LOG_WARN("Session id for secondary transport is invalid");
return false;
}
@@ -766,8 +789,7 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted(
ConnectionList::iterator it =
connection_list_.find(secondary_connection_handle);
if (connection_list_.end() == it) {
- LOG4CXX_WARN(logger_,
- "Unknown connection " << secondary_connection_handle);
+ SDL_LOG_WARN("Unknown connection " << secondary_connection_handle);
return false;
}
@@ -780,8 +802,7 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted(
SetSecondaryTransportID(session_id, secondary_connection_handle);
primary_connection_handle = st.primary_transport;
if (st.secondary_transport != secondary_connection_handle) {
- LOG4CXX_WARN(logger_,
- "Failed setting the session's secondary transport ID");
+ SDL_LOG_WARN("Failed setting the session's secondary transport ID");
return false;
}
@@ -792,9 +813,9 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted(
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
if (connection_handler_observer_) {
- LOG4CXX_TRACE(logger_,
- "Calling Connection Handler Observer's "
- "OnSecondaryTransportStartedCallback");
+ SDL_LOG_TRACE(
+ "Calling Connection Handler Observer's "
+ "OnSecondaryTransportStartedCallback");
connection_handler_observer_->OnSecondaryTransportStartedCallback(
device_handle, session_key);
}
@@ -805,18 +826,17 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted(
void ConnectionHandlerImpl::OnSecondaryTransportEnded(
const transport_manager::ConnectionUID primary_connection_handle,
const transport_manager::ConnectionUID secondary_connection_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_INFO(logger_,
- "Secondary Transport: "
- << static_cast<int32_t>(secondary_connection_handle)
- << " ended. Cleaning up services from primary connection ID "
- << static_cast<int32_t>(primary_connection_handle));
+ SDL_LOG_INFO("Secondary Transport: "
+ << static_cast<int32_t>(secondary_connection_handle)
+ << " ended. Cleaning up services from primary connection ID "
+ << static_cast<int32_t>(primary_connection_handle));
connection_list_lock_.AcquireForReading();
ConnectionList::iterator itr =
connection_list_.find(primary_connection_handle);
if (connection_list_.end() == itr) {
- LOG4CXX_ERROR(logger_, "Primary Connection not found!");
+ SDL_LOG_ERROR("Primary Connection not found!");
connection_list_lock_.Release();
return;
}
@@ -877,12 +897,12 @@ void ConnectionHandlerImpl::CreateWebEngineDevice() {
const std::string
ConnectionHandlerImpl::TransportTypeProfileStringFromConnHandle(
transport_manager::ConnectionUID connection_handle) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::const_iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
- LOG4CXX_WARN(logger_, "Unknown connection " << connection_handle);
+ SDL_LOG_WARN("Unknown connection " << connection_handle);
return std::string();
} else {
DeviceHandle device_handle = it->second->connection_device_handle();
@@ -898,7 +918,7 @@ ConnectionHandlerImpl::TransportTypeProfileStringFromDeviceHandle(
sync_primitives::AutoReadLock lock(device_list_lock_);
auto it = device_list_.find(device_handle);
if (device_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Device not found!");
+ SDL_LOG_ERROR("Device not found!");
} else {
connection_type = it->second.connection_type();
}
@@ -929,7 +949,7 @@ ConnectionHandlerImpl::TransportTypeProfileStringFromDeviceHandle(
return std::string("BTMAC");
#endif
} else {
- LOG4CXX_WARN(logger_, "Unknown transport type string: " << connection_type);
+ SDL_LOG_WARN("Unknown transport type string: " << connection_type);
return std::string();
}
}
@@ -938,15 +958,14 @@ uint32_t ConnectionHandlerImpl::KeyFromPair(
transport_manager::ConnectionUID connection_handle,
uint8_t session_id) const {
const uint32_t key = connection_handle | (session_id << 16);
- LOG4CXX_DEBUG(logger_,
- "Key for ConnectionHandle:"
- << static_cast<uint32_t>(connection_handle)
- << " Session:" << static_cast<uint32_t>(session_id)
- << " is: 0x" << std::hex << static_cast<uint32_t>(key));
+ SDL_LOG_DEBUG("Key for ConnectionHandle:"
+ << static_cast<uint32_t>(connection_handle)
+ << " Session:" << static_cast<uint32_t>(session_id) << " is: 0x"
+ << std::hex << static_cast<uint32_t>(key));
if (protocol_handler::HASH_ID_WRONG == key) {
- LOG4CXX_ERROR(logger_,
- "Connection key is WRONG_HASH_ID "
- "(session id shall be greater 0)");
+ SDL_LOG_ERROR(
+ "Connection key is WRONG_HASH_ID "
+ "(session id shall be greater 0)");
}
return key;
}
@@ -957,8 +976,8 @@ void ConnectionHandlerImpl::PairFromKey(
uint8_t* session_id) const {
*connection_handle = key & 0xFF00FFFF;
*session_id = key >> 16;
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"ConnectionHandle:" << static_cast<int32_t>(*connection_handle)
<< " Session:" << static_cast<int32_t>(*session_id)
<< " for key:" << static_cast<int32_t>(key));
@@ -969,7 +988,7 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey(
uint32_t* app_id,
std::list<int32_t>* sessions_list,
connection_handler::DeviceHandle* device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int32_t error_result = -1;
transport_manager::ConnectionUID conn_handle = 0;
@@ -978,16 +997,15 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey(
ConnectionList::const_iterator it = connection_list_.find(conn_handle);
if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Connection not found for key: " << key);
+ SDL_LOG_ERROR("Connection not found for key: " << key);
return error_result;
}
const Connection& connection = *it->second;
const SessionMap session_map = connection.session_map();
if (0 == session_id || session_map.end() == session_map.find(session_id)) {
- LOG4CXX_ERROR(logger_,
- "Session not found in connection: "
- << static_cast<int32_t>(conn_handle));
+ SDL_LOG_ERROR("Session not found in connection: "
+ << static_cast<int32_t>(conn_handle));
return error_result;
}
@@ -1006,8 +1024,7 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey(
}
}
- LOG4CXX_INFO(logger_,
- "Connection " << static_cast<int32_t>(conn_handle) << " has "
+ SDL_LOG_INFO("Connection " << static_cast<int32_t>(conn_handle) << " has "
<< session_map.size() << " sessions.");
return 0;
}
@@ -1041,13 +1058,12 @@ uint32_t findGap(const std::map<unsigned char, T>& map) {
uint32_t ConnectionHandlerImpl::AddSession(
const transport_manager::ConnectionUID primary_transport_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
const uint32_t session_id = findGap(session_connection_map_);
if (session_id > 0) {
- LOG4CXX_INFO(logger_,
- "New session ID " << session_id << " and Connection Id "
+ SDL_LOG_INFO("New session ID " << session_id << " and Connection Id "
<< static_cast<int>(primary_transport_id)
<< " added to Session/Connection Map");
SessionTransports st;
@@ -1055,25 +1071,23 @@ uint32_t ConnectionHandlerImpl::AddSession(
st.secondary_transport = 0;
session_connection_map_[session_id] = st;
} else {
- LOG4CXX_WARN(logger_,
- "Session/Connection Map could not create a new session ID!!!");
+ SDL_LOG_WARN("Session/Connection Map could not create a new session ID!!!");
}
return session_id;
}
bool ConnectionHandlerImpl::RemoveSession(uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
SessionConnectionMap::iterator itr = session_connection_map_.find(session_id);
if (session_connection_map_.end() == itr) {
- LOG4CXX_WARN(logger_, "Session not found in Session/Connection Map!");
+ SDL_LOG_WARN("Session not found in Session/Connection Map!");
return false;
}
- LOG4CXX_INFO(logger_,
- "Removed Session ID " << static_cast<int>(session_id)
+ SDL_LOG_INFO("Removed Session ID " << static_cast<int>(session_id)
<< " from Session/Connection Map");
session_connection_map_.erase(session_id);
return true;
@@ -1093,10 +1107,9 @@ SessionTransports ConnectionHandlerImpl::SetSecondaryTransportID(
sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
SessionConnectionMap::iterator it = session_connection_map_.find(session_id);
if (session_connection_map_.end() == it) {
- LOG4CXX_WARN(logger_,
- "SetSecondaryTransportID: session ID "
- << static_cast<int>(session_id)
- << " not found in Session/Connection map");
+ SDL_LOG_WARN("SetSecondaryTransportID: session ID "
+ << static_cast<int>(session_id)
+ << " not found in Session/Connection map");
st.primary_transport = 0;
st.secondary_transport = 0;
} else {
@@ -1110,12 +1123,11 @@ SessionTransports ConnectionHandlerImpl::SetSecondaryTransportID(
if (st.secondary_transport != 0 &&
secondary_transport_id != kDisabledSecondary &&
secondary_transport_id != 0) {
- LOG4CXX_WARN(logger_,
- "SetSecondaryTransportID: session ID "
- << static_cast<int>(session_id)
- << " already has a secondary connection "
- << static_cast<int>(st.secondary_transport)
- << " in the Session/Connection map");
+ SDL_LOG_WARN("SetSecondaryTransportID: session ID "
+ << static_cast<int>(session_id)
+ << " already has a secondary connection "
+ << static_cast<int>(st.secondary_transport)
+ << " in the Session/Connection map");
} else {
st.secondary_transport = secondary_transport_id;
session_connection_map_[session_id] = st;
@@ -1152,22 +1164,19 @@ const uint8_t ConnectionHandlerImpl::GetSessionIdFromSecondaryTransport(
}
}
- LOG4CXX_ERROR(logger_,
- "Could not find secondary transport ID "
- << static_cast<int>(secondary_transport_id)
- << " in the Session/Connection map");
+ SDL_LOG_ERROR("Could not find secondary transport ID "
+ << static_cast<int>(secondary_transport_id)
+ << " in the Session/Connection map");
return 0;
}
Connection* ConnectionHandlerImpl::GetPrimaryConnection(
const ConnectionHandle connection_handle) const {
- LOG4CXX_DEBUG(logger_,
- "Getting primary connection for ID " << connection_handle);
+ SDL_LOG_DEBUG("Getting primary connection for ID " << connection_handle);
ConnectionList::const_iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
- LOG4CXX_ERROR(
- logger_,
- "Connection with ID " << connection_handle << " was not found");
+ SDL_LOG_ERROR("Connection with ID " << connection_handle
+ << " was not found");
return nullptr;
}
@@ -1220,7 +1229,7 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID(
std::list<uint32_t>* applications_list,
std::string* mac_address,
std::string* connection_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
int32_t result = -1;
@@ -1228,7 +1237,7 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID(
auto it = device_list_.find(device_handle);
if (device_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Device not found for handle " << device_handle);
+ SDL_LOG_ERROR("Device not found for handle " << device_handle);
return result;
}
@@ -1283,7 +1292,7 @@ void ConnectionHandlerImpl::GetConnectedDevicesMAC(
#ifdef ENABLE_SECURITY
int ConnectionHandlerImpl::SetSSLContext(
const uint32_t& key, security_manager::SSLContext* context) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(key, &connection_handle, &session_id);
@@ -1299,7 +1308,7 @@ int ConnectionHandlerImpl::SetSSLContext(
security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext(
const uint32_t& key, const protocol_handler::ServiceType& service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(key, &connection_handle, &session_id);
@@ -1315,7 +1324,7 @@ security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext(
void ConnectionHandlerImpl::SetProtectionFlag(
const uint32_t& key, const protocol_handler::ServiceType& service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(key, &connection_handle, &session_id);
@@ -1350,7 +1359,7 @@ ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const {
bool ConnectionHandlerImpl::SessionServiceExists(
const uint32_t connection_key,
const protocol_handler::ServiceType& service_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
@@ -1358,7 +1367,7 @@ bool ConnectionHandlerImpl::SessionServiceExists(
sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::const_iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown connection!");
+ SDL_LOG_ERROR("Unknown connection!");
return false;
}
const Connection& connection = *it->second;
@@ -1366,7 +1375,7 @@ bool ConnectionHandlerImpl::SessionServiceExists(
}
void ConnectionHandlerImpl::StartDevicesDiscovery() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager_.SearchDevices();
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
@@ -1382,13 +1391,12 @@ void ConnectionHandlerImpl::ConnectToDevice(
sync_primitives::AutoReadLock lock(device_list_lock_);
it_in = device_list_.find(device_handle);
if (device_list_.end() != it_in) {
- LOG4CXX_INFO(logger_, "Connecting to device with handle " << device_handle);
+ SDL_LOG_INFO("Connecting to device with handle " << device_handle);
if (transport_manager::E_SUCCESS !=
transport_manager_.ConnectDevice(device_handle)) {
- LOG4CXX_WARN(logger_, "Can't connect to device");
+ SDL_LOG_WARN("Can't connect to device");
} else {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Application Manager wanted to connect to non-existing device");
}
}
@@ -1411,7 +1419,7 @@ void ConnectionHandlerImpl::RunAppOnDevice(const std::string& device_mac,
return;
}
}
- LOG4CXX_WARN(logger_, "No apps found on device " << device_mac);
+ SDL_LOG_WARN("No apps found on device " << device_mac);
}
void ConnectionHandlerImpl::ConnectToAllDevices() {
@@ -1420,7 +1428,7 @@ void ConnectionHandlerImpl::ConnectToAllDevices() {
++i) {
if (transport_manager::webengine_constants::kWebEngineDeviceName ==
i->second.user_friendly_name()) {
- LOG4CXX_DEBUG(logger_, "No need to connect to web engine device");
+ SDL_LOG_DEBUG("No need to connect to web engine device");
continue;
}
ConnectToDevice(i->first);
@@ -1443,13 +1451,13 @@ void ConnectionHandlerImpl::RemoveCloudAppDevice(const DeviceHandle device_id) {
}
void ConnectionHandlerImpl::StartTransportManager() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager_.PerformActionOnClients(
transport_manager::TransportAction::kVisibilityOn);
}
void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t connection_handle = 0;
uint8_t session_id = 0;
@@ -1460,7 +1468,7 @@ void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) {
void ConnectionHandlerImpl::CloseConnection(
ConnectionHandle connection_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_uid =
ConnectionUIDFromHandle(connection_handle);
transport_manager_.DisconnectForce(connection_uid);
@@ -1476,7 +1484,7 @@ void ConnectionHandlerImpl::CloseConnection(
uint32_t ConnectionHandlerImpl::GetConnectionSessionsCount(
uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
@@ -1503,9 +1511,8 @@ void ConnectionHandlerImpl::CloseSession(uint32_t key,
void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle,
uint8_t session_id,
CloseSessionReason close_reason) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Closing session with id: " << static_cast<int>(session_id));
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Closing session with id: " << static_cast<int>(session_id));
// In case of malformed message the connection should be broke up without
// any other notification to mobile.
@@ -1526,15 +1533,14 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle,
session_map = connection_list_itr->second->session_map();
connection_list_itr->second->RemoveSession(session_id);
} else {
- LOG4CXX_ERROR(logger_,
- "Connection with id: " << connection_id << " not found");
+ SDL_LOG_ERROR("Connection with id: " << connection_id << " not found");
return;
}
}
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
if (!connection_handler_observer_) {
- LOG4CXX_ERROR(logger_, "Connection handler observer not found");
+ SDL_LOG_ERROR("Connection handler observer not found");
return;
}
@@ -1553,24 +1559,23 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle,
session_key, service_type, close_reason);
}
} else {
- LOG4CXX_ERROR(logger_, "Session with id: " << session_id << " not found");
+ SDL_LOG_ERROR("Session with id: " << session_id << " not found");
return;
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Session with id: " << session_id << " has been closed successfully");
}
void ConnectionHandlerImpl::CloseConnectionSessions(
ConnectionHandle connection_handle, CloseSessionReason close_reason) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::ConnectionUID connection_id =
ConnectionUIDFromHandle(connection_handle);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Closing all sessions for connection with id: " << connection_id);
typedef std::vector<uint8_t> SessionIdVector;
@@ -1588,8 +1593,7 @@ void ConnectionHandlerImpl::CloseConnectionSessions(
session_id_vector.push_back(session_map_itr->first);
}
} else {
- LOG4CXX_ERROR(logger_,
- "Connection with id: " << connection_id << " not found");
+ SDL_LOG_ERROR("Connection with id: " << connection_id << " not found");
return;
}
}
@@ -1599,12 +1603,12 @@ void ConnectionHandlerImpl::CloseConnectionSessions(
}
session_id_vector.clear();
- LOG4CXX_DEBUG(logger_,
- "All sessions for connection with id: "
- << connection_id << " have been closed successfully");
+ SDL_LOG_DEBUG("All sessions for connection with id: "
+ << connection_id << " have been closed successfully");
}
void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) {
+ SDL_LOG_AUTO_TRACE();
if (protocol_handler_) {
uint32_t connection_handle = 0;
uint8_t session_id = 0;
@@ -1614,17 +1618,16 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) {
// that transport from the SessionConnection Map
SessionTransports st = GetSessionTransports(session_id);
if (st.primary_transport == 0) {
- LOG4CXX_WARN(logger_,
- "SendEndService could not find Session in the "
- "Session/Connection Map!");
+ SDL_LOG_WARN(
+ "SendEndService could not find Session in the "
+ "Session/Connection Map!");
} else {
- LOG4CXX_INFO(logger_,
- "SendEndService found session "
- << static_cast<int>(session_id)
- << " with primary connection "
- << static_cast<int>(st.primary_transport)
- << " and secondary connection "
- << static_cast<int>(st.secondary_transport));
+ SDL_LOG_INFO("SendEndService found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
auto it = std::find(st.secondary_transport_services.begin(),
st.secondary_transport_services.end(),
@@ -1640,7 +1643,7 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) {
}
void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
@@ -1654,7 +1657,7 @@ void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) {
void ConnectionHandlerImpl::SetHeartBeatTimeout(uint32_t connection_key,
uint32_t timeout) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
@@ -1676,7 +1679,7 @@ void ConnectionHandlerImpl::SendHeartBeat(ConnectionHandle connection_handle,
void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key,
uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_key);
if (connection_list_.end() != it) {
@@ -1686,13 +1689,12 @@ void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key,
void ConnectionHandlerImpl::OnConnectionEnded(
const transport_manager::ConnectionUID connection_id) {
- LOG4CXX_INFO(logger_,
- "Delete Connection: " << static_cast<int32_t>(connection_id)
+ SDL_LOG_INFO("Delete Connection: " << static_cast<int32_t>(connection_id)
<< " from the list.");
connection_list_lock_.AcquireForWriting();
ConnectionList::iterator itr = connection_list_.find(connection_id);
if (connection_list_.end() == itr) {
- LOG4CXX_ERROR(logger_, "Connection not found!");
+ SDL_LOG_ERROR("Connection not found!");
connection_list_lock_.Release();
return;
}
@@ -1740,7 +1742,7 @@ void ConnectionHandlerImpl::OnConnectionEnded(
void ConnectionHandlerImpl::BindProtocolVersionWithSession(
uint32_t connection_key, uint8_t protocol_version) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
@@ -1752,10 +1754,25 @@ void ConnectionHandlerImpl::BindProtocolVersionWithSession(
}
}
+void ConnectionHandlerImpl::BindProtocolVersionWithSession(
+ uint32_t connection_key,
+ const utils::SemanticVersion& full_protocol_version) {
+ SDL_LOG_AUTO_TRACE();
+ uint32_t connection_handle = 0;
+ uint8_t session_id = 0;
+ PairFromKey(connection_key, &connection_handle, &session_id);
+
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
+ auto connection = GetPrimaryConnection(connection_handle);
+ if (connection) {
+ connection->UpdateProtocolVersionSession(session_id, full_protocol_version);
+ }
+}
+
bool ConnectionHandlerImpl::IsHeartBeatSupported(
transport_manager::ConnectionUID connection_handle,
uint8_t session_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoReadLock lock(connection_list_lock_);
const uint32_t connection_id = static_cast<uint32_t>(connection_handle);
auto connection = GetPrimaryConnection(connection_id);
@@ -1771,7 +1788,7 @@ bool ConnectionHandlerImpl::ProtocolVersionUsed(
uint32_t connection_id,
uint8_t session_id,
uint8_t& protocol_version) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoReadLock lock(connection_list_lock_);
auto connection = GetPrimaryConnection(connection_id);
@@ -1785,6 +1802,25 @@ bool ConnectionHandlerImpl::ProtocolVersionUsed(
return false;
}
+bool ConnectionHandlerImpl::ProtocolVersionUsed(
+ uint32_t connection_id,
+ uint8_t session_id,
+ utils::SemanticVersion& full_protocol_version) const {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
+ auto connection = GetPrimaryConnection(connection_id);
+
+ if (connection) {
+ return connection->ProtocolVersion(session_id, full_protocol_version);
+ } else if (ending_connection_ &&
+ static_cast<uint32_t>(ending_connection_->connection_handle()) ==
+ connection_id) {
+ return ending_connection_->ProtocolVersion(session_id,
+ full_protocol_version);
+ }
+ return false;
+}
+
#ifdef BUILD_TESTS
ConnectionList& ConnectionHandlerImpl::getConnectionList() {
return connection_list_;
diff --git a/src/components/connection_handler/src/device.cc b/src/components/connection_handler/src/device.cc
index 515304778b..c831c0b2d2 100644
--- a/src/components/connection_handler/src/device.cc
+++ b/src/components/connection_handler/src/device.cc
@@ -43,7 +43,7 @@
*/
namespace connection_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler")
+SDL_CREATE_LOG_VARIABLE("ConnectionHandler")
Device::Device(DeviceHandle device_handle,
const std::string& user_friendly_name,
@@ -54,8 +54,8 @@ Device::Device(DeviceHandle device_handle,
, mac_address_(mac_address)
, connection_type_(connection_type) {
mac_address_ = encryption::MakeHash(mac_address);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Device: MAC address - " << mac_address << ", hash - " << mac_address_);
}
diff --git a/src/components/connection_handler/src/heartbeat_monitor.cc b/src/components/connection_handler/src/heartbeat_monitor.cc
index 2b50f1ce1b..e53e914b0a 100644
--- a/src/components/connection_handler/src/heartbeat_monitor.cc
+++ b/src/components/connection_handler/src/heartbeat_monitor.cc
@@ -41,7 +41,7 @@ namespace connection_handler {
using namespace sync_primitives;
-CREATE_LOGGERPTR_GLOBAL(logger_, "HeartBeatMonitor")
+SDL_CREATE_LOG_VARIABLE("HeartBeatMonitor")
HeartBeatMonitor::HeartBeatMonitor(uint32_t heartbeat_timeout_mseconds,
Connection* connection)
@@ -57,7 +57,7 @@ void HeartBeatMonitor::Process() {
if (state.HasTimeoutElapsed()) {
const uint8_t session_id = it->first;
if (state.IsReadyToClose()) {
- LOG4CXX_WARN(logger_, "Will close session");
+ SDL_LOG_WARN("Will close session");
sessions_list_lock_.Release();
RemoveSession(session_id);
connection_->CloseSession(session_id);
@@ -65,9 +65,8 @@ void HeartBeatMonitor::Process() {
it = sessions_.begin();
continue;
} else {
- LOG4CXX_DEBUG(logger_,
- "Send heart beat into session with id "
- << static_cast<int32_t>(session_id));
+ SDL_LOG_DEBUG("Send heart beat into session with id "
+ << static_cast<int32_t>(session_id));
state.PrepareToClose();
connection_->SendHeartBeat(it->first);
}
@@ -79,8 +78,8 @@ void HeartBeatMonitor::Process() {
void HeartBeatMonitor::threadMain() {
AutoLock main_lock(main_thread_lock_);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Start heart beat monitor. Timeout is " << default_heartbeat_timeout_);
while (run_) {
heartbeat_monitor_.WaitFor(main_lock, kDefaultCycleTimeout);
@@ -91,42 +90,37 @@ void HeartBeatMonitor::threadMain() {
void HeartBeatMonitor::AddSession(uint8_t session_id) {
const uint32_t converted_session_id = static_cast<int32_t>(session_id);
UNUSED(converted_session_id);
- LOG4CXX_DEBUG(logger_, "Add session with id " << converted_session_id);
+ SDL_LOG_DEBUG("Add session with id " << converted_session_id);
AutoLock auto_lock(sessions_list_lock_);
if (sessions_.end() != sessions_.find(session_id)) {
- LOG4CXX_WARN(
- logger_,
- "Session with id: " << converted_session_id << " already exists");
+ SDL_LOG_WARN("Session with id: " << converted_session_id
+ << " already exists");
return;
}
sessions_.insert(
std::make_pair(session_id, SessionState(default_heartbeat_timeout_)));
- LOG4CXX_INFO(logger_,
- "Start heartbeat for session: " << converted_session_id);
+ SDL_LOG_INFO("Start heartbeat for session: " << converted_session_id);
}
void HeartBeatMonitor::RemoveSession(uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AutoLock auto_lock(sessions_list_lock_);
- LOG4CXX_DEBUG(logger_,
- "Remove session with id " << static_cast<int>(session_id));
+ SDL_LOG_DEBUG("Remove session with id " << static_cast<int>(session_id));
if (sessions_.erase(session_id) == 0) {
- LOG4CXX_WARN(logger_,
- "Remove session with id " << static_cast<int>(session_id)
+ SDL_LOG_WARN("Remove session with id " << static_cast<int>(session_id)
<< " was unsuccessful");
}
}
void HeartBeatMonitor::KeepAlive(uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AutoLock auto_lock(sessions_list_lock_);
if (sessions_.end() != sessions_.find(session_id)) {
- LOG4CXX_INFO(logger_,
- "Resetting heart beat timer for session with id "
- << static_cast<int32_t>(session_id));
+ SDL_LOG_INFO("Resetting heart beat timer for session with id "
+ << static_cast<int32_t>(session_id));
sessions_[session_id].KeepAlive();
}
@@ -136,7 +130,7 @@ void HeartBeatMonitor::exitThreadMain() {
// FIXME (dchmerev@luxoft.com): thread requested to stop should stop as soon
// as possible,
// not running one more iteration before actual stop
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
AutoLock main_lock(main_thread_lock_);
run_ = false;
heartbeat_monitor_.NotifyOne();
@@ -144,8 +138,7 @@ void HeartBeatMonitor::exitThreadMain() {
void HeartBeatMonitor::set_heartbeat_timeout_milliseconds(uint32_t timeout,
uint8_t session_id) {
- LOG4CXX_DEBUG(logger_,
- "Set new heart beat timeout " << timeout
+ SDL_LOG_DEBUG("Set new heart beat timeout " << timeout
<< "For session: " << session_id);
AutoLock session_locker(sessions_list_lock_);
@@ -158,12 +151,12 @@ HeartBeatMonitor::SessionState::SessionState(
uint32_t heartbeat_timeout_mseconds)
: heartbeat_timeout_mseconds_(heartbeat_timeout_mseconds)
, is_heartbeat_sent_(false) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RefreshExpiration();
}
void HeartBeatMonitor::SessionState::RefreshExpiration() {
- LOG4CXX_DEBUG(logger_, "Refresh expiration: " << heartbeat_timeout_mseconds_);
+ SDL_LOG_DEBUG("Refresh expiration: " << heartbeat_timeout_mseconds_);
using namespace date_time;
date_time::TimeDuration time = getCurrentTime();
AddMilliseconds(time, heartbeat_timeout_mseconds_);
@@ -172,15 +165,14 @@ void HeartBeatMonitor::SessionState::RefreshExpiration() {
void HeartBeatMonitor::SessionState::UpdateTimeout(
uint32_t heartbeat_timeout_mseconds) {
- LOG4CXX_DEBUG(logger_,
- "Update timout with value " << heartbeat_timeout_mseconds_);
+ SDL_LOG_DEBUG("Update timout with value " << heartbeat_timeout_mseconds_);
heartbeat_timeout_mseconds_ = heartbeat_timeout_mseconds;
RefreshExpiration();
}
void HeartBeatMonitor::SessionState::PrepareToClose() {
is_heartbeat_sent_ = true;
- LOG4CXX_DEBUG(logger_, "Prepare to close");
+ SDL_LOG_DEBUG("Prepare to close");
RefreshExpiration();
}
@@ -189,7 +181,7 @@ bool HeartBeatMonitor::SessionState::IsReadyToClose() const {
}
void HeartBeatMonitor::SessionState::KeepAlive() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_heartbeat_sent_ = false;
RefreshExpiration();
}
diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc
index 855225c460..5a8feda2db 100644
--- a/src/components/connection_handler/test/connection_handler_impl_test.cc
+++ b/src/components/connection_handler/test/connection_handler_impl_test.cc
@@ -127,7 +127,7 @@ class ConnectionHandlerTest : public ::testing::Test {
void AddTestSession() {
protocol_handler_test::MockProtocolHandler temp_protocol_handler;
connection_handler_->set_protocol_handler(&temp_protocol_handler);
- EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _))
+ EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&out_context_));
connection_handler_->OnSessionStartedCallback(
@@ -164,7 +164,7 @@ class ConnectionHandlerTest : public ::testing::Test {
SessionContext context;
protocol_handler_test::MockProtocolHandler temp_protocol_handler;
connection_handler_->set_protocol_handler(&temp_protocol_handler);
- EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _))
+ EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&context));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -371,7 +371,7 @@ TEST_F(ConnectionHandlerTest, StartSession_NoConnection) {
protocol_handler::SessionContext context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&context));
connection_handler_->OnSessionStartedCallback(
@@ -1144,7 +1144,7 @@ TEST_F(ConnectionHandlerTest, StartService_withServices) {
SessionContext audio_context, video_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&audio_context))
.WillOnce(SaveArg<0>(&video_context));
@@ -1185,7 +1185,7 @@ TEST_F(ConnectionHandlerTest, StartService_withServices_withParams) {
std::vector<std::string> empty;
BsonObject* dummy_param = reinterpret_cast<BsonObject*>(&dummy);
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
.WillOnce(SaveArg<0>(&video_context));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -1230,7 +1230,7 @@ TEST_F(ConnectionHandlerTest, ServiceStop) {
SessionContext audio_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillRepeatedly(SaveArg<0>(&audio_context));
// Check ignoring hash_id on stop non-rpc service
@@ -1319,7 +1319,7 @@ TEST_F(ConnectionHandlerTest, SessionStarted_WithRpc) {
ByRef(empty)));
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&out_context_));
// Start new session with RPC service
@@ -1357,7 +1357,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_SUCCESS) {
// confirm that NotifySessionStarted() is called
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
.WillOnce(SaveArg<0>(&out_context_));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -1397,7 +1397,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) {
// confirm that NotifySessionStarted() is called
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
.WillOnce(SaveArg<0>(&out_context_));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -1421,7 +1421,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) {
protocol_handler_test::MockProtocolHandler temp_protocol_handler;
connection_handler_->set_protocol_handler(&temp_protocol_handler);
- EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _))
+ EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&context_first))
.WillOnce(SaveArg<0>(&context_second));
@@ -1488,7 +1488,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) {
// verify that connection handler will not mix up the two results
SessionContext new_context_first, new_context_second;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
.WillOnce(SaveArg<0>(&new_context_second))
.WillOnce(SaveArg<0>(&new_context_first));
@@ -1520,7 +1520,7 @@ TEST_F(ConnectionHandlerTest,
SessionContext fail_context;
SessionContext positive_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&fail_context))
.WillOnce(SaveArg<0>(&positive_context));
@@ -1563,7 +1563,7 @@ TEST_F(ConnectionHandlerTest,
SessionContext fail_context;
SessionContext positive_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&fail_context))
.WillOnce(SaveArg<0>(&positive_context));
@@ -1608,7 +1608,7 @@ TEST_F(ConnectionHandlerTest,
SessionContext context_first, context_second;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&context_first))
.WillOnce(SaveArg<0>(&context_second));
@@ -1663,7 +1663,7 @@ TEST_F(ConnectionHandlerTest,
SessionContext rejected_context, positive_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&rejected_context))
.WillOnce(SaveArg<0>(&positive_context));
@@ -1706,7 +1706,7 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtect) {
SessionContext context_new, context_second, context_third;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&context_new))
.WillOnce(SaveArg<0>(&context_second))
.WillOnce(SaveArg<0>(&context_third));
@@ -1761,7 +1761,7 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtectBulk) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&new_context));
connection_handler_->OnSessionStartedCallback(uid_,
out_context_.new_session_id_,
@@ -1867,7 +1867,7 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByProtectedService) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&new_context));
// Open kAudio service
@@ -1904,7 +1904,7 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedRPC) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&new_context));
// Protect kRpc (Bulk will be protect also)
@@ -1944,7 +1944,7 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedBulk) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _))
+ EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
.WillOnce(SaveArg<0>(&new_context));
// Protect Bulk (kRpc will be protected also)
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
index b4c03fd760..6e0ad66199 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
@@ -58,8 +58,6 @@ using namespace boost::beast::websocket;
namespace hmi_message_handler {
-CREATE_LOGGERPTR_GLOBAL(mb_logger_, "HMIMessageHandler")
-
enum ErrorCode {
CONTROLLER_EXISTS = -32000,
SUBSCRIBTION_EXISTS = -32001,
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
index 08d1b55aaf..67a46aca56 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
@@ -83,8 +83,6 @@ typedef std::shared_ptr<std::string> Message;
namespace hmi_message_handler {
-CREATE_LOGGERPTR_GLOBAL(ws_logger_, "HMIMessageHandler")
-
class CMessageBrokerController;
class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
@@ -203,4 +201,4 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
} // namespace hmi_message_handler
-#endif /* WEBSOCKET_SESSION_H */ \ No newline at end of file
+#endif /* WEBSOCKET_SESSION_H */
diff --git a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
index 70865f7771..93ba433d3e 100644
--- a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
+++ b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
@@ -35,7 +35,7 @@
namespace hmi_message_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler")
+SDL_CREATE_LOG_VARIABLE("HMIMessageHandler")
HMIMessageHandlerImpl::HMIMessageHandlerImpl(
const HMIMessageHandlerSettings& settings)
@@ -51,47 +51,47 @@ HMIMessageHandlerImpl::HMIMessageHandlerImpl(
threads::ThreadOptions(get_settings().thread_min_stack_size())) {}
HMIMessageHandlerImpl::~HMIMessageHandlerImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
messages_to_hmi_.Shutdown();
messages_from_hmi_.Shutdown();
set_message_observer(NULL);
}
void HMIMessageHandlerImpl::OnMessageReceived(MessageSharedPointer message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(observer_locker_);
if (!observer_) {
- LOG4CXX_WARN(logger_, "No HMI message observer set!");
+ SDL_LOG_WARN("No HMI message observer set!");
return;
}
messages_from_hmi_.PostMessage(impl::MessageFromHmi(message));
}
void HMIMessageHandlerImpl::SendMessageToHMI(MessageSharedPointer message) {
- LOG4CXX_INFO(logger_, "SendMessageToHMI");
+ SDL_LOG_INFO("SendMessageToHMI");
messages_to_hmi_.PostMessage(impl::MessageToHmi(message));
}
void HMIMessageHandlerImpl::set_message_observer(HMIMessageObserver* observer) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(observer_locker_);
observer_ = observer;
}
void HMIMessageHandlerImpl::OnErrorSending(MessageSharedPointer message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(observer_locker_);
if (!observer_) {
- LOG4CXX_WARN(logger_, "No HMI message observer set!");
+ SDL_LOG_WARN("No HMI message observer set!");
return;
}
observer_->OnErrorSending(message);
}
void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!adapter) {
- LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!");
+ SDL_LOG_WARN("HMIMessageAdapter is not valid!");
return;
}
sync_primitives::AutoLock lock(message_adapters_locker_);
@@ -100,9 +100,9 @@ void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) {
void HMIMessageHandlerImpl::RemoveHMIMessageAdapter(
HMIMessageAdapter* adapter) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!adapter) {
- LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!");
+ SDL_LOG_WARN("HMIMessageAdapter is not valid!");
return;
}
sync_primitives::AutoLock lock(message_adapters_locker_);
@@ -114,15 +114,15 @@ const HMIMessageHandlerSettings& HMIMessageHandlerImpl::get_settings() const {
}
void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi message) {
- LOG4CXX_INFO(logger_, "Received message from hmi");
+ SDL_LOG_INFO("Received message from hmi");
sync_primitives::AutoLock lock(observer_locker_);
if (!observer_) {
- LOG4CXX_ERROR(logger_, "Observer is not set for HMIMessageHandler");
+ SDL_LOG_ERROR("Observer is not set for HMIMessageHandler");
return;
}
observer_->OnMessageReceived(message);
- LOG4CXX_INFO(logger_, "Message from hmi given away.");
+ SDL_LOG_INFO("Message from hmi given away.");
}
void HMIMessageHandlerImpl::Handle(const impl::MessageToHmi message) {
sync_primitives::AutoLock lock(message_adapters_locker_);
diff --git a/src/components/hmi_message_handler/src/mb_controller.cc b/src/components/hmi_message_handler/src/mb_controller.cc
index cfc05647da..681e57906a 100644
--- a/src/components/hmi_message_handler/src/mb_controller.cc
+++ b/src/components/hmi_message_handler/src/mb_controller.cc
@@ -33,6 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace boost::beast::websocket;
namespace hmi_message_handler {
+SDL_CREATE_LOG_VARIABLE("HMIMessageHandler")
+
CMessageBrokerController::CMessageBrokerController(const std::string& address,
uint16_t port,
std::string name,
@@ -59,26 +61,26 @@ bool CMessageBrokerController::StartListener() {
acceptor_.open(endpoint_.protocol(), error);
if (error) {
std::string str_err = "ErrorOpen: " + error.message();
- LOG4CXX_ERROR(mb_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
return false;
}
acceptor_.set_option(boost::asio::socket_base::reuse_address(true), error);
if (error) {
std::string str_err = "ErrorSetOption: " + error.message();
- LOG4CXX_ERROR(mb_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
return false;
}
acceptor_.bind(endpoint_, error);
if (error) {
std::string str_err = "ErrorBind: " + error.message();
- LOG4CXX_ERROR(mb_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
return false;
}
acceptor_.listen(boost::asio::socket_base::max_listen_connections, error);
if (error) {
std::string str_err = "ErrorListen: " + error.message();
- LOG4CXX_ERROR(mb_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
return false;
}
return true;
@@ -107,7 +109,7 @@ void CMessageBrokerController::WaitForConnection() {
void CMessageBrokerController::StartSession(boost::system::error_code ec) {
if (ec) {
- LOG4CXX_ERROR(mb_logger_, "ErrorMessage: " << ec.message());
+ SDL_LOG_ERROR("ErrorMessage: " << ec.message());
CloseConnection();
return;
}
@@ -143,7 +145,7 @@ void CMessageBrokerController::sendNotification(Json::Value& message) {
(*it)->sendJsonMessage(message);
}
} else {
- LOG4CXX_ERROR(mb_logger_, ("No subscribers for this property!\n"));
+ SDL_LOG_ERROR(("No subscribers for this property!\n"));
}
}
@@ -255,7 +257,7 @@ bool CMessageBrokerController::addController(WebsocketSession* ws_session,
std::map<std::string, WebsocketSession*>::value_type(name, ws_session));
result = true;
} else {
- LOG4CXX_ERROR(mb_logger_, ("Controller already exists!\n"));
+ SDL_LOG_ERROR(("Controller already exists!\n"));
}
return result;
}
@@ -325,7 +327,7 @@ bool CMessageBrokerController::addSubscriber(WebsocketSession* ws_session,
for (itr = p.first; itr != p.second; ++itr) {
if (ws_session == itr->second) {
result = false;
- LOG4CXX_ERROR(mb_logger_, ("Subscriber already exists!\n"));
+ SDL_LOG_ERROR(("Subscriber already exists!\n"));
}
}
}
@@ -489,17 +491,17 @@ void CMessageBrokerController::CloseConnection() {
acceptor_.cancel(ec);
if (ec) {
- LOG4CXX_ERROR(mb_logger_, "Acceptor cancel error: " << ec.message());
+ SDL_LOG_ERROR("Acceptor cancel error: " << ec.message());
}
acceptor_.close(ec);
if (ec) {
- LOG4CXX_ERROR(mb_logger_, "Acceptor close error: " << ec.message());
+ SDL_LOG_ERROR("Acceptor close error: " << ec.message());
}
socket_.close(ec);
if (ec) {
- LOG4CXX_ERROR(mb_logger_, "Socket close error : " << ec.message());
+ SDL_LOG_ERROR("Socket close error : " << ec.message());
}
ioc_.stop();
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index b5e2defd58..ca3d03dd91 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -38,7 +38,7 @@
namespace hmi_message_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler")
+SDL_CREATE_LOG_VARIABLE("HMIMessageHandler")
typedef hmi_message_handler::CMessageBrokerController MessageBrokerController;
@@ -47,17 +47,17 @@ MessageBrokerAdapter::MessageBrokerAdapter(HMIMessageHandler* handler_param,
uint16_t port)
: HMIMessageAdapterImpl(handler_param)
, MessageBrokerController(server_address, port, "SDL", 8) {
- LOG4CXX_TRACE(logger_, "Created MessageBrokerAdapter");
+ SDL_LOG_TRACE("Created MessageBrokerAdapter");
}
MessageBrokerAdapter::~MessageBrokerAdapter() {}
void MessageBrokerAdapter::SendMessageToHMI(
hmi_message_handler::MessageSharedPointer message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (message.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Can`t send not valid message");
+ SDL_LOG_ERROR("Can`t send not valid message");
return;
}
@@ -66,7 +66,7 @@ void MessageBrokerAdapter::SendMessageToHMI(
const std::string str = message->json_message();
if (!reader.parse(str, &json_value)) {
- LOG4CXX_ERROR(logger_, "Received invalid json string. ");
+ SDL_LOG_ERROR("Received invalid json string. ");
return;
}
@@ -75,22 +75,22 @@ void MessageBrokerAdapter::SendMessageToHMI(
void MessageBrokerAdapter::processResponse(std::string method,
Json::Value& root) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessRecievedFromMB(root);
}
void MessageBrokerAdapter::processRequest(Json::Value& root) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessRecievedFromMB(root);
}
void MessageBrokerAdapter::processNotification(Json::Value& root) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessRecievedFromMB(root);
}
void MessageBrokerAdapter::SubscribeTo() {
- LOG4CXX_INFO(logger_, "MessageBrokerAdapter::subscribeTo");
+ SDL_LOG_INFO("MessageBrokerAdapter::subscribeTo");
MessageBrokerController::subscribeTo("Buttons.OnButtonEvent");
MessageBrokerController::subscribeTo("Buttons.OnButtonPress");
MessageBrokerController::subscribeTo("UI.OnCommand");
@@ -143,8 +143,10 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("RC.OnRemoteControlSettings");
MessageBrokerController::subscribeTo(
"BasicCommunication.OnSystemCapabilityUpdated");
+ MessageBrokerController::subscribeTo("UI.OnUpdateFile");
+ MessageBrokerController::subscribeTo("UI.OnUpdateSubMenu");
- LOG4CXX_INFO(logger_, "Subscribed to notifications.");
+ SDL_LOG_INFO("Subscribed to notifications.");
}
void* MessageBrokerAdapter::SubscribeAndBeginReceiverThread(void* param) {
@@ -157,8 +159,8 @@ void* MessageBrokerAdapter::SubscribeAndBeginReceiverThread(void* param) {
}
void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "MB_Adapter: " << root);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_INFO("MB_Adapter: " << root);
if (root.isNull()) {
// LOG
return;
@@ -184,12 +186,12 @@ void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) {
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI);
if (!handler()) {
- LOG4CXX_WARN(logger_, "handler is NULL");
+ SDL_LOG_WARN("handler is NULL");
return;
}
handler()->OnMessageReceived(message);
- LOG4CXX_INFO(logger_, "Successfully sent to observer");
+ SDL_LOG_INFO("Successfully sent to observer");
}
} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/src/websocket_session.cc b/src/components/hmi_message_handler/src/websocket_session.cc
index 7ffb35aba6..f2cb265770 100644
--- a/src/components/hmi_message_handler/src/websocket_session.cc
+++ b/src/components/hmi_message_handler/src/websocket_session.cc
@@ -36,6 +36,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace boost::beast::websocket;
namespace hmi_message_handler {
+SDL_CREATE_LOG_VARIABLE("HMIMessageHandler")
+
WebsocketSession::WebsocketSession(boost::asio::ip::tcp::socket socket,
CMessageBrokerController* controller)
: ws_(std::move(socket))
@@ -49,7 +51,7 @@ WebsocketSession::WebsocketSession(boost::asio::ip::tcp::socket socket,
, thread_delegate_(new LoopThreadDelegate(&message_queue_, this))
, thread_(threads::CreateThread("WS Async Send", thread_delegate_)) {
m_writer["indentation"] = "";
- thread_->start(threads::ThreadOptions());
+ thread_->Start(threads::ThreadOptions());
}
WebsocketSession::~WebsocketSession() {}
@@ -64,7 +66,7 @@ void WebsocketSession::Accept() {
void WebsocketSession::Shutdown() {
shutdown_ = true;
thread_delegate_->SetShutdown();
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
delete thread_delegate_;
threads::DeleteThread(thread_);
}
@@ -80,7 +82,7 @@ void WebsocketSession::Recv(boost::system::error_code ec) {
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(ws_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
shutdown_ = true;
thread_delegate_->SetShutdown();
controller_->deleteController(this);
@@ -121,7 +123,7 @@ void WebsocketSession::Read(boost::system::error_code ec,
boost::ignore_unused(bytes_transferred);
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(ws_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
shutdown_ = true;
thread_delegate_->SetShutdown();
controller_->deleteController(this);
@@ -136,7 +138,7 @@ void WebsocketSession::Read(boost::system::error_code ec,
Json::Value root;
if (!reader.parse(data, &root)) {
- LOG4CXX_ERROR(ws_logger_, "Invalid JSON Message.");
+ SDL_LOG_ERROR("Invalid JSON Message.");
return;
}
@@ -179,8 +181,7 @@ void WebsocketSession::onMessageReceived(Json::Value message) {
if (message.isMember("result") && message["result"].isInt()) {
mControllersIdStart = message["result"].asInt();
} else {
- LOG4CXX_ERROR(ws_logger_,
- "Not possible to initialize mControllersIdStart!");
+ SDL_LOG_ERROR("Not possible to initialize mControllersIdStart!");
}
} else if ("MB.subscribeTo" == method ||
"MB.unregisterComponent" == method ||
@@ -190,8 +191,7 @@ void WebsocketSession::onMessageReceived(Json::Value message) {
controller_->processResponse(method, message);
}
} else {
- LOG4CXX_ERROR(ws_logger_,
- "Request with id: " + id + " has not been found!");
+ SDL_LOG_ERROR("Request with id: " + id + " has not been found!");
}
} else {
std::string method = message["method"].asString();
@@ -205,7 +205,7 @@ void WebsocketSession::onMessageReceived(Json::Value message) {
}
}
} else {
- LOG4CXX_ERROR(ws_logger_, "Message contains wrong data!\n");
+ SDL_LOG_ERROR("Message contains wrong data!\n");
sendJsonMessage(error);
}
}
@@ -314,8 +314,7 @@ void WebsocketSession::LoopThreadDelegate::DrainQueue() {
boost::system::error_code ec;
handler_.ws_.write(boost::asio::buffer(*message_ptr), ec);
if (ec) {
- LOG4CXX_ERROR(ws_logger_,
- "A system error has occurred: " << ec.message());
+ SDL_LOG_ERROR("A system error has occurred: " << ec.message());
}
}
}
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index 7245553a18..72dfb71a29 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -89,6 +89,7 @@ class Application;
class AppServiceManager;
class StateControllerImpl;
struct CommandParametersPermissions;
+struct ResetGlobalPropertiesResult;
using policy::RPCParams;
typedef std::vector<ApplicationSharedPtr> AppSharedPtrs;
struct ApplicationsSorter {
@@ -352,11 +353,11 @@ class ApplicationManager {
/**
* @brief Checks if Application is subscribed for way points
- * @param Application pointer
+ * @param Application reference
* @return true if Application is subscribed for way points
* otherwise false
*/
- virtual bool IsAppSubscribedForWayPoints(ApplicationSharedPtr app) const = 0;
+ virtual bool IsAppSubscribedForWayPoints(Application& app) const = 0;
/**
* @brief Subscribe Application for way points
@@ -585,6 +586,26 @@ class ApplicationManager {
virtual void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) = 0;
+ /**
+ * @brief Resets application's global properties to default values
+ * @param global_properties_ids container with global properties IDs to reset
+ * @param app_id ID of app which properties to reset
+ * @return struct with flags indicating success global properties reset
+ */
+ virtual ResetGlobalPropertiesResult ResetGlobalProperties(
+ const smart_objects::SmartObject& global_properties_ids,
+ const uint32_t app_id) = 0;
+
+ /**
+ * @brief Resets all application's global properties to default values
+ * returning struct that indicates which properties have been
+ * successfully reset.
+ * @param app_id ID of app which properties to reset
+ * @return struct with flags indicating global properties reset
+ */
+ virtual ResetGlobalPropertiesResult ResetAllApplicationGlobalProperties(
+ const uint32_t app_id) = 0;
+
virtual mobile_apis::Result::eType SaveBinary(
const std::vector<uint8_t>& binary_data,
const std::string& file_path,
diff --git a/src/components/include/application_manager/state_controller.h b/src/components/include/application_manager/state_controller.h
index 2fa4b0c218..422b34e0a0 100644
--- a/src/components/include/application_manager/state_controller.h
+++ b/src/components/include/application_manager/state_controller.h
@@ -223,6 +223,29 @@ class StateController {
* @param app pointer to application to be exited
*/
virtual void ExitDefaultWindow(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief Sets BACKGROUND or LIMITED hmi level to application
+ * depends on application type
+ * @param window_id ID of app window to deactivate
+ * @param app Application to deactivate
+ */
+ virtual void DeactivateApp(ApplicationSharedPtr app,
+ const WindowID window_id) = 0;
+
+ /**
+ * @brief ResumePostponedWindows resumes adding of all postponed windows for a
+ * specified application, if exists
+ * @param app_id id of application to check
+ */
+ virtual void ResumePostponedWindows(const uint32_t app_id) = 0;
+
+ /**
+ * @brief DropPostponedWindows drops all postponed windows for a specified
+ * application, if exists
+ * @param app_id id of application to check
+ */
+ virtual void DropPostponedWindows(const uint32_t app_id) = 0;
};
} // namespace application_manager
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h
index e98a78f377..de78024e61 100644
--- a/src/components/include/connection_handler/connection_handler.h
+++ b/src/components/include/connection_handler/connection_handler.h
@@ -205,6 +205,15 @@ class ConnectionHandler {
uint8_t protocol_version) = 0;
/**
+ * @brief binds protocol version with session
+ * @param connection_key pair of connection and session id
+ * @param full_protocol_version contains full protocol version of registered
+ * application.
+ */
+ virtual void BindProtocolVersionWithSession(
+ uint32_t connection_key,
+ const utils::SemanticVersion& full_protocol_version) = 0;
+ /**
* \brief information about given Connection Key.
* \param key Unique key used by other components as session identifier
* \param app_id Returned: ApplicationID
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 3086a7dfb8..9d4ad5ea57 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -881,7 +881,8 @@ class PolicyManager : public usage_statistics::StatisticsManager,
} // namespace policy
-extern "C" policy::PolicyManager* CreateManager();
+extern "C" policy::PolicyManager* CreateManager(
+ logger::Logger* logger_instance);
extern "C" void DeleteManager(policy::PolicyManager*);
#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index 4db05ccb38..c90006928a 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -842,7 +842,8 @@ class PolicyManager : public usage_statistics::StatisticsManager,
} // namespace policy
-extern "C" policy::PolicyManager* CreateManager();
+extern "C" policy::PolicyManager* CreateManager(
+ logger::Logger* logger_instance);
extern "C" void DeleteManager(policy::PolicyManager*);
#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_
diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h
index aacb31c260..bb596631a0 100644
--- a/src/components/include/protocol_handler/protocol_handler.h
+++ b/src/components/include/protocol_handler/protocol_handler.h
@@ -137,7 +137,8 @@ class ProtocolHandler {
*/
virtual void NotifySessionStarted(
const SessionContext& context,
- std::vector<std::string>& rejected_params) = 0;
+ std::vector<std::string>& rejected_params,
+ const std::string err_reason = std::string()) = 0;
virtual bool IsRPCServiceSecure(const uint32_t connection_key) const = 0;
diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h
index e71557fecf..cdf4267188 100644
--- a/src/components/include/protocol_handler/session_observer.h
+++ b/src/components/include/protocol_handler/session_observer.h
@@ -37,6 +37,8 @@
#include <string>
#include "transport_manager/transport_manager.h"
#include "utils/macro.h"
+#include "utils/semantic_version.h"
+
#ifdef ENABLE_SECURITY
#include "security_manager/ssl_context.h"
#endif // ENABLE_SECURITY
@@ -150,13 +152,17 @@ class SessionObserver {
* protocol. (Set to HASH_ID_WRONG if the hash is incorrect)
* If not equal to hash assigned to session on start then operation fails.
* \param service_type Type of service
- * \return uint32_t 0 if operation fails, session key otherwise
+ * \param err_reason where to write reason for the End Session failure if the
+ * operation fails
+ * \return uint32_t 0 if operation fails, session key
+ * otherwise
*/
virtual uint32_t OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
uint32_t* hashCode,
- const protocol_handler::ServiceType& service_type) = 0;
+ const protocol_handler::ServiceType& service_type,
+ std::string* err_reason = nullptr) = 0;
/**
* \brief Callback function used by ProtocolHandler
@@ -267,6 +273,18 @@ class SessionObserver {
uint8_t& protocol_version) const = 0;
/**
+ * @brief returns protocol version which application supports
+ * @param connection_id id of connection
+ * @param session_id id of session
+ * @param full_protocol_version where to write the full protocol version
+ * output
+ * @return TRUE if session and connection exist otherwise returns FALSE
+ */
+ virtual bool ProtocolVersionUsed(
+ uint32_t connection_id,
+ uint8_t session_id,
+ utils::SemanticVersion& full_protocol_version) const = 0;
+ /**
* @brief Check if session contains service with specified service type
* @param connection_key unique id of session to check
* @param service_type type of service to check
diff --git a/src/components/include/test/application_manager/mock_app_extension.h b/src/components/include/test/application_manager/mock_app_extension.h
index 10a911e799..97c0140748 100644
--- a/src/components/include/test/application_manager/mock_app_extension.h
+++ b/src/components/include/test/application_manager/mock_app_extension.h
@@ -53,6 +53,9 @@ class MockAppExtension : public application_manager::AppExtension {
MOCK_METHOD1(ProcessResumption,
void(const ns_smart_device_link::ns_smart_objects::SmartObject&
resumption_data));
+ MOCK_METHOD1(RevertResumption,
+ void(const ns_smart_device_link::ns_smart_objects::SmartObject&
+ subscriptions));
};
} // namespace application_manager_test
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index ca72c18229..862c862a20 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -155,9 +155,6 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(const protocol_handler::ServiceType service_type,
const uint32_t app_id,
const bool streaming_data_available));
- MOCK_METHOD1(
- SendHMIStatusNotification,
- void(const std::shared_ptr<application_manager::Application> app));
MOCK_METHOD1(SendDriverDistractionState,
void(application_manager::ApplicationSharedPtr app));
MOCK_METHOD2(SendGetIconUrlNotifications,
@@ -232,6 +229,13 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(IsStopping, bool());
MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList,
void(const uint32_t app_id));
+ MOCK_METHOD2(ResetGlobalProperties,
+ application_manager::ResetGlobalPropertiesResult(
+ const smart_objects::SmartObject& global_properties_ids,
+ const uint32_t app_id));
+ MOCK_METHOD1(
+ ResetAllApplicationGlobalProperties,
+ application_manager::ResetGlobalPropertiesResult(const uint32_t app_id));
MOCK_METHOD4(
SaveBinary,
mobile_apis::Result::eType(const std::vector<uint8_t>& binary_data,
@@ -342,7 +346,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
const smart_objects::SmartObject& display_capabilities));
MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints, bool(uint32_t));
MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints,
- bool(application_manager::ApplicationSharedPtr));
+ bool(application_manager::Application& app));
MOCK_METHOD1(SubscribeAppForWayPoints, void(uint32_t));
MOCK_METHOD1(SubscribeAppForWayPoints,
void(application_manager::ApplicationSharedPtr));
diff --git a/src/components/include/test/application_manager/mock_state_controller.h b/src/components/include/test/application_manager/mock_state_controller.h
index 545090bf30..a06336467e 100644
--- a/src/components/include/test/application_manager/mock_state_controller.h
+++ b/src/components/include/test/application_manager/mock_state_controller.h
@@ -108,6 +108,11 @@ class MockStateController : public am::StateController {
MOCK_CONST_METHOD1(IsStateActive, bool(am::HmiState::StateID state_id));
MOCK_METHOD1(ActivateDefaultWindow, void(am::ApplicationSharedPtr app));
MOCK_METHOD1(ExitDefaultWindow, void(am::ApplicationSharedPtr app));
+ MOCK_METHOD1(ResumePostponedWindows, void(const uint32_t app_id));
+ MOCK_METHOD1(DropPostponedWindows, void(const uint32_t app_id));
+ MOCK_METHOD2(DeactivateApp,
+ void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id));
};
} // namespace application_manager_test
diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h
index 6acffea0ed..d44dd94ddd 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -96,6 +96,9 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
void(uint32_t connection_key, uint8_t session_id));
MOCK_METHOD2(BindProtocolVersionWithSession,
void(uint32_t connection_key, uint8_t protocol_version));
+ MOCK_METHOD2(BindProtocolVersionWithSession,
+ void(uint32_t connection_key,
+ const utils::SemanticVersion& full_protocol_version));
MOCK_CONST_METHOD4(GetDataOnSessionKey,
int32_t(uint32_t key,
uint32_t* app_id,
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h
index 354c797c24..e3a52157ec 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h
@@ -67,6 +67,10 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
MOCK_METHOD2(NotifySessionStarted,
void(const ::protocol_handler::SessionContext& context,
std::vector<std::string>& rejected_params));
+ MOCK_METHOD3(NotifySessionStarted,
+ void(const ::protocol_handler::SessionContext& context,
+ std::vector<std::string>& rejected_params,
+ const std::string err_reason));
MOCK_METHOD0(NotifyOnGetSystemTimeFailed, void());
MOCK_CONST_METHOD1(IsRPCServiceSecure, bool(const uint32_t connection_key));
MOCK_METHOD0(ProcessFailedPTU, void());
diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h
index 01bb41a96e..3414153fc7 100644
--- a/src/components/include/test/protocol_handler/mock_session_observer.h
+++ b/src/components/include/test/protocol_handler/mock_session_observer.h
@@ -65,6 +65,20 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
const uint8_t sessionId,
uint32_t* hashCode,
const protocol_handler::ServiceType& service_type));
+ MOCK_METHOD5(
+ OnSessionEndedCallback,
+ uint32_t(const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ const uint32_t& hashCode,
+ const protocol_handler::ServiceType& service_type,
+ std::string* err_reason));
+ MOCK_METHOD5(
+ OnSessionEndedCallback,
+ uint32_t(const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ uint32_t* hashCode,
+ const protocol_handler::ServiceType& service_type,
+ std::string* err_reason));
MOCK_METHOD1(OnApplicationFloodCallBack,
void(const uint32_t& connection_key));
MOCK_METHOD1(OnMalformedMessageCallback,
@@ -103,6 +117,10 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
bool(uint32_t connection_id,
uint8_t session_id,
uint8_t& protocol_version));
+ MOCK_CONST_METHOD3(ProtocolVersionUsed,
+ bool(uint32_t connection_id,
+ uint8_t session_id,
+ utils::SemanticVersion& full_protocol_version));
MOCK_CONST_METHOD2(SessionServiceExists,
bool(const uint32_t connection_key,
const protocol_handler::ServiceType& service_type));
diff --git a/src/components/include/utils/auto_trace.h b/src/components/include/utils/auto_trace.h
index 36ff3be281..d975d1ae42 100644
--- a/src/components/include/utils/auto_trace.h
+++ b/src/components/include/utils/auto_trace.h
@@ -33,20 +33,19 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_AUTO_TRACE_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_AUTO_TRACE_H_
-#include <log4cxx/logger.h>
#include <string>
+#include "utils/ilogger.h"
namespace logger {
class AutoTrace {
public:
- AutoTrace(log4cxx::LoggerPtr logger,
- const log4cxx::spi::LocationInfo& location);
+ AutoTrace(const std::string& component, const LocationInfo& location);
~AutoTrace();
private:
- log4cxx::LoggerPtr logger_;
- log4cxx::spi::LocationInfo location_;
+ std::string component_;
+ LocationInfo location_;
};
} // namespace logger
diff --git a/src/components/include/utils/push_log.h b/src/components/include/utils/ilogger.h
index f6c396ae71..ba2f93df9b 100644
--- a/src/components/include/utils/push_log.h
+++ b/src/components/include/utils/ilogger.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,28 +30,61 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_
-#define SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_
+#pragma once
-#include <log4cxx/logger.h>
+#include <chrono>
#include <string>
+#include <thread>
namespace logger {
-bool push_log(log4cxx::LoggerPtr logger,
- log4cxx::LevelPtr level,
- const std::string& entry,
- log4cxx_time_t timeStamp,
- const log4cxx::spi::LocationInfo& location,
- const log4cxx::LogString& threadName);
+enum class LogLevel {
+ TRACE_LEVEL,
+ DEBUG_LEVEL,
+ INFO_LEVEL,
+ WARNING_LEVEL,
+ ERROR_LEVEL,
+ FATAL_LEVEL
+};
-void flush_logger();
+struct LocationInfo {
+ std::string file_name;
+ std::string function_name;
+ int line_number;
+};
-bool logs_enabled();
-void set_logs_enabled(bool state);
+typedef std::chrono::high_resolution_clock::time_point TimePoint;
-void create_log_message_loop_thread();
-void delete_log_message_loop_thread(log4cxx::LoggerPtr& logger);
-} // namespace logger
+struct LogMessage {
+ std::string component_; // <- component_name
+ LogLevel log_level_;
+ std::string log_event_;
+ TimePoint timestamp_;
+ LocationInfo location_;
+ std::thread::id thread_id_;
+};
+
+class Logger {
+ public:
+ virtual bool IsEnabledFor(const std::string& component,
+ LogLevel log_level) const = 0;
+ virtual void DeInit() = 0;
+ virtual void Flush() = 0;
+ virtual void PushLog(const LogMessage& log_message) = 0;
+ static Logger& instance(Logger* pre_init = nullptr);
+};
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_
+class ThirdPartyLoggerInterface {
+ public:
+ virtual void Init() = 0;
+ virtual void DeInit() = 0;
+ virtual bool IsEnabledFor(const std::string& component,
+ LogLevel log_level) const = 0;
+ virtual void PushLog(const LogMessage& log_message) = 0;
+};
+
+class LoggerInitializer {
+ public:
+ virtual void Init(std::unique_ptr<ThirdPartyLoggerInterface>&& impl) = 0;
+};
+} // namespace logger
diff --git a/src/components/include/utils/logger.h b/src/components/include/utils/logger.h
index d492cfcb1b..6ceff88738 100644
--- a/src/components/include/utils/logger.h
+++ b/src/components/include/utils/logger.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,151 +33,103 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_
-#ifdef ENABLE_LOG
-#include <errno.h>
-#include <log4cxx/propertyconfigurator.h>
-#include <log4cxx/spi/loggingevent.h>
-#include <string.h>
-#include <sstream>
-#include "utils/auto_trace.h"
-#include "utils/logger_status.h"
-#include "utils/push_log.h"
-#endif // ENABLE_LOG
+#include "utils/ilogger.h"
#ifdef ENABLE_LOG
+#include <sstream>
+#include <string>
-#define CREATE_LOGGERPTR_GLOBAL(logger_var, logger_name) \
- namespace { \
- CREATE_LOGGERPTR_LOCAL(logger_var, logger_name); \
+#include "utils/auto_trace.h"
+#define SDL_CREATE_LOG_VARIABLE(component_name) \
+ namespace { \
+ static std::string logger_(component_name); \
}
-#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name) \
- log4cxx::LoggerPtr logger_var = \
- log4cxx::LoggerPtr(log4cxx::Logger::getLogger(logger_name));
+#define SDL_CREATE_LOCAL_LOG_VARIABLE(component_name) \
+ std::string logger_(component_name);
-#define INIT_LOGGER(file_name, logs_enabled) \
- log4cxx::PropertyConfigurator::configure(file_name); \
- logger::set_logs_enabled(logs_enabled);
+// special macros to dump logs from queue
+// it's needed, for example, when crash happened
+#define SDL_FLUSH_LOGGER() logger::Logger::instance().Flush();
// Logger deinitilization function and macro, need to stop log4cxx writing
// without this deinitilization log4cxx threads continue using some instances
// destroyed by exit()
-void deinit_logger();
-#define DEINIT_LOGGER() deinit_logger()
-
-// Logger thread deinitilization macro that need to stop the thread of handling
-// messages for the log4cxx
-#define DELETE_THREAD_LOGGER(logger_var) \
- logger::delete_log_message_loop_thread(logger_var)
-
-// special macros to dump logs from queue
-// it's need, for example, when crash happend
-#define FLUSH_LOGGER() logger::flush_logger()
-
-#define LOG4CXX_IS_TRACE_ENABLED(logger) logger->isTraceEnabled()
-
-log4cxx_time_t time_now();
-
-#define LOG_WITH_LEVEL(loggerPtr, logLevel, logEvent) \
- do { \
- if (logger::logs_enabled()) { \
- if (logger::logger_status != logger::DeletingLoggerThread) { \
- if (loggerPtr->isEnabledFor(logLevel)) { \
- std::stringstream accumulator; \
- accumulator << logEvent; \
- logger::push_log( \
- loggerPtr, \
- logLevel, \
- accumulator.str(), \
- time_now(), \
- LOG4CXX_LOCATION, \
- ::log4cxx::spi::LoggingEvent::getCurrentThreadName()); \
- } \
- } \
- } \
+#define SDL_DEINIT_LOGGER() logger::Logger::instance().DeInit();
+
+#define LOG_WITH_LEVEL(logLevel, logEvent) \
+ do { \
+ if (logger::Logger::instance().IsEnabledFor(logger_, logLevel)) { \
+ std::stringstream accumulator; \
+ accumulator << logEvent; \
+ logger::LogMessage message{ \
+ logger_, \
+ logLevel, \
+ accumulator.str(), \
+ std::chrono::high_resolution_clock::now(), \
+ logger::LocationInfo{__FILE__, __PRETTY_FUNCTION__, __LINE__}, \
+ std::this_thread::get_id()}; \
+ logger::Logger::instance().PushLog(message); \
+ } \
} while (false)
-#undef LOG4CXX_TRACE
-#define LOG4CXX_TRACE(loggerPtr, logEvent) \
- LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getTrace(), logEvent)
+#define SDL_LOG_TRACE(logEvent) \
+ LOG_WITH_LEVEL(logger::LogLevel::TRACE_LEVEL, logEvent)
-#define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace) \
- logger::AutoTrace auto_trace(loggerPtr, LOG4CXX_LOCATION)
-#define LOG4CXX_AUTO_TRACE(loggerPtr) \
- LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, SDL_local_auto_trace_object)
+#define SDL_LOG_AUTO_TRACE() \
+ logger::AutoTrace auto_trace( \
+ logger_, logger::LocationInfo{__FILE__, __PRETTY_FUNCTION__, __LINE__})
-#undef LOG4CXX_DEBUG
-#define LOG4CXX_DEBUG(loggerPtr, logEvent) \
- LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getDebug(), logEvent)
+#define SDL_LOG_DEBUG(logEvent) \
+ LOG_WITH_LEVEL(logger::LogLevel::DEBUG_LEVEL, logEvent)
-#undef LOG4CXX_INFO
-#define LOG4CXX_INFO(loggerPtr, logEvent) \
- LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getInfo(), logEvent)
+#define SDL_LOG_INFO(logEvent) \
+ LOG_WITH_LEVEL(logger::LogLevel::INFO_LEVEL, logEvent)
-#undef LOG4CXX_WARN
-#define LOG4CXX_WARN(loggerPtr, logEvent) \
- LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getWarn(), logEvent)
+#define SDL_LOG_WARN(logEvent) \
+ LOG_WITH_LEVEL(logger::LogLevel::WARNING_LEVEL, logEvent)
-#undef LOG4CXX_ERROR
-#define LOG4CXX_ERROR(loggerPtr, logEvent) \
- LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getError(), logEvent)
+#define SDL_LOG_ERROR(logEvent) \
+ LOG_WITH_LEVEL(logger::LogLevel::ERROR_LEVEL, logEvent)
-#undef LOG4CXX_FATAL
-#define LOG4CXX_FATAL(loggerPtr, logEvent) \
- LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getFatal(), logEvent)
+#define SDL_LOG_FATAL(logEvent) \
+ LOG_WITH_LEVEL(logger::LogLevel::FATAL_LEVEL, logEvent)
-#define LOG4CXX_ERROR_WITH_ERRNO(loggerPtr, message) \
- LOG4CXX_ERROR( \
- loggerPtr, \
- message << ", error code " << errno << " (" << strerror(errno) << ")")
+#define SDL_LOG_ERROR_WITH_ERRNO(message) \
+ SDL_LOG_ERROR(message << ", error code " << errno << " (" << strerror(errno) \
+ << ")")
-#define LOG4CXX_WARN_WITH_ERRNO(loggerPtr, message) \
- LOG4CXX_WARN( \
- loggerPtr, \
- message << ", error code " << errno << " (" << strerror(errno) << ")")
+#define SDL_LOG_WARN_WITH_ERRNO(message) \
+ SDL_LOG_WARN(message << ", error code " << errno << " (" << strerror(errno) \
+ << ")")
#else // ENABLE_LOG is OFF
+#define SDL_CREATE_LOG_VARIABLE(x)
-#define CREATE_LOGGERPTR_GLOBAL(logger_var, logger_name)
-
-#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name)
-
-#define INIT_LOGGER(file_name, logs_enabled)
-
-#define DEINIT_LOGGER()
+#define SDL_CREATE_LOCAL_LOG_VARIABLE(x)
-#define DELETE_THREAD_LOGGER(logger_var)
+#define SDL_DEINIT_LOGGER()
-#define FLUSH_LOGGER()
+#define SDL_FLUSH_LOGGER()
-#define LOG4CXX_IS_TRACE_ENABLED(logger) false
+#define SDL_LOG_TRACE(x)
-#undef LOG4CXX_TRACE
-#define LOG4CXX_TRACE(x, y)
+#define SDL_LOG_AUTO_TRACE()
-#define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace)
-#define LOG4CXX_AUTO_TRACE(loggerPtr)
+#define SDL_LOG_DEBUG(x)
-#undef LOG4CXX_DEBUG
-#define LOG4CXX_DEBUG(x, y)
+#define SDL_LOG_INFO(x)
-#undef LOG4CXX_INFO
-#define LOG4CXX_INFO(x, y)
+#define SDL_LOG_WARN(x)
-#undef LOG4CXX_WARN
-#define LOG4CXX_WARN(x, y)
+#define SDL_LOG_ERROR(x)
-#undef LOG4CXX_ERROR
-#define LOG4CXX_ERROR(x, y)
+#define SDL_LOG_ERROR_WITH_ERRNO(x)
-#undef LOG4CXX_ERROR_WITH_ERRNO
-#define LOG4CXX_ERROR_WITH_ERRNO(x, y)
+#define SDL_LOG_WARN_WITH_ERRNO(x)
-#undef LOG4CXX_WARN_WITH_ERRNO
-#define LOG4CXX_WARN_WITH_ERRNO(x, y)
+#define SDL_LOG_FATAL(x)
-#undef LOG4CXX_FATAL
-#define LOG4CXX_FATAL(x, y)
#endif // ENABLE_LOG
#endif // SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_
diff --git a/src/components/include/utils/logger_status.h b/src/components/include/utils/logger_status.h
deleted file mode 100644
index 17fa0562c2..0000000000
--- a/src/components/include/utils/logger_status.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_STATUS_H_
-#define SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_STATUS_H_
-
-namespace logger {
-
-typedef enum {
- LoggerThreadNotCreated,
- CreatingLoggerThread,
- LoggerThreadCreated,
- DeletingLoggerThread
-} LoggerStatus;
-
-// this variable is only changed when creating and deleting logger thread
-// its reads and writes are believed to be atomic
-// thus it shall be considered thread safe
-extern volatile LoggerStatus logger_status;
-
-} // namespace logger
-
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_STATUS_H_
diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h
index 00298f690e..7c39bbd356 100644
--- a/src/components/include/utils/macro.h
+++ b/src/components/include/utils/macro.h
@@ -60,9 +60,9 @@
#ifdef DEBUG
#define ASSERT(condition) \
- FLUSH_LOGGER(); \
+ SDL_FLUSH_LOGGER(); \
do { \
- DEINIT_LOGGER(); \
+ SDL_DEINIT_LOGGER(); \
assert(condition); \
} while (false)
#else // RELEASE
@@ -76,9 +76,8 @@
#define DCHECK(condition) \
if (!(condition)) { \
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \
- LOG4CXX_FATAL(logger_, \
- "DCHECK failed with \"" << #condition << "\" [" \
+ SDL_CREATE_LOCAL_LOG_VARIABLE("Utils"); \
+ SDL_LOG_FATAL("DCHECK failed with \"" << #condition << "\" [" \
<< __FUNCTION__ << "][" << __FILE__ \
<< ':' << __LINE__ << ']'); \
ASSERT((condition)); \
@@ -90,9 +89,8 @@
*/
#define DCHECK_OR_RETURN(condition, return_value) \
if (!(condition)) { \
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \
- LOG4CXX_FATAL(logger_, \
- "DCHECK failed with \"" << #condition << "\" [" \
+ SDL_CREATE_LOCAL_LOG_VARIABLE("Utils"); \
+ SDL_LOG_FATAL("DCHECK failed with \"" << #condition << "\" [" \
<< __FUNCTION__ << "][" << __FILE__ \
<< ':' << __LINE__ << ']'); \
ASSERT((condition)); \
@@ -104,9 +102,8 @@
*/
#define DCHECK_OR_RETURN_VOID(condition) \
if (!(condition)) { \
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \
- LOG4CXX_FATAL(logger_, \
- "DCHECK failed with \"" << #condition << "\" [" \
+ SDL_CREATE_LOCAL_LOG_VARIABLE("Utils"); \
+ SDL_LOG_FATAL("DCHECK failed with \"" << #condition << "\" [" \
<< __FUNCTION__ << "][" << __FILE__ \
<< ':' << __LINE__ << ']'); \
ASSERT((condition)); \
diff --git a/src/components/include/utils/message_queue.h b/src/components/include/utils/message_queue.h
index 8dfe7afa52..fd7b762a48 100644
--- a/src/components/include/utils/message_queue.h
+++ b/src/components/include/utils/message_queue.h
@@ -171,13 +171,11 @@ bool MessageQueue<T, Q>::IsShuttingDown() const {
template <typename T, class Q>
void MessageQueue<T, Q>::push(const T& element) {
- {
- sync_primitives::AutoLock auto_lock(queue_lock_);
- if (shutting_down_) {
- return;
- }
- queue_.push(element);
+ sync_primitives::AutoLock auto_lock(queue_lock_);
+ if (shutting_down_) {
+ return;
}
+ queue_.push(element);
queue_new_items_.Broadcast();
}
diff --git a/src/components/include/utils/messagemeter.h b/src/components/include/utils/messagemeter.h
index fb70839640..a5ede6057f 100644
--- a/src/components/include/utils/messagemeter.h
+++ b/src/components/include/utils/messagemeter.h
@@ -41,7 +41,7 @@
namespace utils {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MessageMeter")
+SDL_CREATE_LOG_VARIABLE("MessageMeter")
/**
@brief The MessageMeter class need to count message frequency
Default time range value is 1 second
@@ -105,13 +105,13 @@ MessageMeter<Id>::MessageMeter() {
template <class Id>
size_t MessageMeter<Id>::TrackMessage(const Id& id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return TrackMessages(id, 1);
}
template <class Id>
size_t MessageMeter<Id>::TrackMessages(const Id& id, const size_t count) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(timing_map_lock_);
Timings& timings = timing_map_[id];
const date_time::TimeDuration current_time = date_time::getCurrentTime();
@@ -124,14 +124,14 @@ size_t MessageMeter<Id>::TrackMessages(const Id& id, const size_t count) {
template <class Id>
size_t MessageMeter<Id>::Frequency(const Id& id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(timing_map_lock_);
return FrequencyImpl(id);
}
template <class Id>
size_t MessageMeter<Id>::FrequencyImpl(const Id& id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
typename TimingMap::iterator it = timing_map_.find(id);
if (it == timing_map_.end()) {
return 0u;
@@ -148,27 +148,27 @@ size_t MessageMeter<Id>::FrequencyImpl(const Id& id) {
template <class Id>
void MessageMeter<Id>::RemoveIdentifier(const Id& id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(timing_map_lock_);
timing_map_.erase(id);
}
template <class Id>
void MessageMeter<Id>::ClearIdentifiers() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(timing_map_lock_);
timing_map_.clear();
}
template <class Id>
void MessageMeter<Id>::set_time_range(const size_t time_range_msecs) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
time_range_ = date_time::milliseconds(time_range_msecs);
}
template <class Id>
void MessageMeter<Id>::set_time_range(
const date_time::TimeDuration& time_range) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
time_range_ = time_range;
}
template <class Id>
diff --git a/src/components/include/utils/rwlock.h b/src/components/include/utils/rwlock.h
index 5c7735713e..d98a2c7db7 100644
--- a/src/components/include/utils/rwlock.h
+++ b/src/components/include/utils/rwlock.h
@@ -176,6 +176,40 @@ class AutoWriteLock {
DISALLOW_COPY_AND_ASSIGN(AutoWriteLock);
};
+/**
+ * @brief Unlocks read-write lock which locked on read
+ */
+class AutoReadUnlock {
+ public:
+ explicit AutoReadUnlock(RWLock& rwlock) : rwlock_(rwlock) {
+ rwlock_.Release();
+ }
+ ~AutoReadUnlock() {
+ rwlock_.AcquireForReading();
+ }
+
+ private:
+ RWLock& rwlock_;
+ DISALLOW_COPY_AND_ASSIGN(AutoReadUnlock);
+};
+
+/**
+ * @brief Unlocks read-write lock which locked on write
+ */
+class AutoWriteUnlock {
+ public:
+ explicit AutoWriteUnlock(RWLock& rwlock) : rwlock_(rwlock) {
+ rwlock_.Release();
+ }
+ ~AutoWriteUnlock() {
+ rwlock_.AcquireForWriting();
+ }
+
+ private:
+ RWLock& rwlock_;
+ DISALLOW_COPY_AND_ASSIGN(AutoWriteUnlock);
+};
+
} // namespace sync_primitives
#endif // SRC_COMPONENTS_INCLUDE_UTILS_RWLOCK_H_
diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h
index 26ae127b69..6dea86696b 100644
--- a/src/components/include/utils/threads/message_loop_thread.h
+++ b/src/components/include/utils/threads/message_loop_thread.h
@@ -132,16 +132,17 @@ size_t MessageLoopThread<Q>::GetMessageQueueSize() const {
return message_queue_.size();
}
+SDL_CREATE_LOG_VARIABLE("Utils")
+
template <class Q>
MessageLoopThread<Q>::MessageLoopThread(const std::string& name,
Handler* handler,
const ThreadOptions& thread_opts)
: thread_delegate_(new LoopThreadDelegate(&message_queue_, handler))
, thread_(threads::CreateThread(name.c_str(), thread_delegate_)) {
- const bool started = thread_->start(thread_opts);
+ const bool started = thread_->Start(thread_opts);
if (!started) {
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
- LOG4CXX_ERROR(logger_, "Failed to start thread " << name);
+ SDL_LOG_ERROR("Failed to start thread " << name);
}
}
@@ -159,7 +160,7 @@ void MessageLoopThread<Q>::PostMessage(const Message& message) {
template <class Q>
void MessageLoopThread<Q>::Shutdown() {
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadStopDelegate);
}
template <class Q>
@@ -178,8 +179,7 @@ MessageLoopThread<Q>::LoopThreadDelegate::LoopThreadDelegate(
template <class Q>
void MessageLoopThread<Q>::LoopThreadDelegate::threadMain() {
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
while (!message_queue_.IsShuttingDown()) {
DrainQue();
message_queue_.wait();
diff --git a/src/components/include/utils/threads/thread.h b/src/components/include/utils/threads/thread.h
index 6f72679d63..73a43c48b1 100644
--- a/src/components/include/utils/threads/thread.h
+++ b/src/components/include/utils/threads/thread.h
@@ -76,36 +76,73 @@ typedef pthread_t PlatformThreadHandle;
* printf("ok!\n");
*/
-class Thread;
-void enqueue_to_join(Thread* thread);
-
Thread* CreateThread(const char* name, ThreadDelegate* delegate);
void DeleteThread(Thread* thread);
class Thread {
- private:
- const std::string name_;
- // Should be locked to protect delegate_ value
- sync_primitives::Lock delegate_lock_;
- ThreadDelegate* delegate_;
- PlatformThreadHandle handle_;
- ThreadOptions thread_options_;
- // Should be locked to protect isThreadRunning_ and thread_created_ values
- sync_primitives::Lock state_lock_;
- volatile unsigned int isThreadRunning_;
- volatile bool stopped_;
- volatile bool finalized_;
- bool thread_created_;
- // Signalled when Thread::start() is called
- sync_primitives::ConditionalVariable run_cond_;
-
public:
- static int count;
+ /**
+ * @brief ThreadCommand is used to command the thread
+ * kThreadCommandNone - no command, used to indicate that there is no pending
+ * command
+ * kThreadCommandRun - commands thread to run (do another iteration)
+ * kThreadCommandFinalize - informs thread that must exit
+ */
+ enum ThreadCommand {
+ kThreadCommandNone, // must be first
+ kThreadCommandRun,
+ kThreadCommandFinalize // keep last
+ // in case of new commands - update/check threadFunc()
+ };
+
+ /**
+ * @brief ThreadState informs outside world about its state
+ * kThreadStateError - if pthread_create returned an error
+ * kThreadStateNone - there is no thread at all
+ * kThreadStateIdle - the thread is in state idle
+ * kThreadStateRunning - thread is in state running (executing delegates
+ * threadMain())
+ * kThreadStateCompleted - thread completed
+ */
+ enum ThreadState {
+ kThreadStateError = -1,
+ kThreadStateNone,
+ kThreadStateIdle,
+ kThreadStateRunning,
+ kThreadStateCompleted
+ };
+
+ /**
+ * @brief ThreadStopOption
+ * kThreadStopDelegate - executing delegates exitThreadMain and
+ * move thread to kThreadStateIdle
+ * kThreadSoftStop - executing kThreadStopDelegate and
+ * move thread to kThreadStateCompleted
+ * kThreadForceStop - executing kThreadSoftStop,
+ * if necessary pthread_cancel or pthread_exit and
+ * move thread to kThreadStateCompleted
+ */
+ enum ThreadStopOption {
+ kThreadStopDelegate,
+ kThreadSoftStop,
+ kThreadForceStop
+ };
+
+ /**
+ * @brief ThreadJoinOption
+ * kThreadJoinDelegate - waiting for finish threadMain
+ * kThreadJoinThread - waiting for finish threadFunc
+ */
+ enum ThreadJoinOption { kThreadJoinDelegate, kThreadJoinThread };
+
+ friend Thread* CreateThread(const char* name, ThreadDelegate* delegate);
+ friend void DeleteThread(Thread* thread);
+
/**
* @brief Starts the thread.
* @return true if the thread was successfully started.
*/
- bool start();
+ bool Start();
/**
* @brief Starts the thread. Behaves exactly like \ref start() in addition to
@@ -114,26 +151,44 @@ class Thread {
* for details.
* @return true if the thread was successfully started.
*/
- bool start(const ThreadOptions& options);
+ bool Start(const ThreadOptions& options);
- sync_primitives::Lock& delegate_lock() {
- return delegate_lock_;
- }
+ /**
+ * @brief Signals the thread to exit and returns once the thread has exited.
+ * After this method returns, the Thread object is completely reset and may
+ * be used as if it were newly constructed (i.e., Start may be called again).
+ *
+ * Stop may be called multiple times and is simply ignored if the thread is
+ * already stopped.
+ *
+ * Stop will wait for delegate exit
+ */
+ bool Stop(const ThreadStopOption stop_option);
- ThreadDelegate* delegate() const {
+ /**
+ * @brief Blocks the current thread until
+ * the fucntion identified by join_option finishes execution.
+ * If that fucntion has already terminated, then
+ * Join returns immediately.
+ * @param join_option - specify function to wait
+ */
+ void Join(const ThreadJoinOption join_option);
+
+ ThreadDelegate* GetDelegate() const {
return delegate_;
}
- void set_delegate(ThreadDelegate* delegate) {
+ void SetDelegate(ThreadDelegate* delegate) {
+ Stop(kThreadStopDelegate);
delegate_ = delegate;
}
- friend Thread* CreateThread(const char* name, ThreadDelegate* delegate);
- friend void DeleteThread(Thread* thread);
-
- public:
- // Yield current thread
- static void yield();
+ /**
+ * @brief Causes the calling thread to relinquish the CPU. The
+ * thread is moved to the end of the queue for its static priority and a
+ * new thread gets to run.
+ */
+ static void SchedYield();
// Get unique ID of currently executing thread
static PlatformThreadHandle CurrentId();
@@ -143,22 +198,10 @@ class Thread {
std::string name);
/**
- * @brief Signals the thread to exit and returns once the thread has exited.
- * After this method returns, the Thread object is completely reset and may
- * be used as if it were newly constructed (i.e., Start may be called again).
- *
- * Stop may be called multiple times and is simply ignored if the thread is
- * already stopped.
- */
- void stop();
-
- void join();
-
- /**
* @brief Get thread name.
* @return thread name
*/
- const std::string& name() {
+ const std::string& GetThreadName() {
return name_;
}
@@ -167,17 +210,16 @@ class Thread {
* When a thread is running, the thread_id_ is non-zero.
* @return true if the thread has been started, and not yet stopped.
*/
- bool is_running() const {
- return isThreadRunning_;
+ bool IsRunning() {
+ sync_primitives::AutoLock auto_lock(state_lock_);
+ return kThreadStateRunning == thread_state_;
}
- void set_running(bool running);
-
/**
* @brief Is thread joinable?
* @return - Returns true if the thread is joinable.
*/
- bool is_joinable() const {
+ bool IsJoinable() const {
return thread_options_.is_joinable();
}
@@ -185,7 +227,7 @@ class Thread {
* @brief Thread stack size
* @return thread stack size
*/
- size_t stack_size() const {
+ size_t StackSize() const {
return thread_options_.stack_size();
}
@@ -193,7 +235,7 @@ class Thread {
* @brief The native thread handle.
* @return thread handle.
*/
- PlatformThreadHandle thread_handle() const {
+ PlatformThreadHandle ThreadHandle() const {
return handle_;
}
@@ -207,7 +249,7 @@ class Thread {
* @brief Thread options.
* @return thread options.
*/
- const ThreadOptions& thread_options() const {
+ const ThreadOptions& GetThreadOptions() const {
return thread_options_;
}
@@ -216,9 +258,6 @@ class Thread {
*/
static size_t kMinStackSize;
- protected:
- sync_primitives::ConditionalVariable state_cond_;
-
private:
/**
* Ctor.
@@ -235,6 +274,83 @@ class Thread {
static void* threadFunc(void* arg);
static void cleanup(void* arg);
DISALLOW_COPY_AND_ASSIGN(Thread);
+
+ /**
+ * @brief Initializes the thread attributes and
+ * set thread options into attributes
+ * @param thread_options - thread options
+ * @return pthread_attr_t - initialized the thread attributes
+ */
+ pthread_attr_t SetThreadCreationAttributes(ThreadOptions* thread_options);
+
+ /**
+ * @brief Executing delegates exitThreadMain and move thread to
+ * kThreadStateIdle. That funciton is not thread safe.
+ * @param auto_lock - Locked object is used to wait
+ * thread iteration completion
+ * @return true if delegate has been successfully stopped,
+ * false otherwise
+ */
+ bool StopDelegate(sync_primitives::AutoLock& auto_lock);
+
+ /**
+ * @brief Executing StopDelegate and run kThreadCommandFinalize command,
+ * move thread to kThreadStateCompleted,
+ * that funciton is not thread safe
+ * @param auto_lock - Locked object used for waiting
+ * of the last iteration in thread
+ * @return true if thread has been successfully stopped,
+ * false otherwise
+ */
+ bool StopSoft(sync_primitives::AutoLock& auto_lock);
+
+ /**
+ * @brief Executing StopSoft, if necessary pthread_cancel or pthread_exit
+ * and move thread to kThreadStateCompleted,
+ * that funciton is not thread safe
+ * @param auto_lock - Locked object used for waiting
+ * of the last iteration in thread
+ */
+ void StopForce(sync_primitives::AutoLock& auto_lock);
+
+ /**
+ * @brief Waiting finished iteration in thread,
+ * that funciton is not thread safe
+ * @param auto_lock - Locked object using for waiting
+ * finishing iteration in thread
+ */
+ void JoinDelegate(sync_primitives::AutoLock& auto_lock);
+
+ const std::string name_;
+ ThreadDelegate* delegate_;
+ PlatformThreadHandle handle_;
+ ThreadOptions thread_options_;
+ // Should be locked to protect thread state
+ sync_primitives::Lock state_lock_;
+ sync_primitives::ConditionalVariable state_cond_;
+
+ /**
+ * @brief Used to request actions from worker thread.
+ */
+ volatile ThreadCommand thread_command_;
+
+ /**
+ * @brief Used from worker thread to inform about its status.
+ */
+ volatile ThreadState thread_state_;
+
+#ifdef BUILD_TESTS
+ FRIEND_TEST(PosixThreadTest,
+ StartThreadWithNullPtrDelegate_ExpectThreadStateNone);
+ FRIEND_TEST(PosixThreadTest,
+ StartThreadExecutingThreadMain_ExpectThreadStateRunning);
+ FRIEND_TEST(
+ PosixThreadTest,
+ StartThreadExecutingThreadMainCallStopDelegate_ExpectThreadStateIdle);
+ FRIEND_TEST(
+ PosixThreadTest,
+ StartThreadExecutingThreadMainCallForceStop_ExpectThreadStateCompleted);
+#endif
};
} // namespace threads
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 50df15728f..8e906a7bbb 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -340,6 +340,7 @@
<element name="SYSTEM" />
<element name="PROJECTION" />
<element name="REMOTE_CONTROL" />
+ <element name="WEB_VIEW" />
</enum>
<enum name="CloudConnectionStatus">
@@ -540,6 +541,9 @@
<element name="CLOSE_CLOUD_CONNECTION">
<description>By getting this value, SDL puts the named app to NONE HMILevel. Used by the HMI to close a cloud app connection.</description>
</element>
+ <element name="RESOURCE_CONSTRAINT">
+ <description>By getting this value, SDL should unregister the application to allow the HMI to close the application.</description>
+ </element>
</enum>
<enum name="TextFieldName">
@@ -732,6 +736,9 @@
<element name="alertIcon">
<description>The image field for Alert</description>
</element>
+ <element name="subMenuIcon">
+ <description>The image field for AddSubMenu.menuIcon</description>
+ </element>
<element name="subtleAlertIcon">
<description>The image of the subtle alert; applies to `SubtleAlert` `alertIcon`</description>
</element>
@@ -3601,6 +3608,15 @@
</param>
</struct>
+ <struct name="DynamicUpdateCapabilities">
+ <param name="supportedDynamicImageFieldNames" type="ImageFieldName" array="true" mandatory="false" minsize="1">
+ <description>An array of ImageFieldName values for which the system supports sending OnFileUpdate notifications. If you send an Image struct for that image field with a name without having uploaded the image data using PutFile that matches that name, the system will request that you upload the data with PutFile at a later point when the HMI needs it. The HMI will then display the image in the appropriate field. If not sent, assume false.</description>
+ </param>
+
+ <param name="supportsDynamicSubMenus" type="Boolean" mandatory="false">
+ <description>If true, the head unit supports dynamic sub-menus by sending OnUpdateSubMenu notifications. If true, you should not send AddCommands that attach to a parentID for an AddSubMenu until OnUpdateSubMenu is received with the menuID. At that point, you should send all AddCommands with a parentID that match the menuID. If not set, assume false.</description>
+ </param>
+ </struct>
<struct name="WindowTypeCapabilities">
<param name="type" type="Common.WindowType" mandatory="true" />
@@ -3638,6 +3654,9 @@
<param name="menuLayoutsAvailable" type="Common.MenuLayout" array="true" minsize="1" maxsize="1000" mandatory="false">
<description>An array of available menu layouts. If this parameter is not provided, only the `LIST` layout is assumed to be available</description>
</param>
+ <param name="dynamicUpdateCapabilities" type="DynamicUpdateCapabilities" mandatory="false">
+ <description>Contains the head unit's capabilities for dynamic updating features declaring if the module will send dynamic update RPCs.</description>
+ </param>
</struct>
<struct name="DisplayCapability">
@@ -4241,7 +4260,7 @@
<param name="seatLocationCapability" type="SeatLocationCapability" mandatory="false">
<description>Contains information about the locations of each seat</description>
</param>
- <param name="driverDistractionCapability" type="DriverDistractionCapability" mandatory="false" since="6.0">
+ <param name="driverDistractionCapability" type="DriverDistractionCapability" mandatory="false">
<description>Describes capabilities when the driver is distracted</description>
</param>
</struct>
@@ -5842,6 +5861,33 @@
</function>
<function name="SendHapticData" messagetype="response">
</function>
+
+ <function name="OnUpdateFile" messagetype="notification">
+ <description>For the HMI to tell Core that a file needs to be retrieved from the app.</description>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application related to this RPC.</description>
+ </param>
+ <param name="fileName" type="String" maxlength="255" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+ </function>
+
+ <function name="OnUpdateSubMenu" messagetype="notification">
+ <description>For the HMI to tell Core that a submenu needs updating</description>
+
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application related to this RPC.</description>
+ </param>
+
+ <param name="menuID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>This menuID must match a menuID in the current menu structure</description>
+ </param>
+
+ <param name="updateSubCells" type="Boolean" mandatory="false">
+ <description>If not set, assume false. If true, the app should send AddCommands with parentIDs matching the menuID. These AddCommands will then be attached to the submenu and displayed if the submenu is selected.</description>
+ </param>
+ </function>
+
</interface>
<interface name="Navigation" version="1.5.0" date="2017-08-15">
diff --git a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
index 581997f610..b9cdf55482 100644
--- a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
+++ b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
@@ -43,7 +43,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
const static size_t BUFSIZE = 32;
@@ -77,7 +77,7 @@ A2DPSourcePlayerAdapter::A2DPSourcePlayerAdapter(
A2DPSourcePlayerAdapter::~A2DPSourcePlayerAdapter() {
for (SourcesMap::iterator it = sources_.begin(); sources_.end() != it; ++it) {
Pair pair = it->second;
- pair.first->join();
+ pair.first->Stop(threads::Thread::kThreadSoftStop);
delete pair.second;
threads::DeleteThread(pair.first);
}
@@ -85,8 +85,8 @@ A2DPSourcePlayerAdapter::~A2DPSourcePlayerAdapter() {
}
void A2DPSourcePlayerAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Starting a2dp playing music for " << application_key << " application.");
if (application_key != current_application_) {
current_application_ = application_key;
@@ -105,21 +105,20 @@ void A2DPSourcePlayerAdapter::StartActivity(int32_t application_key) {
threads::Thread* new_activity =
threads::CreateThread(mac_address.c_str(), delegate);
sources_[application_key] = Pair(new_activity, delegate);
- new_activity->start();
+ new_activity->Start();
}
}
void A2DPSourcePlayerAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_INFO(
- logger_,
- "Stopping 2dp playing for " << application_key << " application.");
+ SDL_LOG_INFO("Stopping 2dp playing for " << application_key
+ << " application.");
if (application_key != current_application_) {
return;
}
SourcesMap::iterator it = sources_.find(application_key);
if (sources_.end() != it) {
Pair pair = it->second;
- pair.first->join();
+ pair.first->Stop(threads::Thread::kThreadSoftStop);
delete pair.second;
threads::DeleteThread(pair.first);
current_application_ = 0;
@@ -142,7 +141,7 @@ A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::A2DPSourcePlayerThread(
: threads::ThreadDelegate(), device_(device) {}
void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::freeStreams() {
- LOG4CXX_INFO(logger_, "Free streams in A2DPSourcePlayerThread.");
+ SDL_LOG_INFO("Free streams in A2DPSourcePlayerThread.");
if (s_in) {
pa_simple_free(s_in);
}
@@ -158,7 +157,7 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::exitThreadMain() {
}
void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() {
- LOG4CXX_INFO(logger_, "Main thread of A2DPSourcePlayerThread.");
+ SDL_LOG_INFO("Main thread of A2DPSourcePlayerThread.");
{
sync_primitives::AutoLock auto_lock(should_be_stopped_lock_);
@@ -169,9 +168,9 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() {
const char* a2dpSource = device_.c_str();
- LOG4CXX_DEBUG(logger_, device_);
+ SDL_LOG_DEBUG(device_);
- LOG4CXX_DEBUG(logger_, "Creating streams");
+ SDL_LOG_DEBUG("Creating streams");
/* Create a new playback stream */
if (!(s_out = pa_simple_new(NULL,
@@ -183,7 +182,7 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() {
NULL,
NULL,
&error))) {
- LOG4CXX_ERROR(logger_, "pa_simple_new() failed: " << pa_strerror(error));
+ SDL_LOG_ERROR("pa_simple_new() failed: " << pa_strerror(error));
freeStreams();
return;
}
@@ -197,12 +196,12 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() {
NULL,
NULL,
&error))) {
- LOG4CXX_ERROR(logger_, "pa_simple_new() failed: " << pa_strerror(error));
+ SDL_LOG_ERROR("pa_simple_new() failed: " << pa_strerror(error));
freeStreams();
return;
}
- LOG4CXX_DEBUG(logger_, "Entering main loop");
+ SDL_LOG_DEBUG("Entering main loop");
for (;;) {
uint8_t buf[BUFSIZE];
@@ -210,30 +209,27 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() {
pa_usec_t latency;
if ((latency = pa_simple_get_latency(s_in, &error)) == (pa_usec_t)-1) {
- LOG4CXX_ERROR(logger_,
- "pa_simple_get_latency() failed: " << pa_strerror(error));
+ SDL_LOG_ERROR("pa_simple_get_latency() failed: " << pa_strerror(error));
break;
}
- // LOG4CXX_INFO(logger_, "In: " << static_cast<float>(latency));
+ // SDL_LOG_INFO( "In: " << static_cast<float>(latency));
if ((latency = pa_simple_get_latency(s_out, &error)) == (pa_usec_t)-1) {
- LOG4CXX_ERROR(logger_,
- "pa_simple_get_latency() failed: " << pa_strerror(error));
+ SDL_LOG_ERROR("pa_simple_get_latency() failed: " << pa_strerror(error));
break;
}
- // LOG4CXX_INFO(logger_, "Out: " << static_cast<float>(latency));
+ // SDL_LOG_INFO( "Out: " << static_cast<float>(latency));
if (pa_simple_read(s_in, buf, sizeof(buf), &error) < 0) {
- LOG4CXX_ERROR(logger_, "read() failed: " << strerror(error));
+ SDL_LOG_ERROR("read() failed: " << strerror(error));
break;
}
/* ... and play it */
if (pa_simple_write(s_out, buf, sizeof(buf), &error) < 0) {
- LOG4CXX_ERROR(logger_,
- "pa_simple_write() failed: " << pa_strerror(error));
+ SDL_LOG_ERROR("pa_simple_write() failed: " << pa_strerror(error));
break;
}
@@ -251,7 +247,7 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() {
/* Make sure that every single sample was played */
if (pa_simple_drain(s_out, &error) < 0) {
- LOG4CXX_ERROR(logger_, "pa_simple_drain() failed: " << pa_strerror(error));
+ SDL_LOG_ERROR("pa_simple_drain() failed: " << pa_strerror(error));
freeStreams();
return;
}
diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
index 078841f2a4..ea35d61554 100644
--- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
+++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
@@ -70,7 +70,7 @@ const uint32_t kMqueueMessageSize = 4095;
// the files.
static const uint32_t kRIFFHeaderSize = 44;
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
AudioStreamSenderThread::AudioStreamSenderThread(
const std::string& fileName,
@@ -83,13 +83,13 @@ AudioStreamSenderThread::AudioStreamSenderThread(
, shouldBeStoped_lock_()
, shouldBeStoped_cv_()
, application_manager_(app_mngr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
AudioStreamSenderThread::~AudioStreamSenderThread() {}
void AudioStreamSenderThread::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
offset_ = kRIFFHeaderSize;
@@ -101,30 +101,30 @@ void AudioStreamSenderThread::threadMain() {
}
void AudioStreamSenderThread::sendAudioChunkToMobile() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<uint8_t> binaryData;
std::vector<uint8_t>::iterator from;
std::vector<uint8_t>::iterator to;
if (!file_system::ReadBinaryFile(fileName_, binaryData)) {
- LOG4CXX_ERROR(logger_, "Unable to read file." << fileName_);
+ SDL_LOG_ERROR("Unable to read file." << fileName_);
return;
}
if (binaryData.empty()) {
- LOG4CXX_ERROR(logger_, "Binary data is empty.");
+ SDL_LOG_ERROR("Binary data is empty.");
return;
}
- LOG4CXX_INFO(logger_, "offset = " << offset_);
+ SDL_LOG_INFO("offset = " << offset_);
from = binaryData.begin() + offset_;
to = binaryData.end();
if (from < binaryData.end() /*from != binaryData.end()*/) {
- LOG4CXX_INFO(logger_, "from != binaryData.end()");
+ SDL_LOG_INFO("from != binaryData.end()");
offset_ = offset_ + to - from;
std::vector<uint8_t> data(from, to);
@@ -140,12 +140,12 @@ void AudioStreamSenderThread::sendAudioChunkToMobile() {
void AudioStreamSenderThread::SendAudioPassThroughNotification(
uint32_t session_key, std::vector<uint8_t>& binary_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!application_manager_.is_audio_pass_thru_active()) {
- LOG4CXX_ERROR(logger_,
- "Trying to send PassThroughNotification"
- " when PassThrough is not active");
+ SDL_LOG_ERROR(
+ "Trying to send PassThroughNotification"
+ " when PassThrough is not active");
return;
}
@@ -157,11 +157,11 @@ void AudioStreamSenderThread::SendAudioPassThroughNotification(
std::make_shared<smart_objects::SmartObject>();
if (!on_audio_pass) {
- LOG4CXX_ERROR(logger_, "OnAudioPassThru NULL pointer");
+ SDL_LOG_ERROR("OnAudioPassThru NULL pointer");
return;
}
- LOG4CXX_DEBUG(logger_, "Fill smart object");
+ SDL_LOG_DEBUG("Fill smart object");
(*on_audio_pass)[strings::params][strings::message_type] =
application_manager::MessageType::kNotification;
@@ -171,13 +171,13 @@ void AudioStreamSenderThread::SendAudioPassThroughNotification(
(*on_audio_pass)[strings::params][strings::function_id] =
mobile_apis::FunctionID::OnAudioPassThruID;
- LOG4CXX_DEBUG(logger_, "Fill binary data");
+ SDL_LOG_DEBUG("Fill binary data");
// binary data
(*on_audio_pass)[strings::params][strings::binary_data] =
smart_objects::SmartObject(data.binary_data);
- LOG4CXX_DEBUG(logger_, "After fill binary data");
- LOG4CXX_DEBUG(logger_, "Send data");
+ SDL_LOG_DEBUG("After fill binary data");
+ SDL_LOG_DEBUG("Send data");
application_manager_.GetRPCService().ManageMobileCommand(
on_audio_pass, application_manager::commands::Command::SOURCE_SDL);
}
@@ -195,7 +195,7 @@ void AudioStreamSenderThread::setShouldBeStopped(bool should_stop) {
}
void AudioStreamSenderThread::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
setShouldBeStopped(true);
}
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
index 2575643422..68018028ae 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
@@ -39,7 +39,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
FromMicRecorderAdapter::FromMicRecorderAdapter()
: recorder_thread_(NULL)
@@ -51,19 +51,18 @@ FromMicRecorderAdapter::FromMicRecorderAdapter()
, duration_(kDefaultDuration) {}
FromMicRecorderAdapter::~FromMicRecorderAdapter() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (recorder_thread_) {
- recorder_thread_->join();
- delete recorder_thread_->delegate();
+ recorder_thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete recorder_thread_->GetDelegate();
threads::DeleteThread(recorder_thread_);
}
}
void FromMicRecorderAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_DEBUG(logger_, "Start with app " << application_key);
+ SDL_LOG_DEBUG("Start with app " << application_key);
if (application_key == current_application_) {
- LOG4CXX_WARN(logger_,
- "Running recording from mic for " << current_application_);
+ SDL_LOG_WARN("Running recording from mic for " << current_application_);
return;
}
@@ -79,23 +78,21 @@ void FromMicRecorderAdapter::StartActivity(int32_t application_key) {
}
if (NULL != recorder_thread_) {
- recorder_thread_->start();
+ recorder_thread_->Start();
current_application_ = application_key;
}
}
void FromMicRecorderAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_INFO(logger_,
- "FromMicRecorderAdapter::StopActivity " << application_key);
+ SDL_LOG_INFO("FromMicRecorderAdapter::StopActivity " << application_key);
if (application_key != current_application_) {
- LOG4CXX_WARN(logger_,
- "Running activity on other app key " << current_application_);
+ SDL_LOG_WARN("Running activity on other app key " << current_application_);
return;
}
if (recorder_thread_) {
- recorder_thread_->join();
- delete recorder_thread_->delegate();
+ recorder_thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete recorder_thread_->GetDelegate();
threads::DeleteThread(recorder_thread_);
recorder_thread_ = NULL;
}
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
index 721229b250..377834b05f 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
@@ -37,7 +37,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
FromMicRecorderListener::FromMicRecorderListener(
const std::string& file_name,
@@ -48,10 +48,10 @@ FromMicRecorderListener::FromMicRecorderListener(
, application_manager_(app_mngr) {}
FromMicRecorderListener::~FromMicRecorderListener() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (reader_) {
- reader_->join();
- delete reader_->delegate();
+ reader_->Stop(threads::Thread::kThreadSoftStop);
+ delete reader_->GetDelegate();
threads::DeleteThread(reader_);
}
}
@@ -63,9 +63,8 @@ void FromMicRecorderListener::OnErrorReceived(int32_t application_key,
const DataForListener& data) {}
void FromMicRecorderListener::OnActivityStarted(int32_t application_key) {
- LOG4CXX_INFO(
- logger_,
- "FromMicRecorderListener::OnActivityStarted " << application_key);
+ SDL_LOG_INFO("FromMicRecorderListener::OnActivityStarted "
+ << application_key);
if (application_key == current_application_) {
return;
}
@@ -75,23 +74,21 @@ void FromMicRecorderListener::OnActivityStarted(int32_t application_key) {
reader_ = threads::CreateThread("RecorderSender", thread_delegate);
}
if (reader_) {
- reader_->start();
+ reader_->Start();
current_application_ = application_key;
}
}
void FromMicRecorderListener::OnActivityEnded(int32_t application_key) {
- LOG4CXX_INFO(logger_,
- "FromMicRecorderListener::OnActivityEnded " << application_key);
+ SDL_LOG_INFO("FromMicRecorderListener::OnActivityEnded " << application_key);
if (application_key != current_application_) {
- LOG4CXX_WARN(logger_,
- "Not performing activity on " << application_key << " but on "
+ SDL_LOG_WARN("Not performing activity on " << application_key << " but on "
<< current_application_);
return;
}
if (reader_) {
- reader_->join();
- delete reader_->delegate();
+ reader_->Stop(threads::Thread::kThreadSoftStop);
+ delete reader_->GetDelegate();
threads::DeleteThread(reader_);
reader_ = NULL;
}
diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
index 877722fd70..d2634214fa 100644
--- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
+++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
@@ -39,7 +39,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
GMainLoop* FromMicToFileRecorderThread::loop = NULL;
@@ -61,28 +61,28 @@ FromMicToFileRecorderThread::FromMicToFileRecorderThread(
, outputFileName_(output_file)
, samplingRate_(sampling_rate)
, bitsPerSample_(bits_per_sample) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
set_record_duration(duration);
// audio_type is not used as we always employ LPCM
}
FromMicToFileRecorderThread::~FromMicToFileRecorderThread() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (sleepThread_) {
- sleepThread_->join();
- delete sleepThread_->delegate();
+ sleepThread_->Stop(threads::Thread::kThreadSoftStop);
+ delete sleepThread_->GetDelegate();
threads::DeleteThread(sleepThread_);
}
}
void FromMicToFileRecorderThread::set_output_file(
const std::string& output_file) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
outputFileName_ = output_file;
}
void FromMicToFileRecorderThread::set_record_duration(int32_t duration) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::stringstream stringStream;
stringStream << duration / 1000;
@@ -90,7 +90,7 @@ void FromMicToFileRecorderThread::set_record_duration(int32_t duration) {
}
void FromMicToFileRecorderThread::initArgs() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
argv_ = new gchar*[argc_];
@@ -108,7 +108,7 @@ void FromMicToFileRecorderThread::initArgs() {
}
void FromMicToFileRecorderThread::deinitArgs() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (argv_) {
for (int32_t i = 0; i < argc_; i++) {
@@ -120,7 +120,7 @@ void FromMicToFileRecorderThread::deinitArgs() {
}
void FromMicToFileRecorderThread::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock auto_lock(stopFlagLock_);
@@ -186,9 +186,9 @@ void FromMicToFileRecorderThread::threadMain() {
g_error("Must supply destination (-d FILE)\n");
}
- LOG4CXX_TRACE(logger_, "Reading from device: " << device);
- LOG4CXX_TRACE(logger_, "Saving pipeline output to: " << outfile);
- LOG4CXX_TRACE(logger_, "Duration set to: " << duration);
+ SDL_LOG_TRACE("Reading from device: " << device);
+ SDL_LOG_TRACE("Saving pipeline output to: " << outfile);
+ SDL_LOG_TRACE("Duration set to: " << duration);
// Initialize gstreamer and setup the main loop information
gst_init(&argc, &argv);
@@ -216,7 +216,7 @@ void FromMicToFileRecorderThread::threadMain() {
// Create a capability to specify audio format. It also downmixes the recorded
// audio to monaural.
std::string caps_string = create_caps_string();
- LOG4CXX_DEBUG(logger_, "Using audio caps: " << caps_string);
+ SDL_LOG_DEBUG("Using audio caps: " << caps_string);
audiocaps = gst_caps_from_string(caps_string.c_str());
// Assert that all the elements were created
@@ -248,7 +248,7 @@ void FromMicToFileRecorderThread::threadMain() {
gst_element_set_state(pipeline, GST_STATE_PLAYING);
- LOG4CXX_TRACE(logger_, "Initializing pipeline ...");
+ SDL_LOG_TRACE("Initializing pipeline ...");
while (GST_STATE(pipeline) != GST_STATE_PLAYING) {
bool shouldBeStoped;
{
@@ -266,7 +266,7 @@ void FromMicToFileRecorderThread::threadMain() {
return;
}
}
- LOG4CXX_TRACE(logger_, "Pipeline started ...\n");
+ SDL_LOG_TRACE("Pipeline started ...\n");
// Start up a timer for the pipeline
if (duration > 0) {
@@ -276,7 +276,7 @@ void FromMicToFileRecorderThread::threadMain() {
sleepThread_ =
threads::CreateThread("SleepThread", new SleepThreadDelegate(timeout));
- sleepThread_->start();
+ sleepThread_->Start();
}
loop = g_main_loop_new(NULL, FALSE);
@@ -285,7 +285,7 @@ void FromMicToFileRecorderThread::threadMain() {
gst_element_set_state(pipeline, GST_STATE_NULL);
- LOG4CXX_TRACE(logger_, "Deleting pipeline\n");
+ SDL_LOG_TRACE("Deleting pipeline\n");
gst_object_unref(GST_OBJECT(pipeline));
g_main_loop_unref(loop);
g_option_context_free(context);
@@ -296,7 +296,7 @@ void FromMicToFileRecorderThread::threadMain() {
}
std::string FromMicToFileRecorderThread::create_caps_string() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::stringstream ss;
ss << "audio/x-raw";
@@ -343,7 +343,7 @@ FromMicToFileRecorderThread::SleepThreadDelegate::SleepThreadDelegate(
: threads::ThreadDelegate(), timeout_(timeout) {}
void FromMicToFileRecorderThread::SleepThreadDelegate::threadMain() {
- LOG4CXX_TRACE(logger_, "Sleep for " << timeout_.duration << " seconds");
+ SDL_LOG_TRACE("Sleep for " << timeout_.duration << " seconds");
sleep(timeout_.duration);
@@ -355,21 +355,21 @@ void FromMicToFileRecorderThread::SleepThreadDelegate::threadMain() {
}
void FromMicToFileRecorderThread::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (NULL != loop) {
if (g_main_loop_is_running(loop)) {
- LOG4CXX_TRACE(logger_, "Quit loop\n");
+ SDL_LOG_TRACE("Quit loop\n");
g_main_loop_quit(loop);
}
}
if (sleepThread_) {
- LOG4CXX_DEBUG(logger_, "Stop sleep thread\n");
+ SDL_LOG_DEBUG("Stop sleep thread\n");
sleepThread_->stop();
}
- LOG4CXX_TRACE(logger_, "Set should be stopped flag\n");
+ SDL_LOG_TRACE("Set should be stopped flag\n");
sync_primitives::AutoLock auto_lock(stopFlagLock_);
shouldBeStoped_ = true;
}
diff --git a/src/components/media_manager/src/file_streamer_adapter.cc b/src/components/media_manager/src/file_streamer_adapter.cc
index 7761e13601..301b093829 100644
--- a/src/components/media_manager/src/file_streamer_adapter.cc
+++ b/src/components/media_manager/src/file_streamer_adapter.cc
@@ -36,7 +36,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "FileStreamerAdapter")
+SDL_CREATE_LOG_VARIABLE("FileStreamerAdapter")
FileStreamerAdapter::FileStreamerAdapter(const std::string& file_name,
const std::string& app_storage_folder)
@@ -56,24 +56,24 @@ FileStreamerAdapter::FileStreamer::FileStreamer(
FileStreamerAdapter::FileStreamer::~FileStreamer() {}
bool FileStreamerAdapter::FileStreamer::Connect() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!file_system::CreateDirectoryRecursively(app_storage_folder_)) {
- LOG4CXX_ERROR(logger_, "Cannot create app folder");
+ SDL_LOG_ERROR("Cannot create app folder");
return false;
}
file_stream_ = file_system::Open(file_name_);
if (!file_stream_) {
- LOG4CXX_ERROR(logger_, "Cannot open file stream " << file_name_);
+ SDL_LOG_ERROR("Cannot open file stream " << file_name_);
return false;
}
- LOG4CXX_INFO(logger_, "File " << file_name_ << " was successfuly opened");
+ SDL_LOG_INFO("File " << file_name_ << " was successfuly opened");
return true;
}
void FileStreamerAdapter::FileStreamer::Disconnect() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (file_stream_) {
file_system::Close(file_stream_);
delete file_stream_;
@@ -84,18 +84,18 @@ void FileStreamerAdapter::FileStreamer::Disconnect() {
bool FileStreamerAdapter::FileStreamer::Send(
protocol_handler::RawMessagePtr msg) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!file_stream_) {
- LOG4CXX_ERROR(logger_, "File stream not found " << file_name_);
+ SDL_LOG_ERROR("File stream not found " << file_name_);
return false;
}
if (!file_system::Write(file_stream_, msg->data(), msg->data_size())) {
- LOG4CXX_ERROR(logger_, "Failed writing data to file " << file_name_);
+ SDL_LOG_ERROR("Failed writing data to file " << file_name_);
return false;
}
- LOG4CXX_INFO(logger_, "Streamer::sent " << msg->data_size());
+ SDL_LOG_INFO("Streamer::sent " << msg->data_size());
return true;
}
diff --git a/src/components/media_manager/src/media_adapter_impl.cc b/src/components/media_manager/src/media_adapter_impl.cc
index cf15a7af97..119a08d88b 100644
--- a/src/components/media_manager/src/media_adapter_impl.cc
+++ b/src/components/media_manager/src/media_adapter_impl.cc
@@ -35,7 +35,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
MediaAdapterImpl::MediaAdapterImpl() : current_application_(0) {}
@@ -44,12 +44,12 @@ MediaAdapterImpl::~MediaAdapterImpl() {
}
void MediaAdapterImpl::AddListener(const MediaListenerPtr& listener) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
media_listeners_.insert(listener);
}
void MediaAdapterImpl::RemoveListener(const MediaListenerPtr& listener) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
media_listeners_.erase(listener);
}
diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc
index d7352d0025..ce80cc3c50 100644
--- a/src/components/media_manager/src/media_manager_impl.cc
+++ b/src/components/media_manager/src/media_manager_impl.cc
@@ -57,7 +57,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
MediaManagerImpl::MediaManagerImpl(
application_manager::ApplicationManager& application_manager,
@@ -117,10 +117,10 @@ void MediaManagerImpl::set_mock_streamer_listener(
void MediaManagerImpl::Init() {
using namespace protocol_handler;
- LOG4CXX_INFO(logger_, "MediaManagerImpl::Init()");
+ SDL_LOG_INFO("MediaManagerImpl::Init()");
#if defined(EXTENDED_MEDIA_MODE)
- LOG4CXX_INFO(logger_, "Called Init with default configuration.");
+ SDL_LOG_INFO("Called Init with default configuration.");
from_mic_recorder_ = new FromMicRecorderAdapter();
#endif
@@ -185,7 +185,7 @@ void MediaManagerImpl::Init() {
}
void MediaManagerImpl::PlayA2DPSource(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#if defined(EXTENDED_MEDIA_MODE)
if (!a2dp_player_ && protocol_handler_) {
@@ -200,7 +200,7 @@ void MediaManagerImpl::PlayA2DPSource(int32_t application_key) {
}
void MediaManagerImpl::StopA2DPSource(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (a2dp_player_) {
a2dp_player_->StopActivity(application_key);
}
@@ -224,8 +224,7 @@ void MediaManagerImpl::StartMicrophoneRecording(
mobile_apis::SamplingRate::eType sampling_rate,
mobile_apis::BitsPerSample::eType bits_per_sample,
mobile_apis::AudioType::eType audio_type) {
- LOG4CXX_INFO(logger_,
- "MediaManagerImpl::StartMicrophoneRecording to " << output_file);
+ SDL_LOG_INFO("MediaManagerImpl::StartMicrophoneRecording to " << output_file);
application_manager::ApplicationSharedPtr app =
application_manager_.application(application_key);
std::string file_path = settings().app_storage_folder();
@@ -244,11 +243,11 @@ void MediaManagerImpl::StartMicrophoneRecording(
}
#else
if (file_system::FileExists(file_path)) {
- LOG4CXX_INFO(logger_, "File " << output_file << " exists, removing");
+ SDL_LOG_INFO("File " << output_file << " exists, removing");
if (file_system::DeleteFile(file_path)) {
- LOG4CXX_INFO(logger_, "File " << output_file << " removed");
+ SDL_LOG_INFO("File " << output_file << " removed");
} else {
- LOG4CXX_WARN(logger_, "Could not remove file " << output_file);
+ SDL_LOG_WARN("Could not remove file " << output_file);
}
}
const std::string record_file_source = settings().app_resource_folder() +
@@ -257,21 +256,20 @@ void MediaManagerImpl::StartMicrophoneRecording(
std::vector<uint8_t> buf;
if (file_system::ReadBinaryFile(record_file_source, buf)) {
if (file_system::Write(file_path, buf)) {
- LOG4CXX_INFO(
- logger_,
- "File " << record_file_source << " copied to " << output_file);
+ SDL_LOG_INFO("File " << record_file_source << " copied to "
+ << output_file);
} else {
- LOG4CXX_WARN(logger_, "Could not write to file " << output_file);
+ SDL_LOG_WARN("Could not write to file " << output_file);
}
} else {
- LOG4CXX_WARN(logger_, "Could not read file " << record_file_source);
+ SDL_LOG_WARN("Could not read file " << record_file_source);
}
#endif
from_mic_listener_->OnActivityStarted(application_key);
}
void MediaManagerImpl::StopMicrophoneRecording(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#if defined(EXTENDED_MEDIA_MODE)
if (from_mic_recorder_) {
from_mic_recorder_->StopActivity(application_key);
@@ -289,7 +287,7 @@ void MediaManagerImpl::StopMicrophoneRecording(int32_t application_key) {
void MediaManagerImpl::StartStreaming(
int32_t application_key, protocol_handler::ServiceType service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (streamer_[service_type]) {
streamer_[service_type]->StartActivity(application_key);
@@ -298,7 +296,7 @@ void MediaManagerImpl::StartStreaming(
void MediaManagerImpl::StopStreaming(
int32_t application_key, protocol_handler::ServiceType service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
stream_data_size_ = 0ull;
@@ -317,23 +315,23 @@ void MediaManagerImpl::OnMessageReceived(
using namespace protocol_handler;
using namespace application_manager;
using namespace helpers;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint32_t streaming_app_id = message->connection_key();
const ServiceType service_type = message->service_type();
if (Compare<ServiceType, NEQ, ALL>(
service_type, ServiceType::kMobileNav, ServiceType::kAudio)) {
- LOG4CXX_DEBUG(logger_, "Unsupported service type in MediaManager");
+ SDL_LOG_DEBUG("Unsupported service type in MediaManager");
return;
}
if (!application_manager_.CanAppStream(streaming_app_id, service_type)) {
application_manager_.ForbidStreaming(streaming_app_id, service_type);
- LOG4CXX_ERROR(logger_,
- "The application is trying to stream when it should not."
- " service type: "
- << service_type);
+ SDL_LOG_ERROR(
+ "The application is trying to stream when it should not."
+ " service type: "
+ << service_type);
return;
}
@@ -383,8 +381,7 @@ void MediaManagerImpl::FramesProcessed(int32_t application_key,
if (audio_stream.use_count() != 0 &&
"pipe" == settings().audio_server_type()) {
size_t audio_queue_size = audio_stream->GetMsgQueueSize();
- LOG4CXX_DEBUG(logger_,
- "# Messages in audio queue = " << audio_queue_size);
+ SDL_LOG_DEBUG("# Messages in audio queue = " << audio_queue_size);
if (audio_queue_size > 0) {
app->WakeUpStreaming(protocol_handler::ServiceType::kAudio);
}
@@ -393,8 +390,7 @@ void MediaManagerImpl::FramesProcessed(int32_t application_key,
if (video_stream.use_count() != 0 &&
"pipe" == settings().video_server_type()) {
size_t video_queue_size = video_stream->GetMsgQueueSize();
- LOG4CXX_DEBUG(logger_,
- "# Messages in video queue = " << video_queue_size);
+ SDL_LOG_DEBUG("# Messages in video queue = " << video_queue_size);
if (video_queue_size > 0) {
app->WakeUpStreaming(protocol_handler::ServiceType::kMobileNav);
}
diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc
index bda106721f..0759813c04 100644
--- a/src/components/media_manager/src/pipe_streamer_adapter.cc
+++ b/src/components/media_manager/src/pipe_streamer_adapter.cc
@@ -40,7 +40,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PipeStreamerAdapter")
+SDL_CREATE_LOG_VARIABLE("PipeStreamerAdapter")
PipeStreamerAdapter::PipeStreamerAdapter(const std::string& named_pipe_path,
const std::string& app_storage_folder)
@@ -58,54 +58,52 @@ PipeStreamerAdapter::PipeStreamer::PipeStreamer(
, app_storage_folder_(app_storage_folder)
, pipe_fd_(0) {
if (!file_system::CreateDirectoryRecursively(app_storage_folder_)) {
- LOG4CXX_ERROR(logger_,
- "Cannot create app storage folder " << app_storage_folder_);
+ SDL_LOG_ERROR("Cannot create app storage folder " << app_storage_folder_);
return;
}
if ((mkfifo(named_pipe_path_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) <
0) &&
(errno != EEXIST)) {
- LOG4CXX_ERROR(logger_, "Cannot create pipe " << named_pipe_path_);
+ SDL_LOG_ERROR("Cannot create pipe " << named_pipe_path_);
} else {
- LOG4CXX_INFO(logger_,
- "Pipe " << named_pipe_path_ << " was successfully created");
+ SDL_LOG_INFO("Pipe " << named_pipe_path_ << " was successfully created");
}
}
PipeStreamerAdapter::PipeStreamer::~PipeStreamer() {
if (0 == unlink(named_pipe_path_.c_str())) {
- LOG4CXX_INFO(logger_, "Pipe " << named_pipe_path_ << " was removed");
+ SDL_LOG_INFO("Pipe " << named_pipe_path_ << " was removed");
} else {
- LOG4CXX_ERROR(logger_, "Error removing pipe " << named_pipe_path_);
+ SDL_LOG_ERROR("Error removing pipe " << named_pipe_path_);
}
}
bool PipeStreamerAdapter::PipeStreamer::Connect() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
pipe_fd_ = open(named_pipe_path_.c_str(), O_RDWR | O_NONBLOCK, 0);
if (-1 == pipe_fd_) {
- LOG4CXX_ERROR(logger_, "Cannot open pipe for writing " << named_pipe_path_);
+ SDL_LOG_ERROR("Cannot open pipe for writing " << named_pipe_path_);
return false;
}
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Pipe " << named_pipe_path_ << " was successfuly opened for writing");
return true;
}
void PipeStreamerAdapter::PipeStreamer::Disconnect() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (0 == close(pipe_fd_)) {
- LOG4CXX_INFO(logger_, "Pipe " << named_pipe_path_ << " was closed");
+ SDL_LOG_INFO("Pipe " << named_pipe_path_ << " was closed");
} else {
- LOG4CXX_ERROR(logger_, "Error closing pipe " << named_pipe_path_);
+ SDL_LOG_ERROR("Error closing pipe " << named_pipe_path_);
}
}
bool PipeStreamerAdapter::PipeStreamer::Send(
protocol_handler::RawMessagePtr msg) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
fd_set wfds;
FD_ZERO(&wfds);
FD_SET(pipe_fd_, &wfds);
@@ -118,41 +116,36 @@ bool PipeStreamerAdapter::PipeStreamer::Send(
int select_ret = select(pipe_fd_ + 1, NULL, &wfds, NULL, &tv);
// Most likely pipe closed, fail stream
if (select_ret == -1) {
- LOG4CXX_ERROR(logger_,
- "Failed writing data to pipe "
- << named_pipe_path_ << ". Errno: " << strerror(errno));
+ SDL_LOG_ERROR("Failed writing data to pipe "
+ << named_pipe_path_ << ". Errno: " << strerror(errno));
return false;
// Select success, attempt to write
} else if (select_ret) {
ssize_t temp_ret = write(
pipe_fd_, msg->data() + write_ret, msg->data_size() - write_ret);
if (-1 == temp_ret) {
- LOG4CXX_ERROR(logger_,
- "Failed writing data to pipe "
- << named_pipe_path_
- << ". Errno: " << strerror(errno));
+ SDL_LOG_ERROR("Failed writing data to pipe "
+ << named_pipe_path_ << ". Errno: " << strerror(errno));
return false;
}
write_ret += temp_ret;
// Select timed out, fail stream.
} else {
- LOG4CXX_ERROR(logger_,
- "Failed writing data to pipe " << named_pipe_path_
+ SDL_LOG_ERROR("Failed writing data to pipe " << named_pipe_path_
<< ". Error: TIMEOUT");
return false;
}
// Check that all data was written to the pipe.
data_remaining = static_cast<uint32_t>(write_ret) != msg->data_size();
if (data_remaining) {
- LOG4CXX_WARN(logger_,
- "Couldn't write all the data to pipe "
- << named_pipe_path_ << ". "
- << msg->data_size() - write_ret << " bytes remaining");
+ SDL_LOG_WARN("Couldn't write all the data to pipe "
+ << named_pipe_path_ << ". " << msg->data_size() - write_ret
+ << " bytes remaining");
}
// Loop to send remaining data if there is any.
} while (data_remaining);
- LOG4CXX_INFO(logger_, "Streamer::sent " << msg->data_size());
+ SDL_LOG_INFO("Streamer::sent " << msg->data_size());
return true;
}
diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc
index 624e388a0c..2f10a29c7d 100644
--- a/src/components/media_manager/src/socket_streamer_adapter.cc
+++ b/src/components/media_manager/src/socket_streamer_adapter.cc
@@ -42,7 +42,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger, "SocketStreamerAdapter")
+SDL_CREATE_LOG_VARIABLE("SocketStreamerAdapter")
SocketStreamerAdapter::SocketStreamerAdapter(const std::string& ip,
const uint16_t port,
@@ -67,17 +67,17 @@ SocketStreamerAdapter::SocketStreamer::SocketStreamer(
SocketStreamerAdapter::SocketStreamer::~SocketStreamer() {}
bool SocketStreamerAdapter::SocketStreamer::Connect() {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
socket_fd_ = socket(AF_INET, SOCK_STREAM, 0);
if (0 >= socket_fd_) {
- LOG4CXX_ERROR(logger, "Unable to create socket");
+ SDL_LOG_ERROR("Unable to create socket");
return false;
}
int32_t optval = 1;
if (-1 == setsockopt(
socket_fd_, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval)) {
- LOG4CXX_ERROR(logger, "Unable to set sockopt");
+ SDL_LOG_ERROR("Unable to set sockopt");
return false;
}
@@ -88,23 +88,23 @@ bool SocketStreamerAdapter::SocketStreamer::Connect() {
if (-1 == bind(socket_fd_,
reinterpret_cast<struct sockaddr*>(&serv_addr_),
sizeof(serv_addr_))) {
- LOG4CXX_ERROR(logger, "Unable to bind");
+ SDL_LOG_ERROR("Unable to bind");
return false;
}
if (-1 == listen(socket_fd_, 5)) {
- LOG4CXX_ERROR(logger, "Unable to listen");
+ SDL_LOG_ERROR("Unable to listen");
return false;
}
send_socket_fd_ = accept(socket_fd_, NULL, NULL);
if (0 >= send_socket_fd_) {
- LOG4CXX_ERROR(logger, "Unable to accept");
+ SDL_LOG_ERROR("Unable to accept");
return false;
}
is_first_frame_ = true;
- LOG4CXX_INFO(logger, "Client connected: " << send_socket_fd_);
+ SDL_LOG_INFO("Client connected: " << send_socket_fd_);
return true;
}
@@ -113,7 +113,7 @@ void SocketStreamerAdapter::SocketStreamer::Close() {
}
void SocketStreamerAdapter::SocketStreamer::Disconnect() {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
if (0 < send_socket_fd_) {
shutdown(send_socket_fd_, SHUT_RDWR);
close(send_socket_fd_);
@@ -128,12 +128,12 @@ void SocketStreamerAdapter::SocketStreamer::Disconnect() {
bool SocketStreamerAdapter::SocketStreamer::Send(
protocol_handler::RawMessagePtr msg) {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
ssize_t ret;
if (is_first_frame_) {
ret = send(send_socket_fd_, header_.c_str(), header_.size(), MSG_NOSIGNAL);
if (static_cast<uint32_t>(ret) != header_.size()) {
- LOG4CXX_ERROR(logger, "Unable to send data to socket");
+ SDL_LOG_ERROR("Unable to send data to socket");
return false;
}
is_first_frame_ = false;
@@ -141,16 +141,15 @@ bool SocketStreamerAdapter::SocketStreamer::Send(
ret = send(send_socket_fd_, msg->data(), msg->data_size(), MSG_NOSIGNAL);
if (-1 == ret) {
- LOG4CXX_ERROR(logger, "Unable to send data to socket");
+ SDL_LOG_ERROR("Unable to send data to socket");
return false;
}
if (static_cast<uint32_t>(ret) != msg->data_size()) {
- LOG4CXX_WARN(logger,
- "Couldn't send all the data to socket " << send_socket_fd_);
+ SDL_LOG_WARN("Couldn't send all the data to socket " << send_socket_fd_);
}
- LOG4CXX_INFO(logger, "Streamer::sent " << msg->data_size());
+ SDL_LOG_INFO("Streamer::sent " << msg->data_size());
return true;
}
diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc
index 3ef12e3ed5..808b9715af 100644
--- a/src/components/media_manager/src/streamer_adapter.cc
+++ b/src/components/media_manager/src/streamer_adapter.cc
@@ -35,7 +35,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger, "StreamerAdapter")
+SDL_CREATE_LOG_VARIABLE("StreamerAdapter")
StreamerAdapter::StreamerAdapter(Streamer* const streamer)
: current_application_(0), messages_(), streamer_(streamer), thread_(NULL) {
@@ -47,16 +47,15 @@ StreamerAdapter::~StreamerAdapter() {
if (streamer_) {
streamer_->Close();
}
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
delete streamer_;
threads::DeleteThread(thread_);
}
void StreamerAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
if (is_app_performing_activity(application_key)) {
- LOG4CXX_WARN(logger,
- "Activity for application: " << application_key
+ SDL_LOG_WARN("Activity for application: " << application_key
<< " has been already started");
return;
}
@@ -64,7 +63,7 @@ void StreamerAdapter::StartActivity(int32_t application_key) {
DCHECK(thread_);
const size_t kStackSize = 16384;
- thread_->start(threads::ThreadOptions(kStackSize));
+ thread_->Start(threads::ThreadOptions(kStackSize));
for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
media_listeners_.end() != it;
@@ -79,16 +78,15 @@ size_t StreamerAdapter::GetMsgQueueSize() {
}
void StreamerAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
if (!is_app_performing_activity(application_key)) {
- LOG4CXX_WARN(logger,
- "Activity for application: " << application_key
+ SDL_LOG_WARN("Activity for application: " << application_key
<< " has not been started");
return;
}
- DCHECK(thread_);
- thread_->stop();
+ DCHECK(streamer_);
+ streamer_->exitThreadMain();
for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
media_listeners_.end() != it;
@@ -100,10 +98,9 @@ void StreamerAdapter::StopActivity(int32_t application_key) {
void StreamerAdapter::SendData(int32_t application_key,
const ::protocol_handler::RawMessagePtr msg) {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
if (!is_app_performing_activity(application_key)) {
- LOG4CXX_ERROR(logger,
- "Activity for application: " << application_key
+ SDL_LOG_ERROR("Activity for application: " << application_key
<< " has not been started");
return;
}
@@ -123,13 +120,13 @@ StreamerAdapter::Streamer::Streamer(StreamerAdapter* const adapter)
StreamerAdapter::Streamer::~Streamer() {}
void StreamerAdapter::Streamer::threadMain() {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
if (!adapter_) {
- LOG4CXX_ERROR(logger, "Null pointer to adapter");
+ SDL_LOG_ERROR("Null pointer to adapter");
return;
}
if (!Connect()) {
- LOG4CXX_ERROR(logger, "Unable to connect");
+ SDL_LOG_ERROR("Unable to connect");
return;
}
stop_flag_ = false;
@@ -138,25 +135,24 @@ void StreamerAdapter::Streamer::threadMain() {
while (!adapter_->messages_.empty()) {
protocol_handler::RawMessagePtr msg;
if (!adapter_->messages_.pop(msg)) {
- LOG4CXX_ERROR(logger, "Empty message queue");
+ SDL_LOG_ERROR("Empty message queue");
continue;
}
if (!msg) {
- LOG4CXX_ERROR(logger, "Null pointer message");
+ SDL_LOG_ERROR("Null pointer message");
continue;
}
if (!Send(msg)) {
- LOG4CXX_ERROR(logger, "Unable to send. Disconnecting");
+ SDL_LOG_ERROR("Unable to send. Disconnecting");
Disconnect();
return;
}
static int32_t messages_for_session = 0;
++messages_for_session;
- LOG4CXX_DEBUG(logger,
- "Handling map streaming message. This is "
- << messages_for_session << " message for "
- << adapter_->current_application_);
+ SDL_LOG_DEBUG("Handling map streaming message. This is "
+ << messages_for_session << " message for "
+ << adapter_->current_application_);
std::set<MediaListenerPtr>::iterator it =
adapter_->media_listeners_.begin();
for (; adapter_->media_listeners_.end() != it; ++it) {
@@ -169,7 +165,7 @@ void StreamerAdapter::Streamer::threadMain() {
}
void StreamerAdapter::Streamer::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
stop_flag_ = true;
if (adapter_) {
adapter_->messages_.Shutdown();
diff --git a/src/components/media_manager/src/streamer_listener.cc b/src/components/media_manager/src/streamer_listener.cc
index 2d6c3bc984..13f6162e76 100644
--- a/src/components/media_manager/src/streamer_listener.cc
+++ b/src/components/media_manager/src/streamer_listener.cc
@@ -36,7 +36,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
+SDL_CREATE_LOG_VARIABLE("MediaManager")
StreamerListener::StreamerListener(MediaManager& media_manager)
: current_application_(0), media_manager_(media_manager) {}
@@ -52,24 +52,22 @@ void StreamerListener::OnDataReceived(int32_t application_key,
void StreamerListener::OnErrorReceived(int32_t application_key,
const DataForListener& data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void StreamerListener::OnActivityStarted(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (current_application_ == application_key) {
- LOG4CXX_WARN(logger_,
- "Already performing activity for " << application_key);
+ SDL_LOG_WARN("Already performing activity for " << application_key);
return;
}
current_application_ = application_key;
}
void StreamerListener::OnActivityEnded(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (current_application_ != application_key) {
- LOG4CXX_WARN(logger_,
- "Already not performing activity for " << application_key);
+ SDL_LOG_WARN("Already not performing activity for " << application_key);
return;
}
current_application_ = 0;
diff --git a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
index d907211d16..83bcb8662c 100644
--- a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
+++ b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
@@ -37,7 +37,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger, "VideoStreamToFileAdapter")
+SDL_CREATE_LOG_VARIABLE("VideoStreamToFileAdapter")
VideoStreamToFileAdapter::VideoStreamToFileAdapter(const std::string& file_name)
: file_name_(file_name)
@@ -47,32 +47,31 @@ VideoStreamToFileAdapter::VideoStreamToFileAdapter(const std::string& file_name)
}
VideoStreamToFileAdapter::~VideoStreamToFileAdapter() {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
if ((0 != current_application_) && (is_ready_)) {
StopActivity(current_application_);
}
- thread_->join();
- delete thread_->delegate();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete thread_->GetDelegate();
threads::DeleteThread(thread_);
}
void VideoStreamToFileAdapter::Init() {
- if (thread_->is_running()) {
- LOG4CXX_DEBUG(logger, "Start sending thread");
+ if (thread_->IsRunning()) {
+ SDL_LOG_DEBUG("Start sending thread");
const size_t kStackSize = 16384;
- thread_->start(threads::ThreadOptions(kStackSize));
+ thread_->Start(threads::ThreadOptions(kStackSize));
} else {
- LOG4CXX_WARN(logger, "thread is already running");
+ SDL_LOG_WARN("thread is already running");
}
}
void VideoStreamToFileAdapter::SendData(
int32_t application_key, const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger,
- "VideoStreamToFileAdapter::SendData " << application_key);
+ SDL_LOG_INFO("VideoStreamToFileAdapter::SendData " << application_key);
if (application_key != current_application_) {
- LOG4CXX_WARN(logger, "Wrong application " << application_key);
+ SDL_LOG_WARN("Wrong application " << application_key);
return;
}
@@ -82,11 +81,10 @@ void VideoStreamToFileAdapter::SendData(
}
void VideoStreamToFileAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_INFO(logger,
- "VideoStreamToFileAdapter::StartActivity " << application_key);
+ SDL_LOG_INFO("VideoStreamToFileAdapter::StartActivity " << application_key);
if (application_key == current_application_) {
- LOG4CXX_WARN(
- logger, "Already running video stream to file for " << application_key);
+ SDL_LOG_WARN("Already running video stream to file for "
+ << application_key);
return;
}
@@ -101,11 +99,10 @@ void VideoStreamToFileAdapter::StartActivity(int32_t application_key) {
}
void VideoStreamToFileAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_INFO(logger,
- "VideoStreamToFileAdapter::StopActivity " << application_key);
+ SDL_LOG_INFO("VideoStreamToFileAdapter::StopActivity " << application_key);
if (application_key != current_application_) {
- LOG4CXX_WARN(
- logger, "Performing activity for another key " << current_application_);
+ SDL_LOG_WARN("Performing activity for another key "
+ << current_application_);
return;
}
@@ -133,7 +130,7 @@ VideoStreamToFileAdapter::Streamer::~Streamer() {
}
void VideoStreamToFileAdapter::Streamer::threadMain() {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
open();
@@ -141,7 +138,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() {
while (!server_->messages_.empty()) {
::protocol_handler::RawMessagePtr msg = server_->messages_.pop();
if (!msg) {
- LOG4CXX_ERROR(logger, "Null pointer message");
+ SDL_LOG_ERROR("Null pointer message");
continue;
}
@@ -157,7 +154,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() {
messsages_for_session);
}
} else {
- LOG4CXX_WARN(logger, "Can't open File stream! " << server_->file_name_);
+ SDL_LOG_WARN("Can't open File stream! " << server_->file_name_);
}
}
server_->messages_.wait();
@@ -167,22 +164,22 @@ void VideoStreamToFileAdapter::Streamer::threadMain() {
}
void VideoStreamToFileAdapter::Streamer::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger);
+ SDL_LOG_AUTO_TRACE();
stop_flag_ = true;
server_->messages_.Shutdown();
}
void VideoStreamToFileAdapter::Streamer::open() {
- LOG4CXX_INFO(logger, "Streamer::open()" << server_->file_name_.c_str());
+ SDL_LOG_INFO("Streamer::open()" << server_->file_name_.c_str());
DCHECK(file_system::CreateDirectoryRecursively(
profile::Profile::instance()->app_storage_folder()));
file_stream_ = file_system::Open(server_->file_name_);
if (!file_stream_) {
- LOG4CXX_WARN(logger, "Can't open file stream! " << server_->file_name_);
+ SDL_LOG_WARN("Can't open file stream! " << server_->file_name_);
} else {
- LOG4CXX_INFO(logger, "file_stream_ opened :" << file_stream_);
+ SDL_LOG_INFO("file_stream_ opened :" << file_stream_);
}
}
diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc
index 26c8c5e38e..037f4551f1 100644
--- a/src/components/policy/policy_external/src/access_remote_impl.cc
+++ b/src/components/policy/policy_external/src/access_remote_impl.cc
@@ -36,7 +36,7 @@
#include "policy/cache_manager.h"
#include "utils/logger.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl")
+SDL_CREATE_LOG_VARIABLE("PolicyManagerImpl")
using policy_table::DeviceData;
using policy_table::FunctionalGroupings;
@@ -48,11 +48,10 @@ struct ToHMIType {
policy_table::AppHMITypes::value_type operator()(int item) const {
policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item);
if (!IsValidEnum(type)) {
- LOG4CXX_WARN(logger_, "HMI type isn't known " << item);
+ SDL_LOG_WARN("HMI type isn't known " << item);
type = policy_table::AHT_DEFAULT;
}
- LOG4CXX_DEBUG(logger_,
- "HMI type: " << item << " - " << EnumToJsonString(type));
+ SDL_LOG_DEBUG("HMI type: " << item << " - " << EnumToJsonString(type));
return policy_table::AppHMITypes::value_type(type);
}
};
@@ -94,7 +93,7 @@ AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache)
bool AccessRemoteImpl::CheckModuleType(const PTString& app_id,
policy_table::ModuleType module) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!cache_->IsApplicationRepresented(app_id)) {
return false;
}
@@ -117,10 +116,10 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules,
const std::string& module_name,
const std::string& rpc_name,
RemoteControlParams* input) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::AccessModules::const_iterator i = modules.find(module_name);
if (i == modules.end()) {
- LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found");
+ SDL_LOG_DEBUG("Module " << module_name << " wasn't found");
return false;
}
@@ -133,19 +132,19 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules,
const policy_table::Strings& parameters = j->second;
return CompareParameters(parameters, input);
}
- LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found");
+ SDL_LOG_DEBUG("RPC " << rpc_name << " wasn't found");
return false;
}
bool AccessRemoteImpl::CompareParameters(
const policy_table::Strings& parameters, RemoteControlParams* input) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (parameters.empty()) {
return true;
}
if (input->empty()) {
- LOG4CXX_DEBUG(logger_, "Input is empty");
+ SDL_LOG_DEBUG("Input is empty");
return false;
}
@@ -157,7 +156,7 @@ bool AccessRemoteImpl::CompareParameters(
void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who,
const std::vector<int>& hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
HMIList::mapped_type types;
std::transform(hmi_types.begin(),
hmi_types.end(),
@@ -168,7 +167,7 @@ void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who,
const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes(
const ApplicationOnDevice& who) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (cache_->IsDefaultPolicy(who.app_id)) {
return hmi_types_[who];
} else {
@@ -179,7 +178,7 @@ const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes(
const policy_table::Strings& AccessRemoteImpl::GetGroups(
const ApplicationOnDevice& who) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetGroups(who.app_id);
}
@@ -193,7 +192,7 @@ bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) {
bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id,
const std::string& app_id,
FunctionalIdType& group_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]);
GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]);
GetGroupsIds(
@@ -229,13 +228,13 @@ void AccessRemoteImpl::GetGroupsIds(const std::string& device_id,
FunctionalGroupIDs& groups_ids) {
ApplicationOnDevice who = {device_id, app_id};
const policy_table::Strings& groups = GetGroups(who);
- LOG4CXX_DEBUG(logger_, "Groups Names: " << groups);
+ SDL_LOG_DEBUG("Groups Names: " << groups);
groups_ids.resize(groups.size());
std::transform(groups.begin(),
groups.end(),
groups_ids.begin(),
&CacheManager::GenerateHash);
- LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids);
+ SDL_LOG_DEBUG("Groups Ids: " << groups_ids);
}
bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id,
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 039ab5d3d0..67d8bdb2d1 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -226,22 +226,22 @@ struct DefaultPolicyUpdater {
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
-#define CACHE_MANAGER_CHECK(return_value) \
- { \
- if (!pt_) { \
- LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \
- return return_value; \
- } \
+#define CACHE_MANAGER_CHECK(return_value) \
+ { \
+ if (!pt_) { \
+ SDL_LOG_WARN("The cache manager is not initialized"); \
+ return return_value; \
+ } \
}
-#define CACHE_MANAGER_CHECK_VOID() \
- { \
- if (!pt_) { \
- LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \
- return; \
- } \
+#define CACHE_MANAGER_CHECK_VOID() \
+ { \
+ if (!pt_) { \
+ SDL_LOG_WARN("The cache manager is not initialized"); \
+ return; \
+ } \
}
struct LanguageFinder {
@@ -282,16 +282,16 @@ CacheManager::CacheManager(bool in_memory)
}
CacheManager::~CacheManager() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(backuper_locker_);
- backup_thread_->join();
- delete backup_thread_->delegate();
+ backup_thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete backup_thread_->GetDelegate();
threads::DeleteThread(backup_thread_);
}
ConsentPriorityType CacheManager::GetConsentsPriority(
const std::string& device_id, const std::string& application_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ConsentPriorityType prio_type = ConsentPriorityType::kExternalConsentPrio;
CACHE_MANAGER_CHECK(prio_type);
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -299,7 +299,7 @@ ConsentPriorityType CacheManager::GetConsentsPriority(
pt_->policy_table.device_data->find(device_id);
if (pt_->policy_table.device_data->end() == dev_params_iter) {
- LOG4CXX_DEBUG(logger_, "Device id " << device_id << " not found.");
+ SDL_LOG_DEBUG("Device id " << device_id << " not found.");
return prio_type;
}
@@ -309,8 +309,7 @@ ConsentPriorityType CacheManager::GetConsentsPriority(
dev_par.user_consent_records->find(application_id);
if (dev_par.user_consent_records->end() == app_consent_record) {
- LOG4CXX_DEBUG(logger_,
- "Application id " << application_id << " not found.");
+ SDL_LOG_DEBUG("Application id " << application_id << " not found.");
return prio_type;
}
@@ -327,7 +326,7 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) {
}
const policy_table::Strings CacheManager::GetPolicyAppIDs() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
const auto apps = pt_->policy_table.app_policies_section.apps;
@@ -448,13 +447,12 @@ bool CacheManager::GetUserPermissionsForDevice(
const std::string& device_id,
StringArray& consented_groups,
StringArray& disallowed_groups) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::DeviceData& device_data = *pt_->policy_table.device_data;
if (device_data.end() == device_data.find(device_id)) {
- LOG4CXX_ERROR(logger_,
- "Device with " << device_id << "was not found in PT");
+ SDL_LOG_ERROR("Device with " << device_id << "was not found in PT");
return false;
}
const policy_table::DeviceParams& params = device_data[device_id];
@@ -481,7 +479,7 @@ bool CacheManager::GetUserPermissionsForDevice(
void CacheManager::GetAllAppGroups(const std::string& app_id,
FunctionalGroupIDs& all_group_ids) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -520,7 +518,7 @@ void CacheManager::GetAllAppGroups(const std::string& app_id,
void CacheManager::GetPreConsentedGroups(
const std::string& app_id, FunctionalGroupIDs& preconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
if (kDeviceId == app_id) {
@@ -560,7 +558,7 @@ void CacheManager::GetConsentedGroups(const std::string& device_id,
const std::string& app_id,
FunctionalGroupIDs& allowed_groups,
FunctionalGroupIDs& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::DeviceData::iterator dev_params_iter =
@@ -596,12 +594,11 @@ void CacheManager::GetUnconsentedGroups(
const std::string& device_id,
const std::string& policy_app_id,
FunctionalGroupIDs& unconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
if (!IsApplicationRepresented(policy_app_id)) {
- LOG4CXX_WARN(logger_,
- "The application with app_id: " << policy_app_id
+ SDL_LOG_WARN("The application with app_id: " << policy_app_id
<< " is not represented");
return;
}
@@ -680,21 +677,18 @@ void CacheManager::ProcessUpdate(
if (app_id == kDefaultId || app_id == kPreDataConsentId) {
if (new_request_types.is_omitted()) {
- LOG4CXX_INFO(logger_,
- "Application " << app_id
+ SDL_LOG_INFO("Application " << app_id
<< " has omitted RequestTypes."
" Previous values will be kept.");
update_request_types = false;
} else if (new_request_types.empty()) {
if (new_request_types.is_cleaned_up()) {
- LOG4CXX_INFO(logger_,
- "Application " << app_id
+ SDL_LOG_INFO("Application " << app_id
<< " has cleaned up all values."
" Previous values will be kept.");
update_request_types = false;
} else {
- LOG4CXX_INFO(logger_,
- "Application " << app_id
+ SDL_LOG_INFO("Application " << app_id
<< " has empty RequestTypes."
" Any parameter will be allowed.");
}
@@ -721,7 +715,7 @@ void CacheManager::ProcessUpdate(
}
bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
pt_->policy_table.functional_groupings =
@@ -812,7 +806,7 @@ policy_table::VehicleDataItems CacheManager::CollectCustomVDItems(
void CacheManager::GetHMIAppTypeAfterUpdate(
std::map<std::string, StringArray>& app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::const_iterator policy_iter_begin =
@@ -876,7 +870,7 @@ std::string CacheManager::currentDateTime() {
bool CacheManager::GetPermissionsForApp(const std::string& device_id,
const std::string& app_id,
FunctionalIdType& group_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
GetAllAppGroups(app_id, group_types[kTypeGeneral]);
GetAllAppGroups(kDefaultId, group_types[kTypeDefault]);
GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]);
@@ -896,7 +890,7 @@ bool CacheManager::GetPermissionsForApp(const std::string& device_id,
bool CacheManager::GetDeviceGroupsFromPolicies(
policy_table::Strings& groups,
policy_table::Strings& preconsented_groups) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
groups = pt_->policy_table.app_policies_section.device.groups;
@@ -906,7 +900,7 @@ bool CacheManager::GetDeviceGroupsFromPolicies(
}
bool CacheManager::IsDeviceConsentCached(const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock lock(cached_device_permissions_lock_);
CachedDevicePermissions::const_iterator cached_dev_consent_iter;
@@ -916,7 +910,7 @@ bool CacheManager::IsDeviceConsentCached(const std::string& device_id) const {
DeviceConsent CacheManager::GetCachedDeviceConsent(
const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(cached_device_permissions_lock_);
DeviceConsent result = kDeviceHasNoConsent;
CACHE_MANAGER_CHECK(result);
@@ -930,7 +924,7 @@ DeviceConsent CacheManager::GetCachedDeviceConsent(
void CacheManager::SaveDeviceConsentToCache(const std::string& device_id,
const bool is_allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock lock(cached_device_permissions_lock_);
DeviceConsent result = is_allowed ? kDeviceAllowed : kDeviceDisallowed;
@@ -943,7 +937,7 @@ bool CacheManager::GetPermissionsList(StringArray& perm_list) const {
policy_table::Strings groups;
policy_table::Strings preconsented_groups;
if (!GetDeviceGroupsFromPolicies(groups, preconsented_groups)) {
- LOG4CXX_WARN(logger_, "Can't get device groups from policies.");
+ SDL_LOG_WARN("Can't get device groups from policies.");
return false;
}
@@ -955,8 +949,8 @@ bool CacheManager::GetPermissionsList(StringArray& perm_list) const {
bool CacheManager::HasDeviceSpecifiedConsent(const std::string& device_id,
const bool is_allowed) const {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device :" << device_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device :" << device_id);
const DeviceConsent current_consent = GetDeviceConsent(device_id);
const bool is_current_device_allowed =
DeviceConsent::kDeviceAllowed == current_consent ? true : false;
@@ -966,15 +960,14 @@ bool CacheManager::HasDeviceSpecifiedConsent(const std::string& device_id,
return false;
}
const std::string consent = is_allowed ? "allowed" : "disallowed";
- LOG4CXX_INFO(
- logger_,
- "DeviceGetDeviceGroupsFromPolicies is already " << consent << ".");
+ SDL_LOG_INFO("DeviceGetDeviceGroupsFromPolicies is already " << consent
+ << ".");
return true;
}
void CacheManager::SetDeviceConsent(const std::string& device_id,
const bool is_allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
if (HasDeviceSpecifiedConsent(device_id, is_allowed)) {
return;
@@ -987,7 +980,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id,
StringArray list_of_permissions;
if (!GetPermissionsList(list_of_permissions) || list_of_permissions.empty()) {
- LOG4CXX_WARN(logger_, "List of permissions can't be received or empty");
+ SDL_LOG_WARN("List of permissions can't be received or empty");
return;
}
@@ -1003,7 +996,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id,
if (!SetUserPermissionsForDevice(
device_id, consented_groups, disallowed_groups)) {
- LOG4CXX_WARN(logger_, "Can't set user consent for device");
+ SDL_LOG_WARN("Can't set user consent for device");
return;
}
SaveDeviceConsentToCache(device_id, is_allowed);
@@ -1011,7 +1004,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id,
DeviceConsent CacheManager::GetDeviceConsent(
const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(kDeviceHasNoConsent);
if (IsDeviceConsentCached(device_id)) {
return GetCachedDeviceConsent(device_id);
@@ -1054,7 +1047,7 @@ DeviceConsent CacheManager::GetDeviceConsent(
bool CacheManager::AddDevice(const std::string& device_id,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
@@ -1078,14 +1071,14 @@ bool CacheManager::SetDeviceData(const std::string& device_id,
const std::string& carrier,
const uint32_t number_of_ports,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
if (pt_->policy_table.device_data->end() ==
pt_->policy_table.device_data->find(device_id)) {
- LOG4CXX_ERROR(logger_, "Unable to find mobile device: " << device_id);
+ SDL_LOG_ERROR("Unable to find mobile device: " << device_id);
return false;
}
@@ -1107,7 +1100,7 @@ bool CacheManager::SetUserPermissionsForDevice(
const std::string& device_id,
const StringArray& consented_groups,
const StringArray& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
policy_table::DeviceParams& params =
@@ -1140,7 +1133,7 @@ bool CacheManager::SetUserPermissionsForDevice(
bool CacheManager::ReactOnUserDevConsentForApp(const std::string& app_id,
bool is_device_allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
bool result = true;
if (is_device_allowed) {
@@ -1174,7 +1167,7 @@ void CacheManager::GetGroupNameByHashID(const int32_t group_id,
bool CacheManager::SetUserPermissionsForApp(
const PermissionConsent& permissions, bool* out_app_permissions_changed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
std::vector<FunctionalGroupPermission>::const_iterator iter =
@@ -1204,7 +1197,7 @@ bool CacheManager::SetUserPermissionsForApp(
const date_time::TimeDuration tm = date_time::getCurrentTime();
int64_t current_time_msec = date_time::getmSecs(tm);
ucr.consent_last_updated = current_time_msec;
- LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec);
+ SDL_LOG_DEBUG("Updating consents time " << current_time_msec);
}
(*ucr.consent_groups)[group_name] = is_allowed;
@@ -1240,13 +1233,13 @@ void CacheManager::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
CheckPermissionResult& result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
if (!IsApplicationRepresented(app_id)) {
- LOG4CXX_ERROR(
- logger_, "Application id " << app_id << " was not found in policy DB.");
+ SDL_LOG_ERROR("Application id " << app_id
+ << " was not found in policy DB.");
return;
}
@@ -1301,16 +1294,15 @@ int CacheManager::IgnitionCyclesBeforeExchange() {
static_cast<int>(
pt_->policy_table.module_config.exchange_after_x_ignition_cycles),
0);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"IgnitionCyclesBeforeExchange limit:" << static_cast<int>(limit));
uint8_t current = 0;
const int last_exch = static_cast<int>(
*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange);
current = std::max(last_exch, 0);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"IgnitionCyclesBeforeExchange current:" << static_cast<int>(current));
return std::max(limit - current, 0);
@@ -1323,16 +1315,16 @@ int CacheManager::KilometersBeforeExchange(int current) {
std::max(static_cast<int>(
pt_->policy_table.module_config.exchange_after_x_kilometers),
0);
- LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit);
+ SDL_LOG_DEBUG("KilometersBeforeExchange limit:" << limit);
int last = 0;
const int odo_val = static_cast<int>(
*pt_->policy_table.module_meta->pt_exchanged_at_odometer_x);
last = std::max(odo_val, 0);
- LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange last:" << last);
+ SDL_LOG_DEBUG("KilometersBeforeExchange last:" << last);
const int actual = std::max((current - last), 0);
- LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual);
+ SDL_LOG_DEBUG("KilometersBeforeExchange actual:" << actual);
return std::max(limit - actual, 0);
}
@@ -1343,18 +1335,16 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate(
switch (counter) {
case KILOMETERS:
*pt_->policy_table.module_meta->pt_exchanged_at_odometer_x = value;
- LOG4CXX_DEBUG(logger_,
- "SetCountersPassedForSuccessfulUpdate km:" << value);
+ SDL_LOG_DEBUG("SetCountersPassedForSuccessfulUpdate km:" << value);
break;
case DAYS_AFTER_EPOCH:
*pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch = value;
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"SetCountersPassedForSuccessfulUpdate days after epoch:" << value);
break;
default:
- LOG4CXX_ERROR(logger_,
- "Unknown counter was requested to set: " << counter);
+ SDL_LOG_ERROR("Unknown counter was requested to set: " << counter);
return false;
}
@@ -1363,7 +1353,7 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate(
}
int CacheManager::DaysBeforeExchange(uint16_t current) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(0);
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -1375,14 +1365,13 @@ int CacheManager::DaysBeforeExchange(uint16_t current) {
}
const uint8_t limit = pt_->policy_table.module_config.exchange_after_x_days;
- LOG4CXX_DEBUG(logger_,
- "Exchange after: " << static_cast<int>(limit) << " days");
+ SDL_LOG_DEBUG("Exchange after: " << static_cast<int>(limit) << " days");
- LOG4CXX_DEBUG(logger_, "Epoch since last update: " << *days_after_epoch);
+ SDL_LOG_DEBUG("Epoch since last update: " << *days_after_epoch);
const uint16_t actual =
std::max(static_cast<uint16_t>(current - *days_after_epoch), uint16_t(0));
- LOG4CXX_DEBUG(logger_, "The days since last update: " << actual);
+ SDL_LOG_DEBUG("The days since last update: " << actual);
return std::max(limit - actual, 0);
}
@@ -1394,7 +1383,7 @@ void CacheManager::IncrementIgnitionCycles() {
*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange);
(*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange) =
ign_val + 1;
- LOG4CXX_DEBUG(logger_, "IncrementIgnitionCycles ignitions:" << ign_val);
+ SDL_LOG_DEBUG("IncrementIgnitionCycles ignitions:" << ign_val);
Backup();
}
@@ -1616,7 +1605,7 @@ void CacheManager::SetHybridAppPreference(
void CacheManager::GetAppServiceParameters(
const std::string& policy_app_id,
policy_table::AppServiceParameters* app_service_parameters) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const policy_table::ApplicationPolicies& policies =
pt_->policy_table.app_policies_section.apps;
policy_table::ApplicationPolicies::const_iterator policy_iter =
@@ -1659,7 +1648,7 @@ const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState()
const boost::optional<std::string>
CacheManager::LockScreenDismissalWarningMessage(
const std::string& language) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
boost::optional<std::string> empty;
CACHE_MANAGER_CHECK(empty);
@@ -1682,7 +1671,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
const std::string& active_hmi_language) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<UserFriendlyMessage> result;
CACHE_MANAGER_CHECK(result);
@@ -1699,23 +1688,20 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
FindLanguage(msg_languages, language);
if (!message_string.is_valid()) {
- LOG4CXX_WARN(logger_,
- "Language "
- << language
- << " haven't been found for message code: " << *it);
+ SDL_LOG_WARN("Language "
+ << language
+ << " haven't been found for message code: " << *it);
policy_table::MessageString active_hmi_language_message_string =
FindLanguage(msg_languages, active_hmi_language);
if (!active_hmi_language_message_string.is_valid()) {
- LOG4CXX_WARN(logger_,
- "Active hmi language "
- << active_hmi_language
- << " haven't been found for message code: " << *it);
+ SDL_LOG_WARN("Active hmi language "
+ << active_hmi_language
+ << " haven't been found for message code: " << *it);
policy_table::MessageString fallback_message_string =
FindLanguage(msg_languages, "en-us");
if (!fallback_message_string.is_valid()) {
- LOG4CXX_ERROR(logger_,
- "No fallback language found for message code: " << *it);
+ SDL_LOG_ERROR("No fallback language found for message code: " << *it);
continue;
}
message_string = fallback_message_string;
@@ -1755,10 +1741,10 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type,
void CacheManager::GetUpdateUrls(const std::string& service_type,
EndpointUrls& out_end_points) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
- LOG4CXX_DEBUG(logger_, "Search service value is: " << service_type);
+ SDL_LOG_DEBUG("Search service value is: " << service_type);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ServiceEndpoints::const_iterator iter =
@@ -1842,7 +1828,7 @@ bool CacheManager::GetPriority(const std::string& policy_app_id,
void CacheManager::CheckSnapshotInitialization() {
CACHE_MANAGER_CHECK_VOID();
if (!snapshot_) {
- LOG4CXX_ERROR(logger_, "Snapshot pointer is not initialized");
+ SDL_LOG_ERROR("Snapshot pointer is not initialized");
return;
}
@@ -1960,15 +1946,14 @@ void CacheManager::CheckSnapshotInitialization() {
policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff(
const policy_table::VehicleDataItems& items_before,
const policy_table::VehicleDataItems& items_after) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (items_before.empty()) {
- LOG4CXX_DEBUG(logger_, "No custom VD items found in policy");
+ SDL_LOG_DEBUG("No custom VD items found in policy");
return policy_table::VehicleDataItems();
}
if (items_after.empty()) {
- LOG4CXX_DEBUG(logger_,
- "All custom VD items were removed after policy update");
+ SDL_LOG_DEBUG("All custom VD items were removed after policy update");
return items_before;
}
@@ -1986,19 +1971,18 @@ policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff(
}
}
- LOG4CXX_DEBUG(logger_,
- "Found " << removed_items.size() << " removed VD items");
+ SDL_LOG_DEBUG("Found " << removed_items.size() << " removed VD items");
return removed_items;
}
void CacheManager::SetRemovedCustomVdItems(
const policy_table::VehicleDataItems& removed_items) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
removed_custom_vd_items_ = removed_items;
}
void CacheManager::PersistData() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (backup_.use_count() != 0) {
if (pt_.use_count() != 0) {
// Comma expression is used to hold the lock only during the constructor
@@ -2058,7 +2042,7 @@ void CacheManager::PersistData() {
#ifdef ENABLE_LOG
policy_table::DeviceData& device_data =
*copy_pt.policy_table.device_data;
- LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size());
+ SDL_LOG_DEBUG("Device_data size is: " << device_data.size());
#endif // ENABLE_LOG
for (; it_device != it_end_device; ++it_device) {
if (is_unpaired_.end() != is_unpaired_.find(it_device->first)) {
@@ -2067,7 +2051,7 @@ void CacheManager::PersistData() {
ex_backup_->SetUnpairedDevice(it_device->first, false);
}
}
- LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size());
+ SDL_LOG_DEBUG("Device_data size is: " << device_data.size());
}
backup_->WriteDb();
}
@@ -2075,14 +2059,14 @@ void CacheManager::PersistData() {
}
void CacheManager::ResetCalculatedPermissions() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(calculated_permissions_lock_);
calculated_permissions_.clear();
}
void CacheManager::ResetCalculatedPermissionsForDevice(
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(calculated_permissions_lock_);
calculated_permissions_.erase(device_id);
}
@@ -2090,9 +2074,8 @@ void CacheManager::ResetCalculatedPermissionsForDevice(
void CacheManager::AddCalculatedPermissions(const std::string& device_id,
const std::string& policy_app_id,
const Permissions& permissions) {
- LOG4CXX_DEBUG(logger_,
- "AddCalculatedPermissions for device: "
- << device_id << " and app: " << policy_app_id);
+ SDL_LOG_DEBUG("AddCalculatedPermissions for device: "
+ << device_id << " and app: " << policy_app_id);
sync_primitives::AutoLock lock(calculated_permissions_lock_);
calculated_permissions_[device_id][policy_app_id] = permissions;
}
@@ -2100,9 +2083,8 @@ void CacheManager::AddCalculatedPermissions(const std::string& device_id,
bool CacheManager::IsPermissionsCalculated(const std::string& device_id,
const std::string& policy_app_id,
Permissions& permission) {
- LOG4CXX_DEBUG(logger_,
- "IsPermissionsCalculated for device: "
- << device_id << " and app: " << policy_app_id);
+ SDL_LOG_DEBUG("IsPermissionsCalculated for device: "
+ << device_id << " and app: " << policy_app_id);
sync_primitives::AutoLock lock(calculated_permissions_lock_);
CalculatedPermissions::const_iterator it =
calculated_permissions_.find(device_id);
@@ -2145,7 +2127,7 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() {
bool CacheManager::GetInitialAppData(const std::string& app_id,
StringArray& nicknames,
StringArray& app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::const_iterator policy_iter =
@@ -2168,7 +2150,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id,
bool CacheManager::GetFunctionalGroupings(
policy_table::FunctionalGroupings& groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
const policy_table::FunctionalGroupings& f_groupings =
@@ -2180,9 +2162,9 @@ bool CacheManager::GetFunctionalGroupings(
int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
- LOG4CXX_DEBUG(logger_, "Application id: " << policy_app_id);
+ SDL_LOG_DEBUG("Application id: " << policy_app_id);
int result = 0;
if (kDeviceId != policy_app_id && !IsApplicationRepresented(policy_app_id)) {
return 0;
@@ -2280,7 +2262,7 @@ int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id,
}
void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
*pt_->policy_table.module_config.preloaded_pt = is_preloaded;
Backup();
}
@@ -2304,7 +2286,7 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version,
}
std::string CacheManager::GetCCPUVersionFromPT() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc::Optional<policy_table::ModuleMeta>& module_meta =
pt_->policy_table.module_meta;
return *(module_meta->ccpu_version);
@@ -2329,7 +2311,7 @@ bool CacheManager::SetSystemLanguage(const std::string& language) {
}
bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames& names) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
rpc::policy_table_interface_base::FunctionalGroupings::iterator iter =
@@ -2354,28 +2336,27 @@ bool CacheManager::CleanupUnpairedDevices() {
sync_primitives::AutoLock lock_unpaired(unpaired_lock_);
UnpairedDevices::iterator iter = is_unpaired_.begin();
UnpairedDevices::const_iterator iter_end = is_unpaired_.end();
- LOG4CXX_DEBUG(logger_, "Is_unpaired size is: " << is_unpaired_.size());
+ SDL_LOG_DEBUG("Is_unpaired size is: " << is_unpaired_.size());
for (; iter != iter_end; ++iter) {
// Delete device
if (!pt_->policy_table.device_data.is_initialized()) {
- LOG4CXX_ERROR(logger_, "Device_data section is not initialized.");
+ SDL_LOG_ERROR("Device_data section is not initialized.");
return false;
}
policy_table::DeviceData& device_data = *pt_->policy_table.device_data;
policy_table::DeviceData::iterator it_device = device_data.find(*iter);
if (device_data.end() == it_device) {
- LOG4CXX_INFO(logger_,
- "No device id "
- << *iter << " had been found in device_data section.");
+ SDL_LOG_INFO("No device id "
+ << *iter << " had been found in device_data section.");
return false;
}
- LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size());
+ SDL_LOG_DEBUG("Device_data size is: " << device_data.size());
device_data.erase(it_device);
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Device id " << *iter << " had been deleted from device_data section.");
- LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size());
+ SDL_LOG_DEBUG("Device_data size is: " << device_data.size());
}
is_unpaired_.clear();
Backup();
@@ -2396,7 +2377,7 @@ void CacheManager::Increment(usage_statistics::GlobalCounterId type) {
++(*pt_->policy_table.usage_and_error_counts->count_of_sync_reboots);
break;
default:
- LOG4CXX_WARN(logger_, "Type global counter is unknown");
+ SDL_LOG_WARN("Type global counter is unknown");
return;
}
Backup();
@@ -2444,7 +2425,7 @@ void CacheManager::Increment(const std::string& app_id,
.count_of_tls_errors;
break;
default:
- LOG4CXX_WARN(logger_, "Type app counter is unknown");
+ SDL_LOG_WARN("Type app counter is unknown");
return;
}
Backup();
@@ -2465,7 +2446,7 @@ void CacheManager::Set(const std::string& app_id,
.app_registration_language_vui = value;
break;
default:
- LOG4CXX_WARN(logger_, "Type app info is unknown");
+ SDL_LOG_WARN("Type app info is unknown");
return;
}
Backup();
@@ -2495,7 +2476,7 @@ void CacheManager::Add(const std::string& app_id,
.minutes_in_hmi_none += minutes;
break;
default:
- LOG4CXX_WARN(logger_, "Type app stopwatch is unknown");
+ SDL_LOG_WARN("Type app stopwatch is unknown");
return;
}
Backup();
@@ -2558,8 +2539,7 @@ bool CacheManager::SetPredataPolicy(const std::string& app_id) {
pt_->policy_table.app_policies_section.apps.find(kPreDataConsentId);
if (pt_->policy_table.app_policies_section.apps.end() == iter) {
- LOG4CXX_ERROR(logger_,
- "Could not set " << kPreDataConsentId
+ SDL_LOG_ERROR("Could not set " << kPreDataConsentId
<< " permissions for app " << app_id);
return false;
}
@@ -2589,20 +2569,18 @@ bool CacheManager::SetUnpairedDevice(const std::string& device_id,
const bool result = pt_->policy_table.device_data->end() !=
pt_->policy_table.device_data->find(device_id);
if (!result) {
- LOG4CXX_DEBUG(logger_,
- "Couldn't set unpaired flag for device id "
- << device_id << " , since it wasn't found.");
+ SDL_LOG_DEBUG("Couldn't set unpaired flag for device id "
+ << device_id << " , since it wasn't found.");
return false;
}
sync_primitives::AutoLock lock(unpaired_lock_);
if (unpaired) {
is_unpaired_.insert(device_id);
- LOG4CXX_DEBUG(logger_, "Unpaired flag was set for device id " << device_id);
+ SDL_LOG_DEBUG("Unpaired flag was set for device id " << device_id);
} else {
is_unpaired_.erase(device_id);
- LOG4CXX_DEBUG(logger_,
- "Unpaired flag was removed for device id " << device_id);
+ SDL_LOG_DEBUG("Unpaired flag was removed for device id " << device_id);
}
return result;
}
@@ -2627,7 +2605,7 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const {
bool CacheManager::Init(const std::string& file_name,
const PolicySettings* settings) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
settings_ = settings;
InitResult init_result = backup_->Init(settings);
ex_backup_ = std::dynamic_pointer_cast<PTExtRepresentation>(backup_);
@@ -2635,7 +2613,7 @@ bool CacheManager::Init(const std::string& file_name,
bool result = true;
switch (init_result) {
case InitResult::EXISTS: {
- LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly.");
+ SDL_LOG_INFO("Policy Table exists, was loaded correctly.");
result = LoadFromBackup();
if (result) {
if (!backup_->IsDBVersionActual()) {
@@ -2651,16 +2629,15 @@ bool CacheManager::Init(const std::string& file_name,
}
} break;
case InitResult::SUCCESS: {
- LOG4CXX_INFO(logger_, "Policy Table was inited successfully");
+ SDL_LOG_INFO("Policy Table was inited successfully");
result = LoadFromFile(file_name, *pt_);
std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot();
result &= snapshot->is_valid();
- LOG4CXX_DEBUG(logger_,
- "Check if snapshot valid: " << std::boolalpha << result);
+ SDL_LOG_DEBUG("Check if snapshot valid: " << std::boolalpha << result);
if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) {
- LOG4CXX_ERROR(logger_, "Cannot unwrap application policies");
+ SDL_LOG_ERROR("Cannot unwrap application policies");
}
if (result) {
@@ -2670,14 +2647,13 @@ bool CacheManager::Init(const std::string& file_name,
} else {
rpc::ValidationReport report("policy_table");
snapshot->ReportErrors(&report);
- LOG4CXX_DEBUG(logger_,
- "Validation report: " << rpc::PrettyFormat(report));
+ SDL_LOG_DEBUG("Validation report: " << rpc::PrettyFormat(report));
ex_backup_->RemoveDB();
}
} break;
default: {
result = false;
- LOG4CXX_ERROR(logger_, "Failed to init policy table.");
+ SDL_LOG_ERROR("Failed to init policy table.");
} break;
}
@@ -2729,11 +2705,11 @@ bool CacheManager::LoadFromBackup() {
bool CacheManager::LoadFromFile(const std::string& file_name,
policy_table::Table& table) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Loading policy table from file " << file_name);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Loading policy table from file " << file_name);
BinaryMessage json_string;
if (!file_system::ReadBinaryFile(file_name, json_string)) {
- LOG4CXX_FATAL(logger_, "Failed to read policy table source file.");
+ SDL_LOG_FATAL("Failed to read policy table source file.");
return false;
}
@@ -2742,20 +2718,18 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
std::string json(json_string.begin(), json_string.end());
if (!reader.parse(json, &value)) {
- LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted.");
+ SDL_LOG_FATAL("Preloaded PT is corrupted.");
return false;
}
- LOG4CXX_DEBUG(logger_,
- "Start verification of policy table loaded from file.");
+ SDL_LOG_DEBUG("Start verification of policy table loaded from file.");
sync_primitives::AutoLock locker(cache_lock_);
table = policy_table::Table(&value);
#ifdef ENABLE_LOG
Json::StreamWriterBuilder writer_builder;
- LOG4CXX_DEBUG(logger_,
- "Policy table content loaded:" << Json::writeString(
+ SDL_LOG_DEBUG("Policy table content loaded:" << Json::writeString(
writer_builder, table.ToJsonValue()));
#endif // ENABLE_LOG
@@ -2764,21 +2738,20 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
if (!table.is_valid()) {
rpc::ValidationReport report("policy_table");
table.ReportErrors(&report);
- LOG4CXX_FATAL(logger_,
- "Parsed table is not valid " << rpc::PrettyFormat(report));
+ SDL_LOG_FATAL("Parsed table is not valid " << rpc::PrettyFormat(report));
return false;
}
return true;
}
bool CacheManager::ResetPT(const std::string& file_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_unpaired_.clear();
backuper_->WaitForBackupIsDone();
if (!backup_->RefreshDB()) {
- LOG4CXX_ERROR(logger_, "Can't re-create policy database. Reset failed.");
+ SDL_LOG_ERROR("Can't re-create policy database. Reset failed.");
return false;
}
@@ -2794,25 +2767,22 @@ bool CacheManager::ResetPT(const std::string& file_name) {
policy::RequestType::State CacheManager::GetAppRequestTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::const_iterator app_policies_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request types for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id);
return policy::RequestType::State::UNAVAILABLE;
}
const policy_table::RequestTypes& request_types =
*app_policies_iter->second.RequestType;
if (!request_types.is_initialized()) {
- LOG4CXX_TRACE(logger_,
- "Request types for " << policy_app_id << " are OMITTED");
+ SDL_LOG_TRACE("Request types for " << policy_app_id << " are OMITTED");
return RequestType::State::OMITTED;
}
if (request_types.empty()) {
- LOG4CXX_TRACE(logger_,
- "Request types for " << policy_app_id << " are EMPTY");
+ SDL_LOG_TRACE("Request types for " << policy_app_id << " are EMPTY");
return policy::RequestType::State::EMPTY;
}
return policy::RequestType::State::AVAILABLE;
@@ -2821,19 +2791,17 @@ policy::RequestType::State CacheManager::GetAppRequestTypesState(
void CacheManager::GetAppRequestTypes(
const std::string& policy_app_id,
std::vector<std::string>& request_types) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
if (kDeviceId == policy_app_id) {
- LOG4CXX_DEBUG(logger_,
- "Request types not applicable for app_id " << kDeviceId);
+ SDL_LOG_DEBUG("Request types not applicable for app_id " << kDeviceId);
return;
}
policy_table::ApplicationPolicies::iterator policy_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request types for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id);
return;
}
if (policy_iter->second.RequestType.is_initialized()) {
@@ -2846,25 +2814,22 @@ void CacheManager::GetAppRequestTypes(
RequestSubType::State CacheManager::GetAppRequestSubTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::const_iterator app_policies_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request subtypes for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id);
return RequestSubType::State::UNAVAILABLE;
}
const policy_table::RequestSubTypes& request_subtypes =
*app_policies_iter->second.RequestSubType;
if (!request_subtypes.is_initialized()) {
- LOG4CXX_TRACE(logger_,
- "Request subtypes for " << policy_app_id << " are OMITTED");
+ SDL_LOG_TRACE("Request subtypes for " << policy_app_id << " are OMITTED");
return RequestSubType::State::OMITTED;
}
if (request_subtypes.empty()) {
- LOG4CXX_TRACE(logger_,
- "Request subtypes for " << policy_app_id << " are EMPTY");
+ SDL_LOG_TRACE("Request subtypes for " << policy_app_id << " are EMPTY");
return RequestSubType::State::EMPTY;
}
return RequestSubType::State::AVAILABLE;
@@ -2873,19 +2838,17 @@ RequestSubType::State CacheManager::GetAppRequestSubTypesState(
void CacheManager::GetAppRequestSubTypes(
const std::string& policy_app_id,
std::vector<std::string>& request_subtypes) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
if (kDeviceId == policy_app_id) {
- LOG4CXX_DEBUG(logger_,
- "Request subtypes not applicable for app_id " << kDeviceId);
+ SDL_LOG_DEBUG("Request subtypes not applicable for app_id " << kDeviceId);
return;
}
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::iterator policy_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request subtypes for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id);
return;
}
@@ -2896,7 +2859,7 @@ void CacheManager::GetAppRequestSubTypes(
}
const MetaInfo CacheManager::GetMetaInfo() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
MetaInfo meta_info;
meta_info.ccpu_version = *pt_->policy_table.module_meta->ccpu_version;
@@ -2916,7 +2879,7 @@ std::string CacheManager::GetCertificate() const {
}
void CacheManager::SetDecryptedCertificate(const std::string& certificate) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
*pt_->policy_table.module_config.certificate = certificate;
@@ -2925,10 +2888,10 @@ void CacheManager::SetDecryptedCertificate(const std::string& certificate) {
bool CacheManager::SetExternalConsentStatus(
const ExternalConsentStatus& status) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
if (status.empty()) {
- LOG4CXX_INFO(logger_, "No ExternalConsent status update.");
+ SDL_LOG_INFO("No ExternalConsent status update.");
return false;
}
@@ -2936,13 +2899,13 @@ bool CacheManager::SetExternalConsentStatus(
}
ExternalConsentStatus CacheManager::GetExternalConsentStatus() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
return ex_backup_->GetExternalConsentStatus();
}
ExternalConsentStatus CacheManager::GetExternalConsentEntities() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
ExternalConsentStatus items;
for (policy_table::FunctionalGroupings::const_iterator it =
@@ -2971,7 +2934,7 @@ ExternalConsentStatus CacheManager::GetExternalConsentEntities() {
GroupsByExternalConsentStatus CacheManager::GetGroupsWithSameEntities(
const ExternalConsentStatus& status) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(policy::GroupsByExternalConsentStatus());
sync_primitives::AutoLock auto_lock(cache_lock_);
GroupsByExternalConsentStatus groups_by_external_consent;
@@ -2985,7 +2948,7 @@ GroupsByExternalConsentStatus CacheManager::GetGroupsWithSameEntities(
}
std::map<std::string, std::string> CacheManager::GetKnownLinksFromPT() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK((std::map<std::string, std::string>()));
std::map<std::string, std::string> links;
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -3026,7 +2989,7 @@ bool CacheManager::ConsentsSame(
void CacheManager::SetExternalConsentForApp(
const PermissionConsent& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ConsentGroups& external_consent_groups =
@@ -3035,7 +2998,7 @@ void CacheManager::SetExternalConsentForApp(
.external_consent_status_groups;
if (ConsentsSame(external_consent_groups, permissions)) {
- LOG4CXX_DEBUG(logger_, "External consents already have same values.");
+ SDL_LOG_DEBUG("External consents already have same values.");
return;
}
@@ -3055,16 +3018,16 @@ void CacheManager::SetExternalConsentForApp(
const date_time::TimeDuration tm = date_time::getCurrentTime();
int64_t current_time_msec = date_time::getmSecs(tm);
app_consent_records.ext_consent_last_updated = current_time_msec;
- LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec);
+ SDL_LOG_DEBUG("Updating consents time " << current_time_msec);
Backup();
}
bool CacheManager::MergePreloadPT(const std::string& file_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::Table table;
if (!LoadFromFile(file_name, table)) {
- LOG4CXX_DEBUG(logger_, "Unable to load preloaded PT.");
+ SDL_LOG_DEBUG("Unable to load preloaded PT.");
return false;
}
@@ -3086,7 +3049,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) {
void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::ModuleConfig copy(pt.module_config);
pt.module_config = new_pt.module_config;
@@ -3097,19 +3060,19 @@ void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::FunctionalGroupings::const_iterator it =
new_pt.functional_groupings.begin();
for (; it != new_pt.functional_groupings.end(); ++it) {
- LOG4CXX_DEBUG(logger_, "Merge functional group: " << it->first);
+ SDL_LOG_DEBUG("Merge functional group: " << it->first);
pt.functional_groupings[it->first] = it->second;
}
}
void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
pt.app_policies_section.device =
const_cast<policy_table::PolicyTable&>(new_pt)
.app_policies_section.device;
@@ -3125,7 +3088,7 @@ void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (new_pt.consumer_friendly_messages.is_initialized()) {
if (!pt.consumer_friendly_messages.is_initialized()) {
pt.consumer_friendly_messages = new_pt.consumer_friendly_messages;
@@ -3136,9 +3099,9 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
pt.consumer_friendly_messages->version =
new_pt.consumer_friendly_messages->version;
for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) {
- LOG4CXX_DEBUG(logger_, "Merge CFM: " << it->first);
+ SDL_LOG_DEBUG("Merge CFM: " << it->first);
if (!(pt.consumer_friendly_messages->messages.is_initialized())) {
- LOG4CXX_DEBUG(logger_, "CFM not initialized.");
+ SDL_LOG_DEBUG("CFM not initialized.");
}
(*pt.consumer_friendly_messages->messages)[it->first] = it->second;
}
@@ -3148,15 +3111,15 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
pt.vehicle_data.assign_if_valid(new_pt.vehicle_data);
}
void CacheManager::InitBackupThread() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
backuper_ = new BackgroundBackuper(this);
backup_thread_ = threads::CreateThread("Backup thread", backuper_);
- backup_thread_->start();
+ backup_thread_->Start();
}
const PolicySettings& CacheManager::get_settings() const {
@@ -3167,7 +3130,7 @@ const PolicySettings& CacheManager::get_settings() const {
void CacheManager::OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
auto device_data = *(pt_->policy_table.device_data);
@@ -3180,12 +3143,11 @@ void CacheManager::OnDeviceSwitching(const std::string& device_id_from,
auto& consents_from = *(from->second.user_consent_records);
auto& consents_to = *(to->second.user_consent_records);
- LOG4CXX_DEBUG(logger_,
- "Merging user consents from device: "
- << device_id_from << " to device: " << device_id_to);
+ SDL_LOG_DEBUG("Merging user consents from device: "
+ << device_id_from << " to device: " << device_id_to);
for (auto f = consents_from.begin(); f != consents_from.end(); ++f) {
const auto app_id = f->first;
- LOG4CXX_DEBUG(logger_, "Updating permissions for key: " << app_id);
+ SDL_LOG_DEBUG("Updating permissions for key: " << app_id);
consents_to[app_id] = f->second;
}
}
@@ -3196,26 +3158,26 @@ CacheManager::BackgroundBackuper::BackgroundBackuper(
, backup_is_in_progress_(false)
, stop_flag_(false)
, new_data_available_(false) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
CacheManager::BackgroundBackuper::~BackgroundBackuper() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void CacheManager::BackgroundBackuper::InternalBackup() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(cache_manager_);
while (new_data_available_) {
new_data_available_ = false;
- LOG4CXX_DEBUG(logger_, "DoBackup");
+ SDL_LOG_DEBUG("DoBackup");
cache_manager_->PersistData();
}
}
void CacheManager::BackgroundBackuper::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(need_backup_lock_);
while (!stop_flag_) {
backup_is_in_progress_.exchange(true);
@@ -3225,7 +3187,7 @@ void CacheManager::BackgroundBackuper::threadMain() {
}
{
- LOG4CXX_DEBUG(logger_, "Backup is done");
+ SDL_LOG_DEBUG("Backup is done");
sync_primitives::AutoLock auto_lock(backup_done_lock_);
backup_is_in_progress_.exchange(false);
backup_done_.Broadcast();
@@ -3235,27 +3197,27 @@ void CacheManager::BackgroundBackuper::threadMain() {
continue;
}
- LOG4CXX_DEBUG(logger_, "Wait for a next backup");
+ SDL_LOG_DEBUG("Wait for a next backup");
backup_notifier_.Wait(need_backup_lock_);
}
}
void CacheManager::BackgroundBackuper::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(need_backup_lock_);
stop_flag_ = true;
backup_notifier_.NotifyOne();
}
void CacheManager::BackgroundBackuper::DoBackup() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(need_backup_lock_);
new_data_available_ = true;
backup_notifier_.NotifyOne();
}
void CacheManager::BackgroundBackuper::WaitForBackupIsDone() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(backup_done_lock_);
if (backup_is_in_progress_) {
backup_done_.Wait(auto_lock);
@@ -3264,7 +3226,7 @@ void CacheManager::BackgroundBackuper::WaitForBackupIsDone() {
EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag(
const std::string& application) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
return pt_->policy_table.app_policies_section.apps[application]
@@ -3273,14 +3235,14 @@ EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag(
EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag(
const std::string& functional_group) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
const auto& functional_groupings = pt_->policy_table.functional_groupings;
const auto& grouping_itr = functional_groupings.find(functional_group);
if (grouping_itr == functional_groupings.end()) {
- LOG4CXX_WARN(logger_, "Group " << functional_group << " not found");
+ SDL_LOG_WARN("Group " << functional_group << " not found");
return rpc::Optional<rpc::Boolean>(rpc::Boolean(false));
}
@@ -3290,14 +3252,13 @@ EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag(
void CacheManager::GetApplicationParams(
const std::string& application_name,
policy_table::ApplicationParams& application_params) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
const auto apps = pt_->policy_table.app_policies_section.apps;
const auto it = apps.find(application_name);
if (apps.end() == it) {
- LOG4CXX_WARN(logger_,
- "Application " << application_name << " was not found");
+ SDL_LOG_WARN("Application " << application_name << " was not found");
return;
}
diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc
index b8bbb1682c..4607c3ca5f 100644
--- a/src/components/policy/policy_external/src/policy_helper.cc
+++ b/src/components/policy/policy_external/src/policy_helper.cc
@@ -44,7 +44,7 @@ namespace custom_str = utils::custom_string;
namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
bool CompareStrings(const StringsValueType& first,
const StringsValueType& second) {
@@ -356,7 +356,7 @@ std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups(
FunctionalGroupNames groups_attributes;
if (!pm_->cache_->GetFunctionalGroupNames(groups_attributes)) {
- LOG4CXX_WARN(logger_, "Can't get functional group names");
+ SDL_LOG_WARN("Can't get functional group names");
return std::vector<FunctionalGroupPermission>();
}
@@ -390,7 +390,7 @@ bool CheckAppPolicy::IsKnownAppication(
bool CheckAppPolicy::IsAppRevoked(
const AppPoliciesValueType& app_policy) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Application params are not initialized = application revoked
// i.e. "123":null
return app_policy.second.is_null();
@@ -427,7 +427,7 @@ void CheckAppPolicy::InsertPermission(const std::string& app_id,
auto result = pm_->app_permissions_diff_.insert(
std::make_pair(app_id, permissions_diff));
if (!result.second) {
- LOG4CXX_ERROR(logger_, "App ID: " << app_id << " already exists in map.");
+ SDL_LOG_ERROR("App ID: " << app_id << " already exists in map.");
}
pm_->app_permissions_diff_lock_.Release();
}
@@ -443,8 +443,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
AppPermissions permissions_diff(app_id);
if (!IsKnownAppication(app_id)) {
- LOG4CXX_WARN(logger_,
- "Application:" << app_id << " is not present in snapshot.");
+ SDL_LOG_WARN("Application:" << app_id << " is not present in snapshot.");
return true;
}
@@ -469,8 +468,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
const bool is_request_type_changed = IsRequestTypeChanged(app_policy);
const bool is_request_subtype_changed = IsRequestSubTypeChanged(app_policy);
if (is_request_type_changed) {
- LOG4CXX_TRACE(logger_,
- "Request types were changed for application: " << app_id);
+ SDL_LOG_TRACE("Request types were changed for application: " << app_id);
SetPendingPermissions(
app_policy, RESULT_REQUEST_TYPE_CHANGED, permissions_diff);
AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED);
@@ -478,8 +476,8 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
(RESULT_NO_CHANGES == result) ? RESULT_REQUEST_TYPE_CHANGED : result;
}
if (is_request_subtype_changed) {
- LOG4CXX_TRACE(
- logger_, "Request subtypes were changed for application: " << app_id);
+ SDL_LOG_TRACE(
+ "Request subtypes were changed for application: " << app_id);
SetPendingPermissions(
app_policy, RESULT_REQUEST_SUBTYPE_CHANGED, permissions_diff);
AddResult(app_id, RESULT_REQUEST_SUBTYPE_CHANGED);
@@ -489,16 +487,14 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
}
if (RESULT_NO_CHANGES == result) {
- LOG4CXX_INFO(
- logger_,
- "Permissions for application:" << app_id << " wasn't changed.");
+ SDL_LOG_INFO("Permissions for application:" << app_id
+ << " wasn't changed.");
AddResult(app_id, result);
return true;
}
- LOG4CXX_INFO(
- logger_,
- "Permissions for application:" << app_id << " have been changed.");
+ SDL_LOG_INFO("Permissions for application:" << app_id
+ << " have been changed.");
if (!IsPredefinedApp(app_policy)) {
SetPendingPermissions(app_policy, result, permissions_diff);
@@ -677,7 +673,7 @@ bool CheckAppPolicy::IsRequestSubTypeChanged(
bool CheckAppPolicy::IsAppPropertiesProvided(
const AppPoliciesValueType& app_policy) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app_policy.second.hybrid_app_preference.is_initialized() ||
app_policy.second.endpoint.is_initialized() ||
app_policy.second.enabled.is_initialized() ||
@@ -691,15 +687,15 @@ bool CheckAppPolicy::IsAppPropertiesProvided(
bool CheckAppPolicy::IsAppPropertiesChanged(
const AppPoliciesValueType& app_policy) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!IsAppPropertiesProvided(app_policy)) {
return false;
}
if (!IsKnownAppication(app_policy.first)) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"AppProperties provided for new application: " << app_policy.first);
return true;
}
@@ -710,33 +706,33 @@ bool CheckAppPolicy::IsAppPropertiesChanged(
if (app_policy.second.enabled.is_initialized() &&
app_policy.second.enabled != snapshot_properties.second.enabled) {
- LOG4CXX_DEBUG(logger_, "\"enabled\" was changed");
+ SDL_LOG_DEBUG("\"enabled\" was changed");
return true;
}
if (app_policy.second.endpoint.is_initialized() &&
app_policy.second.endpoint != snapshot_properties.second.endpoint) {
- LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed");
+ SDL_LOG_DEBUG("\"endpoint\" was changed");
return true;
}
if (app_policy.second.hybrid_app_preference.is_initialized() &&
app_policy.second.hybrid_app_preference !=
snapshot_properties.second.hybrid_app_preference) {
- LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed");
+ SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed");
return true;
}
if (app_policy.second.auth_token.is_initialized() &&
app_policy.second.auth_token != snapshot_properties.second.auth_token) {
- LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed");
+ SDL_LOG_DEBUG("\"auth_token\" was changed");
return true;
}
if (app_policy.second.cloud_transport_type.is_initialized() &&
app_policy.second.cloud_transport_type !=
snapshot_properties.second.cloud_transport_type) {
- LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed");
+ SDL_LOG_DEBUG("\"cloud_transport_type\" was changed");
return true;
}
@@ -745,14 +741,14 @@ bool CheckAppPolicy::IsAppPropertiesChanged(
bool CheckAppPolicy::IsEncryptionRequiredFlagChanged(
const AppPoliciesValueType& app_policy) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto get_app_encryption_needed =
[](const std::string& policy_app_id,
policy_table::ApplicationPolicies& policies)
-> rpc::Optional<rpc::Boolean> {
auto it = policies.find(policy_app_id);
if (policies.end() == it) {
- LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ SDL_LOG_WARN("App is not present in policies" << policy_app_id);
return rpc::Optional<rpc::Boolean>(false);
}
return it->second.encryption_required;
@@ -764,7 +760,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged(
policy_table::Strings result;
auto it = policies.find(policy_app_id);
if (policies.end() == it) {
- LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ SDL_LOG_WARN("App is not present in policies" << policy_app_id);
return result;
}
auto& groups = it->second.groups;
@@ -1193,7 +1189,7 @@ void FillFunctionalGroupPermissions(
FunctionalGroupNames& names,
GroupConsent state,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupIDs::const_iterator it = ids.begin();
FunctionalGroupIDs::const_iterator it_end = ids.end();
for (; it != it_end; ++it) {
@@ -1213,7 +1209,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) {
FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
const FunctionalGroupIDs& what) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupIDs from_copy(from);
FunctionalGroupIDs what_copy(what);
@@ -1235,7 +1231,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
const FunctionalGroupIDs& second) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupIDs first_copy(first);
FunctionalGroupIDs second_copy(second);
@@ -1257,7 +1253,7 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first,
const FunctionalGroupIDs& second) {
- LOG4CXX_INFO(logger_, "Find same groups");
+ SDL_LOG_INFO("Find same groups");
FunctionalGroupIDs first_copy(first);
FunctionalGroupIDs second_copy(second);
@@ -1281,7 +1277,7 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) {
policy_table::ApplicationPolicies::iterator it_default =
app_policies.find(kDefaultId);
if (app_policies.end() == it_default) {
- LOG4CXX_ERROR(logger_, "No default application policy found in PTU.");
+ SDL_LOG_ERROR("No default application policy found in PTU.");
return false;
}
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 7314fc040d..773c689409 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -202,7 +202,7 @@ struct GroupSorter
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
PolicyManagerImpl::PolicyManagerImpl()
: PolicyManager()
@@ -253,15 +253,14 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse(
}
void PolicyManagerImpl::CheckTriggers() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool exceed_ignition_cycles = ExceededIgnitionCycles();
const bool exceed_days = ExceededDays();
- LOG4CXX_DEBUG(
- logger_,
- "\nDays exceeded: " << std::boolalpha << exceed_days
- << "\nIgnition cycles exceeded: " << std::boolalpha
- << exceed_ignition_cycles);
+ SDL_LOG_DEBUG("\nDays exceeded: " << std::boolalpha << exceed_days
+ << "\nIgnition cycles exceeded: "
+ << std::boolalpha
+ << exceed_ignition_cycles);
if (exceed_ignition_cycles || exceed_days) {
update_status_manager_.ScheduleUpdate();
@@ -464,15 +463,15 @@ void FilterPolicyTable(
PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
const std::string& file, const BinaryMessage& pt_content) {
- LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size());
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_INFO("LoadPT of size " << pt_content.size());
+ SDL_LOG_DEBUG(
+
"PTU content is: " << std::string(pt_content.begin(), pt_content.end()));
// Parse message into table struct
std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content);
if (!pt_update) {
- LOG4CXX_WARN(logger_, "Parsed table pointer is NULL.");
+ SDL_LOG_WARN("Parsed table pointer is NULL.");
return PtProcessingResult::kWrongPtReceived;
}
@@ -481,7 +480,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
FilterPolicyTable(pt_update->policy_table, current_vd_items);
if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) {
- LOG4CXX_WARN(logger_, "Received policy table update is not valid");
+ SDL_LOG_WARN("Received policy table update is not valid");
return PtProcessingResult::kWrongPtReceived;
}
@@ -491,8 +490,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
// Get current DB data, since it could be updated during awaiting of PTU
auto policy_table_snapshot = cache_->GenerateSnapshot();
if (!policy_table_snapshot) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed to create snapshot of policy table, trying another exchange");
return PtProcessingResult::kNewPtRequired;
}
@@ -507,8 +506,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
// Replace current data with updated
if (!cache_->ApplyUpdate(*pt_update)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Unsuccessful save of updated policy table, trying another exchange");
return PtProcessingResult::kNewPtRequired;
}
@@ -531,10 +530,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
std::map<std::string, StringArray> app_hmi_types;
cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
if (!app_hmi_types.empty()) {
- LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
+ SDL_LOG_INFO("app_hmi_types is full calling OnUpdateHMIAppType");
listener_->OnUpdateHMIAppType(app_hmi_types);
} else {
- LOG4CXX_INFO(logger_, "app_hmi_types empty");
+ SDL_LOG_INFO("app_hmi_types empty");
}
std::vector<std::string> enabled_apps;
@@ -547,11 +546,11 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
}
void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ptu_requested_ = false;
if (PtProcessingResult::kWrongPtReceived == ptu_result) {
- LOG4CXX_DEBUG(logger_, "Wrong PT was received");
+ SDL_LOG_DEBUG("Wrong PT was received");
update_status_manager_.OnWrongUpdateReceived();
return;
}
@@ -561,7 +560,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
if (HasApplicationForPTU()) {
update_status_manager_.OnExistedApplicationAdded(true);
} else if (PtProcessingResult::kNewPtRequired == ptu_result) {
- LOG4CXX_DEBUG(logger_, "New PTU interation is required");
+ SDL_LOG_DEBUG("New PTU interation is required");
ForcePTExchange();
return;
}
@@ -571,8 +570,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
// If there was a user request for policy table update, it should be started
// right after current update is finished
if (update_status_manager_.IsUpdateRequired()) {
- LOG4CXX_DEBUG(logger_,
- "PTU was successful and new PTU iteration was scheduled");
+ SDL_LOG_DEBUG("PTU was successful and new PTU iteration was scheduled");
StartPTExchange();
return;
}
@@ -583,7 +581,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
const std::shared_ptr<policy_table::Table> pt_update,
const std::shared_ptr<policy_table::Table> snapshot) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Replace predefined policies with its actual setting, e.g. "123":"default"
// to actual values of default section
@@ -668,13 +666,13 @@ void PolicyManagerImpl::PrepareNotificationData(
const policy_table::Strings& group_names,
const std::vector<FunctionalGroupPermission>& group_permission,
Permissions& notification_data) {
- LOG4CXX_INFO(logger_, "Preparing data for notification.");
+ SDL_LOG_INFO("Preparing data for notification.");
ProcessFunctionalGroup processor(groups, group_permission, notification_data);
std::for_each(group_names.begin(), group_names.end(), processor);
}
std::string PolicyManagerImpl::GetUpdateUrl(int service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
EndpointUrls urls;
GetUpdateUrls(service_type, urls);
@@ -689,28 +687,28 @@ std::string PolicyManagerImpl::GetUpdateUrl(int service_type) {
++index;
} else {
- LOG4CXX_ERROR(logger_, "The endpoint entry is empty");
+ SDL_LOG_ERROR("The endpoint entry is empty");
}
return url;
}
void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type,
EndpointUrls& out_end_points) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type,
EndpointUrls& out_end_points) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyManagerImpl::RequestPTUpdate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::shared_ptr<policy_table::Table> policy_table_snapshot =
cache_->GenerateSnapshot();
if (!policy_table_snapshot) {
- LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table");
+ SDL_LOG_ERROR("Failed to create snapshot of policy table");
return;
}
@@ -720,19 +718,19 @@ void PolicyManagerImpl::RequestPTUpdate() {
writer_builder["indentation"] = "";
std::string message_string = Json::writeString(writer_builder, value);
- LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string);
+ SDL_LOG_DEBUG("Snapshot contents is : " << message_string);
BinaryMessage update(message_string.begin(), message_string.end());
ptu_requested_ = true;
listener_->OnSnapshotCreated(
update, RetrySequenceDelaysSeconds(), TimeoutExchangeMSec());
} else {
- LOG4CXX_ERROR(logger_, "Invalid Policy table snapshot - PTUpdate failed");
+ SDL_LOG_ERROR("Invalid Policy table snapshot - PTUpdate failed");
}
}
void PolicyManagerImpl::StartPTExchange() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (ignition_check) {
CheckTriggers();
@@ -741,9 +739,9 @@ void PolicyManagerImpl::StartPTExchange() {
if (update_status_manager_.IsAppsSearchInProgress() &&
update_status_manager_.IsUpdateRequired()) {
- LOG4CXX_INFO(logger_,
- "Starting exchange skipped, since applications "
- "search is in progress.");
+ SDL_LOG_INFO(
+ "Starting exchange skipped, since applications "
+ "search is in progress.");
return;
}
@@ -751,29 +749,29 @@ void PolicyManagerImpl::StartPTExchange() {
if (trigger_ptu_) {
update_status_manager_.ScheduleUpdate();
}
- LOG4CXX_INFO(logger_,
- "Starting exchange skipped, since another exchange "
- "is in progress.");
+ SDL_LOG_INFO(
+ "Starting exchange skipped, since another exchange "
+ "is in progress.");
return;
}
- LOG4CXX_INFO(logger_, "Policy want to call RequestPTUpdate");
+ SDL_LOG_INFO("Policy want to call RequestPTUpdate");
if (listener_) {
- LOG4CXX_INFO(logger_, "Listener CanUpdate");
+ SDL_LOG_INFO("Listener CanUpdate");
if (update_status_manager_.IsUpdateRequired()) {
update_status_manager_.PendingUpdate();
- LOG4CXX_INFO(logger_, "IsUpdateRequired");
+ SDL_LOG_INFO("IsUpdateRequired");
RequestPTUpdate();
}
}
}
void PolicyManagerImpl::OnAppsSearchStarted() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.OnAppsSearchStarted();
}
void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.OnAppsSearchCompleted();
trigger_ptu_ = trigger_ptu;
@@ -802,13 +800,13 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes(
RequestType::State PolicyManagerImpl::GetAppRequestTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetAppRequestTypesState(policy_app_id);
}
RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetAppRequestSubTypesState(policy_app_id);
}
@@ -890,7 +888,7 @@ void PolicyManagerImpl::GetAppServiceParameters(
bool PolicyManagerImpl::UnknownRPCPassthroughAllowed(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->UnknownRPCPassthroughAllowed(policy_app_id);
}
@@ -900,18 +898,15 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) {
- LOG4CXX_INFO(logger_,
- "CheckPermissions for " << app_id << " and rpc " << rpc
+ SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc
<< " for " << hmi_level << " level.");
Permissions rpc_permissions;
// Check, if there are calculated permission present in cache
if (!cache_->IsPermissionsCalculated(device_id, app_id, rpc_permissions)) {
- LOG4CXX_DEBUG(logger_,
- "IsPermissionsCalculated for device: "
- << device_id << " and app: " << app_id
- << " returns false");
+ SDL_LOG_DEBUG("IsPermissionsCalculated for device: "
+ << device_id << " and app: " << app_id << " returns false");
// Get actual application group permission according to user consents
std::vector<FunctionalGroupPermission> app_group_permissions;
GetPermissionsForApp(device_id, app_id, app_group_permissions);
@@ -934,10 +929,8 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
cache_->AddCalculatedPermissions(device_id, app_id, rpc_permissions);
} else {
- LOG4CXX_DEBUG(logger_,
- "IsPermissionsCalculated for device: "
- << device_id << " and app: " << app_id
- << " returns true");
+ SDL_LOG_DEBUG("IsPermissionsCalculated for device: "
+ << device_id << " and app: " << app_id << " returns true");
}
if (cache_->IsApplicationRevoked(app_id)) {
@@ -952,7 +945,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
}
const bool known_rpc = rpc_permissions.end() != rpc_permissions.find(rpc);
- LOG4CXX_DEBUG(logger_, "Is known rpc " << (known_rpc ? "true" : "false"));
+ SDL_LOG_DEBUG("Is known rpc " << (known_rpc ? "true" : "false"));
if (!known_rpc) {
// RPC not found in list == disallowed by backend
result.hmi_level_permitted = kRpcDisallowed;
@@ -974,20 +967,19 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
rpc_permissions[rpc].hmi_permissions[kUserDisallowedKey].find(
hmi_level)) {
// RPC found in allowed == allowed by backend, but disallowed by user
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"RPC found in allowed == allowed by backend, but disallowed by user");
result.hmi_level_permitted = kRpcUserDisallowed;
} else {
- LOG4CXX_DEBUG(logger_,
- "HMI level " << hmi_level << " wasn't found "
+ SDL_LOG_DEBUG("HMI level " << hmi_level << " wasn't found "
<< " for rpc " << rpc << " and appID "
<< app_id);
return;
}
if (kRpcAllowed != result.hmi_level_permitted) {
- LOG4CXX_DEBUG(logger_, "RPC is not allowed. Stop parameters processing.");
+ SDL_LOG_DEBUG("RPC is not allowed. Stop parameters processing.");
result.list_of_allowed_params =
rpc_permissions[rpc].parameter_permissions[kAllowedKey];
@@ -1003,7 +995,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
// permissions, so that flag is processed first
if (rpc_permissions[rpc]
.parameter_permissions.any_parameter_disallowed_by_user) {
- LOG4CXX_DEBUG(logger_, "All parameters are disallowed by user.");
+ SDL_LOG_DEBUG("All parameters are disallowed by user.");
result.list_of_disallowed_params = rpc_params;
result.hmi_level_permitted = kRpcUserDisallowed;
return;
@@ -1011,14 +1003,14 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
if (rpc_permissions[rpc]
.parameter_permissions.any_parameter_disallowed_by_policy) {
- LOG4CXX_DEBUG(logger_, "All parameters are disallowed by policy.");
+ SDL_LOG_DEBUG("All parameters are disallowed by policy.");
result.list_of_undefined_params = rpc_params;
result.hmi_level_permitted = kRpcDisallowed;
return;
}
if (rpc_permissions[rpc].parameter_permissions.any_parameter_allowed) {
- LOG4CXX_DEBUG(logger_, "All parameters are allowed.");
+ SDL_LOG_DEBUG("All parameters are allowed.");
result.list_of_allowed_params = rpc_params;
return;
}
@@ -1041,8 +1033,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
RPCParams::const_iterator end = rpc_params.end();
for (; end != parameter; ++parameter) {
if (!result.HasParameter(*parameter)) {
- LOG4CXX_DEBUG(logger_,
- "Parameter " << *parameter
+ SDL_LOG_DEBUG("Parameter " << *parameter
<< " is unknown."
" Adding to undefined list.");
result.list_of_undefined_params.insert(*parameter);
@@ -1050,10 +1041,10 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
}
if (result.DisallowedInclude(rpc_params)) {
- LOG4CXX_DEBUG(logger_, "All parameters are disallowed.");
+ SDL_LOG_DEBUG("All parameters are disallowed.");
result.hmi_level_permitted = kRpcUserDisallowed;
} else if (!result.IsAnyAllowed(rpc_params)) {
- LOG4CXX_DEBUG(logger_, "There are no parameters allowed.");
+ SDL_LOG_DEBUG("There are no parameters allowed.");
if (!result.list_of_undefined_params.empty()) {
result.hmi_level_permitted = kRpcAllowed;
@@ -1079,12 +1070,12 @@ policy_table::Strings PolicyManagerImpl::GetGroupsNames(
void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
const std::string& device_id, const std::string& application_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (device_id.empty()) {
- LOG4CXX_WARN(logger_,
- "Couldn't find device info for application id "
- "'" << application_id
- << "'");
+ SDL_LOG_WARN(
+ "Couldn't find device info for application id "
+ "'"
+ << application_id << "'");
return;
}
@@ -1102,8 +1093,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
app_group_permissions,
notification_data);
- LOG4CXX_INFO(logger_,
- "Send notification for application_id:" << application_id);
+ SDL_LOG_INFO("Send notification for application_id:" << application_id);
const ApplicationOnDevice who = {device_id, application_id};
if (access_remote_->IsAppRemoteControl(who)) {
@@ -1120,27 +1110,27 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
}
bool PolicyManagerImpl::CleanupUnpairedDevices() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->CleanupUnpairedDevices();
}
DeviceConsent PolicyManagerImpl::GetUserConsentForDevice(
const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetDeviceConsent(device_id);
}
void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
const bool is_allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device :" << device_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device :" << device_id);
cache_->SetDeviceConsent(device_id, is_allowed);
if (listener_) {
listener_->OnDeviceConsentChanged(device_id, is_allowed);
} else {
- LOG4CXX_WARN(logger_,
- "Event listener is not initialized. "
- "Can't call OnDeviceConsentChanged");
+ SDL_LOG_WARN(
+ "Event listener is not initialized. "
+ "Can't call OnDeviceConsentChanged");
}
if (is_allowed && listener_->CanUpdate()) {
update_status_manager_.OnDeviceConsented();
@@ -1194,7 +1184,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp(
bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id,
StringArray* nicknames,
StringArray* app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool result = nicknames && app_hmi_types;
if (result) {
cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types);
@@ -1204,23 +1194,23 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id,
void PolicyManagerImpl::AddDevice(const std::string& device_id,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device: " << device_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device: " << device_id);
if (!cache_->AddDevice(device_id, connection_type)) {
- LOG4CXX_WARN(logger_, "Can't add device.");
+ SDL_LOG_WARN("Can't add device.");
}
}
void PolicyManagerImpl::OnLocalAppAdded() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.ScheduleUpdate();
StartPTExchange();
}
void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id,
const DeviceInfo& device_info) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device :" << device_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device :" << device_id);
if (!cache_->SetDeviceData(device_id,
device_info.hardware,
device_info.firmware_rev,
@@ -1229,7 +1219,7 @@ void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id,
device_info.carrier,
device_info.max_number_rfcom_ports,
device_info.connection_type)) {
- LOG4CXX_WARN(logger_, "Can't set device data.");
+ SDL_LOG_WARN("Can't set device data.");
}
}
@@ -1270,19 +1260,18 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent(
void PolicyManagerImpl::CheckPendingPermissionsChanges(
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& current_permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(app_permissions_diff_lock_);
PendingPermissions::iterator it_pending =
app_permissions_diff_.find(policy_app_id);
if (app_permissions_diff_.end() == it_pending) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"No pending permissions had been found for appID: " << policy_app_id);
return;
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Pending permissions had been found for appID: " << policy_app_id);
// Change appPermissionsConsentNeeded depending on unconsented groups
@@ -1294,16 +1283,16 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges(
for (; it_groups != it_end_groups; ++it_groups) {
if (policy::kGroupUndefined == it_groups->state) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Unconsented groups still present for appID: " << policy_app_id);
it_pending->second.appPermissionsConsentNeeded = true;
return;
}
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Unconsented groups not present anymore for appID: " << policy_app_id);
it_pending->second.appPermissionsConsentNeeded = false;
return;
@@ -1313,7 +1302,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges(
const std::string& device_id,
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& app_group_permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Get current functional groups from DB with RPC permissions
policy_table::FunctionalGroupings functional_groups;
cache_->GetFunctionalGroupings(functional_groups);
@@ -1331,7 +1320,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges(
void PolicyManagerImpl::SetUserConsentForApp(
const PermissionConsent& permissions, const NotificationMode mode) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->ResetCalculatedPermissions();
PermissionConsent verified_permissions =
@@ -1340,20 +1329,19 @@ void PolicyManagerImpl::SetUserConsentForApp(
bool app_permissions_changed = false;
if (!cache_->SetUserPermissionsForApp(verified_permissions,
&app_permissions_changed)) {
- LOG4CXX_WARN(logger_, "Can't set user permissions for application.");
+ SDL_LOG_WARN("Can't set user permissions for application.");
return;
}
if (kSilentMode == mode) {
- LOG4CXX_WARN(logger_,
- "Silent mode is enabled. Application won't be informed.");
+ SDL_LOG_WARN("Silent mode is enabled. Application won't be informed.");
return;
}
if (!app_permissions_changed) {
- LOG4CXX_WARN(logger_,
- "Application already has same consents. "
- "Notificaton won't be sent.");
+ SDL_LOG_WARN(
+ "Application already has same consents. "
+ "Notificaton won't be sent.");
return;
}
@@ -1371,30 +1359,28 @@ void PolicyManagerImpl::SetUserConsentForApp(
}
bool PolicyManagerImpl::IsAllowedRetryCountExceeded() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
return retry_sequence_index_ >= retry_sequence_seconds_.size();
}
void PolicyManagerImpl::IncrementRetryIndex() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
if (!is_ptu_in_progress_) {
- LOG4CXX_TRACE(logger_,
- "First PTU iteration, skipping incrementing retry index");
+ SDL_LOG_TRACE("First PTU iteration, skipping incrementing retry index");
is_ptu_in_progress_ = true;
return;
}
++retry_sequence_index_;
- LOG4CXX_DEBUG(logger_,
- "current retry_sequence_index_ is: " << retry_sequence_index_);
+ SDL_LOG_DEBUG("current retry_sequence_index_ is: " << retry_sequence_index_);
}
void PolicyManagerImpl::RetrySequenceFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
listener_->OnPTUFinished(false);
ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
@@ -1407,7 +1393,7 @@ void PolicyManagerImpl::RetrySequenceFailed() {
}
void PolicyManagerImpl::ResetTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (update_status_manager_.IsUpdatePending()) {
uint32_t update_timeout = TimeoutExchangeMSec();
update_status_manager_.ResetTimeout(update_timeout);
@@ -1415,14 +1401,14 @@ void PolicyManagerImpl::ResetTimeout() {
}
void PolicyManagerImpl::OnSystemRequestReceived() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
IncrementRetryIndex();
}
bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id,
const std::string& policy_app_id,
std::string* default_hmi) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceConsent device_consent = GetUserConsentForDevice(device_id);
const std::string app_id = policy::kDeviceAllowed != device_consent
? kPreDataConsentId
@@ -1432,9 +1418,9 @@ bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id,
bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id,
std::string* priority) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!priority) {
- LOG4CXX_WARN(logger_, "Input priority parameter is null.");
+ SDL_LOG_WARN("Input priority parameter is null.");
return false;
}
@@ -1453,12 +1439,11 @@ void PolicyManagerImpl::GetUserConsentForApp(
const std::string& device_id,
const std::string& policy_app_id,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalIdType group_types;
if (!cache_->GetPermissionsForApp(device_id, policy_app_id, group_types)) {
- LOG4CXX_WARN(logger_,
- "Can't get user permissions for app " << policy_app_id);
+ SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id);
return;
}
@@ -1466,7 +1451,7 @@ void PolicyManagerImpl::GetUserConsentForApp(
// automatically allowed and it could not be changed by user
FunctionalGroupNames group_names;
if (!cache_->GetFunctionalGroupNames(group_names)) {
- LOG4CXX_WARN(logger_, "Can't get functional group names");
+ SDL_LOG_WARN("Can't get functional group names");
return;
}
@@ -1516,12 +1501,11 @@ void PolicyManagerImpl::GetPermissionsForApp(
const std::string& device_id,
const std::string& policy_app_id,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string app_id_to_check = policy_app_id;
if (!cache_->IsApplicationRepresented(policy_app_id)) {
- LOG4CXX_WARN(logger_,
- "Application with id " << policy_app_id
+ SDL_LOG_WARN("Application with id " << policy_app_id
<< " is not found within known apps.");
return;
}
@@ -1544,8 +1528,7 @@ void PolicyManagerImpl::GetPermissionsForApp(
cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types);
if (!ret) {
- LOG4CXX_WARN(logger_,
- "Can't get user permissions for app " << policy_app_id);
+ SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id);
return;
}
@@ -1553,14 +1536,14 @@ void PolicyManagerImpl::GetPermissionsForApp(
// automatically allowed and it could not be changed by user
FunctionalGroupNames group_names;
if (!cache_->GetFunctionalGroupNames(group_names)) {
- LOG4CXX_WARN(logger_, "Can't get functional group names");
+ SDL_LOG_WARN("Can't get functional group names");
return;
}
// The "default" and "pre_DataConsent" are auto-allowed groups
// So, check if application in the one of these mode.
if (allowed_by_default) {
- LOG4CXX_INFO(logger_, "Get auto allowed groups");
+ SDL_LOG_INFO("Get auto allowed groups");
GroupType type =
(kDefaultId == app_id_to_check ? kTypeDefault : kTypePreDataConsented);
@@ -1619,7 +1602,7 @@ void PolicyManagerImpl::GetPermissionsForApp(
std::string& PolicyManagerImpl::GetCurrentDeviceId(
const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const {
- LOG4CXX_INFO(logger_, "GetDeviceInfo");
+ SDL_LOG_INFO("GetDeviceInfo");
last_device_id_ =
listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id);
return last_device_id_;
@@ -1630,25 +1613,25 @@ void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {
}
void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetPreloadedPtFlag(is_preloaded);
}
void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetCCPUVersionFromPT();
}
uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority,
const bool is_subtle) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetNotificationsNumber(priority, is_subtle);
}
@@ -1661,10 +1644,10 @@ bool PolicyManagerImpl::IsPTValid(
policy_table::PolicyTableType type) const {
policy_table->SetPolicyTableType(type);
if (!policy_table->is_valid()) {
- LOG4CXX_ERROR(logger_, "Policy table is not valid.");
+ SDL_LOG_ERROR("Policy table is not valid.");
rpc::ValidationReport report("policy_table");
policy_table->ReportErrors(&report);
- LOG4CXX_DEBUG(logger_, "Errors: " << rpc::PrettyFormat(report));
+ SDL_LOG_DEBUG("Errors: " << rpc::PrettyFormat(report));
return false;
}
return true;
@@ -1685,12 +1668,12 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent(
const GroupsNames& allowed_groups,
const GroupsNames& disallowed_groups,
const ConsentProcessingPolicy processing_policy) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (allowed_groups.empty() && disallowed_groups.empty()) {
- LOG4CXX_DEBUG(logger_,
- "Allowed and disallowed groups are empty, skipping update by "
- "external user consent.");
+ SDL_LOG_DEBUG(
+ "Allowed and disallowed groups are empty, skipping update by "
+ "external user consent.");
return;
}
@@ -1733,12 +1716,12 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent(
void PolicyManagerImpl::SendOnAppPropertiesChangeNotification(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
listener_->SendOnAppPropertiesChangeNotification(policy_app_id);
}
void PolicyManagerImpl::ResumePendingAppPolicyActions() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (auto& notify_system_params : notify_system_list_) {
NotifySystem(notify_system_params.first, notify_system_params.second);
@@ -1768,8 +1751,7 @@ void PolicyManagerImpl::SendPermissionsToApp(
const std::string app_id = app_policy.first;
if (device_id.empty()) {
- LOG4CXX_WARN(logger_,
- "Couldn't find device info for application id: " << app_id);
+ SDL_LOG_WARN("Couldn't find device info for application id: " << app_id);
return;
}
std::vector<FunctionalGroupPermission> group_permissons;
@@ -1787,7 +1769,7 @@ void PolicyManagerImpl::SendPermissionsToApp(
group_permissons,
notification_data);
- LOG4CXX_INFO(logger_, "Send notification for application_id: " << app_id);
+ SDL_LOG_INFO("Send notification for application_id: " << app_id);
listener()->OnPermissionsUpdated(
device_id,
app_id,
@@ -1834,7 +1816,7 @@ bool ConsentStatusComparatorFunc(const ExternalConsentStatusItem& i1,
bool PolicyManagerImpl::IsNeedToUpdateExternalConsentStatus(
const ExternalConsentStatus& new_status) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
typedef std::vector<ExternalConsentStatusItem> ItemV;
const ExternalConsentStatus existing_status =
cache_->GetExternalConsentEntities();
@@ -1859,15 +1841,15 @@ bool PolicyManagerImpl::IsNeedToUpdateExternalConsentStatus(
bool PolicyManagerImpl::SetExternalConsentStatus(
const ExternalConsentStatus& status) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (status.empty()) {
- LOG4CXX_INFO(logger_, "External consent status is empty, skipping update.");
+ SDL_LOG_INFO("External consent status is empty, skipping update.");
return false;
}
if (!cache_->SetExternalConsentStatus(status)) {
- LOG4CXX_WARN(logger_, "Can't set external user consent status.");
+ SDL_LOG_WARN("Can't set external user consent status.");
return false;
}
@@ -1880,7 +1862,7 @@ bool PolicyManagerImpl::SetExternalConsentStatus(
}
ExternalConsentStatus PolicyManagerImpl::GetExternalConsentStatus() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetExternalConsentStatus();
}
@@ -1888,7 +1870,7 @@ void PolicyManagerImpl::CalculateGroupsConsentFromExternalConsent(
const GroupsByExternalConsentStatus& groups_by_external_consent,
GroupsNames& out_allowed_groups,
GroupsNames& out_disallowed_groups) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
GroupSorter sorter(out_allowed_groups, out_disallowed_groups);
std::for_each(groups_by_external_consent.begin(),
groups_by_external_consent.end(),
@@ -1906,7 +1888,7 @@ void PolicyManagerImpl::CalculateGroupsConsentFromExternalConsent(
}
bool PolicyManagerImpl::ExceededDays() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
date_time::TimeDuration current_time = date_time::getCurrentTime();
const int kSecondsInDay = 60 * 60 * 24;
@@ -1915,16 +1897,16 @@ bool PolicyManagerImpl::ExceededDays() {
DCHECK(std::numeric_limits<uint16_t>::max() >= days);
if (std::numeric_limits<uint16_t>::max() <= days) {
- LOG4CXX_WARN(logger_, "The days since epoch exceeds maximum value.");
+ SDL_LOG_WARN("The days since epoch exceeds maximum value.");
return false;
}
return 0 == cache_->DaysBeforeExchange(static_cast<uint16_t>(days));
}
void PolicyManagerImpl::KmsChanged(int kilometers) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (0 == cache_->KilometersBeforeExchange(kilometers)) {
- LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update.");
+ SDL_LOG_INFO("Enough kilometers passed to send for PT update.");
update_status_manager_.ScheduleUpdate();
StartPTExchange();
PTUpdatedAt(KILOMETERS, kilometers);
@@ -1933,14 +1915,14 @@ void PolicyManagerImpl::KmsChanged(int kilometers) {
const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->LockScreenDismissalEnabledState();
}
const boost::optional<std::string>
PolicyManagerImpl::LockScreenDismissalWarningMessage(
const std::string& language) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->LockScreenDismissalWarningMessage(language);
}
@@ -1955,7 +1937,7 @@ std::string PolicyManagerImpl::ForcePTExchange() {
}
void policy::PolicyManagerImpl::StopRetrySequence() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (cache_->UpdateRequired()) {
ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
@@ -1963,7 +1945,7 @@ void policy::PolicyManagerImpl::StopRetrySequence() {
}
std::string PolicyManagerImpl::ForcePTExchangeAtUserRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.ScheduleManualUpdate();
StartPTExchange();
return update_status_manager_.StringifiedUpdateStatus();
@@ -1975,7 +1957,7 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const {
int PolicyManagerImpl::NextRetryTimeout() {
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
- LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_);
+ SDL_LOG_DEBUG("Index: " << retry_sequence_index_);
int next = 0;
if (!retry_sequence_seconds_.empty() &&
@@ -1995,7 +1977,7 @@ void PolicyManagerImpl::RefreshRetrySequence() {
void PolicyManagerImpl::ResetRetrySequence(
const ResetRetryCountType reset_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
retry_sequence_index_ = 0;
is_ptu_in_progress_ = false;
@@ -2014,15 +1996,14 @@ const std::vector<int> PolicyManagerImpl::RetrySequenceDelaysSeconds() {
}
void PolicyManagerImpl::OnExceededTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.OnUpdateTimeoutOccurs();
}
void PolicyManagerImpl::OnUpdateStarted() {
uint32_t update_timeout = TimeoutExchangeMSec();
- LOG4CXX_DEBUG(logger_,
- "Update timeout will be set to (milisec): " << update_timeout);
+ SDL_LOG_DEBUG("Update timeout will be set to (milisec): " << update_timeout);
send_on_update_sent_out_ =
policy::kUpdating != update_status_manager_.StringifiedUpdateStatus();
@@ -2033,33 +2014,33 @@ void PolicyManagerImpl::OnUpdateStarted() {
}
void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetCountersPassedForSuccessfulUpdate(counter, value);
cache_->ResetIgnitionCycles();
}
void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) {
- LOG4CXX_INFO(logger_, "Increment without app id");
+ SDL_LOG_INFO("Increment without app id");
cache_->Increment(type);
}
void PolicyManagerImpl::Increment(const std::string& app_id,
usage_statistics::AppCounterId type) {
- LOG4CXX_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type);
+ SDL_LOG_DEBUG("Increment " << app_id << " AppCounter: " << type);
cache_->Increment(app_id, type);
}
void PolicyManagerImpl::Set(const std::string& app_id,
usage_statistics::AppInfoId type,
const std::string& value) {
- LOG4CXX_INFO(logger_, "Set " << app_id);
+ SDL_LOG_INFO("Set " << app_id);
cache_->Set(app_id, type, value);
}
void PolicyManagerImpl::Add(const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds) {
- LOG4CXX_INFO(logger_, "Add " << app_id);
+ SDL_LOG_INFO("Add " << app_id);
cache_->Add(app_id, type, timespan_seconds);
}
@@ -2069,9 +2050,9 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const {
bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id,
const std::string& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int count = cache_->CountUnconsentedGroups(app_id, device_id);
- LOG4CXX_DEBUG(logger_, "There are: " << count << " unconsented groups.");
+ SDL_LOG_DEBUG("There are: " << count << " unconsented groups.");
return count != 0;
}
@@ -2113,7 +2094,7 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) const {
void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {
if (!cache_->SetUnpairedDevice(device_id)) {
- LOG4CXX_DEBUG(logger_, "Could not set unpaired flag for " << device_id);
+ SDL_LOG_DEBUG("Could not set unpaired flag for " << device_id);
return;
}
SetUserConsentForDevice(device_id, false);
@@ -2129,17 +2110,17 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile(
void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->OnDeviceSwitching(device_id_from, device_id_to);
}
const MetaInfo PolicyManagerImpl::GetMetaInfo() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetMetaInfo();
}
std::string PolicyManagerImpl::RetrieveCertificate() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetCertificate();
}
@@ -2149,12 +2130,12 @@ bool PolicyManagerImpl::HasCertificate() const {
void PolicyManagerImpl::SetDecryptedCertificate(
const std::string& certificate) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetDecryptedCertificate(certificate);
}
AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls);
@@ -2216,19 +2197,18 @@ StatusNotifier PolicyManagerImpl::AddApplication(
const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto device_consent = GetUserConsentForDevice(device_id);
- LOG4CXX_DEBUG(logger_,
- "check_device_id: " << device_id << " check_device_consent: "
+ SDL_LOG_DEBUG("check_device_id: " << device_id << " check_device_consent: "
<< device_consent);
sync_primitives::AutoLock lock(apps_registration_lock_);
if (IsNewApplication(application_id)) {
- LOG4CXX_DEBUG(logger_, "Adding new application");
+ SDL_LOG_DEBUG("Adding new application");
AddNewApplication(device_id, application_id, device_consent);
return std::make_shared<CallStatusChange>(update_status_manager_,
device_consent);
}
- LOG4CXX_DEBUG(logger_, "Promote existed application");
+ SDL_LOG_DEBUG("Promote existed application");
PromoteExistedApplication(device_id, application_id, device_consent);
if (!ptu_requested_) {
update_status_manager_.OnExistedApplicationAdded(cache_->UpdateRequired());
@@ -2243,7 +2223,7 @@ void PolicyManagerImpl::RemoveAppConsentForGroup(
bool PolicyManagerImpl::IsPredataPolicy(
const std::string& policy_app_id) const {
- LOG4CXX_INFO(logger_, "IsPredataApp");
+ SDL_LOG_INFO("IsPredataApp");
return cache_->IsPredataPolicy(policy_app_id);
}
@@ -2260,7 +2240,7 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
CalculateGroupsConsentFromExternalConsent(
groups_by_status, allowed_groups, disallowed_groups);
- LOG4CXX_DEBUG(logger_, "check device_id: " << device_id);
+ SDL_LOG_DEBUG("check device_id: " << device_id);
UpdateAppConsentWithExternalConsent(device_id,
application_id,
allowed_groups,
@@ -2271,20 +2251,20 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
void PolicyManagerImpl::AddNewApplication(const std::string& device_id,
const std::string& application_id,
DeviceConsent device_consent) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (kDeviceHasNoConsent == device_consent ||
kDeviceDisallowed == device_consent) {
- LOG4CXX_INFO(logger_,
- "Setting "
- << policy::kPreDataConsentId
- << " permissions for application id: " << application_id);
+ SDL_LOG_INFO(
+
+ "Setting " << policy::kPreDataConsentId
+ << " permissions for application id: " << application_id);
cache_->SetPredataPolicy(application_id);
} else {
- LOG4CXX_INFO(logger_,
- "Setting "
- << policy::kDefaultId
- << " permissions for application id: " << application_id);
+ SDL_LOG_INFO(
+
+ "Setting " << policy::kDefaultId
+ << " permissions for application id: " << application_id);
cache_->SetDefaultPolicy(application_id);
}
@@ -2300,16 +2280,15 @@ void PolicyManagerImpl::PromoteExistedApplication(
DeviceConsent device_consent) {
// If device consent changed to allowed during application being
// disconnected, app permissions should be changed also
- LOG4CXX_DEBUG(logger_,
- "kDeviceAllowed == device_consent: "
- << (kDeviceAllowed == device_consent)
- << " device_consent: " << device_consent);
+ SDL_LOG_DEBUG("kDeviceAllowed == device_consent: "
+ << (kDeviceAllowed == device_consent)
+ << " device_consent: " << device_consent);
if (kDeviceAllowed == device_consent &&
cache_->IsPredataPolicy(application_id)) {
- LOG4CXX_INFO(logger_,
- "Setting "
- << policy::kDefaultId
- << " permissions for application id: " << application_id);
+ SDL_LOG_INFO(
+
+ "Setting " << policy::kDefaultId
+ << " permissions for application id: " << application_id);
cache_->SetDefaultPolicy(application_id);
}
ProcessExternalConsentStatusForApp(
@@ -2322,7 +2301,7 @@ bool PolicyManagerImpl::IsNewApplication(
}
bool PolicyManagerImpl::ResetPT(const std::string& file_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->ResetCalculatedPermissions();
const bool result = cache_->ResetPT(file_name);
if (result) {
@@ -2332,19 +2311,17 @@ bool PolicyManagerImpl::ResetPT(const std::string& file_name) {
}
bool PolicyManagerImpl::CheckAppStorageFolder() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string app_storage_folder = get_settings().app_storage_folder();
- LOG4CXX_DEBUG(logger_, "AppStorageFolder " << app_storage_folder);
+ SDL_LOG_DEBUG("AppStorageFolder " << app_storage_folder);
if (!file_system::DirectoryExists(app_storage_folder)) {
- LOG4CXX_WARN(logger_,
- "Storage directory doesn't exist " << app_storage_folder);
+ SDL_LOG_WARN("Storage directory doesn't exist " << app_storage_folder);
return false;
}
if (!(file_system::IsWritingAllowed(app_storage_folder) &&
file_system::IsReadingAllowed(app_storage_folder))) {
- LOG4CXX_WARN(logger_,
- "Storage directory doesn't have read/write permissions "
- << app_storage_folder);
+ SDL_LOG_WARN("Storage directory doesn't have read/write permissions "
+ << app_storage_folder);
return false;
}
return true;
@@ -2352,10 +2329,10 @@ bool PolicyManagerImpl::CheckAppStorageFolder() const {
bool PolicyManagerImpl::InitPT(const std::string& file_name,
const PolicySettings* settings) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
settings_ = settings;
if (!CheckAppStorageFolder()) {
- LOG4CXX_ERROR(logger_, "Can not read/write into AppStorageFolder");
+ SDL_LOG_ERROR("Can not read/write into AppStorageFolder");
return false;
}
const bool ret = cache_->Init(file_name, settings);
@@ -2375,7 +2352,7 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const {
}
void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!is_update_needed) {
ResetRetrySequence(ResetRetryCountType::kResetInternally);
@@ -2402,7 +2379,7 @@ void PolicyManagerImpl::SetDefaultHmiTypes(
const transport_manager::DeviceHandle& device_handle,
const std::string& application_id,
const std::vector<int>& hmi_types) {
- LOG4CXX_INFO(logger_, "SetDefaultHmiTypes");
+ SDL_LOG_INFO("SetDefaultHmiTypes");
const auto device_id = GetCurrentDeviceId(device_handle, application_id);
ApplicationOnDevice who = {device_id, application_id};
access_remote_->SetDefaultHmiTypes(who, hmi_types);
@@ -2416,7 +2393,7 @@ struct HMITypeToInt {
bool PolicyManagerImpl::GetHMITypes(const std::string& application_id,
std::vector<int>* app_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (cache_->IsDefaultPolicy(application_id)) {
return false;
}
@@ -2433,7 +2410,7 @@ bool PolicyManagerImpl::GetHMITypes(const std::string& application_id,
bool PolicyManagerImpl::CheckModule(const PTString& app_id,
const PTString& module) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::ModuleType module_type;
return EnumFromJsonString(module, &module_type) &&
access_remote_->CheckModuleType(app_id, module_type);
@@ -2444,16 +2421,15 @@ void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) {
if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) {
listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi);
} else {
- LOG4CXX_WARN(
- logger_,
- "Couldn't get default HMI level for application " << who.app_id);
+ SDL_LOG_WARN("Couldn't get default HMI level for application "
+ << who.app_id);
}
}
void PolicyManagerImpl::GetPermissions(const std::string device_id,
const std::string application_id,
Permissions* data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(data);
std::vector<FunctionalGroupPermission> app_group_permissions;
GetPermissionsForApp(device_id, application_id, app_group_permissions);
@@ -2528,7 +2504,7 @@ const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired(
const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace rpc::policy_table_interface_base;
DCHECK(kDeviceId != policy_app_id);
@@ -2548,7 +2524,7 @@ const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp(
const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<std::string> policy_app_ids;
const auto apps = cache_->GetPolicyAppIDs();
@@ -2562,14 +2538,14 @@ const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs()
bool PolicyManagerImpl::FunctionGroupNeedEncryption(
const std::string& policy_group) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupings functional_groupings;
cache_->GetFunctionalGroupings(functional_groupings);
const auto& grouping_itr = functional_groupings.find(policy_group);
if (grouping_itr == functional_groupings.end()) {
- LOG4CXX_WARN(logger_, "Group " << policy_group << " not found");
+ SDL_LOG_WARN("Group " << policy_group << " not found");
return false;
}
@@ -2582,7 +2558,7 @@ bool PolicyManagerImpl::FunctionGroupNeedEncryption(
const std::string PolicyManagerImpl::GetPolicyFunctionName(
const uint32_t function_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return policy_table::EnumToJsonString(
static_cast<policy_table::FunctionID>(function_id));
}
@@ -2605,12 +2581,13 @@ const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup(
} // namespace policy
-__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() {
+__attribute__((visibility("default"))) policy::PolicyManager* CreateManager(
+ logger::Logger* logger_instance) {
+ logger::Logger::instance(logger_instance);
return new policy::PolicyManagerImpl();
}
__attribute__((visibility("default"))) void DeleteManager(
policy::PolicyManager* pm) {
delete pm;
- DELETE_THREAD_LOGGER(policy::logger_);
}
diff --git a/src/components/policy/policy_external/src/policy_table.cc b/src/components/policy/policy_external/src/policy_table.cc
index 8ca6b698d1..7d82e8b635 100644
--- a/src/components/policy/policy_external/src/policy_table.cc
+++ b/src/components/policy/policy_external/src/policy_table.cc
@@ -38,7 +38,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
PolicyTable::PolicyTable() : pt_data_(new SQLPTExtRepresentation()) {}
@@ -46,7 +46,7 @@ PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data)
: pt_data_(pt_data) {}
PolicyTable::~PolicyTable() {
- LOG4CXX_INFO(logger_, "Destroying policy table.");
+ SDL_LOG_INFO("Destroying policy table.");
}
} // namespace policy
diff --git a/src/components/policy/policy_external/src/policy_table/validation.cc b/src/components/policy/policy_external/src/policy_table/validation.cc
index 12a79748d7..89c5992fab 100644
--- a/src/components/policy/policy_external/src/policy_table/validation.cc
+++ b/src/components/policy/policy_external/src/policy_table/validation.cc
@@ -14,7 +14,7 @@ bool IsPredefinedApplication(const std::string& app_id) {
namespace rpc {
namespace policy_table_interface_base {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
bool VerifyPredefinedApp(ApplicationPolicies::value_type& app_policies) {
const std::string& app_id = app_policies.first;
@@ -25,18 +25,17 @@ bool VerifyPredefinedApp(ApplicationPolicies::value_type& app_policies) {
RequestTypes& predefined_request_types = *app_policies.second.RequestType;
if (!predefined_request_types.is_valid()) {
- LOG4CXX_WARN(logger_,
- app_id << " policy invalid RequestTypes will be cleaned.");
+ SDL_LOG_WARN(app_id << " policy invalid RequestTypes will be cleaned.");
predefined_request_types.CleanUp();
if (PT_PRELOADED == app_policies.second.GetPolicyTableType() &&
predefined_request_types.is_cleaned_up()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
app_id << " policy RequestTypes is empty after clean-up. Exiting.");
return false;
}
- LOG4CXX_WARN(logger_, app_id << " request types have cleaned up.");
+ SDL_LOG_WARN(app_id << " request types have cleaned up.");
}
return true;
}
@@ -56,13 +55,13 @@ bool ApplicationPoliciesSection::Validate() const {
// Default and PreData policies are mandatory
if (apps.end() == it_default_policy || apps.end() == it_pre_data_policy) {
- LOG4CXX_ERROR(logger_, "Default or preData policy is not present.");
+ SDL_LOG_ERROR("Default or preData policy is not present.");
return false;
}
// Device policy is mandatory
if (!device.is_initialized()) {
- LOG4CXX_ERROR(logger_, "Device policy is not present.");
+ SDL_LOG_ERROR("Device policy is not present.");
return false;
}
@@ -89,52 +88,48 @@ bool ApplicationPoliciesSection::Validate() const {
continue;
}
- LOG4CXX_TRACE(logger_, "Checking app Request Types...");
+ SDL_LOG_TRACE("Checking app Request Types...");
RequestTypes& app_request_types = *iter->second.RequestType;
if (app_request_types.is_omitted()) {
- LOG4CXX_WARN(logger_,
- "RequestTypes omitted for "
- << app_id << " Will be replaced with default.");
+ SDL_LOG_WARN("RequestTypes omitted for "
+ << app_id << " Will be replaced with default.");
app_request_types = *apps[kDefaultApp].RequestType;
++iter;
continue;
}
if (!app_request_types.is_valid()) {
- LOG4CXX_WARN(
- logger_,
- "Invalid RequestTypes for " << app_id << " Will be cleaned up.");
+ SDL_LOG_WARN("Invalid RequestTypes for " << app_id
+ << " Will be cleaned up.");
app_request_types.CleanUp();
if (app_request_types.is_cleaned_up()) {
if (PT_PRELOADED == pt_type) {
- LOG4CXX_ERROR(logger_,
- "RequestTypes empty after clean-up for "
- << app_id << " Exiting.");
+ SDL_LOG_ERROR("RequestTypes empty after clean-up for "
+ << app_id << " Exiting.");
return false;
}
- LOG4CXX_WARN(logger_,
- "RequestTypes empty after clean-up for "
- << app_id << " Will be replaced with default.");
+ SDL_LOG_WARN("RequestTypes empty after clean-up for "
+ << app_id << " Will be replaced with default.");
app_request_types = *apps[kDefaultApp].RequestType;
}
- LOG4CXX_DEBUG(logger_, "Clean up for " << app_id << " is done.");
+ SDL_LOG_DEBUG("Clean up for " << app_id << " is done.");
++iter;
continue;
}
if (app_request_types.is_empty()) {
- LOG4CXX_WARN(logger_, "RequestTypes is empty for " << app_id);
+ SDL_LOG_WARN("RequestTypes is empty for " << app_id);
}
++iter;
}
- LOG4CXX_TRACE(logger_, "Checking app Request SubTypes...");
+ SDL_LOG_TRACE("Checking app Request SubTypes...");
iter = apps.begin();
while (iter != end_iter) {
if (it_default_policy == iter || it_pre_data_policy == iter) {
@@ -146,9 +141,9 @@ bool ApplicationPoliciesSection::Validate() const {
!app_params.RequestSubType.is_initialized();
if (is_request_subtype_omitted) {
- LOG4CXX_WARN(logger_,
- "App policy RequestSubTypes omitted."
- " Will be replaced with default.");
+ SDL_LOG_WARN(
+ "App policy RequestSubTypes omitted."
+ " Will be replaced with default.");
app_params.RequestSubType = apps[kDefaultApp].RequestSubType;
++iter;
continue;
@@ -156,7 +151,7 @@ bool ApplicationPoliciesSection::Validate() const {
const bool is_request_subtype_empty = app_params.RequestSubType->empty();
if (is_request_subtype_empty) {
- LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty.");
+ SDL_LOG_WARN("App policy RequestSubTypes empty.");
}
++iter;
}
@@ -260,8 +255,7 @@ bool ModuleConfig::Validate() const {
++it_endpoints) {
const URLList& endpoint_list = it_endpoints->second;
if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) {
- LOG4CXX_ERROR(logger_,
- "Endpoint " << it_endpoints->first
+ SDL_LOG_ERROR("Endpoint " << it_endpoints->first
<< "does not contain default group");
return false;
}
@@ -332,8 +326,8 @@ bool VehicleDataItem::Validate() const {
};
if (!ValidateTypes()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Unknown type: " << std::string(type) << " of " << std::string(key));
return false;
}
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
index c8a1b5d7ea..05b45e5f1c 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
@@ -41,7 +41,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
SQLPTExtRepresentation::SQLPTExtRepresentation() {}
SQLPTExtRepresentation::SQLPTExtRepresentation(bool in_memory)
@@ -76,7 +76,7 @@ bool SQLPTExtRepresentation::ResetUserConsent() {
bool SQLPTExtRepresentation::ResetDeviceConsents() {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kResetDeviceConsents)) {
- LOG4CXX_WARN(logger_, "Incorrect delete statement from device_consents.");
+ SDL_LOG_WARN("Incorrect delete statement from device_consents.");
return false;
}
return query.Exec();
@@ -90,10 +90,10 @@ bool SQLPTExtRepresentation::GetUserPermissionsForDevice(
const std::string& device_id,
StringArray* consented_groups,
StringArray* disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect select from device consented groups");
+ SDL_LOG_WARN("Incorrect select from device consented groups");
return false;
}
query.Bind(0, device_id);
@@ -118,9 +118,9 @@ bool SQLPTExtRepresentation::GetPermissionsForApp(
const std::string& device_id,
const std::string& policy_app_id,
FunctionalIdType* group_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!group_types) {
- LOG4CXX_WARN(logger_, "Input parameter for group types is null.");
+ SDL_LOG_WARN("Input parameter for group types is null.");
return false;
}
// Get all app groups for specified device and application
@@ -171,7 +171,7 @@ bool SQLPTExtRepresentation::GetPermissionsForApp(
bool SQLPTExtRepresentation::GetDeviceGroupsFromPolicies(
policy_table::Strings* groups, policy_table::Strings* preconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (groups) {
GatherAppGroup(kDeviceId, groups);
}
@@ -189,17 +189,17 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
const std::string& carrier,
const uint32_t number_of_ports,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery count_query(db());
if (!count_query.Prepare(sql_pt_ext::kCountDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for count of device.");
+ SDL_LOG_WARN("Incorrect statement for count of device.");
return false;
}
count_query.Bind(0, device_id);
if (!count_query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect count of device.");
+ SDL_LOG_WARN("Incorrect count of device.");
return false;
}
@@ -209,7 +209,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
if (update) {
utils::dbms::SQLQuery update_query(db());
if (!update_query.Prepare(sql_pt_ext::kUpdateDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for udpate device.");
+ SDL_LOG_WARN("Incorrect statement for udpate device.");
return false;
}
@@ -223,7 +223,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
update_query.Bind(7, connection_type);
if (!update_query.Exec() || !update_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect update for device.");
+ SDL_LOG_WARN("Incorrect update for device.");
return false;
}
@@ -233,7 +233,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
// Insert new data
utils::dbms::SQLQuery insert_query(db());
if (!insert_query.Prepare(sql_pt_ext::kInsertDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for device.");
+ SDL_LOG_WARN("Incorrect insert statement for device.");
return false;
}
@@ -247,7 +247,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
insert_query.Bind(7, connection_type);
if (!insert_query.Exec() || !insert_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert to device.");
+ SDL_LOG_WARN("Incorrect insert to device.");
return false;
}
@@ -260,17 +260,17 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
const std::string& device_id,
const StringArray& consented_groups,
const StringArray& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery count_query(db());
if (!count_query.Prepare(sql_pt_ext::kCountDeviceConsentGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect count of device consented groups");
+ SDL_LOG_WARN("Incorrect count of device consented groups");
return false;
}
count_query.Bind(0, device_id);
if (!count_query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed count of device consented groups");
+ SDL_LOG_WARN("Failed count of device consented groups");
return false;
}
@@ -281,8 +281,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
// Update old values
if (update) {
if (!query.Prepare(sql_pt_ext::kUpdateDeviceConsentedGroup)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Incorrect statement for updating consented groups on device");
return false;
}
@@ -298,8 +297,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
query.Bind(3, *it_consented_groups);
// TODO(AOleynik): Get this info from external data
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed update of device allowed consented groups.");
+ SDL_LOG_WARN("Failed update of device allowed consented groups.");
return false;
}
}
@@ -315,8 +313,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
query.Bind(2, device_id);
query.Bind(3, *it_disallowed_groups);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed update of device disallowed consented groups.");
+ SDL_LOG_WARN("Failed update of device disallowed consented groups.");
return false;
}
}
@@ -326,8 +323,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
// Insert new values
if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement of inserting to device consented groups");
+ SDL_LOG_WARN("Incorrect statement of inserting to device consented groups");
return false;
}
@@ -341,8 +337,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
// TODO(AOleynik): Get this info from external data
query.Bind(3, std::string("GUI"));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed insert to device allowed consented groups.");
+ SDL_LOG_WARN("Failed insert to device allowed consented groups.");
return false;
}
}
@@ -357,8 +352,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
query.Bind(2, false);
query.Bind(3);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed insert to device disallowed consented groups.");
+ SDL_LOG_WARN("Failed insert to device disallowed consented groups.");
return false;
}
}
@@ -376,15 +370,13 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp(
if (IsPredataPolicy(app_id)) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kHasAppPreloadedGroups)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for has app preloaded groups");
+ SDL_LOG_WARN("Incorrect statement for has app preloaded groups");
return false;
}
query.Bind(0, app_id);
query.Bind(1, kPreDataConsentId);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_,
- "Incorrect select for app has predataconsted groups");
+ SDL_LOG_WARN("Incorrect select for app has predataconsted groups");
return false;
}
if (query.GetInteger(0) > 0) {
@@ -408,7 +400,7 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp(
bool SQLPTExtRepresentation::SetUserPermissionsForApp(
const PermissionConsent& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(AOleynik): Handle situation, when no application was specified, i.e.
// general permissions were set
std::vector<FunctionalGroupPermission>::const_iterator it =
@@ -420,7 +412,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
for (; it != it_end; ++it) {
utils::dbms::SQLQuery counter(db());
if (!counter.Prepare(sql_pt_ext::kCountAppConsents)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for consent group count.");
+ SDL_LOG_WARN("Incorrect statement for consent group count.");
return false;
}
@@ -428,7 +420,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
counter.Bind(1, permissions.policy_app_id);
counter.Bind(2, static_cast<int>((*it).group_id));
if (!counter.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrent count on consent groups.");
+ SDL_LOG_WARN("Incorrent count on consent groups.");
return false;
}
@@ -437,7 +429,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
// Update already present consent record
if (update_required) {
if (!query.Prepare(sql_pt_ext::kUpdateGroupPermissions)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for update consent groups.");
+ SDL_LOG_WARN("Incorrect statement for update consent groups.");
return false;
}
@@ -452,9 +444,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
query.Bind(4, permissions.device_id);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Incorrect update on user defined permissions "
- "for app groups.");
+ SDL_LOG_WARN(
+ "Incorrect update on user defined permissions "
+ "for app groups.");
return false;
}
continue;
@@ -462,8 +454,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
// Insert new consent record
if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for update app group permissions.");
+ SDL_LOG_WARN("Incorrect statement for update app group permissions.");
return false;
}
@@ -478,9 +469,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
query.Bind(4, permissions.consent_source);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert to user defined permissions "
- "for app groups.");
+ SDL_LOG_WARN(
+ "Incorrect insert to user defined permissions "
+ "for app groups.");
return false;
}
continue;
@@ -493,7 +484,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg(
utils::dbms::SQLQuery query(db());
std::vector<UserFriendlyMessage> result;
if (!query.Prepare(sql_pt_ext::kSelectFriendlyMsg)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
+ SDL_LOG_WARN("Incorrect statement for select friendly messages.");
return result;
}
@@ -511,7 +502,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg(
query.Bind(1, msg_language);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from friendly messages.");
+ SDL_LOG_WARN("Incorrect select from friendly messages.");
return result;
}
@@ -527,9 +518,9 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg(
result.push_back(msg);
if (!query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed reset statement for selecting friendly "
- "messages.");
+ SDL_LOG_WARN(
+ "Failed reset statement for selecting friendly "
+ "messages.");
return result;
}
}
@@ -540,7 +531,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg(
bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages(
policy_table::ConsumerFriendlyMessages* messages) const {
if (NULL == messages) {
- LOG4CXX_ERROR(logger_, "NULL pointer has been passed to fill");
+ SDL_LOG_ERROR("NULL pointer has been passed to fill");
return false;
}
@@ -583,7 +574,7 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages(
}
}
} else {
- LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
+ SDL_LOG_WARN("Incorrect statement for select friendly messages.");
}
return result;
}
@@ -591,10 +582,10 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages(
bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateMetaParams)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta.");
+ SDL_LOG_WARN("Incorrect statement for insert to module meta.");
return false;
}
@@ -603,22 +594,22 @@ bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version,
query.Bind(2, language);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert to module meta.");
+ SDL_LOG_WARN("Incorrect insert to module meta.");
return false;
}
return true;
}
bool SQLPTExtRepresentation::IsMetaInfoPresent() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectMetaParams)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for selecting meta info.");
+ SDL_LOG_WARN("Incorrect statement for selecting meta info.");
return false;
}
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from module meta.");
+ SDL_LOG_WARN("Incorrect select from module meta.");
return false;
}
@@ -626,17 +617,17 @@ bool SQLPTExtRepresentation::IsMetaInfoPresent() {
}
bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateMetaLanguage)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for update meta language.");
+ SDL_LOG_WARN("Incorrect statement for update meta language.");
return false;
}
query.Bind(0, language);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update for meta language.");
+ SDL_LOG_WARN("Incorrect update for meta language.");
return false;
}
@@ -645,46 +636,46 @@ bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) {
bool SQLPTExtRepresentation::SaveApplicationPoliciesSection(
const policy_table::ApplicationPoliciesSection& policies) {
- LOG4CXX_INFO(logger_, "SaveApplicationPolicies ext");
+ SDL_LOG_INFO("SaveApplicationPolicies ext");
utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app_group.");
+ SDL_LOG_WARN("Incorrect delete from app_group.");
return false;
}
utils::dbms::SQLQuery query_delete_preconsented(db());
if (!query_delete_preconsented.Exec(sql_pt_ext::kDeletePreconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from preconsented_group.");
+ SDL_LOG_WARN("Incorrect delete from preconsented_group.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from application.");
+ SDL_LOG_WARN("Incorrect delete from application.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from request type.");
+ SDL_LOG_WARN("Incorrect delete from request type.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from request subtype.");
+ SDL_LOG_WARN("Incorrect delete from request subtype.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ SDL_LOG_WARN("Incorrect delete from handled rpcs.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ SDL_LOG_WARN("Incorrect delete from service names.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ SDL_LOG_WARN("Incorrect delete from handled service types.");
return false;
}
@@ -755,7 +746,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
+ SDL_LOG_WARN("Incorrect insert statement into application.");
return false;
}
@@ -799,7 +790,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
: app_query.Bind(16);
if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
+ SDL_LOG_WARN("Incorrect insert into application.");
return false;
}
@@ -843,8 +834,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy(
const policy_table::DevicePolicy& device) {
utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement into application (device).");
+ SDL_LOG_WARN("Incorrect insert statement into application (device).");
return false;
}
app_query.Bind(0, kDeviceId);
@@ -859,7 +849,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy(
app_query.Bind(7, 0);
if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
+ SDL_LOG_WARN("Incorrect insert into application.");
return false;
}
@@ -875,10 +865,10 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy(
bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
- LOG4CXX_INFO(logger_, "Gather applications policies");
+ SDL_LOG_INFO("Gather applications policies");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectAppPolicies)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app_policies");
+ SDL_LOG_WARN("Incorrect select from app_policies");
return false;
}
@@ -990,7 +980,7 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup(
const std::string& app_id, policy_table::Strings* groups) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select from preconsented group");
+ SDL_LOG_WARN("Incorrect select from preconsented group");
return;
}
@@ -1002,10 +992,10 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup(
bool SQLPTExtRepresentation::GatherUsageAndErrorCounts(
policy_table::UsageAndErrorCounts* counts) const {
- LOG4CXX_INFO(logger_, "Gather Usage and Error Counts.");
+ SDL_LOG_INFO("Gather Usage and Error Counts.");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectUsageAndErrorCount) || !query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed select from user_and_error_count");
+ SDL_LOG_INFO("Failed select from user_and_error_count");
return false;
}
@@ -1020,9 +1010,8 @@ bool SQLPTExtRepresentation::GatherAppLevels(
policy_table::AppLevels* apps) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectAppLevels)) {
- LOG4CXX_INFO(logger_,
- "Failed select from app_level. SQLError = "
- << query.LastError().text());
+ SDL_LOG_INFO("Failed select from app_level. SQLError = "
+ << query.LastError().text());
return false;
}
while (query.Next()) {
@@ -1051,10 +1040,10 @@ bool SQLPTExtRepresentation::GatherAppLevels(
void SQLPTExtRepresentation::GatherDeviceData(
policy_table::DeviceData* data) const {
- LOG4CXX_INFO(logger_, "Gather device data.");
+ SDL_LOG_INFO("Gather device data.");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectDeviceData)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for device data.");
+ SDL_LOG_WARN("Incorrect select statement for device data.");
return;
}
data->mark_initialized();
@@ -1076,12 +1065,11 @@ void SQLPTExtRepresentation::GatherDeviceData(
void SQLPTExtRepresentation::GatherConsentGroup(
const std::string& device_id,
policy_table::UserConsentRecords* records) const {
- LOG4CXX_INFO(logger_, "Gather consent records.");
+ SDL_LOG_INFO("Gather consent records.");
utils::dbms::SQLQuery query(db());
// Fill data for device
if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for device consented groups.");
+ SDL_LOG_WARN("Incorrect select statement for device consented groups.");
return;
}
@@ -1107,8 +1095,7 @@ void SQLPTExtRepresentation::GatherConsentGroup(
// Fill data for applications
if (!query.Prepare(sql_pt_ext::kSelectConsentGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for app consented groups.");
+ SDL_LOG_WARN("Incorrect select statement for app consented groups.");
return;
}
@@ -1135,8 +1122,8 @@ void SQLPTExtRepresentation::GatherConsentGroup(
// Fill data for ExternalConsent consents
if (!query.Prepare(sql_pt_ext::kSelectExternalConsentStatusGroup)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Incorrect select statement for ExternalConsent consented groups.");
return;
}
@@ -1159,31 +1146,31 @@ void SQLPTExtRepresentation::GatherConsentGroup(
bool SQLPTExtRepresentation::SaveDeviceData(
const policy_table::DeviceData& devices) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery drop_device_query(db());
const std::string drop_device = "DELETE FROM `device`";
if (!drop_device_query.Exec(drop_device)) {
- LOG4CXX_WARN(logger_, "Could not clear device table.");
+ SDL_LOG_WARN("Could not clear device table.");
return false;
}
utils::dbms::SQLQuery drop_device_consents_query(db());
const std::string drop_device_consents = "DELETE FROM `device_consent_group`";
if (!drop_device_consents_query.Exec(drop_device_consents)) {
- LOG4CXX_WARN(logger_, "Could not clear device consents.");
+ SDL_LOG_WARN("Could not clear device consents.");
return false;
}
utils::dbms::SQLQuery drop_user_consents_query(db());
const std::string drop_user_consents = "DELETE FROM `consent_group`";
if (!drop_user_consents_query.Exec(drop_user_consents)) {
- LOG4CXX_WARN(logger_, "Could not clear user consents.");
+ SDL_LOG_WARN("Could not clear user consents.");
return false;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kInsertDeviceData)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for device data.");
+ SDL_LOG_WARN("Incorrect insert statement for device data.");
return false;
}
@@ -1200,7 +1187,7 @@ bool SQLPTExtRepresentation::SaveDeviceData(
query.Bind(7, *(it->second.connection_type));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into device data.");
+ SDL_LOG_WARN("Incorrect insert into device data.");
return false;
}
@@ -1216,7 +1203,7 @@ bool SQLPTExtRepresentation::SaveDeviceData(
bool SQLPTExtRepresentation::SaveConsentGroup(
const std::string& device_id,
const policy_table::UserConsentRecords& records) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
policy_table::UserConsentRecords::const_iterator it = records.begin();
@@ -1230,8 +1217,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
for (; it_groups != it_groups_end; ++it_groups) {
if (kDeviceId == it->first) {
if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for device consent group.");
+ SDL_LOG_WARN("Incorrect insert statement for device consent group.");
return false;
}
query.Bind(0, device_id);
@@ -1241,16 +1227,13 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
3,
std::string(policy_table::EnumToJsonString(*(it->second.input))));
query.Bind(4, std::string(*(it->second.time_stamp)));
- LOG4CXX_INFO(logger_,
- "Device:"
- << "time stamp "
- << std::string(*(it->second.time_stamp)) << " group "
- << it_groups->first << " consent "
- << it_groups->second);
+ SDL_LOG_INFO("Device:"
+ << "time stamp " << std::string(*(it->second.time_stamp))
+ << " group " << it_groups->first << " consent "
+ << it_groups->second);
} else {
if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for consent group.");
+ SDL_LOG_WARN("Incorrect insert statement for consent group.");
return false;
}
query.Bind(0, device_id);
@@ -1262,16 +1245,14 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
std::string(policy_table::EnumToJsonString(*(it->second.input))));
query.Bind(5, std::string(*(it->second.time_stamp)));
query.Bind(6, (it->second.consent_last_updated));
- LOG4CXX_INFO(logger_,
- "Device:"
- << "time stamp "
- << std::string(*(it->second.time_stamp)) << " group "
- << it_groups->first << " consent "
- << it_groups->second);
+ SDL_LOG_INFO("Device:"
+ << "time stamp " << std::string(*(it->second.time_stamp))
+ << " group " << it_groups->first << " consent "
+ << it_groups->second);
}
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into consent group.");
+ SDL_LOG_WARN("Incorrect insert into consent group.");
return false;
}
}
@@ -1284,8 +1265,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
for (; end_external_consent_consent != it_external_consent_consent;
++it_external_consent_consent) {
if (!query.Prepare(sql_pt_ext::kInsertExternalConsentStatusGroups)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for external consent group.");
+ SDL_LOG_WARN("Incorrect insert statement for external consent group.");
return false;
}
query.Bind(0, device_id);
@@ -1296,14 +1276,13 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
4, std::string(policy_table::EnumToJsonString(*(it->second.input))));
query.Bind(5, std::string(*(it->second.time_stamp)));
query.Bind(6, (it->second.ext_consent_last_updated));
- LOG4CXX_INFO(logger_,
- "Device:"
- << "time stamp " << std::string(*(it->second.time_stamp))
- << " group " << it_external_consent_consent->first
- << " consent " << it_external_consent_consent->second);
+ SDL_LOG_INFO("Device:"
+ << "time stamp " << std::string(*(it->second.time_stamp))
+ << " group " << it_external_consent_consent->first
+ << " consent " << it_external_consent_consent->second);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into external consent group.");
+ SDL_LOG_WARN("Incorrect insert into external consent group.");
return false;
}
} // external_consent_consent_group
@@ -1314,10 +1293,10 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
bool SQLPTExtRepresentation::SavePreconsentedGroup(
const std::string& app_id, const policy_table::Strings& groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kInsertPreconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for preconsented groups");
+ SDL_LOG_WARN("Incorrect insert statement for preconsented groups");
return false;
}
@@ -1326,7 +1305,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup(
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into preconsented groups.");
+ SDL_LOG_WARN("Incorrect insert into preconsented groups.");
return false;
}
}
@@ -1336,7 +1315,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup(
void SQLPTExtRepresentation::GatherModuleMeta(
policy_table::ModuleMeta* meta) const {
- LOG4CXX_INFO(logger_, "Gather Module Meta Info");
+ SDL_LOG_INFO("Gather Module Meta Info");
utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt_ext::kSelectModuleMeta) && query.Next()) {
*meta->ccpu_version = query.GetString(0);
@@ -1354,19 +1333,19 @@ void SQLPTExtRepresentation::Increment(const std::string& type) const {
std::string update_counter =
"UPDATE `usage_and_error_count` SET `" + type + "` = `" + type + "` + 1";
if (!query.Exec(update_counter)) {
- LOG4CXX_INFO(logger_, "Failed updating global counter");
+ SDL_LOG_INFO("Failed updating global counter");
}
}
bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kCountAppLevel)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of count app_level");
+ SDL_LOG_INFO("Incorrect statement of count app_level");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed count app_level");
+ SDL_LOG_INFO("Failed count app_level");
return false;
}
return query.GetInteger(0) > 0;
@@ -1374,10 +1353,10 @@ bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const {
bool SQLPTExtRepresentation::GetAllAppGroups(const std::string& policy_app_id,
FunctionalGroupIDs& all_groups) {
- LOG4CXX_INFO(logger_, "GetAllAppGroups for '" << policy_app_id << "'");
+ SDL_LOG_INFO("GetAllAppGroups for '" << policy_app_id << "'");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectAppGroupsId)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for select app groups id.");
+ SDL_LOG_WARN("Incorrect statement for select app groups id.");
return false;
}
@@ -1395,10 +1374,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups(
const std::string& device_id,
FunctionalGroupIDs& allowed_groups,
FunctionalGroupIDs& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectConsentedGroupsId)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for select consent groups id.");
+ SDL_LOG_WARN("Incorrect statement for select consent groups id.");
return false;
}
@@ -1418,11 +1397,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups(
bool SQLPTExtRepresentation::GetPreconsentedGroups(
const std::string& policy_app_id, FunctionalGroupIDs& preconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroupsId)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for select preconsented groups id.");
+ SDL_LOG_WARN("Incorrect statement for select preconsented groups id.");
return false;
}
@@ -1437,11 +1415,10 @@ bool SQLPTExtRepresentation::GetPreconsentedGroups(
bool SQLPTExtRepresentation::GetFunctionalGroupNames(
FunctionalGroupNames& names) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectFunctionalGroupNames)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for select functional groups names.");
+ SDL_LOG_WARN("Incorrect statement for select functional groups names.");
return false;
}
@@ -1491,12 +1468,12 @@ void SQLPTExtRepresentation::Increment(const std::string& app_id,
"VALUES (?, 1)";
}
if (!query.Prepare(sql_counter)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of update app counter");
+ SDL_LOG_INFO("Incorrect statement of update app counter");
return;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed updating app counter");
+ SDL_LOG_INFO("Failed updating app counter");
}
}
@@ -1517,13 +1494,13 @@ void SQLPTExtRepresentation::Set(const std::string& app_id,
"VALUES (?, ?)";
}
if (!query.Prepare(sql_info)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of update app info");
+ SDL_LOG_INFO("Incorrect statement of update app info");
return;
}
query.Bind(0, value);
query.Bind(1, app_id);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed updating app info");
+ SDL_LOG_INFO("Failed updating app info");
}
}
@@ -1543,29 +1520,29 @@ void SQLPTExtRepresentation::Add(const std::string& app_id,
"VALUES (?, ?)";
}
if (!query.Prepare(sql_stopwatch)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of update app stopwatch");
+ SDL_LOG_INFO("Incorrect statement of update app stopwatch");
return;
}
query.Bind(0, seconds);
query.Bind(1, app_id);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed updating app stopwatch");
+ SDL_LOG_INFO("Failed updating app stopwatch");
}
}
bool SQLPTExtRepresentation::GetDefaultHMI(const std::string& policy_app_id,
std::string* default_hmi) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectDefaultHmi)) {
- LOG4CXX_INFO(logger_, "Incorrect statement for default hmi.");
+ SDL_LOG_INFO("Incorrect statement for default hmi.");
return false;
}
query.Bind(0, policy_app_id);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Error during default hmi getting.");
+ SDL_LOG_INFO("Error during default hmi getting.");
return false;
}
@@ -1583,10 +1560,10 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups(
const std::string& policy_app_id,
const std::string& device_id,
int* result) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kCountUnconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select for unconsented groups.");
+ SDL_LOG_WARN("Incorrect select for unconsented groups.");
return false;
}
@@ -1596,7 +1573,7 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups(
query.Bind(3, kPreDataConsentId);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Error during executing unconsented groups.");
+ SDL_LOG_INFO("Error during executing unconsented groups.");
return false;
}
*result = query.GetInteger(0);
@@ -1607,7 +1584,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message,
const std::string& language) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kHasMsgLanguageCode)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for message language check.");
+ SDL_LOG_WARN("Incorrect statement for message language check.");
return false;
}
@@ -1615,7 +1592,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message,
query.Bind(1, language);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to check message language code.");
+ SDL_LOG_WARN("Failed to check message language code.");
return false;
}
@@ -1628,7 +1605,7 @@ bool SQLPTExtRepresentation::SaveMessageString(
const policy_table::MessageString& strings) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertMessageString)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for message.");
+ SDL_LOG_WARN("Incorrect insert statement for message.");
return false;
}
@@ -1651,7 +1628,7 @@ bool SQLPTExtRepresentation::SaveMessageString(
}
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into message.");
+ SDL_LOG_WARN("Incorrect insert into message.");
return false;
}
@@ -1668,7 +1645,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta(
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSaveModuleMeta)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta.");
+ SDL_LOG_WARN("Incorrect insert statement for module_meta.");
return false;
}
const int64_t odometer = *(meta.pt_exchanged_at_odometer_x);
@@ -1682,7 +1659,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta(
query.Bind(6, *(meta.vin));
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update for module_meta.");
+ SDL_LOG_WARN("Incorrect update for module_meta.");
return false;
}
@@ -1693,11 +1670,11 @@ bool SQLPTExtRepresentation::SaveAppCounters(
const rpc::policy_table_interface_base::AppLevels& app_levels) {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app level.");
+ SDL_LOG_WARN("Incorrect delete from app level.");
return false;
}
if (!query.Prepare(sql_pt::kInsertAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app level.");
+ SDL_LOG_WARN("Incorrect insert statement for app level.");
return false;
}
@@ -1721,7 +1698,7 @@ bool SQLPTExtRepresentation::SaveAppCounters(
query.Bind(15, it->second.count_of_tls_errors);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app level.");
+ SDL_LOG_WARN("Incorrect insert into app level.");
return false;
}
}
@@ -1732,7 +1709,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters(
const rpc::policy_table_interface_base::UsageAndErrorCounts& counts) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateGlobalCounters)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for global counters.");
+ SDL_LOG_WARN("Incorrect insert statement for global counters.");
return false;
}
@@ -1741,7 +1718,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters(
query.Bind(2, *counts.count_of_sync_reboots);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into global counters.");
+ SDL_LOG_WARN("Incorrect insert into global counters.");
return false;
}
@@ -1750,22 +1727,22 @@ bool SQLPTExtRepresentation::SaveGlobalCounters(
bool SQLPTExtRepresentation::CleanupUnpairedDevices(
const DeviceIds& device_ids) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery delete_device_query(db());
if (!delete_device_query.Prepare(sql_pt::kDeleteDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for device delete.");
+ SDL_LOG_WARN("Incorrect statement for device delete.");
return true;
}
utils::dbms::SQLQuery delete_device_consent_query(db());
if (!delete_device_consent_query.Prepare(sql_pt_ext::kDeleteDeviceConsent)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for delete device consent.");
+ SDL_LOG_WARN("Incorrect statement for delete device consent.");
return false;
}
utils::dbms::SQLQuery delete_app_consent_query(db());
if (!delete_app_consent_query.Prepare(sql_pt_ext::kDeleteAppConsent)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for delete app consent.");
+ SDL_LOG_WARN("Incorrect statement for delete app consent.");
return false;
}
@@ -1774,20 +1751,20 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices(
for (; it != it_end; ++it) {
delete_device_query.Bind(0, (*it));
if (!delete_device_query.Exec() || !delete_device_query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to delete from device");
+ SDL_LOG_WARN("Failed to delete from device");
return false;
}
delete_device_consent_query.Bind(0, (*it));
if (!delete_device_consent_query.Exec() ||
!delete_device_consent_query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to delete from device consent.");
+ SDL_LOG_WARN("Failed to delete from device consent.");
return false;
}
delete_app_consent_query.Bind(0, (*it));
if (!delete_app_consent_query.Exec() || !delete_app_consent_query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to delete from app consent.");
+ SDL_LOG_WARN("Failed to delete from app consent.");
return false;
}
}
@@ -1797,22 +1774,22 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices(
bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
+ SDL_LOG_ERROR("Incorrect statement to delete from app_group.");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
+ SDL_LOG_ERROR("Failed deleting from app_group.");
return false;
}
if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
+ SDL_LOG_ERROR("Incorrect statement to delete from app_group.");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
+ SDL_LOG_ERROR("Failed deleting from app_group.");
return false;
}
@@ -1835,26 +1812,25 @@ bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) {
}
bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) {
- LOG4CXX_INFO(logger_,
- "SQLPTExtRepresentation::SetPredataPolicy for " << app_id);
+ SDL_LOG_INFO("SQLPTExtRepresentation::SetPredataPolicy for " << app_id);
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
+ SDL_LOG_ERROR("Incorrect statement to delete from app_group.");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
+ SDL_LOG_ERROR("Failed deleting from app_group.");
return false;
}
if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
+ SDL_LOG_ERROR("Incorrect statement to delete from app_group.");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
+ SDL_LOG_ERROR("Failed deleting from app_group.");
return false;
}
@@ -1878,13 +1854,13 @@ bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) {
bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectApplicationIsPreData)) {
- LOG4CXX_WARN(logger_, "Incorrect select application is pre_dataConsented");
+ SDL_LOG_WARN("Incorrect select application is pre_dataConsented");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select application is pre_dataConsented");
+ SDL_LOG_WARN("Failed select application is pre_dataConsented");
return false;
}
return query.IsNull(0) ? false : query.GetBoolean(0);
@@ -1892,17 +1868,17 @@ bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const {
bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id,
bool is_pre_data) {
- LOG4CXX_TRACE(logger_, "Set flag is_predata of application");
+ SDL_LOG_TRACE("Set flag is_predata of application");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateIsPredata)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating is_predata");
+ SDL_LOG_WARN("Incorect statement for updating is_predata");
return false;
}
query.Bind(0, is_pre_data);
query.Bind(1, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update is_predata");
+ SDL_LOG_WARN("Failed update is_predata");
return false;
}
return true;
@@ -1910,27 +1886,27 @@ bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id,
bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id,
bool unpaired) const {
- LOG4CXX_TRACE(logger_, "Set unpaired device: " << device_id);
+ SDL_LOG_TRACE("Set unpaired device: " << device_id);
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateUnpairedDevice)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating unpaired device");
+ SDL_LOG_WARN("Incorect statement for updating unpaired device");
return false;
}
query.Bind(0, unpaired);
query.Bind(1, device_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update unpaired device");
+ SDL_LOG_WARN("Failed update unpaired device");
return false;
}
return true;
}
bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const {
- LOG4CXX_TRACE(logger_, "Get list of unpaired devices");
+ SDL_LOG_TRACE("Get list of unpaired devices");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectUnpairedDevices)) {
- LOG4CXX_WARN(logger_, "Incorect statement for selecting unpaired devices");
+ SDL_LOG_WARN("Incorect statement for selecting unpaired devices");
return false;
}
@@ -1943,7 +1919,7 @@ bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const {
bool SQLPTExtRepresentation::SetVINValue(const std::string& value) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateModuleMetaVinParam)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating module_meta params");
+ SDL_LOG_WARN("Incorect statement for updating module_meta params");
return false;
}
@@ -1951,18 +1927,17 @@ bool SQLPTExtRepresentation::SetVINValue(const std::string& value) {
const bool result = query.Exec();
if (!result) {
- LOG4CXX_WARN(logger_, "Failed update module_meta");
+ SDL_LOG_WARN("Failed update module_meta");
}
return result;
}
bool SQLPTExtRepresentation::SaveExternalConsentStatus(
const ExternalConsentStatus& status) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kInsertExternalConsentStatus)) {
- LOG4CXX_ERROR(logger_,
- "Incorrect statement for saving external consent status.");
+ SDL_LOG_ERROR("Incorrect statement for saving external consent status.");
return false;
}
@@ -1978,7 +1953,7 @@ bool SQLPTExtRepresentation::SaveExternalConsentStatus(
policy::kStatusOn == it->status_ ? std::string("ON")
: std::string("OFF"));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_ERROR(logger_, "Error during ExternalConsent status saving.");
+ SDL_LOG_ERROR("Error during ExternalConsent status saving.");
return false;
}
}
@@ -1987,11 +1962,10 @@ bool SQLPTExtRepresentation::SaveExternalConsentStatus(
}
ExternalConsentStatus SQLPTExtRepresentation::GetExternalConsentStatus() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectExternalConsentStatus)) {
- LOG4CXX_ERROR(logger_,
- "Incorrect statement for selecting external consent status.");
+ SDL_LOG_ERROR("Incorrect statement for selecting external consent status.");
return ExternalConsentStatus();
}
@@ -2013,14 +1987,14 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup(
const std::string& functional_group_name) const {
utils::dbms::SQLQuery query_group_id(db());
if (!query_group_id.Prepare(sql_pt_ext::kSelectGroupId)) {
- LOG4CXX_WARN(logger_, "Incorect statement for select group name.");
+ SDL_LOG_WARN("Incorect statement for select group name.");
return false;
}
query_group_id.Bind(0, functional_group_name);
if (!query_group_id.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to select group id.");
+ SDL_LOG_WARN("Failed to select group id.");
return false;
}
@@ -2028,7 +2002,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup(
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kDeleteAppGroupConsent)) {
- LOG4CXX_WARN(logger_, "Incorect statement for remove app consent.");
+ SDL_LOG_WARN("Incorect statement for remove app consent.");
return false;
}
@@ -2036,7 +2010,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup(
query.Bind(1, id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to remove app consent.");
+ SDL_LOG_WARN("Failed to remove app consent.");
return false;
}
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index a7658740c4..36e363d922 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -51,7 +51,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
namespace dbms = utils::dbms;
@@ -108,8 +108,8 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRpc)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Incorrect select statement from rpcs" << query.LastError().text());
return;
}
@@ -119,8 +119,7 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
bool ret = query.Next();
result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed;
- LOG4CXX_INFO(logger_,
- "Level is " << (result.hmi_level_permitted == kRpcAllowed
+ SDL_LOG_INFO("Level is " << (result.hmi_level_permitted == kRpcAllowed
? "permitted"
: "not permitted"));
std::string parameter;
@@ -141,7 +140,7 @@ bool SQLPTRepresentation::IsPTPreloaded() {
int SQLPTRepresentation::IgnitionCyclesBeforeExchange() {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) {
- LOG4CXX_WARN(logger_, "Can not select ignition cycles");
+ SDL_LOG_WARN("Can not select ignition cycles");
return 0;
}
int limit = query.GetInteger(0);
@@ -157,7 +156,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() {
int SQLPTRepresentation::KilometersBeforeExchange(int current) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) {
- LOG4CXX_WARN(logger_, "Can not select kilometers");
+ SDL_LOG_WARN("Can not select kilometers");
return 0;
}
int limit = query.GetInteger(0);
@@ -173,17 +172,16 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) {
bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate(
int kilometers, int days_after_epoch) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) {
- LOG4CXX_WARN(logger_,
- "Wrong update query for counters on successful update.");
+ SDL_LOG_WARN("Wrong update query for counters on successful update.");
return false;
}
query.Bind(0, kilometers);
query.Bind(1, days_after_epoch);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to update counters on successful update.");
+ SDL_LOG_WARN("Failed to update counters on successful update.");
return false;
}
return true;
@@ -192,7 +190,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate(
int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) {
- LOG4CXX_WARN(logger_, "Can not select days");
+ SDL_LOG_WARN("Can not select days");
return 0;
}
int limit = query.GetInteger(0);
@@ -212,7 +210,7 @@ int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) {
int SQLPTRepresentation::TimeoutResponse() {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) {
- LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence");
+ SDL_LOG_INFO("Can not select timeout response for retry sequence");
const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND;
return defaultTimeout;
}
@@ -222,8 +220,7 @@ int SQLPTRepresentation::TimeoutResponse() {
bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) {
- LOG4CXX_INFO(logger_,
- "Incorrect select statement from seconds between retries");
+ SDL_LOG_INFO("Incorrect select statement from seconds between retries");
return false;
}
while (query.Next()) {
@@ -246,8 +243,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg(
}
EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
- LOG4CXX_INFO(logger_,
- "SQLPTRepresentation::GetUpdateUrls for " << service_type);
+ SDL_LOG_INFO("SQLPTRepresentation::GetUpdateUrls for " << service_type);
utils::dbms::SQLQuery query(db());
EndpointUrls ret;
if (query.Prepare(sql_pt::kSelectEndpoint)) {
@@ -262,23 +258,23 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
ret.push_back(data);
}
} else {
- LOG4CXX_WARN(logger_, "Invalid select endpoints statement.");
+ SDL_LOG_WARN("Invalid select endpoints statement.");
}
return ret;
}
int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for priority "
- "notification number.");
+ SDL_LOG_WARN(
+ "Incorrect select statement for priority "
+ "notification number.");
return 0;
}
query.Bind(0, priority);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority.");
+ SDL_LOG_WARN("Incorrect select from notifications by priority.");
return 0;
}
@@ -291,21 +287,21 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id,
std::string* priority) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (NULL == priority) {
- LOG4CXX_WARN(logger_, "Input priority parameter is null.");
+ SDL_LOG_WARN("Input priority parameter is null.");
return false;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectPriority)) {
- LOG4CXX_INFO(logger_, "Incorrect statement for priority.");
+ SDL_LOG_INFO("Incorrect statement for priority.");
return false;
}
query.Bind(0, policy_app_id);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Error during select priority.");
+ SDL_LOG_INFO("Error during select priority.");
return false;
}
@@ -321,7 +317,7 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id,
InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
settings_ = settings;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef BUILD_TESTS
open_counter_ = 0;
#endif // BUILD_TESTS
@@ -334,60 +330,57 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
}
#endif // __QNX__
if (!db_->Open()) {
- LOG4CXX_ERROR(logger_, "Failed opening database.");
- LOG4CXX_INFO(logger_, "Starting opening retries.");
+ SDL_LOG_ERROR("Failed opening database.");
+ SDL_LOG_INFO("Starting opening retries.");
const uint16_t attempts = get_settings().attempts_to_open_policy_db();
- LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts);
+ SDL_LOG_DEBUG("Total attempts number is: " << attempts);
bool is_opened = false;
const uint16_t open_attempt_timeout_ms =
get_settings().open_attempt_timeout_ms();
const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000;
- LOG4CXX_DEBUG(logger_,
- "Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
+ SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
for (int i = 0; i < attempts; ++i) {
usleep(sleep_interval_mcsec);
- LOG4CXX_INFO(logger_, "Attempt: " << i + 1);
+ SDL_LOG_INFO("Attempt: " << i + 1);
#ifdef BUILD_TESTS
++open_counter_;
#endif // BUILD_TESTS
if (db_->Open()) {
- LOG4CXX_INFO(logger_, "Database opened.");
+ SDL_LOG_INFO("Database opened.");
is_opened = true;
break;
}
}
if (!is_opened) {
- LOG4CXX_ERROR(logger_,
- "Open retry sequence failed. Tried "
- << attempts << " attempts with "
- << open_attempt_timeout_ms
- << " open timeout(ms) for each.");
+ SDL_LOG_ERROR("Open retry sequence failed. Tried "
+ << attempts << " attempts with " << open_attempt_timeout_ms
+ << " open timeout(ms) for each.");
return InitResult::FAIL;
}
}
#ifndef __QNX__
if (!db_->IsReadWrite()) {
- LOG4CXX_ERROR(logger_, "There are no read/write permissions for database");
+ SDL_LOG_ERROR("There are no read/write permissions for database");
return InitResult::FAIL;
}
#endif // __QNX__
utils::dbms::SQLQuery check_pages(db());
if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) {
- LOG4CXX_WARN(logger_, "Incorrect pragma for page counting.");
+ SDL_LOG_WARN("Incorrect pragma for page counting.");
} else {
if (0 < check_pages.GetInteger(0)) {
utils::dbms::SQLQuery db_check(db());
if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) {
- LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check.");
+ SDL_LOG_WARN("Incorrect pragma for integrity check.");
} else {
while (db_check.Next()) {
if (db_check.GetString(0).compare("ok") == 0) {
utils::dbms::SQLQuery check_first_run(db());
if (check_first_run.Prepare(sql_pt::kIsFirstRun) &&
check_first_run.Next()) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Selecting is first run " << check_first_run.GetBoolean(0));
if (check_first_run.GetBoolean(0)) {
utils::dbms::SQLQuery set_not_first_run(db());
@@ -395,12 +388,11 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
return InitResult::SUCCESS;
}
} else {
- LOG4CXX_WARN(logger_, "Incorrect select is first run");
+ SDL_LOG_WARN("Incorrect select is first run");
}
return InitResult::EXISTS;
} else {
- LOG4CXX_ERROR(logger_,
- "Existing policy table representation is invlaid.");
+ SDL_LOG_ERROR("Existing policy table representation is invlaid.");
// TODO(PV): add handle
return InitResult::FAIL;
}
@@ -410,14 +402,14 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
}
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed creating schema of database: " << query.LastError().text());
return InitResult::FAIL;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed insert init data to database: " << query.LastError().text());
return InitResult::FAIL;
}
@@ -432,8 +424,7 @@ bool SQLPTRepresentation::Close() {
bool SQLPTRepresentation::Drop() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
- LOG4CXX_WARN(logger_,
- "Failed dropping database: " << query.LastError().text());
+ SDL_LOG_WARN("Failed dropping database: " << query.LastError().text());
return false;
}
return true;
@@ -446,13 +437,12 @@ void SQLPTRepresentation::WriteDb() {
bool SQLPTRepresentation::Clear() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteData)) {
- LOG4CXX_ERROR(logger_,
- "Failed clearing database: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed insert init data to database: " << query.LastError().text());
return false;
}
@@ -462,19 +452,18 @@ bool SQLPTRepresentation::Clear() {
bool SQLPTRepresentation::RefreshDB() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
- LOG4CXX_WARN(logger_,
- "Failed dropping database: " << query.LastError().text());
+ SDL_LOG_WARN("Failed dropping database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed creating schema of database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed insert init data to database: " << query.LastError().text());
return false;
}
@@ -483,7 +472,7 @@ bool SQLPTRepresentation::RefreshDB() {
std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto table = std::make_shared<policy_table::Table>();
GatherModuleMeta(&*table->policy_table.module_meta);
GatherModuleConfig(&table->policy_table.module_config);
@@ -503,17 +492,17 @@ std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
void SQLPTRepresentation::GatherModuleMeta(
policy_table::ModuleMeta* meta) const {
- LOG4CXX_INFO(logger_, "Gather Module Meta Info");
+ SDL_LOG_INFO("Gather Module Meta Info");
meta->mark_initialized();
// Section Module Meta is empty for SDL specific
}
void SQLPTRepresentation::GatherModuleConfig(
policy_table::ModuleConfig* config) const {
- LOG4CXX_INFO(logger_, "Gather Configuration Info");
+ SDL_LOG_INFO("Gather Configuration Info");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for module config");
+ SDL_LOG_WARN("Incorrect select statement for module config");
} else {
*config->preloaded_pt = query.GetBoolean(0);
config->exchange_after_x_ignition_cycles = query.GetInteger(1);
@@ -532,7 +521,7 @@ void SQLPTRepresentation::GatherModuleConfig(
utils::dbms::SQLQuery endpoints(db());
if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints");
+ SDL_LOG_WARN("Incorrect select statement for endpoints");
} else {
while (endpoints.Next()) {
const std::string& url = endpoints.GetString(0);
@@ -544,7 +533,7 @@ void SQLPTRepresentation::GatherModuleConfig(
utils::dbms::SQLQuery endpoint_properties(db());
if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties");
+ SDL_LOG_ERROR("Incorrect statement for Endpoint properties");
} else {
while (endpoint_properties.Next()) {
const std::string& service = endpoint_properties.GetString(0);
@@ -556,7 +545,7 @@ void SQLPTRepresentation::GatherModuleConfig(
utils::dbms::SQLQuery notifications(db());
if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for notifications");
+ SDL_LOG_WARN("Incorrect select statement for notifications");
} else {
while (notifications.Next()) {
config->notifications_per_minute_by_priority[notifications.GetString(0)] =
@@ -565,8 +554,7 @@ void SQLPTRepresentation::GatherModuleConfig(
}
utils::dbms::SQLQuery subtle_notifications(db());
if (!subtle_notifications.Prepare(sql_pt::kSelectSubtleNotificationsPerMin)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for subtle notifications");
+ SDL_LOG_WARN("Incorrect select statement for subtle notifications");
} else {
while (subtle_notifications.Next()) {
(*config->subtle_notifications_per_minute_by_priority)
@@ -576,8 +564,7 @@ void SQLPTRepresentation::GatherModuleConfig(
}
utils::dbms::SQLQuery seconds(db());
if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) {
- LOG4CXX_INFO(logger_,
- "Incorrect select statement from seconds between retries");
+ SDL_LOG_INFO("Incorrect select statement from seconds between retries");
} else {
while (seconds.Next()) {
config->seconds_between_retries.push_back(seconds.GetInteger(0));
@@ -587,7 +574,7 @@ void SQLPTRepresentation::GatherModuleConfig(
bool SQLPTRepresentation::GatherUsageAndErrorCounts(
policy_table::UsageAndErrorCounts* counts) const {
- LOG4CXX_INFO(logger_, "Gather Usage and Error Counts.");
+ SDL_LOG_INFO("Gather Usage and Error Counts.");
utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectAppLevels)) {
policy_table::AppLevel app_level_empty;
@@ -601,7 +588,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts(
void SQLPTRepresentation::GatherDeviceData(
policy_table::DeviceData* data) const {
- LOG4CXX_INFO(logger_, "Gather device data.");
+ SDL_LOG_INFO("Gather device data.");
data->mark_initialized();
utils::dbms::SQLQuery query(db());
@@ -616,24 +603,23 @@ void SQLPTRepresentation::GatherDeviceData(
bool SQLPTRepresentation::GatherFunctionalGroupings(
policy_table::FunctionalGroupings* groups) const {
- LOG4CXX_INFO(logger_, "Gather Functional Groupings info");
+ SDL_LOG_INFO("Gather Functional Groupings info");
utils::dbms::SQLQuery func_group(db());
if (!func_group.Prepare(sql_pt::kSelectFunctionalGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings");
+ SDL_LOG_WARN("Incorrect select from functional_groupings");
return false;
}
utils::dbms::SQLQuery rpcs(db());
if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect select all from rpc");
+ SDL_LOG_WARN("Incorrect select all from rpc");
return false;
}
utils::dbms::SQLQuery external_consent_entities(db());
if (!external_consent_entities.Prepare(
sql_pt::kSelectExternalConsentEntities)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for 'external_consent_entities'.");
+ SDL_LOG_WARN("Incorrect select statement for 'external_consent_entities'.");
return false;
}
@@ -702,10 +688,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
policy_table::ConsumerFriendlyMessages* messages) const {
- LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages");
+ SDL_LOG_INFO("Gather Consumer Friendly Messages");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) {
- LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages");
+ SDL_LOG_WARN("Incorrect select from consumer_friendly_messages");
return false;
}
@@ -743,7 +729,7 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
}
}
} else {
- LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
+ SDL_LOG_WARN("Incorrect statement for select friendly messages.");
}
return true;
@@ -751,10 +737,10 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
bool SQLPTRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
- LOG4CXX_INFO(logger_, "Gather applications policies");
+ SDL_LOG_INFO("Gather applications policies");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppPolicies)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app_policies");
+ SDL_LOG_WARN("Incorrect select from app_policies");
return false;
}
@@ -855,8 +841,7 @@ bool SQLPTRepresentation::GatherVehicleData(
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) ||
!query.Next()) {
- LOG4CXX_ERROR(logger_,
- "Incorrect statement for vehicle data schema version");
+ SDL_LOG_ERROR("Incorrect statement for vehicle data schema version");
return false;
}
*vehicle_data->schema_version = query.GetString(0);
@@ -888,7 +873,7 @@ bool SQLPTRepresentation::GatherVehicleDataItems(
}
bool SQLPTRepresentation::Save(const policy_table::Table& table) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
db_->BeginTransaction();
if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) {
db_->RollbackTransaction();
@@ -933,23 +918,23 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
const policy_table::FunctionalGroupings& groups) {
utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteRpc)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from rpc.");
+ SDL_LOG_WARN("Incorrect delete from rpc.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteExternalConsentEntities)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from external consent entities.");
+ SDL_LOG_WARN("Incorrect delete from external consent entities.");
return false;
}
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries.");
+ SDL_LOG_WARN("Incorrect delete from seconds between retries.");
return false;
}
if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for functional groups");
+ SDL_LOG_WARN("Incorrect insert statement for functional groups");
return false;
}
@@ -974,7 +959,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
? query.Bind(3, *(groups_it->second.encryption_required))
: query.Bind(3);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into functional groups");
+ SDL_LOG_WARN("Incorrect insert into functional groups");
return false;
}
@@ -1008,7 +993,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
utils::dbms::SQLQuery query_parameter(db());
if (!query.Prepare(sql_pt::kInsertRpc) ||
!query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc");
+ SDL_LOG_WARN("Incorrect insert statement for rpc");
return false;
}
@@ -1028,7 +1013,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
query_parameter.Bind(2, std::string(*ps_it));
query_parameter.Bind(3, group_id);
if (!query_parameter.Exec() || !query_parameter.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter");
+ SDL_LOG_WARN("Incorrect insert into rpc with parameter");
return false;
}
}
@@ -1041,7 +1026,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
std::string(policy_table::EnumToJsonString(policy_table::P_EMPTY)));
query_parameter.Bind(3, group_id);
if (!query_parameter.Exec() || !query_parameter.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter");
+ SDL_LOG_WARN("Incorrect insert into rpc with parameter");
return false;
}
} else {
@@ -1049,7 +1034,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it)));
query.Bind(2, group_id);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into rpc");
+ SDL_LOG_WARN("Incorrect insert into rpc");
return false;
}
}
@@ -1063,32 +1048,32 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
const policy_table::ApplicationPoliciesSection& policies) {
utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app_group.");
+ SDL_LOG_WARN("Incorrect delete from app_group.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from application.");
+ SDL_LOG_WARN("Incorrect delete from application.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from request type.");
+ SDL_LOG_WARN("Incorrect delete from request type.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ SDL_LOG_WARN("Incorrect delete from handled rpcs.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ SDL_LOG_WARN("Incorrect delete from service names.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ SDL_LOG_WARN("Incorrect delete from handled service types.");
return false;
}
@@ -1132,8 +1117,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
const policy_table::ApplicationPolicies::value_type& app) {
utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement into application (device).");
+ SDL_LOG_WARN("Incorrect insert statement into application (device).");
return false;
}
@@ -1173,7 +1157,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
: app_query.Bind(13);
if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
+ SDL_LOG_WARN("Incorrect insert into application.");
return false;
}
@@ -1219,7 +1203,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
const policy_table::DevicePolicy& device) {
utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
+ SDL_LOG_WARN("Incorrect insert statement into application.");
return false;
}
@@ -1232,7 +1216,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
app_query.Bind(5);
if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
+ SDL_LOG_WARN("Incorrect insert into application.");
return false;
}
@@ -1245,7 +1229,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
bool SQLPTRepresentation::SaveVehicleDataItems(
const policy_table::VehicleDataItems& vehicle_data_items) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeleteVehicleDataItems();
for (const auto& item : vehicle_data_items) {
if (!InsertVehicleDataItem(item)) {
@@ -1257,18 +1241,17 @@ bool SQLPTRepresentation::SaveVehicleDataItems(
bool SQLPTRepresentation::SaveVehicleData(
const policy_table::VehicleData& vehicle_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (vehicle_data.is_initialized() &&
vehicle_data.schema_version.is_initialized()) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert of schema_version to vehicle_data.");
+ SDL_LOG_WARN("Incorrect insert of schema_version to vehicle_data.");
return false;
}
query.Bind(0, *vehicle_data.schema_version);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data.");
+ SDL_LOG_WARN("Failed to insert schema_version to vehicle_data.");
return false;
}
}
@@ -1285,20 +1268,19 @@ bool SQLPTRepresentation::SaveAppGroup(
const std::string& app_id, const policy_table::Strings& app_groups) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app group");
+ SDL_LOG_WARN("Incorrect insert statement for app group");
return false;
}
- LOG4CXX_INFO(logger_, "SaveAppGroup");
+ SDL_LOG_INFO("SaveAppGroup");
policy_table::Strings::const_iterator it;
for (it = app_groups.begin(); it != app_groups.end(); ++it) {
std::string ssss = *it;
- LOG4CXX_INFO(logger_, "Group: " << ssss);
+ SDL_LOG_INFO("Group: " << ssss);
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(
- logger_,
- "Incorrect insert into app group." << query.LastError().text());
+ SDL_LOG_WARN("Incorrect insert into app group."
+ << query.LastError().text());
return false;
}
}
@@ -1310,7 +1292,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
const policy_table::Strings& nicknames) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNickname)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname");
+ SDL_LOG_WARN("Incorrect insert statement for nickname");
return false;
}
@@ -1319,7 +1301,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into nickname.");
+ SDL_LOG_WARN("Incorrect insert into nickname.");
return false;
}
}
@@ -1331,7 +1313,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
const policy_table::AppHMITypes& types) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app type");
+ SDL_LOG_WARN("Incorrect insert statement for app type");
return false;
}
@@ -1340,7 +1322,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
query.Bind(0, app_id);
query.Bind(1, std::string(policy_table::EnumToJsonString(*it)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app type.");
+ SDL_LOG_WARN("Incorrect insert into app type.");
return false;
}
}
@@ -1352,29 +1334,29 @@ bool SQLPTRepresentation::SaveRequestType(
const std::string& app_id, const policy_table::RequestTypes& types) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
+ SDL_LOG_WARN("Incorrect insert statement for request types.");
return false;
}
policy_table::RequestTypes::const_iterator it;
if (!types.empty()) {
- LOG4CXX_WARN(logger_, "Request types not empty.");
+ SDL_LOG_WARN("Request types not empty.");
for (it = types.begin(); it != types.end(); ++it) {
query.Bind(0, app_id);
query.Bind(1, std::string(policy_table::EnumToJsonString(*it)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
+ SDL_LOG_WARN("Incorrect insert into request types.");
return false;
}
}
} else if (types.is_initialized()) {
- LOG4CXX_WARN(logger_, "Request types empty.");
+ SDL_LOG_WARN("Request types empty.");
query.Bind(0, app_id);
query.Bind(1,
std::string(policy_table::EnumToJsonString(
policy_table::RequestType::RT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
+ SDL_LOG_WARN("Incorrect insert into request types.");
return false;
}
}
@@ -1386,29 +1368,29 @@ bool SQLPTRepresentation::SaveRequestSubType(
const policy_table::RequestSubTypes& request_subtypes) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes.");
+ SDL_LOG_WARN("Incorrect insert statement for request subtypes.");
return false;
}
policy_table::Strings::const_iterator it;
if (!request_subtypes.empty()) {
- LOG4CXX_TRACE(logger_, "Request subtypes are not empty.");
+ SDL_LOG_TRACE("Request subtypes are not empty.");
for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) {
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
+ SDL_LOG_WARN("Incorrect insert into request subtypes.");
return false;
}
}
} else if (request_subtypes.is_initialized()) {
- LOG4CXX_WARN(logger_, "Request subtypes empty.");
+ SDL_LOG_WARN("Request subtypes empty.");
query.Bind(0, app_id);
query.Bind(1,
std::string(policy_table::EnumToJsonString(
policy_table::RequestType::RT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
+ SDL_LOG_WARN("Incorrect insert into request subtypes.");
return false;
}
}
@@ -1418,11 +1400,11 @@ bool SQLPTRepresentation::SaveRequestSubType(
bool SQLPTRepresentation::SaveAppServiceParameters(
const std::string& app_id,
const policy_table::AppServiceParameters& app_service_parameters) {
- LOG4CXX_INFO(logger_, "Save app service parameters");
+ SDL_LOG_INFO("Save app service parameters");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types");
+ SDL_LOG_WARN("Incorrect insert statement for app service types");
return false;
}
policy_table::AppServiceParameters::const_iterator it;
@@ -1435,14 +1417,14 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
query.Bind(1, it->first);
query.Bind(2, app_id);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Insert execute failed for into app service types");
+ SDL_LOG_WARN("Insert execute failed for into app service types");
return false;
}
// Insert app names array into db
utils::dbms::SQLQuery service_name_query(db());
if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names");
+ SDL_LOG_WARN("Incorrect insert statement for app service names");
return false;
}
@@ -1450,11 +1432,11 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
if (app_service_names.is_initialized() && app_service_names->empty()) {
// App service names is an empty array
- LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array");
+ SDL_LOG_DEBUG("App Service Names is Empty Array");
service_name_query.Bind(0, static_cast<int64_t>(id));
service_name_query.Bind(1);
if (!service_name_query.Exec() || !service_name_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names");
+ SDL_LOG_WARN("Incorrect insert into empty app service names");
return false;
}
} else {
@@ -1465,7 +1447,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
service_name_query.Bind(0, static_cast<int64_t>(id));
service_name_query.Bind(1, *names_it);
if (!service_name_query.Exec() || !service_name_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app service names");
+ SDL_LOG_WARN("Incorrect insert into app service names");
return false;
}
}
@@ -1474,8 +1456,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
// Insert handled rpcs array into db
utils::dbms::SQLQuery handled_rpcs_query(db());
if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for app service handled rpcs");
+ SDL_LOG_WARN("Incorrect insert statement for app service handled rpcs");
return false;
}
@@ -1486,7 +1467,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
handled_rpcs_query.Bind(0, static_cast<int64_t>(id));
handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id));
if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs");
+ SDL_LOG_WARN("Incorrect insert into app service handled rpcs");
return false;
}
}
@@ -1503,7 +1484,7 @@ bool SQLPTRepresentation::SaveModuleConfig(
const policy_table::ModuleConfig& config) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateModuleConfig)) {
- LOG4CXX_WARN(logger_, "Incorrect update statement for module config");
+ SDL_LOG_WARN("Incorrect update statement for module config");
return false;
}
@@ -1532,7 +1513,7 @@ bool SQLPTRepresentation::SaveModuleConfig(
: query.Bind(10);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update module config");
+ SDL_LOG_WARN("Incorrect update module config");
return false;
}
@@ -1565,12 +1546,12 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
const policy_table::ServiceEndpoints& endpoints) {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteEndpoint)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from endpoint.");
+ SDL_LOG_WARN("Incorrect delete from endpoint.");
return false;
}
if (!query.Prepare(sql_pt::kInsertEndpoint)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for endpoint");
+ SDL_LOG_WARN("Incorrect insert statement for endpoint");
return false;
}
@@ -1586,7 +1567,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
query.Bind(1, *url_it);
query.Bind(2, app_it->first);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into endpoint");
+ SDL_LOG_WARN("Incorrect insert into endpoint");
return false;
}
}
@@ -1600,8 +1581,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
const policy_table::ServiceEndpointProperties& endpoint_properties) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertEndpointVersion)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Incorrect insert of endpoint property to endpoint_properties.");
return false;
}
@@ -1611,8 +1591,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
query.Bind(1, endpoint_property.second.version);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Failed to insert endpoint property into endpoint_properties.");
return false;
}
@@ -1623,13 +1602,13 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
const policy_table::ConsumerFriendlyMessages& messages) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// According CRS-2419 If there is no “consumer_friendly_messages” key,
// the current local consumer_friendly_messages section shall be maintained in
// the policy table. So it won't be changed/updated
if (!messages.messages.is_initialized()) {
- LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty");
+ SDL_LOG_INFO("ConsumerFriendlyMessages messages list is empty");
return true;
}
@@ -1640,18 +1619,18 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
}
if (!delete_query_exec_result) {
- LOG4CXX_WARN(logger_, "Failed to delete messages from DB.");
+ SDL_LOG_WARN("Failed to delete messages from DB.");
return false;
}
if (!query.Prepare(sql_pt::kUpdateVersion)) {
- LOG4CXX_WARN(logger_, "Invalid update messages version statement.");
+ SDL_LOG_WARN("Invalid update messages version statement.");
return false;
}
query.Bind(0, messages.version);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to update messages version number in DB.");
+ SDL_LOG_WARN("Failed to update messages version number in DB.");
return false;
}
@@ -1678,13 +1657,13 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertMessageType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for message type.");
+ SDL_LOG_WARN("Incorrect insert statement for message type.");
return false;
}
query.Bind(0, type);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into message type.");
+ SDL_LOG_WARN("Incorrect insert into message type.");
return false;
}
@@ -1694,13 +1673,13 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
bool SQLPTRepresentation::SaveLanguage(const std::string& code) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertLanguage)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for language.");
+ SDL_LOG_WARN("Incorrect insert statement for language.");
return false;
}
query.Bind(0, code);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into language.");
+ SDL_LOG_WARN("Incorrect insert into language.");
return false;
}
@@ -1759,8 +1738,7 @@ policy_table::VehicleDataItems
SQLPTRepresentation::SelectCompositeVehicleDataItems() const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) {
- LOG4CXX_ERROR(logger_,
- "Incorrect statement for parameterized vehicle data items");
+ SDL_LOG_ERROR("Incorrect statement for parameterized vehicle data items");
return policy_table::VehicleDataItems();
}
@@ -1784,8 +1762,7 @@ policy_table::VehicleDataItems
SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Incorrect statement for non parameterized vehicle data items");
return policy_table::VehicleDataItems();
}
@@ -1805,17 +1782,15 @@ SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const {
bool SQLPTRepresentation::DeleteVehicleDataItems() const {
utils::dbms::SQLQuery query(db());
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) {
- LOG4CXX_ERROR(logger_,
- "Failed clearing database: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) {
- LOG4CXX_ERROR(logger_,
- "Failed clearing database: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text());
return false;
}
return true;
@@ -1833,12 +1808,11 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries(
const policy_table::SecondsBetweenRetries& seconds) {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries.");
+ SDL_LOG_WARN("Incorrect delete from seconds between retries.");
return false;
}
if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for seconds between retries.");
+ SDL_LOG_WARN("Incorrect insert statement for seconds between retries.");
return false;
}
@@ -1846,7 +1820,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries(
query.Bind(0, static_cast<int>(i));
query.Bind(1, seconds[i]);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into seconds between retries.");
+ SDL_LOG_WARN("Incorrect insert into seconds between retries.");
return false;
}
}
@@ -1858,8 +1832,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
const policy_table::NumberOfNotificationsPerMinute& notifications) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert statement for notifications by priority.");
return false;
}
@@ -1868,7 +1841,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
query.Bind(0, it->first);
query.Bind(1, it->second);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert into notifications by priority.");
return false;
}
}
@@ -1880,8 +1853,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute(
const policy_table::NumberOfNotificationsPerMinute& notifications) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertSubtleNotificationsByPriority)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert statement for notifications by priority.");
return false;
}
@@ -1890,7 +1862,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute(
query.Bind(0, it->first);
query.Bind(1, it->second);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert into notifications by priority.");
return false;
}
}
@@ -1902,7 +1874,7 @@ bool SQLPTRepresentation::SaveDeviceData(
const policy_table::DeviceData& devices) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertDeviceData)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for device data.");
+ SDL_LOG_WARN("Incorrect insert statement for device data.");
return false;
}
@@ -1910,7 +1882,7 @@ bool SQLPTRepresentation::SaveDeviceData(
for (it = devices.begin(); it != devices.end(); ++it) {
query.Bind(0, it->first);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into device data.");
+ SDL_LOG_WARN("Incorrect insert into device data.");
return false;
}
}
@@ -1923,11 +1895,11 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized();
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app level.");
+ SDL_LOG_WARN("Incorrect delete from app level.");
return false;
}
if (!query.Prepare(sql_pt::kInsertAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app level.");
+ SDL_LOG_WARN("Incorrect insert statement for app level.");
return false;
}
@@ -1937,7 +1909,7 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
for (it = app_levels.begin(); it != app_levels.end(); ++it) {
query.Bind(0, it->first);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app level.");
+ SDL_LOG_WARN("Incorrect insert into app level.");
return false;
}
}
@@ -1947,23 +1919,22 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
void SQLPTRepresentation::IncrementIgnitionCycles() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) {
- LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles");
+ SDL_LOG_WARN("Failed incrementing ignition cycles");
}
}
void SQLPTRepresentation::ResetIgnitionCycles() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kResetIgnitionCycles)) {
- LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number.");
+ SDL_LOG_WARN("Failed to reset ignition cycles number.");
}
}
bool SQLPTRepresentation::UpdateRequired() const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) {
- LOG4CXX_WARN(logger_,
- "Failed select update required flag from module meta");
+ SDL_LOG_WARN("Failed select update required flag from module meta");
return false;
}
return query.GetBoolean(0);
@@ -1974,34 +1945,33 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) {
// TODO(AOleynik): Quick fix, will be reworked
if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/
"UPDATE `module_meta` SET `flag_update_required` = ?")) {
- LOG4CXX_WARN(logger_,
- "Incorrect update into module meta (update_required): "
- << strerror(errno));
+ SDL_LOG_WARN("Incorrect update into module meta (update_required): "
+ << strerror(errno));
return;
}
query.Bind(0, value);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update module meta (update_required)");
+ SDL_LOG_WARN("Failed update module meta (update_required)");
}
}
bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
StringArray* nicknames,
StringArray* app_types) {
- LOG4CXX_INFO(logger_, "Getting initial application data.");
+ SDL_LOG_INFO("Getting initial application data.");
utils::dbms::SQLQuery app_names(db());
if (!app_names.Prepare(sql_pt::kSelectNicknames)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app nicknames");
+ SDL_LOG_WARN("Incorrect select from app nicknames");
return false;
}
utils::dbms::SQLQuery app_hmi_types(db());
if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app types");
+ SDL_LOG_WARN("Incorrect select from app types");
return false;
}
dbms::SQLQuery module_types(db());
if (!module_types.Prepare(sql_pt::kSelectModuleTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from module types");
+ SDL_LOG_WARN("Incorrect select from module types");
return false;
}
@@ -2026,7 +1996,7 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
bool SQLPTRepresentation::GetFunctionalGroupings(
policy_table::FunctionalGroupings& groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return GatherFunctionalGroupings(&groups);
}
@@ -2034,7 +2004,7 @@ bool SQLPTRepresentation::GatherAppType(
const std::string& app_id, policy_table::AppHMITypes* app_types) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app types");
+ SDL_LOG_WARN("Incorrect select from app types");
return false;
}
@@ -2054,7 +2024,7 @@ bool SQLPTRepresentation::GatherRequestType(
policy_table::RequestTypes* request_types) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRequestTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from request types.");
+ SDL_LOG_WARN("Incorrect select from request types.");
return false;
}
@@ -2078,7 +2048,7 @@ bool SQLPTRepresentation::GatherRequestSubType(
policy_table::RequestSubTypes* request_subtypes) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from request subtypes.");
+ SDL_LOG_WARN("Incorrect select from request subtypes.");
return false;
}
@@ -2098,22 +2068,22 @@ bool SQLPTRepresentation::GatherRequestSubType(
bool SQLPTRepresentation::GatherAppServiceParameters(
const std::string& app_id,
policy_table::AppServiceParameters* app_service_parameters) const {
- LOG4CXX_INFO(logger_, "Gather app service info");
+ SDL_LOG_INFO("Gather app service info");
utils::dbms::SQLQuery service_type_query(db());
if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from service_types");
+ SDL_LOG_WARN("Incorrect select from service_types");
return false;
}
utils::dbms::SQLQuery service_name_query(db());
if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) {
- LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names");
+ SDL_LOG_WARN("Incorrect select all from app_service_names");
return false;
}
utils::dbms::SQLQuery handled_rpcs_query(db());
if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs");
+ SDL_LOG_WARN("Incorrect select all from app_service_handled_rpcs");
return false;
}
@@ -2125,7 +2095,7 @@ bool SQLPTRepresentation::GatherAppServiceParameters(
service_name_query.Bind(0, service_type_id);
while (service_name_query.Next()) {
- LOG4CXX_DEBUG(logger_, "Loading service name");
+ SDL_LOG_DEBUG("Loading service name");
(*app_service_parameters)[service_type].service_names->push_back(
service_name_query.GetString(0));
(*app_service_parameters)[service_type].service_names->mark_initialized();
@@ -2140,11 +2110,11 @@ bool SQLPTRepresentation::GatherAppServiceParameters(
}
if (!service_name_query.Reset()) {
- LOG4CXX_ERROR(logger_, "Could not reset service_name query");
+ SDL_LOG_ERROR("Could not reset service_name query");
return false;
}
if (!handled_rpcs_query.Reset()) {
- LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query");
+ SDL_LOG_ERROR("Could not reset handled_rpcs query");
return false;
}
}
@@ -2156,7 +2126,7 @@ bool SQLPTRepresentation::GatherNickName(
const std::string& app_id, policy_table::Strings* nicknames) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNicknames)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app nicknames");
+ SDL_LOG_WARN("Incorrect select from app nicknames");
return false;
}
@@ -2171,7 +2141,7 @@ bool SQLPTRepresentation::GatherAppGroup(
const std::string& app_id, policy_table::Strings* app_groups) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app groups");
+ SDL_LOG_WARN("Incorrect select from app groups");
return false;
}
@@ -2184,10 +2154,10 @@ bool SQLPTRepresentation::GatherAppGroup(
bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id,
bool* denied) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) {
- LOG4CXX_WARN(logger_, "Incorrect select remote control flag");
+ SDL_LOG_WARN("Incorrect select remote control flag");
return false;
}
query.Bind(0, app_id);
@@ -2203,7 +2173,7 @@ bool SQLPTRepresentation::GatherModuleType(
const std::string& app_id, policy_table::ModuleTypes* app_types) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectModuleTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app types");
+ SDL_LOG_WARN("Incorrect select from app types");
return false;
}
@@ -2224,17 +2194,17 @@ bool SQLPTRepresentation::GatherModuleType(
bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id,
bool deny) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) {
- LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag");
+ SDL_LOG_WARN("Incorrect update statement for remote control flag");
return false;
}
- LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny);
+ SDL_LOG_DEBUG("App: " << app_id << std::boolalpha << " - " << deny);
query.Bind(0, deny);
query.Bind(1, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update remote control flag.");
+ SDL_LOG_WARN("Incorrect update remote control flag.");
return false;
}
return true;
@@ -2244,7 +2214,7 @@ bool SQLPTRepresentation::SaveModuleType(
const std::string& app_id, const policy_table::ModuleTypes& types) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertModuleType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for module type");
+ SDL_LOG_WARN("Incorrect insert statement for module type");
return false;
}
@@ -2254,10 +2224,9 @@ bool SQLPTRepresentation::SaveModuleType(
query.Bind(0, app_id);
std::string module(policy_table::EnumToJsonString(*it));
query.Bind(1, module);
- LOG4CXX_DEBUG(logger_,
- "Module(app: " << app_id << ", type: " << module << ")");
+ SDL_LOG_DEBUG("Module(app: " << app_id << ", type: " << module << ")");
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into module type.");
+ SDL_LOG_WARN("Incorrect insert into module type.");
return false;
}
}
@@ -2267,21 +2236,21 @@ bool SQLPTRepresentation::SaveModuleType(
std::string(policy_table::EnumToJsonString(
policy_table::ModuleType::MT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into module types.");
+ SDL_LOG_WARN("Incorrect insert into module types.");
return false;
}
} else {
- LOG4CXX_WARN(logger_, "Module Type omitted.");
+ SDL_LOG_WARN("Module Type omitted.");
}
return true;
}
bool SQLPTRepresentation::SaveAccessModule(
TypeAccess access, const policy_table::AccessModules& modules) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAccessModule)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for access module");
+ SDL_LOG_WARN("Incorrect insert statement for access module");
return false;
}
@@ -2292,12 +2261,12 @@ bool SQLPTRepresentation::SaveAccessModule(
query.Bind(0, name);
query.Bind(1, access);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into access module.");
+ SDL_LOG_WARN("Incorrect insert into access module.");
return false;
}
int id = query.LastInsertId();
if (!query.Reset()) {
- LOG4CXX_WARN(logger_, "Couldn't reset query access module.");
+ SDL_LOG_WARN("Couldn't reset query access module.");
return false;
}
if (!SaveRemoteRpc(id, rpcs)) {
@@ -2309,10 +2278,10 @@ bool SQLPTRepresentation::SaveAccessModule(
bool SQLPTRepresentation::GatherAccessModule(
TypeAccess access, policy_table::AccessModules* modules) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAccessModules)) {
- LOG4CXX_WARN(logger_, "Incorrect select from access module");
+ SDL_LOG_WARN("Incorrect select from access module");
return false;
}
@@ -2331,10 +2300,10 @@ bool SQLPTRepresentation::GatherAccessModule(
bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
const policy_table::RemoteRpcs& rpcs) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRemoteRpc)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc");
+ SDL_LOG_WARN("Incorrect insert statement for remote rpc");
return false;
}
policy_table::RemoteRpcs::const_iterator i;
@@ -2347,7 +2316,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
query.Bind(1, name);
query.Bind(2);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc.");
+ SDL_LOG_WARN("Incorrect insert into remote rpc.");
return false;
}
} else {
@@ -2357,7 +2326,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
query.Bind(1, name);
query.Bind(2, param);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc.");
+ SDL_LOG_WARN("Incorrect insert into remote rpc.");
return false;
}
}
@@ -2368,10 +2337,10 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
bool SQLPTRepresentation::GatherRemoteRpc(
int module_id, policy_table::RemoteRpcs* rpcs) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect select from remote rpc");
+ SDL_LOG_WARN("Incorrect select from remote rpc");
return false;
}
@@ -2394,7 +2363,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
bool is_predata) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) {
- LOG4CXX_WARN(logger_, "Incorrect update in application");
+ SDL_LOG_WARN("Incorrect update in application");
return false;
}
@@ -2404,7 +2373,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
query.Bind(3, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update in application");
+ SDL_LOG_WARN("Failed update in application");
return false;
}
@@ -2415,13 +2384,13 @@ bool SQLPTRepresentation::IsApplicationRevoked(
const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) {
- LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application");
+ SDL_LOG_WARN("Incorrect select from is_revoked of application");
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select is_revoked of application");
+ SDL_LOG_WARN("Failed select is_revoked of application");
return false;
}
return query.IsNull(0) ? false : query.GetBoolean(0);
@@ -2430,13 +2399,13 @@ bool SQLPTRepresentation::IsApplicationRepresented(
const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) {
- LOG4CXX_WARN(logger_, "Incorrect select application by id");
+ SDL_LOG_WARN("Incorrect select application by id");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select application by id");
+ SDL_LOG_WARN("Failed select application by id");
return false;
}
return query.GetInteger(0) != 0;
@@ -2445,13 +2414,13 @@ bool SQLPTRepresentation::IsApplicationRepresented(
bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) {
- LOG4CXX_WARN(logger_, "Incorrect select application by id");
+ SDL_LOG_WARN("Incorrect select application by id");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select application by id");
+ SDL_LOG_WARN("Failed select application by id");
return false;
}
return query.IsNull(0) ? false : query.GetBoolean(0);
@@ -2464,12 +2433,12 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const {
bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
+ SDL_LOG_ERROR("Incorrect statement to delete from app_group.");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
+ SDL_LOG_ERROR("Failed deleting from app_group.");
return false;
}
@@ -2514,17 +2483,17 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
bool SQLPTRepresentation::SetIsDefault(const std::string& app_id,
bool is_default) const {
- LOG4CXX_TRACE(logger_, "Set flag is_default of application");
+ SDL_LOG_TRACE("Set flag is_default of application");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateIsDefault)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating is_default");
+ SDL_LOG_WARN("Incorect statement for updating is_default");
return false;
}
query.Bind(0, is_default);
query.Bind(1, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update is_default");
+ SDL_LOG_WARN("Failed update is_default");
return false;
}
return true;
@@ -2535,18 +2504,16 @@ void SQLPTRepresentation::RemoveDB() const {
}
bool SQLPTRepresentation::IsDBVersionActual() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Failed to get DB version: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed to get DB version: " << query.LastError().text());
return false;
}
const int32_t saved_db_version = query.GetInteger(0);
const int32_t current_db_version = GetDBVersion();
- LOG4CXX_DEBUG(logger_,
- "Saved DB version is: " << saved_db_version
+ SDL_LOG_DEBUG("Saved DB version is: " << saved_db_version
<< ". Current DB vesion is: "
<< current_db_version);
@@ -2554,21 +2521,19 @@ bool SQLPTRepresentation::IsDBVersionActual() const {
}
bool SQLPTRepresentation::UpdateDBVersion() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateDBVersion)) {
- LOG4CXX_ERROR(logger_,
- "Incorrect DB version query: " << query.LastError().text());
+ SDL_LOG_ERROR("Incorrect DB version query: " << query.LastError().text());
return false;
}
const int32_t db_version = GetDBVersion();
- LOG4CXX_DEBUG(logger_, "DB version will be updated to: " << db_version);
+ SDL_LOG_DEBUG("DB version will be updated to: " << db_version);
query.Bind(0, db_version);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "DB version getting failed: " << query.LastError().text());
+ SDL_LOG_ERROR("DB version getting failed: " << query.LastError().text());
return false;
}
@@ -2581,9 +2546,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem(
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
return result;
}
@@ -2600,9 +2564,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem(
if (policy_table::VehicleDataItem::kStruct ==
static_cast<std::string>(vdi.type)) {
if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << param_query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << param_query.LastError().text());
return policy_table::VehicleDataItems();
}
@@ -2634,21 +2597,19 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
utils::dbms::SQLQuery query(db());
if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) {
- LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized.");
+ SDL_LOG_ERROR("Vehicle data item is not initialized.");
return false;
}
if (VehicleDataItemExists(vehicle_data_item)) {
- LOG4CXX_INFO(logger_,
- static_cast<std::string>(vehicle_data_item.key)
- << " is already stored.");
+ SDL_LOG_INFO(static_cast<std::string>(vehicle_data_item.key)
+ << " is already stored.");
return true;
}
if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
return false;
}
@@ -2691,10 +2652,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
: query.Bind(14);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_ERROR(logger_,
- "Failed to insert vehicle data item: "
- << static_cast<std::string>(vehicle_data_item.key)
- << ". Error: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed to insert vehicle data item: "
+ << static_cast<std::string>(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
return false;
}
@@ -2707,14 +2667,13 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
if (stored_vehicle_data_item_params.end() !=
stored_vehicle_data_item_params.find(param.name)) {
- LOG4CXX_DEBUG(logger_, "Parameter already stored.");
+ SDL_LOG_DEBUG("Parameter already stored.");
continue;
}
if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
return false;
}
@@ -2724,11 +2683,11 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
query.Bind(3, param.key);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed to insert to vehicle data item relations helper table: "
- << static_cast<std::string>(param.key)
- << ". Error: " << query.LastError().text());
+ << static_cast<std::string>(param.key)
+ << ". Error: " << query.LastError().text());
return false;
}
stored_vehicle_data_item_params[param.name] = param.key;
@@ -2742,9 +2701,8 @@ bool SQLPTRepresentation::VehicleDataItemExists(
const policy_table::VehicleDataItem& vehicle_data_item) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement for vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement for vehicle data item. "
+ << query.LastError().text());
return false;
}
@@ -2758,10 +2716,9 @@ bool SQLPTRepresentation::VehicleDataItemExists(
: query.Bind(3);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Failed to retrieve vehicle data item: "
- << std::string(vehicle_data_item.key)
- << ". Error: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed to retrieve vehicle data item: "
+ << std::string(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
return false;
}
return !query.IsNull(0);
@@ -2785,18 +2742,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
const std::string& destination) {
utils::dbms::SQLQuery source_app(db());
if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement from application.");
+ SDL_LOG_WARN("Incorrect select statement from application.");
return false;
}
source_app.Bind(0, source);
if (!source_app.Exec()) {
- LOG4CXX_WARN(logger_, "Failed selecting from application.");
+ SDL_LOG_WARN("Failed selecting from application.");
return false;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertApplicationFull)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application full.");
+ SDL_LOG_WARN("Incorrect insert statement into application full.");
return false;
}
query.Bind(0, destination);
@@ -2834,7 +2791,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
: query.Bind(18, source_app.GetBoolean(17));
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed inserting into application.");
+ SDL_LOG_WARN("Failed inserting into application.");
return false;
}
return true;
@@ -2843,13 +2800,13 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
void SQLPTRepresentation::SetPreloaded(bool value) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdatePreloaded)) {
- LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded.");
+ SDL_LOG_WARN("Incorrect statement of updating preloaded.");
return;
}
query.Bind(0, value);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed updating preloaded.");
+ SDL_LOG_WARN("Failed updating preloaded.");
return;
}
}
@@ -2864,8 +2821,7 @@ bool SQLPTRepresentation::SaveExternalConsentEntities(
ExternalConsentEntitiesType type) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kInsertExternalConsentEntity)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for external consent entities.");
+ SDL_LOG_WARN("Incorrect insert statement for external consent entities.");
return false;
}
@@ -2882,8 +2838,7 @@ bool SQLPTRepresentation::SaveExternalConsentEntities(
query.Bind(2, it_entity->entity_id);
query.Bind(3, external_consent_entity_type);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_ERROR(logger_,
- "Can't insert '" << external_consent_entity_type
+ SDL_LOG_ERROR("Can't insert '" << external_consent_entity_type
<< "' external consent entity.");
return false;
}
diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc
index d34d1b7817..59b95a405c 100644
--- a/src/components/policy/policy_external/src/update_status_manager.cc
+++ b/src/components/policy/policy_external/src/update_status_manager.cc
@@ -37,7 +37,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
UpdateStatusManager::UpdateStatusManager()
: listener_(NULL)
@@ -48,20 +48,20 @@ UpdateStatusManager::UpdateStatusManager()
update_status_thread_delegate_ = new UpdateThreadDelegate(this);
thread_ = threads::CreateThread("UpdateStatusThread",
update_status_thread_delegate_);
- thread_->start();
+ thread_->Start();
}
UpdateStatusManager::~UpdateStatusManager() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(update_status_thread_delegate_);
DCHECK(thread_);
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
delete update_status_thread_delegate_;
threads::DeleteThread(thread_);
}
void UpdateStatusManager::ProcessEvent(UpdateEvent event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(status_lock_);
current_status_->ProcessEvent(this, event);
last_processed_event_ = event;
@@ -81,14 +81,14 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) {
}
void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(update_status_thread_delegate_);
update_status_thread_delegate_->updateTimeOut(update_timeout);
ProcessEvent(kOnUpdateSentOut);
}
void UpdateStatusManager::OnUpdateTimeoutOccurs() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto& ptu_retry_handler = listener_->ptu_retry_handler();
@@ -103,25 +103,25 @@ void UpdateStatusManager::OnUpdateTimeoutOccurs() {
}
void UpdateStatusManager::OnValidUpdateReceived() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
ProcessEvent(kOnValidUpdateReceived);
}
void UpdateStatusManager::ResetTimeout(uint32_t update_timeout) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_thread_delegate_->updateTimeOut(
update_timeout); // Restart Timer
}
void UpdateStatusManager::OnWrongUpdateReceived() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
ProcessEvent(kOnWrongUpdateReceived);
}
void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (is_update_required) {
ProcessEvent(kOnResetPolicyTableRequireUpdate);
return;
@@ -130,13 +130,13 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) {
}
void UpdateStatusManager::OnResetRetrySequence() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kOnResetRetrySequence);
}
void UpdateStatusManager::OnExistedApplicationAdded(
const bool is_update_required) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (is_update_required) {
current_status_.reset(new UpToDateStatus());
ProcessEvent(kScheduleUpdate);
@@ -144,13 +144,13 @@ void UpdateStatusManager::OnExistedApplicationAdded(
}
void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (kDeviceAllowed != consent) {
- LOG4CXX_DEBUG(logger_, "Application registered from non-consented device");
+ SDL_LOG_DEBUG("Application registered from non-consented device");
app_registered_from_non_consented_device_ = true;
return;
}
- LOG4CXX_DEBUG(logger_, "Application registered from consented device");
+ SDL_LOG_DEBUG("Application registered from consented device");
app_registered_from_non_consented_device_ = false;
if (kOnResetRetrySequence == last_processed_event_) {
current_status_.reset(new UpToDateStatus());
@@ -161,7 +161,7 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
}
void UpdateStatusManager::OnDeviceConsented() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app_registered_from_non_consented_device_) {
ProcessEvent(kOnNewAppRegistered);
}
@@ -176,17 +176,17 @@ bool UpdateStatusManager::IsUpdatePending() const {
}
void UpdateStatusManager::ScheduleUpdate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kScheduleUpdate);
}
void UpdateStatusManager::PendingUpdate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kPendingUpdate);
}
void UpdateStatusManager::ScheduleManualUpdate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kScheduleManualUpdate);
}
@@ -195,19 +195,19 @@ std::string UpdateStatusManager::StringifiedUpdateStatus() const {
}
void policy::UpdateStatusManager::OnAppsSearchStarted() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_search_in_progress_lock_);
apps_search_in_progress_ = true;
}
void policy::UpdateStatusManager::OnAppsSearchCompleted() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_search_in_progress_lock_);
apps_search_in_progress_ = false;
}
bool policy::UpdateStatusManager::IsAppsSearchInProgress() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_search_in_progress_lock_);
return apps_search_in_progress_;
}
@@ -244,22 +244,22 @@ UpdateStatusManager::UpdateThreadDelegate::UpdateThreadDelegate(
: timeout_(0)
, stop_flag_(false)
, update_status_manager_(update_status_manager) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Create UpdateThreadDelegate");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Create UpdateThreadDelegate");
}
UpdateStatusManager::UpdateThreadDelegate::~UpdateThreadDelegate() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Delete UpdateThreadDelegate");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Delete UpdateThreadDelegate");
}
void UpdateStatusManager::UpdateThreadDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "UpdateStatusManager thread started (started normal)");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("UpdateStatusManager thread started (started normal)");
sync_primitives::AutoLock auto_lock(state_lock_);
while (false == stop_flag_) {
if (timeout_ > 0) {
- LOG4CXX_DEBUG(logger_, "Timeout is greater then 0");
+ SDL_LOG_DEBUG("Timeout is greater then 0");
sync_primitives::ConditionalVariable::WaitStatus wait_status =
termination_condition_.WaitFor(auto_lock, timeout_);
if (sync_primitives::ConditionalVariable::kTimeout == wait_status) {
@@ -276,16 +276,16 @@ void UpdateStatusManager::UpdateThreadDelegate::threadMain() {
}
void UpdateStatusManager::UpdateThreadDelegate::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(state_lock_);
stop_flag_ = true;
- LOG4CXX_DEBUG(logger_, "before notify");
+ SDL_LOG_DEBUG("before notify");
termination_condition_.NotifyOne();
}
void UpdateStatusManager::UpdateThreadDelegate::updateTimeOut(
const uint32_t timeout_ms) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(state_lock_);
timeout_ = timeout_ms;
termination_condition_.NotifyOne();
diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc
index f743a4d56e..439fbcc8d2 100644
--- a/src/components/policy/policy_regular/src/access_remote_impl.cc
+++ b/src/components/policy/policy_regular/src/access_remote_impl.cc
@@ -36,7 +36,7 @@
#include "policy/cache_manager.h"
#include "utils/logger.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl")
+SDL_CREATE_LOG_VARIABLE("PolicyManagerImpl")
using policy_table::DeviceData;
using policy_table::FunctionalGroupings;
@@ -48,11 +48,10 @@ struct ToHMIType {
policy_table::AppHMITypes::value_type operator()(int item) const {
policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item);
if (!IsValidEnum(type)) {
- LOG4CXX_WARN(logger_, "HMI type isn't known " << item);
+ SDL_LOG_WARN("HMI type isn't known " << item);
type = policy_table::AHT_DEFAULT;
}
- LOG4CXX_DEBUG(logger_,
- "HMI type: " << item << " - " << EnumToJsonString(type));
+ SDL_LOG_DEBUG("HMI type: " << item << " - " << EnumToJsonString(type));
return policy_table::AppHMITypes::value_type(type);
}
};
@@ -94,7 +93,7 @@ AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache)
bool AccessRemoteImpl::CheckModuleType(const PTString& app_id,
policy_table::ModuleType module) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!cache_->IsApplicationRepresented(app_id)) {
return false;
}
@@ -117,10 +116,10 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules,
const std::string& module_name,
const std::string& rpc_name,
RemoteControlParams* input) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::AccessModules::const_iterator i = modules.find(module_name);
if (i == modules.end()) {
- LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found");
+ SDL_LOG_DEBUG("Module " << module_name << " wasn't found");
return false;
}
@@ -133,19 +132,19 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules,
const policy_table::Strings& parameters = j->second;
return CompareParameters(parameters, input);
}
- LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found");
+ SDL_LOG_DEBUG("RPC " << rpc_name << " wasn't found");
return false;
}
bool AccessRemoteImpl::CompareParameters(
const policy_table::Strings& parameters, RemoteControlParams* input) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (parameters.empty()) {
return true;
}
if (input->empty()) {
- LOG4CXX_DEBUG(logger_, "Input is empty");
+ SDL_LOG_DEBUG("Input is empty");
return false;
}
@@ -157,7 +156,7 @@ bool AccessRemoteImpl::CompareParameters(
void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who,
const std::vector<int>& hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
HMIList::mapped_type types;
std::transform(hmi_types.begin(),
hmi_types.end(),
@@ -168,7 +167,7 @@ void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who,
const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes(
const ApplicationOnDevice& who) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (cache_->IsDefaultPolicy(who.app_id)) {
return hmi_types_[who];
} else {
@@ -180,12 +179,12 @@ const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes(
const policy_table::Strings& AccessRemoteImpl::GetGroups(
const ApplicationOnDevice& who) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetGroups(who.app_id);
}
bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const policy_table::AppHMITypes& hmi_types = HmiTypes(who);
return std::find(hmi_types.begin(),
hmi_types.end(),
@@ -195,7 +194,7 @@ bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) {
bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id,
const std::string& app_id,
FunctionalIdType& group_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]);
GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]);
GetGroupsIds(
@@ -221,7 +220,7 @@ void AccessRemoteImpl::GetGroupsIds(const std::string& device_id,
groups.end(),
groups_ids.begin(),
&CacheManager::GenerateHash);
- LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids);
+ SDL_LOG_DEBUG("Groups Ids: " << groups_ids);
}
bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id,
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index ed2bbefcd7..5a75c47725 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -60,22 +60,22 @@ namespace policy_table = rpc::policy_table_interface_base;
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
-#define CACHE_MANAGER_CHECK(return_value) \
- { \
- if (!pt_) { \
- LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \
- return return_value; \
- } \
+#define CACHE_MANAGER_CHECK(return_value) \
+ { \
+ if (!pt_) { \
+ SDL_LOG_WARN("The cache manager is not initialized"); \
+ return return_value; \
+ } \
}
-#define CACHE_MANAGER_CHECK_VOID() \
- { \
- if (!pt_) { \
- LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \
- return; \
- } \
+#define CACHE_MANAGER_CHECK_VOID() \
+ { \
+ if (!pt_) { \
+ SDL_LOG_WARN("The cache manager is not initialized"); \
+ return; \
+ } \
}
struct LanguageFinder {
@@ -110,17 +110,17 @@ CacheManager::CacheManager()
, update_required(false)
, removed_custom_vd_items_()
, settings_(nullptr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
backuper_ = new BackgroundBackuper(this);
backup_thread_ = threads::CreateThread("Backup thread", backuper_);
- backup_thread_->start();
+ backup_thread_->Start();
}
CacheManager::~CacheManager() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(backuper_locker_);
- backup_thread_->join();
- delete backup_thread_->delegate();
+ backup_thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete backup_thread_->GetDelegate();
threads::DeleteThread(backup_thread_);
}
@@ -130,7 +130,7 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) {
}
const policy_table::Strings CacheManager::GetPolicyAppIDs() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
const auto apps = pt_->policy_table.app_policies_section.apps;
@@ -204,18 +204,18 @@ bool CacheManager::GetUserPermissionsForDevice(
const std::string& device_id,
StringArray& consented_groups,
StringArray& disallowed_groups) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
return true;
}
void CacheManager::GetAllAppGroups(const std::string& app_id,
FunctionalGroupIDs& all_group_ids) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
if (kDeviceId == app_id) {
- LOG4CXX_INFO(logger_, "Devices doesn't have groups");
+ SDL_LOG_INFO("Devices doesn't have groups");
return;
}
@@ -238,7 +238,7 @@ void CacheManager::GetAllAppGroups(const std::string& app_id,
void CacheManager::GetPreConsentedGroups(
const std::string& app_id, FunctionalGroupIDs& preconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
}
@@ -246,7 +246,7 @@ void CacheManager::GetConsentedGroups(const std::string& device_id,
const std::string& app_id,
FunctionalGroupIDs& allowed_groups,
FunctionalGroupIDs& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
}
@@ -254,7 +254,7 @@ void CacheManager::GetUnconsentedGroups(
const std::string& device_id,
const std::string& policy_app_id,
FunctionalGroupIDs& unconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
}
@@ -264,7 +264,7 @@ void CacheManager::RemoveAppConsentForGroup(const std::string& app_id,
}
bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
pt_->policy_table.functional_groupings =
@@ -355,7 +355,7 @@ policy_table::VehicleDataItems CacheManager::CollectCustomVDItems(
void CacheManager::GetHMIAppTypeAfterUpdate(
std::map<std::string, StringArray>& app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::const_iterator policy_iter_begin =
@@ -419,7 +419,7 @@ std::string CacheManager::currentDateTime() {
bool CacheManager::GetPermissionsForApp(const std::string& device_id,
const std::string& app_id,
FunctionalIdType& group_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
GetAllAppGroups(app_id, group_types[kTypeGeneral]);
GetAllAppGroups(kDefaultId, group_types[kTypeDefault]);
GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]);
@@ -429,14 +429,14 @@ bool CacheManager::GetPermissionsForApp(const std::string& device_id,
bool CacheManager::GetDeviceGroupsFromPolicies(
policy_table::Strings& groups,
policy_table::Strings& preconsented_groups) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
return true;
}
bool CacheManager::AddDevice(const std::string& device_id,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
@@ -462,7 +462,7 @@ bool CacheManager::SetDeviceData(const std::string& device_id,
const std::string& carrier,
const uint32_t number_of_ports,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
@@ -474,7 +474,7 @@ bool CacheManager::SetUserPermissionsForDevice(
const std::string& device_id,
const StringArray& consented_groups,
const StringArray& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
Backup();
@@ -483,7 +483,7 @@ bool CacheManager::SetUserPermissionsForDevice(
bool CacheManager::ReactOnUserDevConsentForApp(const std::string& app_id,
bool is_device_allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
bool result = true;
Backup();
@@ -509,7 +509,7 @@ void CacheManager::GetGroupNameByHashID(const int32_t group_id,
bool CacheManager::SetUserPermissionsForApp(
const PermissionConsent& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
CACHE_MANAGER_CHECK(false);
Backup();
@@ -541,7 +541,7 @@ void CacheManager::CheckPermissions(const policy_table::Strings& groups,
const PTString& hmi_level,
const PTString& rpc,
CheckPermissionResult& result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -600,14 +600,14 @@ int CacheManager::IgnitionCyclesBeforeExchange() {
static_cast<int>(
pt_->policy_table.module_config.exchange_after_x_ignition_cycles),
0);
- LOG4CXX_DEBUG(logger_, "IgnitionCyclesBeforeExchange limit:" << limit);
+ SDL_LOG_DEBUG("IgnitionCyclesBeforeExchange limit:" << limit);
uint8_t current = 0;
const int last_exch = static_cast<int>(
*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange);
current = std::max(last_exch, 0);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"IgnitionCyclesBeforeExchange current:" << static_cast<int>(current));
return std::max(limit - current, 0);
@@ -620,16 +620,16 @@ int CacheManager::KilometersBeforeExchange(int current) {
std::max(static_cast<int>(
pt_->policy_table.module_config.exchange_after_x_kilometers),
0);
- LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit);
+ SDL_LOG_DEBUG("KilometersBeforeExchange limit:" << limit);
int last = 0;
const int odo_val = static_cast<int>(
*pt_->policy_table.module_meta->pt_exchanged_at_odometer_x);
last = std::max(odo_val, 0);
- LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange last:" << last);
+ SDL_LOG_DEBUG("KilometersBeforeExchange last:" << last);
const int actual = std::max((current - last), 0);
- LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual);
+ SDL_LOG_DEBUG("KilometersBeforeExchange actual:" << actual);
return std::max(limit - actual, 0);
}
@@ -640,18 +640,16 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate(
switch (counter) {
case KILOMETERS:
*pt_->policy_table.module_meta->pt_exchanged_at_odometer_x = value;
- LOG4CXX_DEBUG(logger_,
- "SetCountersPassedForSuccessfulUpdate km:" << value);
+ SDL_LOG_DEBUG("SetCountersPassedForSuccessfulUpdate km:" << value);
break;
case DAYS_AFTER_EPOCH:
*pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch = value;
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"SetCountersPassedForSuccessfulUpdate days after epoch:" << value);
break;
default:
- LOG4CXX_ERROR(logger_,
- "Unknown counter was requested to set: " << counter);
+ SDL_LOG_ERROR("Unknown counter was requested to set: " << counter);
return false;
}
@@ -660,7 +658,7 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate(
}
int CacheManager::DaysBeforeExchange(int current) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(0);
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -672,14 +670,13 @@ int CacheManager::DaysBeforeExchange(int current) {
}
const uint8_t limit = pt_->policy_table.module_config.exchange_after_x_days;
- LOG4CXX_DEBUG(logger_,
- "Exchange after: " << static_cast<int>(limit) << " days");
+ SDL_LOG_DEBUG("Exchange after: " << static_cast<int>(limit) << " days");
- LOG4CXX_DEBUG(logger_, "Epoch since last update: " << *days_after_epoch);
+ SDL_LOG_DEBUG("Epoch since last update: " << *days_after_epoch);
const uint16_t actual =
std::max(static_cast<uint16_t>(current - *days_after_epoch), uint16_t(0));
- LOG4CXX_DEBUG(logger_, "The days since last update: " << actual);
+ SDL_LOG_DEBUG("The days since last update: " << actual);
return std::max(limit - actual, 0);
}
@@ -691,7 +688,7 @@ void CacheManager::IncrementIgnitionCycles() {
*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange);
(*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange) =
ign_val + 1;
- LOG4CXX_DEBUG(logger_, "IncrementIgnitionCycles ignitions:" << ign_val);
+ SDL_LOG_DEBUG("IncrementIgnitionCycles ignitions:" << ign_val);
Backup();
}
@@ -914,7 +911,7 @@ void CacheManager::SetHybridAppPreference(
void CacheManager::GetAppServiceParameters(
const std::string& policy_app_id,
policy_table::AppServiceParameters* app_service_parameters) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const policy_table::ApplicationPolicies& policies =
pt_->policy_table.app_policies_section.apps;
policy_table::ApplicationPolicies::const_iterator policy_iter =
@@ -944,24 +941,23 @@ bool CacheManager::UnknownRPCPassthroughAllowed(
const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
boost::optional<bool> empty;
CACHE_MANAGER_CHECK(empty);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ModuleConfig& module_config = pt_->policy_table.module_config;
if (module_config.lock_screen_dismissal_enabled.is_initialized()) {
- LOG4CXX_TRACE(logger_,
- "state = " << *module_config.lock_screen_dismissal_enabled);
+ SDL_LOG_TRACE("state = " << *module_config.lock_screen_dismissal_enabled);
return boost::optional<bool>(*module_config.lock_screen_dismissal_enabled);
}
- LOG4CXX_TRACE(logger_, "state = empty");
+ SDL_LOG_TRACE("state = empty");
return empty;
}
const boost::optional<std::string>
CacheManager::LockScreenDismissalWarningMessage(
const std::string& language) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
boost::optional<std::string> empty;
CACHE_MANAGER_CHECK(empty);
@@ -983,7 +979,7 @@ CacheManager::LockScreenDismissalWarningMessage(
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<UserFriendlyMessage> result;
CACHE_MANAGER_CHECK(result);
@@ -1003,10 +999,9 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
msg_languages.languages.begin(), msg_languages.languages.end(), finder);
if (msg_languages.languages.end() == it_language) {
- LOG4CXX_WARN(logger_,
- "Language "
- << language
- << " haven't been found for message code: " << *it);
+ SDL_LOG_WARN("Language "
+ << language
+ << " haven't been found for message code: " << *it);
LanguageFinder fallback_language_finder("en-us");
@@ -1016,8 +1011,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
fallback_language_finder);
if (msg_languages.languages.end() == it_fallback_language) {
- LOG4CXX_ERROR(logger_,
- "No fallback language found for message code: " << *it);
+ SDL_LOG_ERROR("No fallback language found for message code: " << *it);
continue;
}
@@ -1058,10 +1052,10 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type,
void CacheManager::GetUpdateUrls(const std::string& service_type,
EndpointUrls& out_end_points) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
- LOG4CXX_DEBUG(logger_, "Search service value is: " << service_type);
+ SDL_LOG_DEBUG("Search service value is: " << service_type);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ServiceEndpoints::const_iterator iter =
@@ -1145,7 +1139,7 @@ bool CacheManager::GetPriority(const std::string& policy_app_id,
void CacheManager::CheckSnapshotInitialization() {
CACHE_MANAGER_CHECK_VOID();
if (!snapshot_) {
- LOG4CXX_ERROR(logger_, "Snapshot pointer is not initialized");
+ SDL_LOG_ERROR("Snapshot pointer is not initialized");
return;
}
@@ -1177,8 +1171,7 @@ void CacheManager::CheckSnapshotInitialization() {
snapshot_->policy_table.consumer_friendly_messages->messages =
rpc::Optional<policy_table::Messages>();
} else {
- LOG4CXX_WARN(logger_,
- "policy_table.consumer_friendly_messages is not initialized");
+ SDL_LOG_WARN("policy_table.consumer_friendly_messages is not initialized");
}
/* policy_table.usage_and_error_counts are required for PTS and
@@ -1256,22 +1249,21 @@ void CacheManager::CheckSnapshotInitialization() {
}
}
} else {
- LOG4CXX_WARN(logger_, "app_level is not initialized");
+ SDL_LOG_WARN("app_level is not initialized");
}
}
policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff(
const policy_table::VehicleDataItems& items_before,
const policy_table::VehicleDataItems& items_after) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (items_before.empty()) {
- LOG4CXX_DEBUG(logger_, "No custom VD items found in policy");
+ SDL_LOG_DEBUG("No custom VD items found in policy");
return policy_table::VehicleDataItems();
}
if (items_after.empty()) {
- LOG4CXX_DEBUG(logger_,
- "All custom VD items were removed after policy update");
+ SDL_LOG_DEBUG("All custom VD items were removed after policy update");
return items_before;
}
@@ -1289,19 +1281,18 @@ policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff(
}
}
- LOG4CXX_DEBUG(logger_,
- "Found " << removed_items.size() << " removed VD items");
+ SDL_LOG_DEBUG("Found " << removed_items.size() << " removed VD items");
return removed_items;
}
void CacheManager::SetRemovedCustomVdItems(
const policy_table::VehicleDataItems& removed_items) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
removed_custom_vd_items_ = removed_items;
}
void CacheManager::PersistData() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (backup_.use_count() != 0) {
if (pt_.use_count() != 0) {
// Comma expression is used to hold the lock only during the constructor
@@ -1359,7 +1350,7 @@ void CacheManager::PersistData() {
}
void CacheManager::ResetCalculatedPermissions() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(calculated_permissions_lock_);
calculated_permissions_.clear();
}
@@ -1367,9 +1358,8 @@ void CacheManager::ResetCalculatedPermissions() {
void CacheManager::AddCalculatedPermissions(const std::string& device_id,
const std::string& policy_app_id,
const Permissions& permissions) {
- LOG4CXX_DEBUG(logger_,
- "AddCalculatedPermissions for device: "
- << device_id << " and app: " << policy_app_id);
+ SDL_LOG_DEBUG("AddCalculatedPermissions for device: "
+ << device_id << " and app: " << policy_app_id);
sync_primitives::AutoLock lock(calculated_permissions_lock_);
calculated_permissions_[device_id][policy_app_id] = permissions;
}
@@ -1377,9 +1367,8 @@ void CacheManager::AddCalculatedPermissions(const std::string& device_id,
bool CacheManager::IsPermissionsCalculated(const std::string& device_id,
const std::string& policy_app_id,
Permissions& permission) {
- LOG4CXX_DEBUG(logger_,
- "IsPermissionsCalculated for device: "
- << device_id << " and app: " << policy_app_id);
+ SDL_LOG_DEBUG("IsPermissionsCalculated for device: "
+ << device_id << " and app: " << policy_app_id);
sync_primitives::AutoLock lock(calculated_permissions_lock_);
CalculatedPermissions::const_iterator it =
calculated_permissions_.find(device_id);
@@ -1443,7 +1432,7 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() {
bool CacheManager::GetInitialAppData(const std::string& app_id,
StringArray& nicknames,
StringArray& app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::const_iterator policy_iter =
@@ -1466,7 +1455,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id,
bool CacheManager::GetFunctionalGroupings(
policy_table::FunctionalGroupings& groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
const policy_table::FunctionalGroupings& f_groupings =
@@ -1478,15 +1467,15 @@ bool CacheManager::GetFunctionalGroupings(
int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id,
const std::string& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
- LOG4CXX_DEBUG(logger_, "Application id: " << policy_app_id);
+ SDL_LOG_DEBUG("Application id: " << policy_app_id);
int result = 0;
return result;
}
void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
*(pt_->policy_table.module_config.preloaded_pt) = is_preloaded;
Backup();
}
@@ -1507,7 +1496,7 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version,
}
std::string CacheManager::GetCCPUVersionFromPT() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
rpc::Optional<policy_table::ModuleMeta>& module_meta =
pt_->policy_table.module_meta;
return *(module_meta->ccpu_version);
@@ -1526,7 +1515,7 @@ bool CacheManager::SetSystemLanguage(const std::string& language) {
}
bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames& names) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
rpc::policy_table_interface_base::FunctionalGroupings::iterator iter =
@@ -1598,7 +1587,7 @@ void CacheManager::Increment(const std::string& app_id,
.count_of_tls_errors;
break;
default:
- LOG4CXX_WARN(logger_, "Type app counter is unknown");
+ SDL_LOG_WARN("Type app counter is unknown");
return;
}
Backup();
@@ -1619,7 +1608,7 @@ void CacheManager::Set(const std::string& app_id,
.app_registration_language_vui = value;
break;
default:
- LOG4CXX_WARN(logger_, "Type app info is unknown");
+ SDL_LOG_WARN("Type app info is unknown");
return;
}
Backup();
@@ -1649,7 +1638,7 @@ void CacheManager::Add(const std::string& app_id,
.minutes_in_hmi_none += minutes;
break;
default:
- LOG4CXX_WARN(logger_, "Type app stopwatch is unknown");
+ SDL_LOG_WARN("Type app stopwatch is unknown");
return;
}
Backup();
@@ -1706,8 +1695,7 @@ bool CacheManager::SetPredataPolicy(const std::string& app_id) {
pt_->policy_table.app_policies_section.apps.find(kPreDataConsentId);
if (pt_->policy_table.app_policies_section.apps.end() == iter) {
- LOG4CXX_ERROR(logger_,
- "Could not set " << kPreDataConsentId
+ SDL_LOG_ERROR("Could not set " << kPreDataConsentId
<< " permissions for app " << app_id);
return false;
}
@@ -1756,20 +1744,18 @@ bool CacheManager::SetUnpairedDevice(const std::string& device_id,
const bool result = pt_->policy_table.device_data->end() !=
pt_->policy_table.device_data->find(device_id);
if (!result) {
- LOG4CXX_DEBUG(logger_,
- "Couldn't set unpaired flag for device id "
- << device_id << " , since it wasn't found.");
+ SDL_LOG_DEBUG("Couldn't set unpaired flag for device id "
+ << device_id << " , since it wasn't found.");
return false;
}
sync_primitives::AutoLock lock(unpaired_lock_);
if (unpaired) {
is_unpaired_.insert(device_id);
- LOG4CXX_DEBUG(logger_, "Unpaired flag was set for device id " << device_id);
+ SDL_LOG_DEBUG("Unpaired flag was set for device id " << device_id);
} else {
is_unpaired_.erase(device_id);
- LOG4CXX_DEBUG(logger_,
- "Unpaired flag was removed for device id " << device_id);
+ SDL_LOG_DEBUG("Unpaired flag was removed for device id " << device_id);
}
return result;
}
@@ -1793,20 +1779,20 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const {
bool CacheManager::Init(const std::string& file_name,
const PolicySettings* settings) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
settings_ = settings;
InitResult init_result = backup_->Init(settings);
bool result = true;
switch (init_result) {
case InitResult::EXISTS: {
- LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly.");
+ SDL_LOG_INFO("Policy Table exists, was loaded correctly.");
result = LoadFromBackup();
if (result) {
if (!backup_->IsDBVersionActual()) {
- LOG4CXX_INFO(logger_, "DB version is NOT actual");
+ SDL_LOG_INFO("DB version is NOT actual");
if (!backup_->RefreshDB()) {
- LOG4CXX_ERROR(logger_, "RefreshDB() failed");
+ SDL_LOG_ERROR("RefreshDB() failed");
return false;
}
backup_->UpdateDBVersion();
@@ -1818,24 +1804,22 @@ bool CacheManager::Init(const std::string& file_name,
}
} break;
case InitResult::SUCCESS: {
- LOG4CXX_INFO(logger_, "Policy Table was inited successfully");
+ SDL_LOG_INFO("Policy Table was inited successfully");
result = LoadFromFile(file_name, *pt_);
std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot();
result &= snapshot->is_valid();
- LOG4CXX_DEBUG(logger_,
- "Check if snapshot is valid: " << std::boolalpha << result);
+ SDL_LOG_DEBUG("Check if snapshot is valid: " << std::boolalpha << result);
if (!result) {
rpc::ValidationReport report("policy_table");
snapshot->ReportErrors(&report);
- LOG4CXX_DEBUG(logger_,
- "Validation report: " << rpc::PrettyFormat(report));
+ SDL_LOG_DEBUG("Validation report: " << rpc::PrettyFormat(report));
return result;
}
if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) {
- LOG4CXX_ERROR(logger_, "Cannot unwrap application policies");
+ SDL_LOG_ERROR("Cannot unwrap application policies");
}
backup_->UpdateDBVersion();
@@ -1843,7 +1827,7 @@ bool CacheManager::Init(const std::string& file_name,
} break;
default: {
result = false;
- LOG4CXX_ERROR(logger_, "Failed to init policy table.");
+ SDL_LOG_ERROR("Failed to init policy table.");
} break;
}
@@ -1853,12 +1837,11 @@ bool CacheManager::Init(const std::string& file_name,
void CacheManager::FillDeviceSpecificData() {}
bool CacheManager::LoadFromBackup() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(cache_lock_);
pt_ = backup_->GenerateSnapshot();
update_required = backup_->UpdateRequired();
- LOG4CXX_DEBUG(logger_,
- "Update required flag from backup: " << std::boolalpha
+ SDL_LOG_DEBUG("Update required flag from backup: " << std::boolalpha
<< update_required);
FillDeviceSpecificData();
@@ -1888,10 +1871,10 @@ void CacheManager::MakeLowerCaseAppNames(policy_table::Table& pt) const {
bool CacheManager::LoadFromFile(const std::string& file_name,
policy_table::Table& table) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
BinaryMessage json_string;
if (!file_system::ReadBinaryFile(file_name, json_string)) {
- LOG4CXX_FATAL(logger_, "Failed to read pt file.");
+ SDL_LOG_FATAL("Failed to read pt file.");
return false;
}
@@ -1904,27 +1887,25 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
std::string json(json_string.begin(), json_string.end());
const size_t json_len = json.length();
if (!reader->parse(json.c_str(), json.c_str() + json_len, &value, &err)) {
- LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted: " << err);
+ SDL_LOG_FATAL("Preloaded PT is corrupted: " << err);
return false;
}
- LOG4CXX_TRACE(logger_, "Start create PT");
+ SDL_LOG_TRACE("Start create PT");
sync_primitives::AutoLock locker(cache_lock_);
table = policy_table::Table(&value);
Json::StreamWriterBuilder writer_builder;
- LOG4CXX_DEBUG(logger_, "PT out:");
- LOG4CXX_DEBUG(logger_,
- Json::writeString(writer_builder, table.ToJsonValue()));
+ SDL_LOG_DEBUG("PT out:");
+ SDL_LOG_DEBUG(Json::writeString(writer_builder, table.ToJsonValue()));
MakeLowerCaseAppNames(table);
if (!table.is_valid()) {
rpc::ValidationReport report("policy_table");
table.ReportErrors(&report);
- LOG4CXX_FATAL(logger_,
- "Parsed table is not valid " << rpc::PrettyFormat(report));
+ SDL_LOG_FATAL("Parsed table is not valid " << rpc::PrettyFormat(report));
return false;
}
@@ -1962,25 +1943,22 @@ int32_t CacheManager::GenerateHash(const std::string& str_to_hash) {
RequestType::State CacheManager::GetAppRequestTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::iterator app_policies_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request types for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id);
return RequestType::State::UNAVAILABLE;
}
const policy_table::RequestTypes& request_types =
*app_policies_iter->second.RequestType;
if (!request_types.is_initialized()) {
- LOG4CXX_DEBUG(logger_,
- "Request types for " << policy_app_id << " are OMITTED");
+ SDL_LOG_DEBUG("Request types for " << policy_app_id << " are OMITTED");
return RequestType::State::OMITTED;
}
if (request_types.empty()) {
- LOG4CXX_DEBUG(logger_,
- "Request types for " << policy_app_id << " are EMPTY");
+ SDL_LOG_DEBUG("Request types for " << policy_app_id << " are EMPTY");
return RequestType::State::EMPTY;
}
return RequestType::State::AVAILABLE;
@@ -1989,19 +1967,17 @@ RequestType::State CacheManager::GetAppRequestTypesState(
void CacheManager::GetAppRequestTypes(
const std::string& policy_app_id,
std::vector<std::string>& request_types) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
if (kDeviceId == policy_app_id) {
- LOG4CXX_DEBUG(logger_,
- "Request types not applicable for app_id " << kDeviceId);
+ SDL_LOG_DEBUG("Request types not applicable for app_id " << kDeviceId);
return;
}
policy_table::ApplicationPolicies::iterator policy_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request types for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id);
return;
}
@@ -2013,25 +1989,22 @@ void CacheManager::GetAppRequestTypes(
RequestSubType::State CacheManager::GetAppRequestSubTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ApplicationPolicies::iterator app_policies_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request subtypes for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id);
return RequestSubType::State::UNAVAILABLE;
}
const policy_table::RequestSubTypes& request_subtypes =
*app_policies_iter->second.RequestSubType;
if (!request_subtypes.is_initialized()) {
- LOG4CXX_DEBUG(logger_,
- "Request subtypes for " << policy_app_id << " are OMITTED");
+ SDL_LOG_DEBUG("Request subtypes for " << policy_app_id << " are OMITTED");
return RequestSubType::State::OMITTED;
}
if (request_subtypes.empty()) {
- LOG4CXX_DEBUG(logger_,
- "Request subtypes for " << policy_app_id << " are EMPTY");
+ SDL_LOG_DEBUG("Request subtypes for " << policy_app_id << " are EMPTY");
return RequestSubType::State::EMPTY;
}
return RequestSubType::State::AVAILABLE;
@@ -2040,19 +2013,17 @@ RequestSubType::State CacheManager::GetAppRequestSubTypesState(
void CacheManager::GetAppRequestSubTypes(
const std::string& policy_app_id,
std::vector<std::string>& request_types) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK_VOID();
sync_primitives::AutoLock auto_lock(cache_lock_);
if (kDeviceId == policy_app_id) {
- LOG4CXX_DEBUG(logger_,
- "Request subtypes not applicable for app_id " << kDeviceId);
+ SDL_LOG_DEBUG("Request subtypes not applicable for app_id " << kDeviceId);
return;
}
policy_table::ApplicationPolicies::iterator policy_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) {
- LOG4CXX_DEBUG(logger_,
- "Can't find request subtypes for app_id " << policy_app_id);
+ SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id);
return;
}
@@ -2072,10 +2043,10 @@ std::string CacheManager::GetCertificate() const {
}
bool CacheManager::MergePreloadPT(const std::string& file_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::Table table;
if (!LoadFromFile(file_name, table)) {
- LOG4CXX_DEBUG(logger_, "Unable to load preloaded PT.");
+ SDL_LOG_DEBUG("Unable to load preloaded PT.");
return false;
}
@@ -2097,7 +2068,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) {
void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::ModuleConfig copy(pt.module_config);
pt.module_config = new_pt.module_config;
@@ -2108,19 +2079,19 @@ void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::FunctionalGroupings::const_iterator it =
new_pt.functional_groupings.begin();
for (; it != new_pt.functional_groupings.end(); ++it) {
- LOG4CXX_DEBUG(logger_, "Merge functional group: " << it->first);
+ SDL_LOG_DEBUG("Merge functional group: " << it->first);
pt.functional_groupings[it->first] = it->second;
}
}
void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
pt.app_policies_section.device =
const_cast<policy_table::PolicyTable&>(new_pt)
.app_policies_section.device;
@@ -2136,7 +2107,7 @@ void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (new_pt.consumer_friendly_messages.is_initialized()) {
if (!pt.consumer_friendly_messages.is_initialized()) {
pt.consumer_friendly_messages = new_pt.consumer_friendly_messages;
@@ -2147,9 +2118,9 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
pt.consumer_friendly_messages->version =
new_pt.consumer_friendly_messages->version;
for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) {
- LOG4CXX_DEBUG(logger_, "Merge CFM: " << it->first);
+ SDL_LOG_DEBUG("Merge CFM: " << it->first);
if (!(pt.consumer_friendly_messages->messages.is_initialized())) {
- LOG4CXX_DEBUG(logger_, "CFM not initialized.");
+ SDL_LOG_DEBUG("CFM not initialized.");
}
(*pt.consumer_friendly_messages->messages)[it->first] = it->second;
}
@@ -2159,7 +2130,7 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
pt.vehicle_data.assign_if_valid(new_pt.vehicle_data);
}
@@ -2171,8 +2142,8 @@ const PolicySettings& CacheManager::get_settings() const {
void CacheManager::OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_INFO(logger_, "Implementation does not support user consents.");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_INFO("Implementation does not support user consents.");
}
CacheManager::BackgroundBackuper::BackgroundBackuper(
@@ -2180,26 +2151,26 @@ CacheManager::BackgroundBackuper::BackgroundBackuper(
: cache_manager_(cache_manager)
, stop_flag_(false)
, new_data_available_(false) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
CacheManager::BackgroundBackuper::~BackgroundBackuper() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
void CacheManager::BackgroundBackuper::InternalBackup() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(cache_manager_);
while (new_data_available_) {
new_data_available_ = false;
- LOG4CXX_DEBUG(logger_, "DoBackup");
+ SDL_LOG_DEBUG("DoBackup");
cache_manager_->PersistData();
}
}
void CacheManager::BackgroundBackuper::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(need_backup_lock_);
while (!stop_flag_) {
{
@@ -2209,20 +2180,20 @@ void CacheManager::BackgroundBackuper::threadMain() {
if (new_data_available_ || stop_flag_) {
continue;
}
- LOG4CXX_DEBUG(logger_, "Wait for a next backup");
+ SDL_LOG_DEBUG("Wait for a next backup");
backup_notifier_.Wait(need_backup_lock_);
}
}
void CacheManager::BackgroundBackuper::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(need_backup_lock_);
stop_flag_ = true;
backup_notifier_.NotifyOne();
}
void CacheManager::BackgroundBackuper::DoBackup() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(need_backup_lock_);
new_data_available_ = true;
backup_notifier_.NotifyOne();
@@ -2230,7 +2201,7 @@ void CacheManager::BackgroundBackuper::DoBackup() {
EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag(
const std::string& application) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
return pt_->policy_table.app_policies_section.apps[application]
@@ -2239,14 +2210,14 @@ EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag(
EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag(
const std::string& functional_group) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
const auto& functional_groupings = pt_->policy_table.functional_groupings;
const auto& grouping_itr = functional_groupings.find(functional_group);
if (grouping_itr == functional_groupings.end()) {
- LOG4CXX_WARN(logger_, "Group " << functional_group << " not found");
+ SDL_LOG_WARN("Group " << functional_group << " not found");
return EncryptionRequired(rpc::Boolean(false));
}
@@ -2256,14 +2227,13 @@ EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag(
void CacheManager::GetApplicationParams(
const std::string& application_name,
policy_table::ApplicationParams& application_params) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(cache_lock_);
const auto apps = pt_->policy_table.app_policies_section.apps;
const auto it = apps.find(application_name);
if (apps.end() == it) {
- LOG4CXX_WARN(logger_,
- "Application " << application_name << " was not found");
+ SDL_LOG_WARN("Application " << application_name << " was not found");
return;
}
diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc
index 08f1fbb177..7d99ff51c0 100644
--- a/src/components/policy/policy_regular/src/policy_helper.cc
+++ b/src/components/policy/policy_regular/src/policy_helper.cc
@@ -44,7 +44,7 @@ namespace custom_str = utils::custom_string;
namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
bool CompareStrings(const StringsValueType& first,
const StringsValueType& second) {
@@ -302,7 +302,7 @@ std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups(
FunctionalGroupNames groups_attributes;
if (!pm_->cache_->GetFunctionalGroupNames(groups_attributes)) {
- LOG4CXX_WARN(logger_, "Can't get functional group names");
+ SDL_LOG_WARN("Can't get functional group names");
return std::vector<FunctionalGroupPermission>();
}
@@ -339,8 +339,8 @@ void policy::CheckAppPolicy::NotifySystem(
auto& listener = *pm_->listener();
const auto devices_ids = listener.GetDevicesIds(app_policy.first);
if (devices_ids.empty()) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Couldn't find device info for application id: " << app_policy.first);
return;
}
@@ -352,7 +352,7 @@ void policy::CheckAppPolicy::NotifySystem(
bool CheckAppPolicy::IsAppRevoked(
const AppPoliciesValueType& app_policy) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Application params are not initialized = application revoked
// i.e. "123":null
return app_policy.second.is_null();
@@ -380,7 +380,7 @@ bool CheckAppPolicy::NicknamesMatch(
void CheckAppPolicy::AddResult(const std::string& app_id,
PermissionsCheckResult result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto item = std::make_pair(app_id, result);
out_results_.insert(item);
}
@@ -395,8 +395,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
}
if (!IsKnownAppication(app_id)) {
- LOG4CXX_WARN(logger_,
- "Application:" << app_id << " is not present in snapshot.");
+ SDL_LOG_WARN("Application:" << app_id << " is not present in snapshot.");
return true;
}
@@ -427,16 +426,14 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
}
}
if (RESULT_NO_CHANGES == result) {
- LOG4CXX_INFO(
- logger_,
- "Permissions for application:" << app_id << " wasn't changed.");
+ SDL_LOG_INFO("Permissions for application:" << app_id
+ << " wasn't changed.");
AddResult(app_id, RESULT_NO_CHANGES);
return true;
}
- LOG4CXX_INFO(
- logger_,
- "Permissions for application:" << app_id << " have been changed.");
+ SDL_LOG_INFO("Permissions for application:" << app_id
+ << " have been changed.");
if (IsPredefinedApp(app_policy)) {
const auto& snapshot_app_policy_begin =
@@ -616,7 +613,7 @@ bool CheckAppPolicy::IsRequestSubTypeChanged(
bool CheckAppPolicy::IsAppPropertiesProvided(
const AppPoliciesValueType& app_policy) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app_policy.second.hybrid_app_preference.is_initialized() ||
app_policy.second.endpoint.is_initialized() ||
app_policy.second.enabled.is_initialized() ||
@@ -630,15 +627,15 @@ bool CheckAppPolicy::IsAppPropertiesProvided(
bool CheckAppPolicy::IsAppPropertiesChanged(
const AppPoliciesValueType& app_policy) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!IsAppPropertiesProvided(app_policy)) {
return false;
}
if (!IsKnownAppication(app_policy.first)) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"AppProperties provided for new application: " << app_policy.first);
return true;
}
@@ -649,33 +646,33 @@ bool CheckAppPolicy::IsAppPropertiesChanged(
if (app_policy.second.enabled.is_initialized() &&
app_policy.second.enabled != snapshot_properties.second.enabled) {
- LOG4CXX_DEBUG(logger_, "\"enabled\" was changed");
+ SDL_LOG_DEBUG("\"enabled\" was changed");
return true;
}
if (app_policy.second.endpoint.is_initialized() &&
app_policy.second.endpoint != snapshot_properties.second.endpoint) {
- LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed");
+ SDL_LOG_DEBUG("\"endpoint\" was changed");
return true;
}
if (app_policy.second.hybrid_app_preference.is_initialized() &&
app_policy.second.hybrid_app_preference !=
snapshot_properties.second.hybrid_app_preference) {
- LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed");
+ SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed");
return true;
}
if (app_policy.second.auth_token.is_initialized() &&
app_policy.second.auth_token != snapshot_properties.second.auth_token) {
- LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed");
+ SDL_LOG_DEBUG("\"auth_token\" was changed");
return true;
}
if (app_policy.second.cloud_transport_type.is_initialized() &&
app_policy.second.cloud_transport_type !=
snapshot_properties.second.cloud_transport_type) {
- LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed");
+ SDL_LOG_DEBUG("\"cloud_transport_type\" was changed");
return true;
}
@@ -690,7 +687,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged(
-> rpc::Optional<rpc::Boolean> {
auto it = policies.find(policy_app_id);
if (policies.end() == it) {
- LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ SDL_LOG_WARN("App is not present in policies " << policy_app_id);
return rpc::Optional<rpc::Boolean>(false);
}
return it->second.encryption_required;
@@ -702,7 +699,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged(
policy_table::Strings result;
auto it = policies.find(policy_app_id);
if (policies.end() == it) {
- LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ SDL_LOG_WARN("App is not present in policies " << policy_app_id);
return result;
}
auto& groups = it->second.groups;
@@ -1047,7 +1044,7 @@ void FillFunctionalGroupPermissions(
FunctionalGroupNames& names,
GroupConsent state,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupIDs::const_iterator it = ids.begin();
FunctionalGroupIDs::const_iterator it_end = ids.end();
for (; it != it_end; ++it) {
@@ -1067,7 +1064,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) {
FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
const FunctionalGroupIDs& what) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupIDs from_copy(from);
FunctionalGroupIDs what_copy(what);
@@ -1089,7 +1086,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
const FunctionalGroupIDs& second) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupIDs first_copy(first);
FunctionalGroupIDs second_copy(second);
@@ -1111,7 +1108,7 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first,
const FunctionalGroupIDs& second) {
- LOG4CXX_INFO(logger_, "Find same groups");
+ SDL_LOG_INFO("Find same groups");
FunctionalGroupIDs first_copy(first);
FunctionalGroupIDs second_copy(second);
@@ -1142,9 +1139,9 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) {
(*it).second = (*it_default).second;
it->second.set_to_string(kDefaultId);
} else {
- LOG4CXX_ERROR(logger_,
- "There is no default application policy was "
- "found in PTU.");
+ SDL_LOG_ERROR(
+ "There is no default application policy was "
+ "found in PTU.");
return false;
}
}
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 174d0d5d12..36beeeb07f 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -60,7 +60,7 @@ const uint32_t kDefaultRetryTimeoutInMSec =
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
PolicyManagerImpl::PolicyManagerImpl()
: PolicyManager()
@@ -126,15 +126,14 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray(
#endif
void PolicyManagerImpl::CheckTriggers() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool exceed_ignition_cycles = ExceededIgnitionCycles();
const bool exceed_days = ExceededDays();
- LOG4CXX_DEBUG(
- logger_,
- "\nDays exceeded: " << std::boolalpha << exceed_days
- << "\nIgnition cycles exceeded: " << std::boolalpha
- << exceed_ignition_cycles);
+ SDL_LOG_DEBUG("\nDays exceeded: " << std::boolalpha << exceed_days
+ << "\nIgnition cycles exceeded: "
+ << std::boolalpha
+ << exceed_ignition_cycles);
if (exceed_ignition_cycles || exceed_days) {
update_status_manager_.ScheduleUpdate();
@@ -327,9 +326,9 @@ void FilterPolicyTable(
PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
const std::string& file, const BinaryMessage& pt_content) {
- LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size());
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_INFO("LoadPT of size " << pt_content.size());
+ SDL_LOG_DEBUG(
+
"PTU content is: " << std::string(pt_content.begin(), pt_content.end()));
#ifdef USE_HMI_PTU_DECRYPTION
@@ -343,7 +342,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content);
#endif
if (!pt_update) {
- LOG4CXX_WARN(logger_, "Parsed table pointer is NULL.");
+ SDL_LOG_WARN("Parsed table pointer is NULL.");
;
return PtProcessingResult::kWrongPtReceived;
}
@@ -354,13 +353,13 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
FilterPolicyTable(pt_update->policy_table, current_vd_items);
if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) {
- LOG4CXX_WARN(logger_, "Received policy table update is not valid");
+ SDL_LOG_WARN("Received policy table update is not valid");
return PtProcessingResult::kWrongPtReceived;
}
// Update finished, no need retry
if (timer_retry_sequence_.is_running()) {
- LOG4CXX_INFO(logger_, "Stop retry sequence");
+ SDL_LOG_INFO("Stop retry sequence");
timer_retry_sequence_.Stop();
}
@@ -371,8 +370,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
// Get current DB data, since it could be updated during awaiting of PTU
auto policy_table_snapshot = cache_->GenerateSnapshot();
if (!policy_table_snapshot) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Failed to create snapshot of policy table, trying another exchange");
return PtProcessingResult::kNewPtRequired;
}
@@ -387,8 +385,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
// Replace current data with updated
if (!cache_->ApplyUpdate(*pt_update)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Unsuccessful save of updated policy table, trying another exchange");
return PtProcessingResult::kNewPtRequired;
}
@@ -403,10 +401,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
std::map<std::string, StringArray> app_hmi_types;
cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
if (!app_hmi_types.empty()) {
- LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
+ SDL_LOG_INFO("app_hmi_types is full calling OnUpdateHMIAppType");
listener_->OnUpdateHMIAppType(app_hmi_types);
} else {
- LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size());
+ SDL_LOG_INFO("app_hmi_types empty" << pt_content.size());
}
std::vector<std::string> enabled_apps;
@@ -419,10 +417,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
}
void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ptu_requested_ = false;
if (PtProcessingResult::kWrongPtReceived == ptu_result) {
- LOG4CXX_DEBUG(logger_, "Wrong PT was received");
+ SDL_LOG_DEBUG("Wrong PT was received");
update_status_manager_.OnWrongUpdateReceived();
return;
}
@@ -430,7 +428,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
update_status_manager_.OnValidUpdateReceived();
if (PtProcessingResult::kNewPtRequired == ptu_result) {
- LOG4CXX_DEBUG(logger_, "New PTU interation is required");
+ SDL_LOG_DEBUG("New PTU interation is required");
ForcePTExchange();
return;
}
@@ -440,8 +438,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
// If there was a user request for policy table update, it should be started
// right after current update is finished
if (update_status_manager_.IsUpdateRequired() && HasApplicationForPTU()) {
- LOG4CXX_DEBUG(logger_,
- "PTU was successful and new PTU iteration was scheduled");
+ SDL_LOG_DEBUG("PTU was successful and new PTU iteration was scheduled");
StartPTExchange();
return;
}
@@ -452,7 +449,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
void PolicyManagerImpl::ProcessAppPolicyCheckResults(
const CheckAppPolicyResults& results,
const rpc::policy_table_interface_base::ApplicationPolicies& app_policies) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationsPoliciesActions actions_for_apps_policies;
FillActionsForAppPolicies filler(actions_for_apps_policies, app_policies);
@@ -508,12 +505,12 @@ void PolicyManagerImpl::ProcessActionsForAppPolicies(
void PolicyManagerImpl::SendOnAppPropertiesChangeNotification(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
listener_->SendOnAppPropertiesChangeNotification(policy_app_id);
}
void PolicyManagerImpl::ResumePendingAppPolicyActions() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (auto& notify_system_params : notify_system_list_) {
NotifySystem(notify_system_params.first, notify_system_params.second);
@@ -566,7 +563,7 @@ void PolicyManagerImpl::SendPermissionsToApp(
CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
const std::shared_ptr<policy_table::Table> pt_update,
const std::shared_ptr<policy_table::Table> snapshot) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Replace predefined policies with its actual setting, e.g. "123":"default"
// to actual values of default section
@@ -597,31 +594,31 @@ void PolicyManagerImpl::PrepareNotificationData(
const policy_table::Strings& group_names,
const std::vector<FunctionalGroupPermission>& group_permission,
Permissions& notification_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessFunctionalGroup processor(groups, group_permission, notification_data);
std::for_each(group_names.begin(), group_names.end(), processor);
}
void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type,
EndpointUrls& out_end_points) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type,
EndpointUrls& out_end_points) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->GetUpdateUrls(service_type, out_end_points);
}
bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
BinaryMessage update;
if (PTUIterationType::DefaultIteration == iteration_type) {
std::shared_ptr<policy_table::Table> policy_table_snapshot =
cache_->GenerateSnapshot();
if (!policy_table_snapshot) {
- LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table");
+ SDL_LOG_ERROR("Failed to create snapshot of policy table");
return false;
}
@@ -632,7 +629,7 @@ bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) {
writer_builder["indentation"] = "";
std::string message_string = Json::writeString(writer_builder, value);
- LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string);
+ SDL_LOG_DEBUG("Snapshot contents is : " << message_string);
update = BinaryMessage(message_string.begin(), message_string.end());
}
@@ -647,24 +644,24 @@ std::string PolicyManagerImpl::GetIconUrl(
}
void PolicyManagerImpl::StartPTExchange() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool update_required = update_status_manager_.IsUpdateRequired();
if (update_status_manager_.IsAppsSearchInProgress() && update_required) {
update_status_manager_.ScheduleUpdate();
- LOG4CXX_INFO(logger_,
- "Starting exchange skipped, since applications "
- "search is in progress.");
+ SDL_LOG_INFO(
+ "Starting exchange skipped, since applications "
+ "search is in progress.");
return;
}
if (update_status_manager_.IsUpdatePending() && update_required) {
if (trigger_ptu_)
update_status_manager_.ScheduleUpdate();
- LOG4CXX_INFO(logger_,
- "Starting exchange skipped, since another exchange "
- "is in progress.");
+ SDL_LOG_INFO(
+ "Starting exchange skipped, since another exchange "
+ "is in progress.");
return;
}
@@ -682,8 +679,7 @@ void PolicyManagerImpl::StartPTExchange() {
const uint32_t timeout_msec = NextRetryTimeout();
if (timeout_msec) {
- LOG4CXX_DEBUG(logger_,
- "Start retry sequence timeout = " << timeout_msec);
+ SDL_LOG_DEBUG("Start retry sequence timeout = " << timeout_msec);
timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic);
}
}
@@ -692,12 +688,12 @@ void PolicyManagerImpl::StartPTExchange() {
}
void PolicyManagerImpl::OnAppsSearchStarted() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.OnAppsSearchStarted();
}
void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.OnAppsSearchCompleted();
trigger_ptu_ = trigger_ptu;
@@ -709,13 +705,13 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) {
}
void PolicyManagerImpl::OnLocalAppAdded() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
update_status_manager_.ScheduleUpdate();
StartPTExchange();
}
void PolicyManagerImpl::UpdatePTUReadyAppsCount(const uint32_t new_app_count) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
applications_pending_ptu_count_ = new_app_count;
}
@@ -723,7 +719,7 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile(
const std::string& device_id, const std::string& application_id) {
if (application_id != last_registered_policy_app_id_) {
if (last_registered_policy_app_id_.empty()) {
- LOG4CXX_DEBUG(logger_, "Stopping update after first app is registered");
+ SDL_LOG_DEBUG("Stopping update after first app is registered");
// ResetRetrySequence(ResetRetryCountType::kResetInternally);
StopRetrySequence();
}
@@ -736,7 +732,7 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile(
void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->OnDeviceSwitching(device_id_from, device_id_to);
}
@@ -749,13 +745,13 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes(
RequestType::State PolicyManagerImpl::GetAppRequestTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetAppRequestTypesState(policy_app_id);
}
RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetAppRequestSubTypesState(policy_app_id);
}
@@ -836,7 +832,7 @@ void PolicyManagerImpl::GetAppServiceParameters(
bool PolicyManagerImpl::UnknownRPCPassthroughAllowed(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->UnknownRPCPassthroughAllowed(policy_app_id);
}
@@ -846,23 +842,21 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!cache_->IsApplicationRepresented(app_id)) {
- LOG4CXX_WARN(logger_, "Application " << app_id << " isn't exist");
+ SDL_LOG_WARN("Application " << app_id << " isn't exist");
return;
}
- LOG4CXX_INFO(logger_,
- "CheckPermissions for " << app_id << " and rpc " << rpc
+ SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc
<< " for " << hmi_level << " level.");
ApplicationOnDevice who = {device_id, app_id};
policy_table::Strings groups;
if (access_remote_->IsAppRemoteControl(who)) {
groups = access_remote_->GetGroups(who);
- LOG4CXX_INFO(logger_,
- "CheckPermissions for " << app_id << " and rpc " << rpc
+ SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc
<< " for " << hmi_level << " level.");
} else {
groups = cache_->GetGroups(app_id);
@@ -886,7 +880,7 @@ bool PolicyManagerImpl::ResetUserConsent() {
void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
const std::string& device_id, const std::string& application_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<FunctionalGroupPermission> app_group_permissions;
GetPermissionsForApp(device_id, application_id, app_group_permissions);
@@ -905,8 +899,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
app_group_permissions,
notification_data);
- LOG4CXX_INFO(logger_,
- "Send notification for application_id: " << application_id);
+ SDL_LOG_INFO("Send notification for application_id: " << application_id);
std::string default_hmi = "NONE";
@@ -922,21 +915,21 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
}
bool PolicyManagerImpl::CleanupUnpairedDevices() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// For SDL-specific it doesn't matter
return true;
}
DeviceConsent PolicyManagerImpl::GetUserConsentForDevice(
const std::string& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return kDeviceAllowed;
}
void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
bool is_allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device :" << device_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device :" << device_id);
DeviceConsent current_consent = GetUserConsentForDevice(device_id);
bool is_current_device_allowed =
DeviceConsent::kDeviceAllowed == current_consent ? true : false;
@@ -946,7 +939,7 @@ void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
if (DeviceConsent::kDeviceHasNoConsent != current_consent &&
is_current_device_allowed == is_allowed) {
const std::string consent = is_allowed ? "allowed" : "disallowed";
- LOG4CXX_INFO(logger_, "Device is already " << consent << ".");
+ SDL_LOG_INFO("Device is already " << consent << ".");
return;
}
}
@@ -964,7 +957,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp(
bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id,
StringArray* nicknames,
StringArray* app_hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool result = nicknames && app_hmi_types;
if (result) {
cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types);
@@ -974,17 +967,17 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id,
void PolicyManagerImpl::AddDevice(const std::string& device_id,
const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device: " << device_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device: " << device_id);
if (!cache_->AddDevice(device_id, connection_type)) {
- LOG4CXX_WARN(logger_, "Can't add device.");
+ SDL_LOG_WARN("Can't add device.");
}
}
void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id,
const DeviceInfo& device_info) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device :" << device_id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device :" << device_id);
}
PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent(
@@ -1024,19 +1017,18 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent(
void PolicyManagerImpl::CheckPendingPermissionsChanges(
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& current_permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(app_permissions_diff_lock_);
std::map<std::string, AppPermissions>::iterator it_pending =
app_permissions_diff_.find(policy_app_id);
if (app_permissions_diff_.end() == it_pending) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"No pending permissions had been found for appID: " << policy_app_id);
return;
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Pending permissions had been found for appID: " << policy_app_id);
// Change appPermissionsConsentNeeded depending on unconsented groups
@@ -1048,16 +1040,16 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges(
for (; it_groups != it_end_groups; ++it_groups) {
if (policy::kGroupUndefined == it_groups->state) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Unconsented groups still present for appID: " << policy_app_id);
it_pending->second.appPermissionsConsentNeeded = true;
return;
}
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Unconsented groups not present anymore for appID: " << policy_app_id);
it_pending->second.appPermissionsConsentNeeded = false;
return;
@@ -1065,13 +1057,13 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges(
void PolicyManagerImpl::SetUserConsentForApp(
const PermissionConsent& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id,
const std::string& policy_app_id,
std::string* default_hmi) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const DeviceConsent device_consent = GetUserConsentForDevice(device_id);
const std::string app_id = policy::kDeviceAllowed != device_consent
? kPreDataConsentId
@@ -1081,9 +1073,9 @@ bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id,
bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id,
std::string* priority) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!priority) {
- LOG4CXX_WARN(logger_, "Input priority parameter is null.");
+ SDL_LOG_WARN("Input priority parameter is null.");
return false;
}
@@ -1099,12 +1091,11 @@ void PolicyManagerImpl::GetUserConsentForApp(
const std::string& device_id,
const std::string& policy_app_id,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalIdType group_types;
if (!cache_->GetPermissionsForApp(device_id, policy_app_id, group_types)) {
- LOG4CXX_WARN(logger_,
- "Can't get user permissions for app " << policy_app_id);
+ SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id);
return;
}
@@ -1112,7 +1103,7 @@ void PolicyManagerImpl::GetUserConsentForApp(
// automatically allowed and it could not be changed by user
FunctionalGroupNames group_names;
if (!cache_->GetFunctionalGroupNames(group_names)) {
- LOG4CXX_WARN(logger_, "Can't get functional group names");
+ SDL_LOG_WARN("Can't get functional group names");
return;
}
@@ -1147,7 +1138,7 @@ void PolicyManagerImpl::GetPermissionsForApp(
const std::string& device_id,
const std::string& policy_app_id,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string app_id_to_check = policy_app_id;
bool allowed_by_default = false;
@@ -1172,8 +1163,7 @@ void PolicyManagerImpl::GetPermissionsForApp(
}
if (!ret) {
- LOG4CXX_WARN(logger_,
- "Can't get user permissions for app " << policy_app_id);
+ SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id);
return;
}
@@ -1181,14 +1171,14 @@ void PolicyManagerImpl::GetPermissionsForApp(
// automatically allowed and it could not be changed by user
FunctionalGroupNames group_names;
if (!cache_->GetFunctionalGroupNames(group_names)) {
- LOG4CXX_WARN(logger_, "Can't get functional group names");
+ SDL_LOG_WARN("Can't get functional group names");
return;
}
// The "default" and "pre_DataConsent" are auto-allowed groups
// So, check if application in the one of these mode.
if (allowed_by_default) {
- LOG4CXX_INFO(logger_, "Get auto allowed groups");
+ SDL_LOG_INFO("Get auto allowed groups");
GroupType type =
(kDefaultId == app_id_to_check ? kTypeDefault : kTypePreDataConsented);
@@ -1212,7 +1202,7 @@ void PolicyManagerImpl::GetPermissionsForApp(
std::string& PolicyManagerImpl::GetCurrentDeviceId(
const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
last_device_id_ =
listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id);
return last_device_id_;
@@ -1221,25 +1211,25 @@ std::string& PolicyManagerImpl::GetCurrentDeviceId(
void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {}
void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetPreloadedPtFlag(is_preloaded);
}
void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetCCPUVersionFromPT();
}
uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority,
const bool is_subtle) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetNotificationsNumber(priority, is_subtle);
}
@@ -1252,10 +1242,10 @@ bool PolicyManagerImpl::IsPTValid(
policy_table::PolicyTableType type) const {
policy_table->SetPolicyTableType(type);
if (!policy_table->is_valid()) {
- LOG4CXX_ERROR(logger_, "Policy table is not valid.");
+ SDL_LOG_ERROR("Policy table is not valid.");
rpc::ValidationReport report("policy_table");
policy_table->ReportErrors(&report);
- LOG4CXX_DEBUG(logger_, "Errors: " << rpc::PrettyFormat(report));
+ SDL_LOG_DEBUG("Errors: " << rpc::PrettyFormat(report));
return false;
}
return true;
@@ -1267,7 +1257,7 @@ const PolicySettings& PolicyManagerImpl::get_settings() const {
}
bool PolicyManagerImpl::ExceededDays() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
date_time::TimeDuration current_time = date_time::getCurrentTime();
const int kSecondsInDay = 60 * 60 * 24;
@@ -1277,9 +1267,9 @@ bool PolicyManagerImpl::ExceededDays() {
}
void PolicyManagerImpl::KmsChanged(int kilometers) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (0 == cache_->KilometersBeforeExchange(kilometers)) {
- LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update.");
+ SDL_LOG_INFO("Enough kilometers passed to send for PT update.");
update_status_manager_.ScheduleUpdate();
StartPTExchange();
PTUpdatedAt(KILOMETERS, kilometers);
@@ -1310,7 +1300,7 @@ std::string PolicyManagerImpl::ForcePTExchange() {
}
void PolicyManagerImpl::StopRetrySequence() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (timer_retry_sequence_.is_running()) {
timer_retry_sequence_.Stop();
@@ -1332,9 +1322,9 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const {
}
uint32_t PolicyManagerImpl::NextRetryTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
- LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_);
+ SDL_LOG_DEBUG("Index: " << retry_sequence_index_);
uint32_t next = 0u;
if (retry_sequence_seconds_.empty() ||
retry_sequence_index_ > retry_sequence_seconds_.size()) {
@@ -1358,7 +1348,7 @@ uint32_t PolicyManagerImpl::NextRetryTimeout() {
}
void PolicyManagerImpl::RefreshRetrySequence() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
retry_sequence_timeout_ = cache_->TimeoutResponse();
retry_sequence_seconds_.clear();
@@ -1367,7 +1357,7 @@ void PolicyManagerImpl::RefreshRetrySequence() {
void PolicyManagerImpl::ResetRetrySequence(
const ResetRetryCountType reset_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
retry_sequence_index_ = 0;
retry_sequence_url_ = RetrySequenceURL();
@@ -1396,33 +1386,33 @@ void PolicyManagerImpl::OnUpdateStarted() {
}
void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetCountersPassedForSuccessfulUpdate(counter, value);
cache_->ResetIgnitionCycles();
}
void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) {
- LOG4CXX_INFO(logger_, "Increment without app id");
+ SDL_LOG_INFO("Increment without app id");
cache_->Increment(type);
}
void PolicyManagerImpl::Increment(const std::string& app_id,
usage_statistics::AppCounterId type) {
- LOG4CXX_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type);
+ SDL_LOG_DEBUG("Increment " << app_id << " AppCounter: " << type);
cache_->Increment(app_id, type);
}
void PolicyManagerImpl::Set(const std::string& app_id,
usage_statistics::AppInfoId type,
const std::string& value) {
- LOG4CXX_INFO(logger_, "Set " << app_id);
+ SDL_LOG_INFO("Set " << app_id);
cache_->Set(app_id, type, value);
}
void PolicyManagerImpl::Add(const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds) {
- LOG4CXX_INFO(logger_, "Add " << app_id);
+ SDL_LOG_INFO("Add " << app_id);
cache_->Add(app_id, type, timespan_seconds);
}
@@ -1432,7 +1422,7 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const {
bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id,
const std::string& app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return false;
}
@@ -1471,12 +1461,12 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) const {
void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {}
std::string PolicyManagerImpl::RetrieveCertificate() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetCertificate();
}
AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls);
@@ -1539,7 +1529,7 @@ StatusNotifier PolicyManagerImpl::AddApplication(
const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto device_consent = GetUserConsentForDevice(device_id);
sync_primitives::AutoLock lock(apps_registration_lock_);
if (IsNewApplication(application_id)) {
@@ -1561,20 +1551,20 @@ void PolicyManagerImpl::RemoveAppConsentForGroup(
bool PolicyManagerImpl::IsPredataPolicy(
const std::string& policy_app_id) const {
- LOG4CXX_INFO(logger_, "IsPredataApp");
+ SDL_LOG_INFO("IsPredataApp");
return cache_->IsPredataPolicy(policy_app_id);
}
void PolicyManagerImpl::AddNewApplication(const std::string& application_id,
DeviceConsent device_consent) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->SetDefaultPolicy(application_id);
}
void PolicyManagerImpl::PromoteExistedApplication(
const std::string& application_id, DeviceConsent device_consent) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// If device consent changed to allowed during application being
// disconnected, app permissions should be changed also
if (kDeviceAllowed == device_consent &&
@@ -1589,7 +1579,7 @@ bool PolicyManagerImpl::IsNewApplication(
}
bool PolicyManagerImpl::ResetPT(const std::string& file_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
cache_->ResetCalculatedPermissions();
const bool result = cache_->ResetPT(file_name);
if (result) {
@@ -1599,19 +1589,17 @@ bool PolicyManagerImpl::ResetPT(const std::string& file_name) {
}
bool PolicyManagerImpl::CheckAppStorageFolder() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string app_storage_folder = get_settings().app_storage_folder();
- LOG4CXX_DEBUG(logger_, "AppStorageFolder " << app_storage_folder);
+ SDL_LOG_DEBUG("AppStorageFolder " << app_storage_folder);
if (!file_system::DirectoryExists(app_storage_folder)) {
- LOG4CXX_WARN(logger_,
- "Storage directory doesn't exist " << app_storage_folder);
+ SDL_LOG_WARN("Storage directory doesn't exist " << app_storage_folder);
return false;
}
if (!(file_system::IsWritingAllowed(app_storage_folder) &&
file_system::IsReadingAllowed(app_storage_folder))) {
- LOG4CXX_WARN(logger_,
- "Storage directory doesn't have read/write permissions "
- << app_storage_folder);
+ SDL_LOG_WARN("Storage directory doesn't have read/write permissions "
+ << app_storage_folder);
return false;
}
return true;
@@ -1619,10 +1607,10 @@ bool PolicyManagerImpl::CheckAppStorageFolder() const {
bool PolicyManagerImpl::InitPT(const std::string& file_name,
const PolicySettings* settings) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
settings_ = settings;
if (!CheckAppStorageFolder()) {
- LOG4CXX_ERROR(logger_, "Can not read/write into AppStorageFolder");
+ SDL_LOG_ERROR("Can not read/write into AppStorageFolder");
return false;
}
const bool ret = cache_->Init(file_name, settings);
@@ -1646,7 +1634,7 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const {
}
void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!is_update_needed) {
ResetRetrySequence(ResetRetryCountType::kResetInternally);
@@ -1660,7 +1648,7 @@ void PolicyManagerImpl::set_cache_manager(
}
void PolicyManagerImpl::ResetTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (update_status_manager_.IsUpdatePending()) {
if (timer_retry_sequence_.is_running()) {
timer_retry_sequence_.Stop();
@@ -1670,13 +1658,13 @@ void PolicyManagerImpl::ResetTimeout() {
}
void PolicyManagerImpl::OnPTUIterationTimeout() {
- LOG4CXX_DEBUG(logger_, "Start new retry sequence");
+ SDL_LOG_DEBUG("Start new retry sequence");
const bool is_exceeded_retries_count =
(retry_sequence_seconds_.size() < retry_sequence_index_);
if (is_exceeded_retries_count) {
- LOG4CXX_WARN(logger_, "Exceeded allowed PTU retry count");
+ SDL_LOG_WARN("Exceeded allowed PTU retry count");
listener_->OnPTUTimeOut();
ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
if (timer_retry_sequence_.is_running()) {
@@ -1692,7 +1680,7 @@ void PolicyManagerImpl::OnPTUIterationTimeout() {
update_status_manager_.OnUpdateTimeoutOccurs();
const uint32_t timeout_msec = NextRetryTimeout();
- LOG4CXX_DEBUG(logger_, "New retry sequence timeout = " << timeout_msec);
+ SDL_LOG_DEBUG("New retry sequence timeout = " << timeout_msec);
if (!timeout_msec) {
if (timer_retry_sequence_.is_running()) {
timer_retry_sequence_.Stop();
@@ -1712,7 +1700,7 @@ void PolicyManagerImpl::SetDefaultHmiTypes(
const transport_manager::DeviceHandle& device_handle,
const std::string& application_id,
const std::vector<int>& hmi_types) {
- LOG4CXX_INFO(logger_, "SetDefaultHmiTypes");
+ SDL_LOG_INFO("SetDefaultHmiTypes");
const std::string device_id =
GetCurrentDeviceId(device_handle, application_id);
ApplicationOnDevice who = {device_id, application_id};
@@ -1727,7 +1715,7 @@ struct HMITypeToInt {
bool PolicyManagerImpl::GetHMITypes(const std::string& application_id,
std::vector<int>* app_types) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (cache_->IsDefaultPolicy(application_id)) {
return false;
}
@@ -1744,7 +1732,7 @@ bool PolicyManagerImpl::GetHMITypes(const std::string& application_id,
bool PolicyManagerImpl::CheckModule(const PTString& app_id,
const PTString& module) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
policy_table::ModuleType module_type;
return EnumFromJsonString(module, &module_type) &&
access_remote_->CheckModuleType(app_id, module_type);
@@ -1755,16 +1743,15 @@ void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) {
if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) {
listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi);
} else {
- LOG4CXX_WARN(
- logger_,
- "Couldn't get default HMI level for application " << who.app_id);
+ SDL_LOG_WARN("Couldn't get default HMI level for application "
+ << who.app_id);
}
}
void PolicyManagerImpl::GetPermissions(const std::string device_id,
const std::string application_id,
Permissions* data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(data);
std::vector<FunctionalGroupPermission> app_group_permissions;
GetPermissionsForApp(device_id, application_id, app_group_permissions);
@@ -1826,7 +1813,7 @@ void PolicyManagerImpl::set_access_remote(
bool PolicyManagerImpl::AppNeedEncryption(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto encryption_required =
cache_->GetAppEncryptionRequiredFlag(policy_app_id);
@@ -1835,13 +1822,13 @@ bool PolicyManagerImpl::AppNeedEncryption(
const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return cache_->GetAppEncryptionRequiredFlag(policy_app_id);
}
const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp(
const std::string& policy_app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace rpc::policy_table_interface_base;
DCHECK(kDeviceId != policy_app_id);
@@ -1861,7 +1848,7 @@ const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp(
const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<std::string> policy_app_ids;
const auto apps = cache_->GetPolicyAppIDs();
@@ -1875,13 +1862,13 @@ const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs()
bool PolicyManagerImpl::FunctionGroupNeedEncryption(
const std::string& policy_group) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FunctionalGroupings functional_groupings;
cache_->GetFunctionalGroupings(functional_groupings);
const auto& grouping_itr = functional_groupings.find(policy_group);
if (grouping_itr == functional_groupings.end()) {
- LOG4CXX_WARN(logger_, "Group " << policy_group << " not found");
+ SDL_LOG_WARN("Group " << policy_group << " not found");
return false;
}
@@ -1893,7 +1880,7 @@ bool PolicyManagerImpl::FunctionGroupNeedEncryption(
}
void PolicyManagerImpl::TriggerPTUOnStartupIfRequired() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (ignition_check) {
StartPTExchange();
}
@@ -1923,12 +1910,13 @@ const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup(
} // namespace policy
-__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() {
+__attribute__((visibility("default"))) policy::PolicyManager* CreateManager(
+ logger::Logger* logger_instance) {
+ logger::Logger::instance(logger_instance);
return new policy::PolicyManagerImpl();
}
__attribute__((visibility("default"))) void DeleteManager(
policy::PolicyManager* pm) {
delete pm;
- DELETE_THREAD_LOGGER(policy::logger_);
}
diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc
index b0fa5739da..dd6eef0c45 100644
--- a/src/components/policy/policy_regular/src/policy_table.cc
+++ b/src/components/policy/policy_regular/src/policy_table.cc
@@ -38,7 +38,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {}
@@ -46,7 +46,7 @@ PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data)
: pt_data_(pt_data) {}
PolicyTable::~PolicyTable() {
- LOG4CXX_INFO(logger_, "Destroying policy table.");
+ SDL_LOG_INFO("Destroying policy table.");
}
} // namespace policy
diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc
index 14b6d657c2..c98a0ed5f0 100644
--- a/src/components/policy/policy_regular/src/policy_table/validation.cc
+++ b/src/components/policy/policy_regular/src/policy_table/validation.cc
@@ -12,7 +12,7 @@ bool IsTypeInvalid(
namespace rpc {
namespace policy_table_interface_base {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
void RemoveInvalidTypes(RequestTypes& types) {
types.erase(std::remove_if(types.begin(), types.end(), &IsTypeInvalid),
@@ -30,13 +30,13 @@ bool ApplicationPoliciesSection::Validate() const {
// Default and PreData policies are mandatory
if (apps.end() == it_default_policy || apps.end() == it_pre_data_policy) {
- LOG4CXX_ERROR(logger_, "Default or preData policy is not present.");
+ SDL_LOG_ERROR("Default or preData policy is not present.");
return false;
}
// Device policy is mandatory
if (!device.is_initialized()) {
- LOG4CXX_ERROR(logger_, "Device policy is not present.");
+ SDL_LOG_ERROR("Device policy is not present.");
return false;
}
@@ -45,17 +45,15 @@ bool ApplicationPoliciesSection::Validate() const {
return true;
}
- LOG4CXX_TRACE(logger_, "Checking app Request Types...");
+ SDL_LOG_TRACE("Checking app Request Types...");
if (!it_default_policy->second.RequestType.is_valid()) {
- LOG4CXX_WARN(logger_,
- "Default policy RequestTypes are not valid. Will be cleaned.");
+ SDL_LOG_WARN("Default policy RequestTypes are not valid. Will be cleaned.");
RemoveInvalidTypes(*it_default_policy->second.RequestType);
// If preloaded does not have valid default types - validation fails
// Otherwise default will be empty, i.e. all types allowed
if (PT_PRELOADED == pt_type) {
if (it_default_policy->second.RequestType->empty()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Default policy RequestTypes empty after clean-up. Exiting.");
return false;
}
@@ -78,46 +76,43 @@ bool ApplicationPoliciesSection::Validate() const {
if (PT_PRELOADED == pt_type) {
if (!is_request_type_valid) {
- LOG4CXX_WARN(logger_,
- "App policy RequestTypes are not valid. Will be cleaned.");
+ SDL_LOG_WARN("App policy RequestTypes are not valid. Will be cleaned.");
RemoveInvalidTypes(*app_params.RequestType);
if (app_params.RequestType->empty()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"App policy RequestTypes empty after clean-up. Exiting.");
return false;
}
}
} else {
if (is_request_type_omitted) {
- LOG4CXX_WARN(logger_,
- "App policy RequestTypes omitted."
- " Will be replaced with default.");
+ SDL_LOG_WARN(
+ "App policy RequestTypes omitted."
+ " Will be replaced with default.");
app_params.RequestType = apps[kDefaultApp].RequestType;
++iter;
continue;
}
if (!is_request_type_valid) {
- LOG4CXX_WARN(logger_,
- "App policy RequestTypes are invalid. Will be cleaned.");
+ SDL_LOG_WARN("App policy RequestTypes are invalid. Will be cleaned.");
RemoveInvalidTypes(*app_params.RequestType);
if (app_params.RequestType->empty()) {
- LOG4CXX_WARN(logger_,
- "App policy RequestTypes empty after clean-up."
- " Will be replaced with default.");
+ SDL_LOG_WARN(
+ "App policy RequestTypes empty after clean-up."
+ " Will be replaced with default.");
app_params.RequestType = apps[kDefaultApp].RequestType;
++iter;
continue;
}
}
if (is_request_type_empty) {
- LOG4CXX_WARN(logger_, "App policy RequestTypes empty.");
+ SDL_LOG_WARN("App policy RequestTypes empty.");
}
}
++iter;
}
- LOG4CXX_TRACE(logger_, "Checking app Request SubTypes...");
+ SDL_LOG_TRACE("Checking app Request SubTypes...");
iter = apps.begin();
while (iter != end_iter) {
if (it_default_policy == iter || it_pre_data_policy == iter) {
@@ -129,9 +124,9 @@ bool ApplicationPoliciesSection::Validate() const {
!app_params.RequestSubType.is_initialized();
if (is_request_subtype_omitted) {
- LOG4CXX_WARN(logger_,
- "App policy RequestSubTypes omitted."
- " Will be replaced with default.");
+ SDL_LOG_WARN(
+ "App policy RequestSubTypes omitted."
+ " Will be replaced with default.");
app_params.RequestSubType = apps[kDefaultApp].RequestSubType;
++iter;
continue;
@@ -139,7 +134,7 @@ bool ApplicationPoliciesSection::Validate() const {
const bool is_request_subtype_empty = app_params.RequestSubType->empty();
if (is_request_subtype_empty) {
- LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty.");
+ SDL_LOG_WARN("App policy RequestSubTypes empty.");
}
++iter;
}
@@ -222,8 +217,7 @@ bool ModuleConfig::Validate() const {
++it_endpoints) {
const URLList& endpoint_list = it_endpoints->second;
if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) {
- LOG4CXX_ERROR(logger_,
- "Endpoint " << it_endpoints->first
+ SDL_LOG_ERROR("Endpoint " << it_endpoints->first
<< "does not contain default group");
return false;
}
@@ -294,8 +288,8 @@ bool VehicleDataItem::Validate() const {
};
if (!ValidateTypes()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Unknown type: " << std::string(type) << " of " << std::string(key));
return false;
}
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index 043b413c13..49b7f2e7be 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -49,7 +49,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
namespace {
template <typename T, typename K>
@@ -92,8 +92,8 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRpc)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Incorrect select statement from rpcs" << query.LastError().text());
return;
}
@@ -103,8 +103,7 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
bool ret = query.Next();
result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed;
- LOG4CXX_INFO(logger_,
- "Level is " << (result.hmi_level_permitted == kRpcAllowed
+ SDL_LOG_INFO("Level is " << (result.hmi_level_permitted == kRpcAllowed
? "permitted"
: "not permitted"));
std::string parameter;
@@ -125,7 +124,7 @@ bool SQLPTRepresentation::IsPTPreloaded() {
int SQLPTRepresentation::IgnitionCyclesBeforeExchange() {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) {
- LOG4CXX_WARN(logger_, "Can not select ignition cycles");
+ SDL_LOG_WARN("Can not select ignition cycles");
return 0;
}
int limit = query.GetInteger(0);
@@ -141,7 +140,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() {
int SQLPTRepresentation::KilometersBeforeExchange(int current) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) {
- LOG4CXX_WARN(logger_, "Can not select kilometers");
+ SDL_LOG_WARN("Can not select kilometers");
return 0;
}
int limit = query.GetInteger(0);
@@ -157,17 +156,16 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) {
bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate(
int kilometers, int days_after_epoch) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) {
- LOG4CXX_WARN(logger_,
- "Wrong update query for counters on successful update.");
+ SDL_LOG_WARN("Wrong update query for counters on successful update.");
return false;
}
query.Bind(0, kilometers);
query.Bind(1, days_after_epoch);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to update counters on successful update.");
+ SDL_LOG_WARN("Failed to update counters on successful update.");
return false;
}
return true;
@@ -176,7 +174,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate(
int SQLPTRepresentation::DaysBeforeExchange(int current) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) {
- LOG4CXX_WARN(logger_, "Can not select days");
+ SDL_LOG_WARN("Can not select days");
return 0;
}
int limit = query.GetInteger(0);
@@ -197,7 +195,7 @@ int SQLPTRepresentation::DaysBeforeExchange(int current) {
int SQLPTRepresentation::TimeoutResponse() {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) {
- LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence");
+ SDL_LOG_INFO("Can not select timeout response for retry sequence");
const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND;
return defaultTimeout;
}
@@ -207,8 +205,7 @@ int SQLPTRepresentation::TimeoutResponse() {
bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) {
- LOG4CXX_INFO(logger_,
- "Incorrect select statement from seconds between retries");
+ SDL_LOG_INFO("Incorrect select statement from seconds between retries");
return false;
}
while (query.Next()) {
@@ -231,8 +228,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg(
}
EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
- LOG4CXX_INFO(logger_,
- "SQLPTRepresentation::GetUpdateUrls for " << service_type);
+ SDL_LOG_INFO("SQLPTRepresentation::GetUpdateUrls for " << service_type);
utils::dbms::SQLQuery query(db());
EndpointUrls ret;
if (query.Prepare(sql_pt::kSelectEndpoint)) {
@@ -247,23 +243,23 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
ret.push_back(data);
}
} else {
- LOG4CXX_WARN(logger_, "Invalid select endpoints statement.");
+ SDL_LOG_WARN("Invalid select endpoints statement.");
}
return ret;
}
int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for priority "
- "notification number.");
+ SDL_LOG_WARN(
+ "Incorrect select statement for priority "
+ "notification number.");
return 0;
}
query.Bind(0, priority);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority.");
+ SDL_LOG_WARN("Incorrect select from notifications by priority.");
return 0;
}
@@ -276,21 +272,21 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id,
std::string* priority) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (NULL == priority) {
- LOG4CXX_WARN(logger_, "Input priority parameter is null.");
+ SDL_LOG_WARN("Input priority parameter is null.");
return false;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectPriority)) {
- LOG4CXX_INFO(logger_, "Incorrect statement for priority.");
+ SDL_LOG_INFO("Incorrect statement for priority.");
return false;
}
query.Bind(0, policy_app_id);
if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Error during select priority.");
+ SDL_LOG_INFO("Error during select priority.");
return false;
}
@@ -306,7 +302,7 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id,
InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
settings_ = settings;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef BUILD_TESTS
open_counter_ = 0;
#endif // BUILD_TESTS
@@ -319,59 +315,56 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
}
if (!db_->Open()) {
- LOG4CXX_ERROR(logger_, "Failed opening database.");
- LOG4CXX_INFO(logger_, "Starting opening retries.");
+ SDL_LOG_ERROR("Failed opening database.");
+ SDL_LOG_INFO("Starting opening retries.");
const uint16_t attempts = get_settings().attempts_to_open_policy_db();
- LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts);
+ SDL_LOG_DEBUG("Total attempts number is: " << attempts);
bool is_opened = false;
const uint16_t open_attempt_timeout_ms =
get_settings().open_attempt_timeout_ms();
const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000;
- LOG4CXX_DEBUG(logger_,
- "Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
+ SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
for (int i = 0; i < attempts; ++i) {
usleep(sleep_interval_mcsec);
- LOG4CXX_INFO(logger_, "Attempt: " << i + 1);
+ SDL_LOG_INFO("Attempt: " << i + 1);
#ifdef BUILD_TESTS
++open_counter_;
#endif // BUILD_TESTS
if (db_->Open()) {
- LOG4CXX_INFO(logger_, "Database opened.");
+ SDL_LOG_INFO("Database opened.");
is_opened = true;
break;
}
}
if (!is_opened) {
- LOG4CXX_ERROR(logger_,
- "Open retry sequence failed. Tried "
- << attempts << " attempts with "
- << open_attempt_timeout_ms
- << " open timeout(ms) for each.");
+ SDL_LOG_ERROR("Open retry sequence failed. Tried "
+ << attempts << " attempts with " << open_attempt_timeout_ms
+ << " open timeout(ms) for each.");
return InitResult::FAIL;
}
}
if (!db_->IsReadWrite()) {
- LOG4CXX_ERROR(logger_, "There are no read/write permissions for database");
+ SDL_LOG_ERROR("There are no read/write permissions for database");
return InitResult::FAIL;
}
utils::dbms::SQLQuery check_pages(db());
if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) {
- LOG4CXX_WARN(logger_, "Incorrect pragma for page counting.");
+ SDL_LOG_WARN("Incorrect pragma for page counting.");
} else {
if (0 < check_pages.GetInteger(0)) {
utils::dbms::SQLQuery db_check(db());
if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) {
- LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check.");
+ SDL_LOG_WARN("Incorrect pragma for integrity check.");
} else {
while (db_check.Next()) {
if (db_check.GetString(0).compare("ok") == 0) {
utils::dbms::SQLQuery check_first_run(db());
if (check_first_run.Prepare(sql_pt::kIsFirstRun) &&
check_first_run.Next()) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"Selecting is first run " << check_first_run.GetBoolean(0));
if (check_first_run.GetBoolean(0)) {
utils::dbms::SQLQuery set_not_first_run(db());
@@ -379,12 +372,11 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
return InitResult::SUCCESS;
}
} else {
- LOG4CXX_WARN(logger_, "Incorrect select is first run");
+ SDL_LOG_WARN("Incorrect select is first run");
}
return InitResult::EXISTS;
} else {
- LOG4CXX_ERROR(logger_,
- "Existing policy table representation is invlaid.");
+ SDL_LOG_ERROR("Existing policy table representation is invlaid.");
// TODO(PV): add handle
return InitResult::FAIL;
}
@@ -394,14 +386,14 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
}
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed creating schema of database: " << query.LastError().text());
return InitResult::FAIL;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed insert init data to database: " << query.LastError().text());
return InitResult::FAIL;
}
@@ -416,8 +408,7 @@ bool SQLPTRepresentation::Close() {
bool SQLPTRepresentation::Drop() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
- LOG4CXX_WARN(logger_,
- "Failed dropping database: " << query.LastError().text());
+ SDL_LOG_WARN("Failed dropping database: " << query.LastError().text());
return false;
}
return true;
@@ -430,13 +421,12 @@ void SQLPTRepresentation::WriteDb() {
bool SQLPTRepresentation::Clear() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteData)) {
- LOG4CXX_ERROR(logger_,
- "Failed clearing database: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed insert init data to database: " << query.LastError().text());
return false;
}
@@ -446,19 +436,18 @@ bool SQLPTRepresentation::Clear() {
bool SQLPTRepresentation::RefreshDB() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
- LOG4CXX_WARN(logger_,
- "Failed dropping database: " << query.LastError().text());
+ SDL_LOG_WARN("Failed dropping database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed creating schema of database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed insert init data to database: " << query.LastError().text());
return false;
}
@@ -467,7 +456,7 @@ bool SQLPTRepresentation::RefreshDB() {
std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto table = std::make_shared<policy_table::Table>();
GatherModuleMeta(&*table->policy_table.module_meta);
GatherModuleConfig(&table->policy_table.module_config);
@@ -487,7 +476,7 @@ std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
void SQLPTRepresentation::GatherModuleMeta(
policy_table::ModuleMeta* meta) const {
- LOG4CXX_INFO(logger_, "Gather Module Meta Info");
+ SDL_LOG_INFO("Gather Module Meta Info");
utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectModuleMeta) && query.Next()) {
*meta->pt_exchanged_at_odometer_x = query.GetInteger(0);
@@ -499,10 +488,10 @@ void SQLPTRepresentation::GatherModuleMeta(
void SQLPTRepresentation::GatherModuleConfig(
policy_table::ModuleConfig* config) const {
- LOG4CXX_INFO(logger_, "Gather Configuration Info");
+ SDL_LOG_INFO("Gather Configuration Info");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for module config");
+ SDL_LOG_WARN("Incorrect select statement for module config");
} else {
*config->preloaded_pt = query.GetBoolean(0);
config->exchange_after_x_ignition_cycles = query.GetInteger(1);
@@ -520,7 +509,7 @@ void SQLPTRepresentation::GatherModuleConfig(
utils::dbms::SQLQuery endpoints(db());
if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints");
+ SDL_LOG_WARN("Incorrect select statement for endpoints");
} else {
while (endpoints.Next()) {
const std::string& url = endpoints.GetString(0);
@@ -532,7 +521,7 @@ void SQLPTRepresentation::GatherModuleConfig(
utils::dbms::SQLQuery endpoint_properties(db());
if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties");
+ SDL_LOG_ERROR("Incorrect statement for Endpoint properties");
} else {
while (endpoint_properties.Next()) {
const std::string& service = endpoint_properties.GetString(0);
@@ -544,7 +533,7 @@ void SQLPTRepresentation::GatherModuleConfig(
utils::dbms::SQLQuery notifications(db());
if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for notifications");
+ SDL_LOG_WARN("Incorrect select statement for notifications");
} else {
while (notifications.Next()) {
config->notifications_per_minute_by_priority[notifications.GetString(0)] =
@@ -553,8 +542,7 @@ void SQLPTRepresentation::GatherModuleConfig(
}
utils::dbms::SQLQuery subtle_notifications(db());
if (!subtle_notifications.Prepare(sql_pt::kSelectSubtleNotificationsPerMin)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for subtle notifications");
+ SDL_LOG_WARN("Incorrect select statement for subtle notifications");
} else {
while (subtle_notifications.Next()) {
(*config->subtle_notifications_per_minute_by_priority)
@@ -564,8 +552,7 @@ void SQLPTRepresentation::GatherModuleConfig(
}
utils::dbms::SQLQuery seconds(db());
if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) {
- LOG4CXX_INFO(logger_,
- "Incorrect select statement from seconds between retries");
+ SDL_LOG_INFO("Incorrect select statement from seconds between retries");
} else {
while (seconds.Next()) {
config->seconds_between_retries.push_back(seconds.GetInteger(0));
@@ -575,7 +562,7 @@ void SQLPTRepresentation::GatherModuleConfig(
bool SQLPTRepresentation::GatherUsageAndErrorCounts(
policy_table::UsageAndErrorCounts* counts) const {
- LOG4CXX_INFO(logger_, "Gather Usage and Error Counts.");
+ SDL_LOG_INFO("Gather Usage and Error Counts.");
utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectAppLevels)) {
policy_table::AppLevel app_level;
@@ -592,7 +579,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts(
void SQLPTRepresentation::GatherDeviceData(
policy_table::DeviceData* data) const {
- LOG4CXX_INFO(logger_, "Gather device data.");
+ SDL_LOG_INFO("Gather device data.");
data->mark_initialized();
utils::dbms::SQLQuery query(db());
@@ -608,15 +595,15 @@ void SQLPTRepresentation::GatherDeviceData(
bool SQLPTRepresentation::GatherFunctionalGroupings(
policy_table::FunctionalGroupings* groups) const {
- LOG4CXX_INFO(logger_, "Gather Functional Groupings info");
+ SDL_LOG_INFO("Gather Functional Groupings info");
utils::dbms::SQLQuery functional_group(db());
if (!functional_group.Prepare(sql_pt::kSelectFunctionalGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings");
+ SDL_LOG_WARN("Incorrect select from functional_groupings");
return false;
}
utils::dbms::SQLQuery rpcs(db());
if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect select all from rpc");
+ SDL_LOG_WARN("Incorrect select all from rpc");
return false;
}
@@ -672,10 +659,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
policy_table::ConsumerFriendlyMessages* messages) const {
- LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages");
+ SDL_LOG_INFO("Gather Consumer Friendly Messages");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) {
- LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages");
+ SDL_LOG_WARN("Incorrect select from consumer_friendly_messages");
return false;
}
@@ -713,24 +700,24 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
}
}
} else {
- LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
+ SDL_LOG_WARN("Incorrect statement for select friendly messages.");
}
return true;
}
bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateMetaParams)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta.");
+ SDL_LOG_WARN("Incorrect statement for insert to module meta.");
return false;
}
query.Bind(0, ccpu_version);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert to module meta.");
+ SDL_LOG_WARN("Incorrect insert to module meta.");
return false;
}
return true;
@@ -738,10 +725,10 @@ bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) {
bool SQLPTRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
- LOG4CXX_INFO(logger_, "Gather applications policies");
+ SDL_LOG_INFO("Gather applications policies");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppPolicies)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app_policies");
+ SDL_LOG_WARN("Incorrect select from app_policies");
return false;
}
@@ -844,8 +831,7 @@ bool SQLPTRepresentation::GatherVehicleData(
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) ||
!query.Next()) {
- LOG4CXX_ERROR(logger_,
- "Incorrect statement for vehicle data schema version");
+ SDL_LOG_ERROR("Incorrect statement for vehicle data schema version");
return false;
}
*vehicle_data->schema_version = query.GetString(0);
@@ -856,7 +842,7 @@ bool SQLPTRepresentation::GatherVehicleData(
bool SQLPTRepresentation::GatherVehicleDataItems(
policy_table::VehicleDataItems* vehicle_data_items) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto parameterized_vdi = SelectCompositeVehicleDataItems();
if (!parameterized_vdi.is_initialized()) {
return false;
@@ -878,7 +864,7 @@ bool SQLPTRepresentation::GatherVehicleDataItems(
}
bool SQLPTRepresentation::Save(const policy_table::Table& table) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
db_->BeginTransaction();
if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) {
db_->RollbackTransaction();
@@ -923,17 +909,17 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
const policy_table::FunctionalGroupings& groups) {
utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteRpc)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from rpc.");
+ SDL_LOG_WARN("Incorrect delete from rpc.");
return false;
}
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries.");
+ SDL_LOG_WARN("Incorrect delete from seconds between retries.");
return false;
}
if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for functional groups");
+ SDL_LOG_WARN("Incorrect insert statement for functional groups");
return false;
}
@@ -958,7 +944,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
? query.Bind(3, *(it->second.encryption_required))
: query.Bind(3);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into functional groups");
+ SDL_LOG_WARN("Incorrect insert into functional groups");
return false;
}
@@ -971,12 +957,12 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
const policy_table::Rpc& rpcs) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
utils::dbms::SQLQuery query_parameter(db());
if (!query.Prepare(sql_pt::kInsertRpc) ||
!query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc");
+ SDL_LOG_WARN("Incorrect insert statement for rpc");
return false;
}
@@ -996,7 +982,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
query_parameter.Bind(2, std::string(*ps_it));
query_parameter.Bind(3, group_id);
if (!query_parameter.Exec() || !query_parameter.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter");
+ SDL_LOG_WARN("Incorrect insert into rpc with parameter");
return false;
}
}
@@ -1009,7 +995,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
std::string(policy_table::EnumToJsonString(policy_table::P_EMPTY)));
query_parameter.Bind(3, group_id);
if (!query_parameter.Exec() || !query_parameter.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter");
+ SDL_LOG_WARN("Incorrect insert into rpc with parameter");
return false;
}
} else {
@@ -1017,7 +1003,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it)));
query.Bind(2, group_id);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into rpc");
+ SDL_LOG_WARN("Incorrect insert into rpc");
return false;
}
}
@@ -1031,40 +1017,40 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
const policy_table::ApplicationPoliciesSection& policies) {
utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app_group.");
+ SDL_LOG_WARN("Incorrect delete from app_group.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteModuleTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from module_type.");
+ SDL_LOG_WARN("Incorrect delete from module_type.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from application.");
+ SDL_LOG_WARN("Incorrect delete from application.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from request type.");
+ SDL_LOG_WARN("Incorrect delete from request type.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from request subtype.");
+ SDL_LOG_WARN("Incorrect delete from request subtype.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ SDL_LOG_WARN("Incorrect delete from handled rpcs.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ SDL_LOG_WARN("Incorrect delete from service names.");
return false;
}
if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ SDL_LOG_WARN("Incorrect delete from handled service types.");
return false;
}
@@ -1108,8 +1094,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
const policy_table::ApplicationPolicies::value_type& app) {
utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement into application (device).");
+ SDL_LOG_WARN("Incorrect insert statement into application (device).");
return false;
}
@@ -1149,7 +1134,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
: app_query.Bind(13);
if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
+ SDL_LOG_WARN("Incorrect insert into application.");
return false;
}
@@ -1198,7 +1183,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
const policy_table::DevicePolicy& device) {
utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
+ SDL_LOG_WARN("Incorrect insert statement into application.");
return false;
}
@@ -1210,7 +1195,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
app_query.Bind(4, 0);
app_query.Bind(5);
if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
+ SDL_LOG_WARN("Incorrect insert into application.");
return false;
}
@@ -1221,20 +1206,19 @@ bool SQLPTRepresentation::SaveAppGroup(
const std::string& app_id, const policy_table::Strings& app_groups) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app group");
+ SDL_LOG_WARN("Incorrect insert statement for app group");
return false;
}
- LOG4CXX_INFO(logger_, "SaveAppGroup");
+ SDL_LOG_INFO("SaveAppGroup");
policy_table::Strings::const_iterator it;
for (it = app_groups.begin(); it != app_groups.end(); ++it) {
std::string ssss = *it;
- LOG4CXX_INFO(logger_, "Group: " << ssss);
+ SDL_LOG_INFO("Group: " << ssss);
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(
- logger_,
- "Incorrect insert into app group." << query.LastError().text());
+ SDL_LOG_WARN("Incorrect insert into app group."
+ << query.LastError().text());
return false;
}
}
@@ -1246,7 +1230,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
const policy_table::Strings& nicknames) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNickname)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname");
+ SDL_LOG_WARN("Incorrect insert statement for nickname");
return false;
}
@@ -1255,7 +1239,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into nickname.");
+ SDL_LOG_WARN("Incorrect insert into nickname.");
return false;
}
}
@@ -1267,7 +1251,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
const policy_table::AppHMITypes& types) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app type");
+ SDL_LOG_WARN("Incorrect insert statement for app type");
return false;
}
@@ -1276,7 +1260,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
query.Bind(0, app_id);
query.Bind(1, std::string(policy_table::EnumToJsonString(*it)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app type.");
+ SDL_LOG_WARN("Incorrect insert into app type.");
return false;
}
}
@@ -1288,29 +1272,29 @@ bool SQLPTRepresentation::SaveRequestType(
const std::string& app_id, const policy_table::RequestTypes& types) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
+ SDL_LOG_WARN("Incorrect insert statement for request types.");
return false;
}
policy_table::RequestTypes::const_iterator it;
if (!types.empty()) {
- LOG4CXX_WARN(logger_, "Request types not empty.");
+ SDL_LOG_WARN("Request types not empty.");
for (it = types.begin(); it != types.end(); ++it) {
query.Bind(0, app_id);
query.Bind(1, std::string(policy_table::EnumToJsonString(*it)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
+ SDL_LOG_WARN("Incorrect insert into request types.");
return false;
}
}
} else if (types.is_initialized()) {
- LOG4CXX_WARN(logger_, "Request types empty.");
+ SDL_LOG_WARN("Request types empty.");
query.Bind(0, app_id);
query.Bind(1,
std::string(policy_table::EnumToJsonString(
policy_table::RequestType::RT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
+ SDL_LOG_WARN("Incorrect insert into request types.");
return false;
}
}
@@ -1322,29 +1306,29 @@ bool SQLPTRepresentation::SaveRequestSubType(
const policy_table::RequestSubTypes& request_subtypes) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes.");
+ SDL_LOG_WARN("Incorrect insert statement for request subtypes.");
return false;
}
policy_table::Strings::const_iterator it;
if (!request_subtypes.empty()) {
- LOG4CXX_TRACE(logger_, "Request subtypes are not empty.");
+ SDL_LOG_TRACE("Request subtypes are not empty.");
for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) {
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
+ SDL_LOG_WARN("Incorrect insert into request subtypes.");
return false;
}
}
} else if (request_subtypes.is_initialized()) {
- LOG4CXX_WARN(logger_, "Request subtypes empty.");
+ SDL_LOG_WARN("Request subtypes empty.");
query.Bind(0, app_id);
query.Bind(1,
std::string(policy_table::EnumToJsonString(
policy_table::RequestType::RT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
+ SDL_LOG_WARN("Incorrect insert into request subtypes.");
return false;
}
}
@@ -1354,11 +1338,11 @@ bool SQLPTRepresentation::SaveRequestSubType(
bool SQLPTRepresentation::SaveAppServiceParameters(
const std::string& app_id,
const policy_table::AppServiceParameters& app_service_parameters) {
- LOG4CXX_INFO(logger_, "Save app service parameters");
+ SDL_LOG_INFO("Save app service parameters");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types");
+ SDL_LOG_WARN("Incorrect insert statement for app service types");
return false;
}
policy_table::AppServiceParameters::const_iterator it;
@@ -1371,14 +1355,14 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
query.Bind(1, it->first);
query.Bind(2, app_id);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Insert execute failed for into app service types");
+ SDL_LOG_WARN("Insert execute failed for into app service types");
return false;
}
// Insert app names array into db
utils::dbms::SQLQuery service_name_query(db());
if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names");
+ SDL_LOG_WARN("Incorrect insert statement for app service names");
return false;
}
@@ -1386,11 +1370,11 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
if (app_service_names.is_initialized() && app_service_names->empty()) {
// App service names is an empty array
- LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array");
+ SDL_LOG_DEBUG("App Service Names is Empty Array");
service_name_query.Bind(0, static_cast<int64_t>(id));
service_name_query.Bind(1);
if (!service_name_query.Exec() || !service_name_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names");
+ SDL_LOG_WARN("Incorrect insert into empty app service names");
return false;
}
} else {
@@ -1401,7 +1385,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
service_name_query.Bind(0, static_cast<int64_t>(id));
service_name_query.Bind(1, *names_it);
if (!service_name_query.Exec() || !service_name_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app service names");
+ SDL_LOG_WARN("Incorrect insert into app service names");
return false;
}
}
@@ -1410,8 +1394,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
// Insert handled rpcs array into db
utils::dbms::SQLQuery handled_rpcs_query(db());
if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for app service handled rpcs");
+ SDL_LOG_WARN("Incorrect insert statement for app service handled rpcs");
return false;
}
@@ -1422,7 +1405,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters(
handled_rpcs_query.Bind(0, static_cast<int64_t>(id));
handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id));
if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs");
+ SDL_LOG_WARN("Incorrect insert into app service handled rpcs");
return false;
}
}
@@ -1434,7 +1417,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSaveModuleMeta)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta.");
+ SDL_LOG_WARN("Incorrect insert statement for module_meta.");
return false;
}
const int64_t odometer = *(meta.pt_exchanged_at_odometer_x);
@@ -1444,7 +1427,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) {
query.Bind(2, *(meta.ignition_cycles_since_last_exchange));
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update for module_meta.");
+ SDL_LOG_WARN("Incorrect update for module_meta.");
return false;
}
@@ -1455,7 +1438,7 @@ bool SQLPTRepresentation::SaveModuleConfig(
const policy_table::ModuleConfig& config) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateModuleConfig)) {
- LOG4CXX_WARN(logger_, "Incorrect update statement for module config");
+ SDL_LOG_WARN("Incorrect update statement for module config");
return false;
}
@@ -1478,7 +1461,7 @@ bool SQLPTRepresentation::SaveModuleConfig(
? query.Bind(9, *(config.lock_screen_dismissal_enabled))
: query.Bind(9);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update module config");
+ SDL_LOG_WARN("Incorrect update module config");
return false;
}
@@ -1511,12 +1494,12 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
const policy_table::ServiceEndpoints& endpoints) {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteEndpoint)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from endpoint.");
+ SDL_LOG_WARN("Incorrect delete from endpoint.");
return false;
}
if (!query.Prepare(sql_pt::kInsertEndpoint)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for endpoint");
+ SDL_LOG_WARN("Incorrect insert statement for endpoint");
return false;
}
@@ -1532,7 +1515,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
query.Bind(1, *url_it);
query.Bind(2, app_it->first);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into endpoint");
+ SDL_LOG_WARN("Incorrect insert into endpoint");
return false;
}
}
@@ -1546,8 +1529,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
const policy_table::ServiceEndpointProperties& endpoint_properties) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertEndpointVersion)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Incorrect insert of endpoint property to endpoint_properties.");
return false;
}
@@ -1557,8 +1539,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
query.Bind(1, endpoint_property.second.version);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Failed to insert endpoint property into endpoint_properties.");
return false;
}
@@ -1569,13 +1550,13 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
const policy_table::ConsumerFriendlyMessages& messages) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// According CRS-2419 If there is no “consumer_friendly_messages” key,
// the current local consumer_friendly_messages section shall be maintained in
// the policy table. So it won't be changed/updated
if (!messages.messages.is_initialized()) {
- LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty");
+ SDL_LOG_INFO("ConsumerFriendlyMessages messages list is empty");
return true;
}
@@ -1586,18 +1567,18 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
}
if (!delete_query_exec_result) {
- LOG4CXX_WARN(logger_, "Failed to delete messages from DB.");
+ SDL_LOG_WARN("Failed to delete messages from DB.");
return false;
}
if (!query.Prepare(sql_pt::kUpdateVersion)) {
- LOG4CXX_WARN(logger_, "Invalid update messages version statement.");
+ SDL_LOG_WARN("Invalid update messages version statement.");
return false;
}
query.Bind(0, messages.version);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to update messages version number in DB.");
+ SDL_LOG_WARN("Failed to update messages version number in DB.");
return false;
}
@@ -1624,13 +1605,13 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertMessageType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for message type.");
+ SDL_LOG_WARN("Incorrect insert statement for message type.");
return false;
}
query.Bind(0, type);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into message type.");
+ SDL_LOG_WARN("Incorrect insert into message type.");
return false;
}
@@ -1640,13 +1621,13 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
bool SQLPTRepresentation::SaveLanguage(const std::string& code) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertLanguage)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for language.");
+ SDL_LOG_WARN("Incorrect insert statement for language.");
return false;
}
query.Bind(0, code);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into language.");
+ SDL_LOG_WARN("Incorrect insert into language.");
return false;
}
@@ -1659,7 +1640,7 @@ bool SQLPTRepresentation::SaveMessageString(
const policy_table::MessageString& strings) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertMessageString)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for message.");
+ SDL_LOG_WARN("Incorrect insert statement for message.");
return false;
}
@@ -1686,7 +1667,7 @@ bool SQLPTRepresentation::SaveMessageString(
}
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into message.");
+ SDL_LOG_WARN("Incorrect insert into message.");
return false;
}
return true;
@@ -1696,12 +1677,11 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries(
const policy_table::SecondsBetweenRetries& seconds) {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries.");
+ SDL_LOG_WARN("Incorrect delete from seconds between retries.");
return false;
}
if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for seconds between retries.");
+ SDL_LOG_WARN("Incorrect insert statement for seconds between retries.");
return false;
}
@@ -1709,7 +1689,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries(
query.Bind(0, static_cast<int>(i));
query.Bind(1, seconds[i]);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into seconds between retries.");
+ SDL_LOG_WARN("Incorrect insert into seconds between retries.");
return false;
}
}
@@ -1721,8 +1701,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
const policy_table::NumberOfNotificationsPerMinute& notifications) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert statement for notifications by priority.");
return false;
}
@@ -1731,7 +1710,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
query.Bind(0, it->first);
query.Bind(1, it->second);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert into notifications by priority.");
return false;
}
}
@@ -1743,8 +1722,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute(
const policy_table::NumberOfNotificationsPerMinute& notifications) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertSubtleNotificationsByPriority)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert statement for notifications by priority.");
return false;
}
@@ -1753,7 +1731,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute(
query.Bind(0, it->first);
query.Bind(1, it->second);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority.");
+ SDL_LOG_WARN("Incorrect insert into notifications by priority.");
return false;
}
}
@@ -1765,7 +1743,7 @@ bool SQLPTRepresentation::SaveDeviceData(
const policy_table::DeviceData& devices) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertDeviceData)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for device data.");
+ SDL_LOG_WARN("Incorrect insert statement for device data.");
return false;
}
@@ -1773,7 +1751,7 @@ bool SQLPTRepresentation::SaveDeviceData(
for (it = devices.begin(); it != devices.end(); ++it) {
query.Bind(0, it->first);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into device data.");
+ SDL_LOG_WARN("Incorrect insert into device data.");
return false;
}
}
@@ -1786,11 +1764,11 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized();
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app level.");
+ SDL_LOG_WARN("Incorrect delete from app level.");
return false;
}
if (!query.Prepare(sql_pt::kInsertAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app level.");
+ SDL_LOG_WARN("Incorrect insert statement for app level.");
return false;
}
@@ -1801,7 +1779,7 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
query.Bind(0, it->first);
query.Bind(1, it->second.count_of_tls_errors);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app level.");
+ SDL_LOG_WARN("Incorrect insert into app level.");
return false;
}
}
@@ -1810,18 +1788,17 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
bool SQLPTRepresentation::SaveVehicleData(
const policy_table::VehicleData& vehicle_data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (vehicle_data.is_initialized() &&
vehicle_data.schema_version.is_initialized()) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert of schema_version to vehicle_data.");
+ SDL_LOG_WARN("Incorrect insert of schema_version to vehicle_data.");
return false;
}
query.Bind(0, (*vehicle_data.schema_version));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data.");
+ SDL_LOG_WARN("Failed to insert schema_version to vehicle_data.");
return false;
}
}
@@ -1836,7 +1813,7 @@ bool SQLPTRepresentation::SaveVehicleData(
bool SQLPTRepresentation::SaveVehicleDataItems(
const policy_table::VehicleDataItems& vehicle_data_items) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeleteVehicleDataItems();
for (const auto& item : vehicle_data_items) {
if (!InsertVehicleDataItem(item)) {
@@ -1849,23 +1826,22 @@ bool SQLPTRepresentation::SaveVehicleDataItems(
void SQLPTRepresentation::IncrementIgnitionCycles() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) {
- LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles");
+ SDL_LOG_WARN("Failed incrementing ignition cycles");
}
}
void SQLPTRepresentation::ResetIgnitionCycles() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kResetIgnitionCycles)) {
- LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number.");
+ SDL_LOG_WARN("Failed to reset ignition cycles number.");
}
}
bool SQLPTRepresentation::UpdateRequired() const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) {
- LOG4CXX_WARN(logger_,
- "Failed select update required flag from module meta");
+ SDL_LOG_WARN("Failed select update required flag from module meta");
return false;
}
return query.GetBoolean(0);
@@ -1876,29 +1852,28 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) {
// TODO(AOleynik): Quick fix, will be reworked
if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/
"UPDATE `module_meta` SET `flag_update_required` = ?")) {
- LOG4CXX_WARN(logger_,
- "Incorrect update into module meta (update_required): "
- << strerror(errno));
+ SDL_LOG_WARN("Incorrect update into module meta (update_required): "
+ << strerror(errno));
return;
}
query.Bind(0, value);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update module meta (update_required)");
+ SDL_LOG_WARN("Failed update module meta (update_required)");
}
}
bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
StringArray* nicknames,
StringArray* app_types) {
- LOG4CXX_INFO(logger_, "Getting initial application data.");
+ SDL_LOG_INFO("Getting initial application data.");
utils::dbms::SQLQuery app_names(db());
if (!app_names.Prepare(sql_pt::kSelectNicknames)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app nicknames");
+ SDL_LOG_WARN("Incorrect select from app nicknames");
return false;
}
utils::dbms::SQLQuery app_hmi_types(db());
if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app types");
+ SDL_LOG_WARN("Incorrect select from app types");
return false;
}
app_names.Bind(0, app_id);
@@ -1916,7 +1891,7 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
bool SQLPTRepresentation::GetFunctionalGroupings(
policy_table::FunctionalGroupings& groups) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return GatherFunctionalGroupings(&groups);
}
@@ -1924,7 +1899,7 @@ bool SQLPTRepresentation::GatherAppType(
const std::string& app_id, policy_table::AppHMITypes* app_types) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app types");
+ SDL_LOG_WARN("Incorrect select from app types");
return false;
}
@@ -1944,7 +1919,7 @@ bool SQLPTRepresentation::GatherRequestType(
policy_table::RequestTypes* request_types) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRequestTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from request types.");
+ SDL_LOG_WARN("Incorrect select from request types.");
return false;
}
@@ -1968,7 +1943,7 @@ bool SQLPTRepresentation::GatherRequestSubType(
policy_table::RequestSubTypes* request_subtypes) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from request subtypes.");
+ SDL_LOG_WARN("Incorrect select from request subtypes.");
return false;
}
@@ -1988,22 +1963,22 @@ bool SQLPTRepresentation::GatherRequestSubType(
bool SQLPTRepresentation::GatherAppServiceParameters(
const std::string& app_id,
policy_table::AppServiceParameters* app_service_parameters) const {
- LOG4CXX_INFO(logger_, "Gather app service info");
+ SDL_LOG_INFO("Gather app service info");
utils::dbms::SQLQuery service_type_query(db());
if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from service_types");
+ SDL_LOG_WARN("Incorrect select from service_types");
return false;
}
utils::dbms::SQLQuery service_name_query(db());
if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) {
- LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names");
+ SDL_LOG_WARN("Incorrect select all from app_service_names");
return false;
}
utils::dbms::SQLQuery handled_rpcs_query(db());
if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs");
+ SDL_LOG_WARN("Incorrect select all from app_service_handled_rpcs");
return false;
}
@@ -2011,12 +1986,12 @@ bool SQLPTRepresentation::GatherAppServiceParameters(
while (service_type_query.Next()) {
const int service_type_id = service_type_query.GetInteger(0);
std::string service_type = service_type_query.GetString(1);
- LOG4CXX_WARN(logger_, "Load service type from pt: " << service_type);
+ SDL_LOG_WARN("Load service type from pt: " << service_type);
(*app_service_parameters)[service_type] = policy_table::AppServiceInfo();
service_name_query.Bind(0, service_type_id);
while (service_name_query.Next()) {
- LOG4CXX_DEBUG(logger_, "Loading service name");
+ SDL_LOG_DEBUG("Loading service name");
(*app_service_parameters)[service_type].service_names->push_back(
service_name_query.GetString(0));
(*app_service_parameters)[service_type].service_names->mark_initialized();
@@ -2031,11 +2006,11 @@ bool SQLPTRepresentation::GatherAppServiceParameters(
}
if (!service_name_query.Reset()) {
- LOG4CXX_ERROR(logger_, "Could not reset service_name query");
+ SDL_LOG_ERROR("Could not reset service_name query");
return false;
}
if (!handled_rpcs_query.Reset()) {
- LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query");
+ SDL_LOG_ERROR("Could not reset handled_rpcs query");
return false;
}
}
@@ -2047,7 +2022,7 @@ bool SQLPTRepresentation::GatherNickName(
const std::string& app_id, policy_table::Strings* nicknames) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNicknames)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app nicknames");
+ SDL_LOG_WARN("Incorrect select from app nicknames");
return false;
}
@@ -2062,7 +2037,7 @@ bool SQLPTRepresentation::GatherAppGroup(
const std::string& app_id, policy_table::Strings* app_groups) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app groups");
+ SDL_LOG_WARN("Incorrect select from app groups");
return false;
}
@@ -2075,10 +2050,10 @@ bool SQLPTRepresentation::GatherAppGroup(
bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id,
bool* denied) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) {
- LOG4CXX_WARN(logger_, "Incorrect select remote control flag");
+ SDL_LOG_WARN("Incorrect select remote control flag");
return false;
}
query.Bind(0, app_id);
@@ -2094,7 +2069,7 @@ bool SQLPTRepresentation::GatherModuleType(
const std::string& app_id, policy_table::ModuleTypes* app_types) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectModuleTypes)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app types");
+ SDL_LOG_WARN("Incorrect select from app types");
return false;
}
@@ -2115,17 +2090,17 @@ bool SQLPTRepresentation::GatherModuleType(
bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id,
bool deny) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) {
- LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag");
+ SDL_LOG_WARN("Incorrect update statement for remote control flag");
return false;
}
- LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny);
+ SDL_LOG_DEBUG("App: " << app_id << std::boolalpha << " - " << deny);
query.Bind(0, deny);
query.Bind(1, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update remote control flag.");
+ SDL_LOG_WARN("Incorrect update remote control flag.");
return false;
}
return true;
@@ -2135,7 +2110,7 @@ bool SQLPTRepresentation::SaveModuleType(
const std::string& app_id, const policy_table::ModuleTypes& types) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertModuleType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for module type");
+ SDL_LOG_WARN("Incorrect insert statement for module type");
return false;
}
@@ -2145,10 +2120,9 @@ bool SQLPTRepresentation::SaveModuleType(
query.Bind(0, app_id);
std::string module(policy_table::EnumToJsonString(*it));
query.Bind(1, module);
- LOG4CXX_DEBUG(logger_,
- "Module(app: " << app_id << ", type: " << module << ")");
+ SDL_LOG_DEBUG("Module(app: " << app_id << ", type: " << module << ")");
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into module type.");
+ SDL_LOG_WARN("Incorrect insert into module type.");
return false;
}
}
@@ -2158,21 +2132,21 @@ bool SQLPTRepresentation::SaveModuleType(
std::string(policy_table::EnumToJsonString(
policy_table::ModuleType::MT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into module types.");
+ SDL_LOG_WARN("Incorrect insert into module types.");
return false;
}
} else {
- LOG4CXX_WARN(logger_, "Module Type omitted.");
+ SDL_LOG_WARN("Module Type omitted.");
}
return true;
}
bool SQLPTRepresentation::SaveAccessModule(
TypeAccess access, const policy_table::AccessModules& modules) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAccessModule)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for access module");
+ SDL_LOG_WARN("Incorrect insert statement for access module");
return false;
}
@@ -2183,12 +2157,12 @@ bool SQLPTRepresentation::SaveAccessModule(
query.Bind(0, name);
query.Bind(1, access);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into access module.");
+ SDL_LOG_WARN("Incorrect insert into access module.");
return false;
}
int id = query.LastInsertId();
if (!query.Reset()) {
- LOG4CXX_WARN(logger_, "Couldn't reset query access module.");
+ SDL_LOG_WARN("Couldn't reset query access module.");
return false;
}
if (!SaveRemoteRpc(id, rpcs)) {
@@ -2200,10 +2174,10 @@ bool SQLPTRepresentation::SaveAccessModule(
bool SQLPTRepresentation::GatherAccessModule(
TypeAccess access, policy_table::AccessModules* modules) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAccessModules)) {
- LOG4CXX_WARN(logger_, "Incorrect select from access module");
+ SDL_LOG_WARN("Incorrect select from access module");
return false;
}
@@ -2222,10 +2196,10 @@ bool SQLPTRepresentation::GatherAccessModule(
bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
const policy_table::RemoteRpcs& rpcs) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRemoteRpc)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc");
+ SDL_LOG_WARN("Incorrect insert statement for remote rpc");
return false;
}
policy_table::RemoteRpcs::const_iterator i;
@@ -2238,7 +2212,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
query.Bind(1, name);
query.Bind(2);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc.");
+ SDL_LOG_WARN("Incorrect insert into remote rpc.");
return false;
}
} else {
@@ -2248,7 +2222,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
query.Bind(1, name);
query.Bind(2, param);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc.");
+ SDL_LOG_WARN("Incorrect insert into remote rpc.");
return false;
}
}
@@ -2259,10 +2233,10 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id,
bool SQLPTRepresentation::GatherRemoteRpc(
int module_id, policy_table::RemoteRpcs* rpcs) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) {
- LOG4CXX_WARN(logger_, "Incorrect select from remote rpc");
+ SDL_LOG_WARN("Incorrect select from remote rpc");
return false;
}
@@ -2285,7 +2259,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
bool is_predata) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) {
- LOG4CXX_WARN(logger_, "Incorrect update in application");
+ SDL_LOG_WARN("Incorrect update in application");
return false;
}
@@ -2295,7 +2269,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
query.Bind(3, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update in application");
+ SDL_LOG_WARN("Failed update in application");
return false;
}
@@ -2306,13 +2280,13 @@ bool SQLPTRepresentation::IsApplicationRevoked(
const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) {
- LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application");
+ SDL_LOG_WARN("Incorrect select from is_revoked of application");
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select is_revoked of application");
+ SDL_LOG_WARN("Failed select is_revoked of application");
return false;
}
return query.IsNull(0) ? false : query.GetBoolean(0);
@@ -2321,13 +2295,13 @@ bool SQLPTRepresentation::IsApplicationRepresented(
const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) {
- LOG4CXX_WARN(logger_, "Incorrect select application by id");
+ SDL_LOG_WARN("Incorrect select application by id");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select application by id");
+ SDL_LOG_WARN("Failed select application by id");
return false;
}
return query.GetInteger(0) != 0;
@@ -2336,13 +2310,13 @@ bool SQLPTRepresentation::IsApplicationRepresented(
bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) {
- LOG4CXX_WARN(logger_, "Incorrect select application by id");
+ SDL_LOG_WARN("Incorrect select application by id");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select application by id");
+ SDL_LOG_WARN("Failed select application by id");
return false;
}
return query.IsNull(0) ? false : query.GetBoolean(0);
@@ -2355,12 +2329,12 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const {
bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
+ SDL_LOG_ERROR("Incorrect statement to delete from app_group.");
return false;
}
query.Bind(0, app_id);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
+ SDL_LOG_ERROR("Failed deleting from app_group.");
return false;
}
@@ -2404,17 +2378,17 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
bool SQLPTRepresentation::SetIsDefault(const std::string& app_id,
bool is_default) const {
- LOG4CXX_TRACE(logger_, "Set flag is_default of application");
+ SDL_LOG_TRACE("Set flag is_default of application");
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateIsDefault)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating is_default");
+ SDL_LOG_WARN("Incorect statement for updating is_default");
return false;
}
query.Bind(0, is_default);
query.Bind(1, app_id);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update is_default");
+ SDL_LOG_WARN("Failed update is_default");
return false;
}
return true;
@@ -2425,18 +2399,16 @@ void SQLPTRepresentation::RemoveDB() const {
}
bool SQLPTRepresentation::IsDBVersionActual() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Failed to get DB version: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed to get DB version: " << query.LastError().text());
return false;
}
const int32_t saved_db_version = query.GetInteger(0);
const int32_t current_db_version = GetDBVersion();
- LOG4CXX_DEBUG(logger_,
- "Saved DB version is: " << saved_db_version
+ SDL_LOG_DEBUG("Saved DB version is: " << saved_db_version
<< ". Current DB vesion is: "
<< current_db_version);
@@ -2444,21 +2416,19 @@ bool SQLPTRepresentation::IsDBVersionActual() const {
}
bool SQLPTRepresentation::UpdateDBVersion() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateDBVersion)) {
- LOG4CXX_ERROR(logger_,
- "Incorrect DB version query: " << query.LastError().text());
+ SDL_LOG_ERROR("Incorrect DB version query: " << query.LastError().text());
return false;
}
const int32_t db_version = GetDBVersion();
- LOG4CXX_DEBUG(logger_, "DB version will be updated to: " << db_version);
+ SDL_LOG_DEBUG("DB version will be updated to: " << db_version);
query.Bind(0, db_version);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "DB version getting failed: " << query.LastError().text());
+ SDL_LOG_ERROR("DB version getting failed: " << query.LastError().text());
return false;
}
@@ -2477,18 +2447,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
const std::string& destination) {
utils::dbms::SQLQuery source_app(db());
if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement from application.");
+ SDL_LOG_WARN("Incorrect select statement from application.");
return false;
}
source_app.Bind(0, source);
if (!source_app.Exec()) {
- LOG4CXX_WARN(logger_, "Failed selecting from application.");
+ SDL_LOG_WARN("Failed selecting from application.");
return false;
}
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertApplicationFull)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
+ SDL_LOG_WARN("Incorrect insert statement into application.");
return false;
}
query.Bind(0, destination);
@@ -2526,7 +2496,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
: query.Bind(18, source_app.GetBoolean(17));
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed inserting into application.");
+ SDL_LOG_WARN("Failed inserting into application.");
return false;
}
return true;
@@ -2535,13 +2505,13 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
void SQLPTRepresentation::SetPreloaded(bool value) {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdatePreloaded)) {
- LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded.");
+ SDL_LOG_WARN("Incorrect statement of updating preloaded.");
return;
}
query.Bind(0, value);
if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed updating preloaded.");
+ SDL_LOG_WARN("Failed updating preloaded.");
return;
}
}
@@ -2554,9 +2524,8 @@ bool SQLPTRepresentation::VehicleDataItemExists(
const policy_table::VehicleDataItem& vehicle_data_item) const {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement for vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement for vehicle data item. "
+ << query.LastError().text());
return false;
}
@@ -2570,10 +2539,9 @@ bool SQLPTRepresentation::VehicleDataItemExists(
: query.Bind(3);
if (!query.Exec()) {
- LOG4CXX_ERROR(logger_,
- "Failed to retrieve vehicle data item: "
- << std::string(vehicle_data_item.key)
- << ". Error: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed to retrieve vehicle data item: "
+ << std::string(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
return false;
}
return !query.IsNull(0);
@@ -2585,9 +2553,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem(
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
return result;
}
@@ -2604,9 +2571,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem(
if (policy_table::VehicleDataItem::kStruct ==
static_cast<std::string>(vdi.type)) {
if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << param_query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << param_query.LastError().text());
return policy_table::VehicleDataItems();
}
@@ -2687,21 +2653,19 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
utils::dbms::SQLQuery query(db());
if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) {
- LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized.");
+ SDL_LOG_ERROR("Vehicle data item is not initialized.");
return false;
}
if (VehicleDataItemExists(vehicle_data_item)) {
- LOG4CXX_INFO(logger_,
- static_cast<std::string>(vehicle_data_item.key)
- << " is already stored.");
+ SDL_LOG_INFO(static_cast<std::string>(vehicle_data_item.key)
+ << " is already stored.");
return true;
}
if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
return false;
}
@@ -2744,10 +2708,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
: query.Bind(14);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_ERROR(logger_,
- "Failed to insert vehicle data item: "
- << static_cast<std::string>(vehicle_data_item.key)
- << ". Error: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed to insert vehicle data item: "
+ << static_cast<std::string>(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
return false;
}
@@ -2760,14 +2723,13 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
if (stored_vehicle_data_item_params.end() !=
stored_vehicle_data_item_params.find(param.name)) {
- LOG4CXX_DEBUG(logger_, "Parameter already stored.");
+ SDL_LOG_DEBUG("Parameter already stored.");
continue;
};
if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) {
- LOG4CXX_ERROR(logger_,
- "Incorrent select statement of vehicle data item. "
- << query.LastError().text());
+ SDL_LOG_ERROR("Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
return false;
}
@@ -2777,11 +2739,11 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
query.Bind(3, param.key);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Failed to insert to vehicle data item relations helper table: "
- << static_cast<std::string>(param.key)
- << ". Error: " << query.LastError().text());
+ << static_cast<std::string>(param.key)
+ << ". Error: " << query.LastError().text());
return false;
}
stored_vehicle_data_item_params[param.name] = param.key;
@@ -2794,10 +2756,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem(
policy_table::VehicleDataItems
SQLPTRepresentation::SelectCompositeVehicleDataItems() const {
utils::dbms::SQLQuery query(db());
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) {
- LOG4CXX_ERROR(logger_,
- "Incorrect statement for parameterized vehicle data items");
+ SDL_LOG_ERROR("Incorrect statement for parameterized vehicle data items");
return policy_table::VehicleDataItems();
}
@@ -2820,10 +2781,9 @@ SQLPTRepresentation::SelectCompositeVehicleDataItems() const {
policy_table::VehicleDataItems
SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const {
utils::dbms::SQLQuery query(db());
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Incorrect statement for non parameterized vehicle data items");
return policy_table::VehicleDataItems();
}
@@ -2843,17 +2803,15 @@ SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const {
bool SQLPTRepresentation::DeleteVehicleDataItems() const {
utils::dbms::SQLQuery query(db());
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) {
- LOG4CXX_ERROR(logger_,
- "Failed clearing database: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) {
- LOG4CXX_ERROR(logger_,
- "Failed clearing database: " << query.LastError().text());
+ SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text());
return false;
}
diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc
index 1ba3d0f394..9ac51c3f93 100644
--- a/src/components/policy/policy_regular/src/update_status_manager.cc
+++ b/src/components/policy/policy_regular/src/update_status_manager.cc
@@ -36,7 +36,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
+SDL_CREATE_LOG_VARIABLE("Policy")
UpdateStatusManager::UpdateStatusManager()
: listener_(NULL)
@@ -55,7 +55,7 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) {
}
void UpdateStatusManager::PendingUpdate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kPendingUpdate);
}
@@ -72,27 +72,27 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) {
}
void UpdateStatusManager::OnUpdateSentOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kOnUpdateSentOut);
}
void UpdateStatusManager::OnUpdateTimeoutOccurs() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kOnUpdateTimeout);
}
void UpdateStatusManager::OnValidUpdateReceived() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kOnValidUpdateReceived);
}
void UpdateStatusManager::OnWrongUpdateReceived() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kOnWrongUpdateReceived);
}
void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (is_update_required) {
ProcessEvent(kOnResetPolicyTableRequireUpdate);
return;
@@ -101,13 +101,13 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) {
}
void UpdateStatusManager::OnResetRetrySequence() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProcessEvent(kOnResetRetrySequence);
}
void UpdateStatusManager::OnExistedApplicationAdded(
const bool is_update_required) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (is_update_required) {
current_status_.reset(new UpToDateStatus());
ProcessEvent(kScheduleUpdate);
@@ -115,7 +115,7 @@ void UpdateStatusManager::OnExistedApplicationAdded(
}
void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (kDeviceAllowed != consent) {
app_registered_from_non_consented_device_ = true;
return;
@@ -130,7 +130,7 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
}
void UpdateStatusManager::OnDeviceConsented() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (app_registered_from_non_consented_device_) {
ProcessEvent(kOnNewAppRegistered);
}
@@ -157,19 +157,19 @@ std::string UpdateStatusManager::StringifiedUpdateStatus() const {
}
void policy::UpdateStatusManager::OnAppsSearchStarted() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_search_in_progress_lock_);
apps_search_in_progress_ = true;
}
void policy::UpdateStatusManager::OnAppsSearchCompleted() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_search_in_progress_lock_);
apps_search_in_progress_ = false;
}
bool policy::UpdateStatusManager::IsAppsSearchInProgress() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(apps_search_in_progress_lock_);
return apps_search_in_progress_;
}
@@ -182,7 +182,7 @@ void UpdateStatusManager::DoTransition() {
current_status_ = next_status_;
next_status_.reset();
- LOG4CXX_DEBUG(logger_, "last_processed_event_ = " << last_processed_event_);
+ SDL_LOG_DEBUG("last_processed_event_ = " << last_processed_event_);
const bool is_update_pending =
policy::StatusProcessingSnapshot == current_status_->get_status();
diff --git a/src/components/protocol/src/rpc_type.cc b/src/components/protocol/src/rpc_type.cc
index bc1142ad5c..fb9845d148 100644
--- a/src/components/protocol/src/rpc_type.cc
+++ b/src/components/protocol/src/rpc_type.cc
@@ -37,7 +37,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
namespace {
bool IsSupported(RpcType rpc_type) {
@@ -56,7 +56,7 @@ RpcType RpcTypeFromByte(uint8_t byte) {
RpcType type = RpcType(byte);
bool supported_type = IsSupported(type);
if (!supported_type) {
- LOG4CXX_INFO(logger_, "Invalid service type: " << int32_t(byte));
+ SDL_LOG_INFO("Invalid service type: " << int32_t(byte));
}
return supported_type ? type : kRpcTypeReserved;
diff --git a/src/components/protocol/src/service_type.cc b/src/components/protocol/src/service_type.cc
index 8ca57f338b..e6417b07d0 100644
--- a/src/components/protocol/src/service_type.cc
+++ b/src/components/protocol/src/service_type.cc
@@ -36,7 +36,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
namespace {
// Check if provided service value is one of the specified
@@ -58,7 +58,7 @@ ServiceType ServiceTypeFromByte(uint8_t byte) {
ServiceType type = ServiceType(byte);
const bool valid_type = IsValid(type);
if (!valid_type) {
- LOG4CXX_INFO(logger_, "Invalid service type: " << int32_t(byte));
+ SDL_LOG_INFO("Invalid service type: " << int32_t(byte));
}
return valid_type ? type : kInvalidServiceType;
}
diff --git a/src/components/protocol_handler/include/protocol_handler/handshake_handler.h b/src/components/protocol_handler/include/protocol_handler/handshake_handler.h
index 9552d4c420..a9a5997493 100644
--- a/src/components/protocol_handler/include/protocol_handler/handshake_handler.h
+++ b/src/components/protocol_handler/include/protocol_handler/handshake_handler.h
@@ -130,8 +130,11 @@ class HandshakeHandler : public security_manager::SecurityManagerListener {
* @brief Performs related actions if handshake was failed
* @param params set of params used in bson part of message
* @param service_status - service status to be sent to HMI
+ * @param err_reason - Optional error description
*/
- void ProcessFailedHandshake(BsonObject& params, ServiceStatus service_status);
+ void ProcessFailedHandshake(BsonObject& params,
+ ServiceStatus service_status,
+ std::string err_reason = std::string());
/**
* @brief Determines whether service can be protected
diff --git a/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h b/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
index 3da63bd79f..5a63532626 100644
--- a/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
+++ b/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
@@ -40,6 +40,7 @@
#include "protocol_handler/protocol_packet.h"
#include "utils/date_time.h"
+#include "utils/lock.h"
/**
*\namespace protocol_handlerHandler
@@ -125,6 +126,7 @@ class MultiFrameBuilder {
// Map of frames with last frame data for messages received in multiple
// frames.
MultiFrameMap multiframes_map_;
+ sync_primitives::Lock multiframes_map_lock_;
int64_t consecutive_frame_wait_msecs_;
};
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
index 8dbfc4ed4d..ead997da69 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
@@ -373,11 +373,13 @@ class ProtocolHandlerImpl
* \param session_id ID of session to be sent to mobile application
* \param protocol_version Version of protocol used for communication
* \param service_type Type of session: RPC or BULK Data. RPC by default
+ * \param reason String stating the reason for the rejecting the start service
*/
void SendStartSessionNAck(ConnectionID connection_id,
uint8_t session_id,
uint8_t protocol_version,
- uint8_t service_type);
+ uint8_t service_type,
+ const std::string reason);
/**
* \brief Sends fail of starting session to mobile application
@@ -386,12 +388,14 @@ class ProtocolHandlerImpl
* \param protocol_version Version of protocol used for communication
* \param service_type Type of session: RPC or BULK Data. RPC by default
* \param rejected_params List of rejected params to send in payload
+ * \param reason String stating the reason for the rejecting the start service
*/
void SendStartSessionNAck(ConnectionID connection_id,
uint8_t session_id,
uint8_t protocol_version,
uint8_t service_type,
- std::vector<std::string>& rejectedParams);
+ std::vector<std::string>& rejectedParams,
+ const std::string reason);
/**
* \brief Sends acknowledgement of end session/service to mobile application
@@ -416,11 +420,13 @@ class ProtocolHandlerImpl
* \param session_id ID of session ment to be ended
* \param protocol_version Version of protocol used for communication
* \param service_type Type of session: RPC or BULK Data. RPC by default
+ * \param reason String stating the reason for the rejecting the end service
*/
void SendEndSessionNAck(ConnectionID connection_id,
uint32_t session_id,
uint8_t protocol_version,
- uint8_t service_type);
+ uint8_t service_type,
+ const std::string reason);
/**
* \brief Sends fail of ending session to mobile application (variant for
* Protocol v5)
@@ -430,12 +436,14 @@ class ProtocolHandlerImpl
* \param protocol_version Version of protocol used for communication
* \param service_type Type of session: RPC or BULK Data. RPC by default
* \param rejected_params List of rejected params to send in payload
+ * \param reason String stating the reason for the rejecting the end service
*/
void SendEndSessionNAck(ConnectionID connection_id,
uint32_t session_id,
uint8_t protocol_version,
uint8_t service_type,
- std::vector<std::string>& rejected_params);
+ std::vector<std::string>& rejected_params,
+ const std::string reason);
SessionObserver& get_session_observer() OVERRIDE;
@@ -448,7 +456,8 @@ class ProtocolHandlerImpl
* generated_session_id is 0, the list may be empty.
*/
void NotifySessionStarted(const SessionContext& context,
- std::vector<std::string>& rejected_params) OVERRIDE;
+ std::vector<std::string>& rejected_params,
+ const std::string err_reason) OVERRIDE;
#ifdef BUILD_TESTS
const impl::FromMobileQueue& get_from_mobile_queue() const {
diff --git a/src/components/protocol_handler/src/handshake_handler.cc b/src/components/protocol_handler/src/handshake_handler.cc
index 3b4ae6ef1f..4d306fd330 100644
--- a/src/components/protocol_handler/src/handshake_handler.cc
+++ b/src/components/protocol_handler/src/handshake_handler.cc
@@ -42,7 +42,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
HandshakeHandler::HandshakeHandler(
ProtocolHandlerImpl& protocol_handler,
@@ -61,7 +61,7 @@ HandshakeHandler::HandshakeHandler(
, service_status_update_handler_(service_status_update_handler) {}
HandshakeHandler::~HandshakeHandler() {
- LOG4CXX_DEBUG(logger_, "Destroying of HandshakeHandler: " << this);
+ SDL_LOG_DEBUG("Destroying of HandshakeHandler: " << this);
}
uint32_t HandshakeHandler::connection_key() const {
@@ -79,14 +79,16 @@ bool HandshakeHandler::GetPolicyCertificateData(std::string& data) const {
}
void HandshakeHandler::OnCertificateUpdateRequired() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
bool HandshakeHandler::OnCertDecryptFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (payload_) {
- ProcessFailedHandshake(*payload_, ServiceStatus::CERT_INVALID);
+ ProcessFailedHandshake(*payload_,
+ ServiceStatus::CERT_INVALID,
+ "Failed to decrypt the certificate");
}
return true;
@@ -94,7 +96,7 @@ bool HandshakeHandler::OnCertDecryptFailed() {
#endif
bool HandshakeHandler::OnGetSystemTimeFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (payload_) {
ProcessFailedHandshake(*payload_, ServiceStatus::INVALID_TIME);
@@ -109,7 +111,7 @@ bool HandshakeHandler::OnGetSystemTimeFailed() {
}
bool HandshakeHandler::OnPTUFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (payload_) {
ProcessFailedHandshake(*payload_, ServiceStatus::PTU_FAILED);
}
@@ -120,14 +122,12 @@ bool HandshakeHandler::OnPTUFailed() {
bool HandshakeHandler::OnHandshakeDone(
uint32_t connection_key,
security_manager::SSLContext::HandshakeResult result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_DEBUG(logger_,
- "OnHandshakeDone for service : " << context_.service_type_);
+ SDL_LOG_DEBUG("OnHandshakeDone for service : " << context_.service_type_);
if (connection_key != this->primary_connection_key()) {
- LOG4CXX_DEBUG(logger_,
- "Listener " << this
+ SDL_LOG_DEBUG("Listener " << this
<< " expects notification for connection id: "
<< this->primary_connection_key()
<< ". Received notification for connection id "
@@ -138,11 +138,34 @@ bool HandshakeHandler::OnHandshakeDone(
const bool success =
result == security_manager::SSLContext::Handshake_Result_Success;
+ auto getInvalidCertReason =
+ [](const security_manager::SSLContext::HandshakeResult& result) {
+ switch (result) {
+ case security_manager::SSLContext::Handshake_Result_CertExpired:
+ return "Certificate already expired";
+ case security_manager::SSLContext::Handshake_Result_NotYetValid:
+ return "Certificate is not yet valid";
+ case security_manager::SSLContext::Handshake_Result_CertNotSigned:
+ return "Certificate is not signed";
+ case security_manager::SSLContext::Handshake_Result_AppIDMismatch:
+ return "Trying to run handshake with wrong app id";
+ case security_manager::SSLContext::Handshake_Result_AppNameMismatch:
+ return "Trying to run handshake with wrong app name";
+ case security_manager::SSLContext::Handshake_Result_AbnormalFail:
+ return "Error occurred during handshake";
+ case security_manager::SSLContext::Handshake_Result_Fail:
+ return "";
+ default:
+ return "";
+ }
+ };
+
if (payload_) {
if (success) {
ProcessSuccessfulHandshake(connection_key, *payload_);
} else {
- ProcessFailedHandshake(*payload_, ServiceStatus::CERT_INVALID);
+ ProcessFailedHandshake(
+ *payload_, ServiceStatus::CERT_INVALID, getInvalidCertReason(result));
}
} else {
BsonObject params;
@@ -150,7 +173,8 @@ bool HandshakeHandler::OnHandshakeDone(
if (success) {
ProcessSuccessfulHandshake(connection_key, params);
} else {
- ProcessFailedHandshake(params, ServiceStatus::CERT_INVALID);
+ ProcessFailedHandshake(
+ params, ServiceStatus::CERT_INVALID, getInvalidCertReason(result));
}
bson_object_deinitialize(&params);
}
@@ -172,14 +196,13 @@ bool HandshakeHandler::IsAlreadyProtected() const {
void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key,
BsonObject& params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool is_service_already_protected = IsAlreadyProtected();
const bool can_be_protected = CanBeProtected();
- LOG4CXX_DEBUG(logger_,
- "Service can be protected: " << can_be_protected
+ SDL_LOG_DEBUG("Service can be protected: " << can_be_protected
<< " and service was protected: "
<< is_service_already_protected);
@@ -202,17 +225,22 @@ void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key,
this->connection_key(),
context_.service_type_,
ServiceStatus::SERVICE_START_FAILED);
+
protocol_handler_.SendStartSessionNAck(context_.connection_id_,
context_.new_session_id_,
protocol_version_,
- context_.service_type_);
+ context_.service_type_,
+ (is_service_already_protected)
+ ? "Service is already protected"
+ : "Service cannot be protected");
}
}
void HandshakeHandler::ProcessFailedHandshake(BsonObject& params,
- ServiceStatus service_status) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Handshake failed");
+ ServiceStatus service_status,
+ std::string err_reason) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Handshake failed");
const std::vector<int>& force_protected =
protocol_handler_.get_settings().force_protected_service();
@@ -221,8 +249,7 @@ void HandshakeHandler::ProcessFailedHandshake(BsonObject& params,
force_protected.end(),
context_.service_type_) == force_protected.end();
- LOG4CXX_DEBUG(logger_,
- "Service can be unprotected: " << can_be_unprotected
+ SDL_LOG_DEBUG("Service can be unprotected: " << can_be_unprotected
<< " and this is a new service: "
<< context_.is_new_service_);
@@ -242,10 +269,22 @@ void HandshakeHandler::ProcessFailedHandshake(BsonObject& params,
} else {
service_status_update_handler_.OnServiceUpdate(
this->connection_key(), context_.service_type_, service_status);
- protocol_handler_.SendStartSessionNAck(context_.connection_id_,
- context_.new_session_id_,
- protocol_version_,
- context_.service_type_);
+
+ std::string reason_msg =
+ (service_status == ServiceStatus::PTU_FAILED)
+ ? "Policy Table Update failed"
+ : (service_status == ServiceStatus::CERT_INVALID)
+ ? "Invalid certificate"
+ : (service_status == ServiceStatus::INVALID_TIME)
+ ? "Failed to get system time"
+ : "Unknown cause of failure";
+
+ protocol_handler_.SendStartSessionNAck(
+ context_.connection_id_,
+ context_.new_session_id_,
+ protocol_version_,
+ context_.service_type_,
+ reason_msg + (err_reason.empty() ? "" : ": " + err_reason));
}
}
diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc
index 498618d6de..f0692b3304 100644
--- a/src/components/protocol_handler/src/incoming_data_handler.cc
+++ b/src/components/protocol_handler/src/incoming_data_handler.cc
@@ -35,7 +35,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
IncomingDataHandler::IncomingDataHandler()
: header_(), validator_(NULL), last_portion_of_data_was_malformed_(false) {}
@@ -52,48 +52,43 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData(
const RawMessage& tm_message,
RESULT_CODE& out_result,
size_t* malformed_occurrence) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(malformed_occurrence);
const transport_manager::ConnectionUID connection_id =
tm_message.connection_key();
const uint8_t* data = tm_message.data();
const size_t tm_message_size = tm_message.data_size();
if (tm_message_size == 0 || data == NULL) {
- LOG4CXX_WARN(logger_, "Wrong raw message " << tm_message_size << " bytes");
+ SDL_LOG_WARN("Wrong raw message " << tm_message_size << " bytes");
out_result = RESULT_FAIL;
return ProtocolFramePtrList();
}
- LOG4CXX_INFO(logger_,
- "Processing incoming data of size "
- << tm_message_size << " for connection " << connection_id);
+ SDL_LOG_INFO("Processing incoming data of size "
+ << tm_message_size << " for connection " << connection_id);
ConnectionsDataMap::iterator it = connections_data_.find(connection_id);
if (connections_data_.end() == it) {
- LOG4CXX_WARN(logger_, "ProcessData requested for unknown connection");
+ SDL_LOG_WARN("ProcessData requested for unknown connection");
out_result = RESULT_FAIL;
return ProtocolFramePtrList();
}
std::vector<uint8_t>& connection_data = it->second;
connection_data.insert(connection_data.end(), data, data + tm_message_size);
- LOG4CXX_DEBUG(logger_,
- "Total data size for connection " << connection_id << " is "
+ SDL_LOG_DEBUG("Total data size for connection " << connection_id << " is "
<< connection_data.size());
ProtocolFramePtrList out_frames;
*malformed_occurrence = 0;
out_result = CreateFrame(
connection_data, out_frames, *malformed_occurrence, connection_id);
- LOG4CXX_DEBUG(logger_,
- "New data size for connection " << connection_id << " is "
+ SDL_LOG_DEBUG("New data size for connection " << connection_id << " is "
<< connection_data.size());
if (!out_frames.empty()) {
- LOG4CXX_INFO(logger_,
- "Created and passed " << out_frames.size() << " packets");
+ SDL_LOG_INFO("Created and passed " << out_frames.size() << " packets");
} else {
if (RESULT_DEFERRED == out_result) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"No packets have been created. Waiting next portion of data.");
} else {
- LOG4CXX_WARN(logger_, "No packets have been created.");
+ SDL_LOG_WARN("No packets have been created.");
}
}
if (*malformed_occurrence > 0u || last_portion_of_data_was_malformed_) {
@@ -106,14 +101,14 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData(
void IncomingDataHandler::AddConnection(
const transport_manager::ConnectionUID connection_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Add empty list of session to new connection
connections_data_[connection_id] = ConnectionsDataMap::mapped_type();
}
void IncomingDataHandler::RemoveConnection(
const transport_manager::ConnectionUID connection_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
connections_data_.erase(connection_id);
}
@@ -128,8 +123,7 @@ uint32_t IncomingDataHandler::GetPacketSize(
case PROTOCOL_VERSION_5:
return header.dataSize + PROTOCOL_HEADER_V2_SIZE;
default:
- LOG4CXX_WARN(logger_,
- "Unknown version: " << static_cast<int>(header.version));
+ SDL_LOG_WARN("Unknown version: " << static_cast<int>(header.version));
break;
}
return 0u;
@@ -140,7 +134,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
ProtocolFramePtrList& out_frames,
size_t& malformed_occurrence,
const transport_manager::ConnectionUID connection_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<uint8_t>::iterator data_it = incoming_data.begin();
size_t data_size = incoming_data.size();
@@ -150,51 +144,47 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
validator_ ? validator_->validate(header_) : RESULT_OK;
if (validate_result != RESULT_OK) {
- LOG4CXX_WARN(logger_, "Packet validation failed");
+ SDL_LOG_WARN("Packet validation failed");
if (!last_portion_of_data_was_malformed_) {
++malformed_occurrence;
- LOG4CXX_DEBUG(logger_,
- "Malformed message found " << malformed_occurrence);
+ SDL_LOG_DEBUG("Malformed message found " << malformed_occurrence);
}
last_portion_of_data_was_malformed_ = true;
++data_it;
--data_size;
- LOG4CXX_DEBUG(logger_,
- "Moved to the next byte "
- << std::hex << static_cast<const void*>(&*data_it));
+ SDL_LOG_DEBUG("Moved to the next byte "
+ << std::hex << static_cast<const void*>(&*data_it));
continue;
}
- LOG4CXX_DEBUG(logger_, "Payload size " << header_.dataSize);
+ SDL_LOG_DEBUG("Payload size " << header_.dataSize);
const uint32_t packet_size = GetPacketSize(header_);
if (packet_size <= 0) {
- LOG4CXX_WARN(logger_, "Null packet size");
+ SDL_LOG_WARN("Null packet size");
++data_it;
--data_size;
- LOG4CXX_DEBUG(logger_,
- "Moved to the next byte "
- << std::hex << static_cast<const void*>(&*data_it));
+ SDL_LOG_DEBUG("Moved to the next byte "
+ << std::hex << static_cast<const void*>(&*data_it));
continue;
}
if (data_size < packet_size) {
- LOG4CXX_DEBUG(logger_, "Packet data is not available yet");
+ SDL_LOG_DEBUG("Packet data is not available yet");
incoming_data.erase(incoming_data.begin(), data_it);
return RESULT_DEFERRED;
}
ProtocolFramePtr frame(new protocol_handler::ProtocolPacket(connection_id));
const RESULT_CODE deserialize_result =
frame->deserializePacket(&*data_it, packet_size);
- LOG4CXX_DEBUG(logger_, "Deserialized frame " << frame);
+ SDL_LOG_DEBUG("Deserialized frame " << frame);
if (deserialize_result != RESULT_OK) {
- LOG4CXX_WARN(logger_, "Packet deserialization failed");
+ SDL_LOG_WARN("Packet deserialization failed");
incoming_data.erase(incoming_data.begin(), data_it);
return RESULT_FAIL;
}
out_frames.push_back(frame);
last_portion_of_data_was_malformed_ = false;
- LOG4CXX_DEBUG(logger_,
- "Frame added. "
- << "Connection ID " << connection_id);
+ SDL_LOG_DEBUG("Frame added. "
+ << "Connection ID " << connection_id);
data_it += packet_size;
data_size -= packet_size;
diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc
index fbfc061490..0cffe724c7 100644
--- a/src/components/protocol_handler/src/multiframe_builder.cc
+++ b/src/components/protocol_handler/src/multiframe_builder.cc
@@ -41,7 +41,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
MultiFrameBuilder::MultiFrameBuilder() : consecutive_frame_wait_msecs_(0u) {}
@@ -50,19 +50,19 @@ void MultiFrameBuilder::set_waiting_timeout(
consecutive_frame_wait_msecs_ =
static_cast<int64_t>(consecutive_frame_wait_msecs);
if (consecutive_frame_wait_msecs == 0) {
- LOG4CXX_WARN(logger_, "Waiting timout disabled");
+ SDL_LOG_WARN("Waiting timout disabled");
} else {
- LOG4CXX_DEBUG(logger_,
- "Waiting time in msec: " << consecutive_frame_wait_msecs_);
+ SDL_LOG_DEBUG("Waiting time in msec: " << consecutive_frame_wait_msecs_);
}
}
bool MultiFrameBuilder::AddConnection(const ConnectionID connection_id) {
- LOG4CXX_DEBUG(logger_, "Adding connection_id: " << connection_id);
- LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
+ SDL_LOG_DEBUG("Adding connection_id: " << connection_id);
+ sync_primitives::AutoLock lock(multiframes_map_lock_);
+ SDL_LOG_DEBUG("Current state is: " << multiframes_map_);
const MultiFrameMap::const_iterator it = multiframes_map_.find(connection_id);
if (it != multiframes_map_.end()) {
- LOG4CXX_ERROR(logger_, "Exists connection_id: " << connection_id);
+ SDL_LOG_ERROR("Exists connection_id: " << connection_id);
return false;
}
multiframes_map_[connection_id] = SessionToFrameMap();
@@ -70,18 +70,18 @@ bool MultiFrameBuilder::AddConnection(const ConnectionID connection_id) {
}
bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) {
- LOG4CXX_DEBUG(logger_, "Removing connection_id: " << connection_id);
- LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
+ SDL_LOG_DEBUG("Removing connection_id: " << connection_id);
+ sync_primitives::AutoLock lock(multiframes_map_lock_);
+ SDL_LOG_DEBUG("Current state is: " << multiframes_map_);
const MultiFrameMap::iterator it = multiframes_map_.find(connection_id);
if (it == multiframes_map_.end()) {
- LOG4CXX_ERROR(logger_, "Non-existent connection_id: " << connection_id);
+ SDL_LOG_ERROR("Non-existent connection_id: " << connection_id);
return false;
}
const SessionToFrameMap& session_to_frame_map = it->second;
if (!session_to_frame_map.empty()) {
// FIXME(EZamakhov): Ask ReqManager - do we need to send GenericError
- LOG4CXX_WARN(logger_,
- "For connection_id: " << connection_id
+ SDL_LOG_WARN("For connection_id: " << connection_id
<< " waiting: " << multiframes_map_);
}
multiframes_map_.erase(it);
@@ -89,45 +89,44 @@ bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) {
}
ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
- LOG4CXX_DEBUG(logger_,
- "Current multiframe map size is: " << multiframes_map_.size());
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(multiframes_map_lock_);
+ SDL_LOG_DEBUG("Current state is: " << multiframes_map_);
+ SDL_LOG_DEBUG("Current multiframe map size is: " << multiframes_map_.size());
ProtocolFramePtrList outpute_frame_list;
for (MultiFrameMap::iterator connection_it = multiframes_map_.begin();
connection_it != multiframes_map_.end();
++connection_it) {
- LOG4CXX_TRACE(logger_, "Step over connection: " << connection_it->first);
+ SDL_LOG_TRACE("Step over connection: " << connection_it->first);
SessionToFrameMap& session_map = connection_it->second;
for (SessionToFrameMap::iterator session_it = session_map.begin();
session_it != session_map.end();
++session_it) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
"Step over session: " << static_cast<int>(session_it->first));
MessageIDToFrameMap& messageId_map = session_it->second;
MessageIDToFrameMap::iterator messageId_it = messageId_map.begin();
while (messageId_it != messageId_map.end()) {
- LOG4CXX_TRACE(logger_, "Step over messageId: " << messageId_it->first);
+ SDL_LOG_TRACE("Step over messageId: " << messageId_it->first);
ProtocolFrameData& frame_data = messageId_it->second;
ProtocolFramePtr frame = frame_data.frame;
if (frame && frame->frame_data() == FRAME_DATA_LAST_CONSECUTIVE &&
frame->payload_size() > 0u) {
- LOG4CXX_DEBUG(logger_, "Ready frame: " << frame);
+ SDL_LOG_DEBUG("Ready frame: " << frame);
outpute_frame_list.push_back(frame);
messageId_map.erase(messageId_it++);
continue;
}
if (consecutive_frame_wait_msecs_ != 0) {
- LOG4CXX_TRACE(logger_, "Expiration verification");
+ SDL_LOG_TRACE("Expiration verification");
const int64_t time_left =
date_time::calculateTimeSpan(frame_data.append_time);
- LOG4CXX_DEBUG(logger_, "mSecs left: " << time_left);
+ SDL_LOG_DEBUG("mSecs left: " << time_left);
if (time_left >= consecutive_frame_wait_msecs_) {
- LOG4CXX_WARN(logger_, "Expired frame: " << frame);
+ SDL_LOG_WARN("Expired frame: " << frame);
outpute_frame_list.push_back(frame);
messageId_map.erase(messageId_it++);
continue;
@@ -137,27 +136,26 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() {
} // iteration over messageId_map
} // iteration over session_map
} // iteration over multiframes_map_
- LOG4CXX_DEBUG(logger_, "Result frames count: " << outpute_frame_list.size());
+ SDL_LOG_DEBUG("Result frames count: " << outpute_frame_list.size());
return outpute_frame_list;
}
RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Handling frame: " << packet);
- LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Handling frame: " << packet);
if (!packet) {
- LOG4CXX_ERROR(logger_, "Skip empty frame");
+ SDL_LOG_ERROR("Skip empty frame");
return RESULT_FAIL;
}
switch (packet->frame_type()) {
case FRAME_TYPE_FIRST:
- LOG4CXX_TRACE(logger_, "FRAME_TYPE_FIRST");
+ SDL_LOG_TRACE("FRAME_TYPE_FIRST");
return HandleFirstFrame(packet);
case FRAME_TYPE_CONSECUTIVE:
- LOG4CXX_TRACE(logger_, "FRAME_TYPE_CONSECUTIVE");
+ SDL_LOG_TRACE("FRAME_TYPE_CONSECUTIVE");
return HandleConsecutiveFrame(packet);
default:
- LOG4CXX_ERROR(logger_, "Frame is not FIRST or CONSECUTIVE :" << packet);
+ SDL_LOG_ERROR("Frame is not FIRST or CONSECUTIVE :" << packet);
break;
}
return RESULT_FAIL;
@@ -165,17 +163,18 @@ RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) {
RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) {
DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_FIRST, RESULT_FAIL);
- LOG4CXX_DEBUG(logger_, "Waiting : " << multiframes_map_);
- LOG4CXX_DEBUG(logger_, "Handling FIRST frame: " << packet);
+ sync_primitives::AutoLock lock(multiframes_map_lock_);
+ SDL_LOG_DEBUG("Waiting : " << multiframes_map_);
+ SDL_LOG_DEBUG("Handling FIRST frame: " << packet);
if (packet->payload_size() != 0u) {
- LOG4CXX_ERROR(logger_, "First frame shall have no data:" << packet);
+ SDL_LOG_ERROR("First frame shall have no data:" << packet);
return RESULT_FAIL;
}
const ConnectionID connection_id = packet->connection_id();
MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id);
if (connection_it == multiframes_map_.end()) {
- LOG4CXX_ERROR(logger_, "Unknown connection_id: " << connection_id);
+ SDL_LOG_ERROR("Unknown connection_id: " << connection_id);
return RESULT_FAIL;
}
SessionToFrameMap& session_map = connection_it->second;
@@ -187,19 +186,17 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) {
const MessageID message_id = packet->message_id();
MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id);
if (messageId_it != messageId_map.end()) {
- LOG4CXX_ERROR(logger_,
- "Already waiting message for connection_id: "
- << connection_id
- << ", session_id: " << static_cast<int>(session_id)
- << ", message_id: " << message_id);
+ SDL_LOG_ERROR("Already waiting message for connection_id: "
+ << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id);
return RESULT_FAIL;
}
- LOG4CXX_DEBUG(logger_,
- "Start waiting frames for connection_id: "
- << connection_id
- << ", session_id: " << static_cast<int>(session_id)
- << ", message_id: " << message_id);
+ SDL_LOG_DEBUG("Start waiting frames for connection_id: "
+ << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id);
messageId_map[message_id] = {packet, date_time::getCurrentTime()};
return RESULT_OK;
}
@@ -207,12 +204,13 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) {
RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
const ProtocolFramePtr packet) {
DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_CONSECUTIVE, RESULT_FAIL);
- LOG4CXX_DEBUG(logger_, "Handling CONSECUTIVE frame: " << packet);
+ sync_primitives::AutoLock lock(multiframes_map_lock_);
+ SDL_LOG_DEBUG("Handling CONSECUTIVE frame: " << packet);
const ConnectionID connection_id = packet->connection_id();
MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id);
if (connection_it == multiframes_map_.end()) {
- LOG4CXX_ERROR(logger_, "Unknown connection_id: " << connection_id);
+ SDL_LOG_ERROR("Unknown connection_id: " << connection_id);
return RESULT_FAIL;
}
SessionToFrameMap& session_map = connection_it->second;
@@ -224,11 +222,10 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
const MessageID message_id = packet->message_id();
MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id);
if (messageId_it == messageId_map.end()) {
- LOG4CXX_ERROR(logger_,
- "No waiting message for connection_id: "
- << connection_id
- << ", session_id: " << static_cast<int>(session_id)
- << ", message_id: " << message_id);
+ SDL_LOG_ERROR("No waiting message for connection_id: "
+ << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id);
return RESULT_FAIL;
}
@@ -243,7 +240,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
if (is_last_consecutive) {
// TODO(EZamakhov): implement count of frames and result size verification
- LOG4CXX_DEBUG(logger_, "Last CONSECUTIVE frame");
+ SDL_LOG_DEBUG("Last CONSECUTIVE frame");
} else {
uint8_t previous_frame_data = assembling_frame->frame_data();
if (previous_frame_data == std::numeric_limits<uint8_t>::max()) {
@@ -251,12 +248,10 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
}
// The next frame data is bigger at 1
if (new_frame_data != (previous_frame_data + 1)) {
- LOG4CXX_ERROR(logger_,
- "Unexpected CONSECUTIVE frame for connection_id: "
- << connection_id
- << ", session_id: " << static_cast<int>(session_id)
- << ", message_id: " << message_id
- << ", frame: " << packet);
+ SDL_LOG_ERROR("Unexpected CONSECUTIVE frame for connection_id: "
+ << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id << ", frame: " << packet);
return RESULT_FAIL;
}
}
@@ -268,8 +263,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
assembling_frame->set_frame_data(new_frame_data);
- LOG4CXX_DEBUG(logger_,
- "Appending " << packet->data_size() << " bytes "
+ SDL_LOG_DEBUG("Appending " << packet->data_size() << " bytes "
<< "; frame_data "
<< static_cast<int>(new_frame_data)
<< "; for connection_id: " << connection_id
@@ -278,12 +272,11 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
if (assembling_frame->appendData(packet->data(), packet->data_size()) !=
RESULT_OK) {
- LOG4CXX_ERROR(logger_, "Failed to append frame for multiframe message.");
+ SDL_LOG_ERROR("Failed to append frame for multiframe message.");
return RESULT_FAIL;
}
- LOG4CXX_INFO(logger_,
- "Assembled frame with payload size: "
- << assembling_frame->payload_size());
+ SDL_LOG_INFO("Assembled frame with payload size: "
+ << assembling_frame->payload_size());
frame_data.append_time = date_time::getCurrentTime();
return RESULT_OK;
}
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 7769696a76..f1179e7107 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -50,7 +50,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
/**
* Function return packet data as std::string.
@@ -61,9 +61,10 @@ std::string ConvertPacketDataToString(const uint8_t* data,
const size_t kStackSize = 131072;
-utils::SemanticVersion default_protocol_version(5, 2, 0);
-utils::SemanticVersion min_multiple_transports_version(5, 1, 0);
-utils::SemanticVersion min_cloud_app_version(5, 2, 0);
+const utils::SemanticVersion default_protocol_version(5, 3, 0);
+const utils::SemanticVersion min_multiple_transports_version(5, 1, 0);
+const utils::SemanticVersion min_cloud_app_version(5, 2, 0);
+const utils::SemanticVersion min_reason_param_version(5, 3, 0);
ProtocolHandlerImpl::ProtocolHandlerImpl(
const ProtocolHandlerSettings& settings,
@@ -93,7 +94,7 @@ ProtocolHandlerImpl::ProtocolHandlerImpl(
#endif // TELEMETRY_MONITOR
{
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
protocol_header_validator_.set_max_payload_size(
get_settings().maximum_payload_size());
protocol_header_validator_.set_max_control_payload_size(
@@ -115,12 +116,11 @@ ProtocolHandlerImpl::ProtocolHandlerImpl(
if (message_frequency_time > 0u && message_frequency_count > 0u) {
message_meter_.set_time_range(message_frequency_time);
- LOG4CXX_DEBUG(logger_,
- "Frequency meter is enabled ( "
- << message_frequency_count << " per "
- << message_frequency_time << " mSecond)");
+ SDL_LOG_DEBUG("Frequency meter is enabled ( "
+ << message_frequency_count << " per "
+ << message_frequency_time << " mSecond)");
} else {
- LOG4CXX_WARN(logger_, "Frequency meter is disabled");
+ SDL_LOG_WARN("Frequency meter is disabled");
}
const size_t& malformed_frequency_time =
@@ -131,18 +131,17 @@ ProtocolHandlerImpl::ProtocolHandlerImpl(
if (get_settings().malformed_message_filtering()) {
if (malformed_frequency_time > 0u && malformed_frequency_count > 0u) {
malformed_message_meter_.set_time_range(malformed_frequency_time);
- LOG4CXX_DEBUG(logger_,
- "Malformed frequency meter is enabled ( "
- << malformed_frequency_count << " per "
- << malformed_frequency_time << " mSecond)");
+ SDL_LOG_DEBUG("Malformed frequency meter is enabled ( "
+ << malformed_frequency_count << " per "
+ << malformed_frequency_time << " mSecond)");
} else {
- LOG4CXX_WARN(logger_, "Malformed frequency meter is disabled");
+ SDL_LOG_WARN("Malformed frequency meter is disabled");
}
} else {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Malformed message filtering is disabled."
- << "Connection will be close on first malformed message detection");
+ << "Connection will be close on first malformed message detection");
}
multiframe_builder_.set_waiting_timeout(
get_settings().multiframe_waiting_timeout());
@@ -151,15 +150,15 @@ ProtocolHandlerImpl::ProtocolHandlerImpl(
ProtocolHandlerImpl::~ProtocolHandlerImpl() {
sync_primitives::AutoLock lock(protocol_observers_lock_);
if (!protocol_observers_.empty()) {
- LOG4CXX_WARN(logger_,
- "Not all observers have unsubscribed"
- " from ProtocolHandlerImpl");
+ SDL_LOG_WARN(
+ "Not all observers have unsubscribed"
+ " from ProtocolHandlerImpl");
}
}
void ProtocolHandlerImpl::AddProtocolObserver(ProtocolObserver* observer) {
if (!observer) {
- LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to IProtocolObserver.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to IProtocolObserver.");
return;
}
sync_primitives::AutoLock lock(protocol_observers_lock_);
@@ -167,9 +166,9 @@ void ProtocolHandlerImpl::AddProtocolObserver(ProtocolObserver* observer) {
}
void ProtocolHandlerImpl::RemoveProtocolObserver(ProtocolObserver* observer) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!observer) {
- LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to IProtocolObserver.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to IProtocolObserver.");
return;
}
sync_primitives::AutoLock lock(protocol_observers_lock_);
@@ -181,12 +180,10 @@ void set_hash_id(uint32_t hash_id, protocol_handler::ProtocolPacket& packet) {
return;
}
if (packet.protocol_version() < PROTOCOL_VERSION_2) {
- LOG4CXX_DEBUG(logger_,
- "Packet needs no hash data (protocol version less 2)");
+ SDL_LOG_DEBUG("Packet needs no hash data (protocol version less 2)");
return;
}
- LOG4CXX_DEBUG(logger_,
- "Set hash_id 0x" << std::hex << hash_id << " to the packet 0x"
+ SDL_LOG_DEBUG("Set hash_id 0x" << std::hex << hash_id << " to the packet 0x"
<< &packet);
// Hash id shall be 4 bytes according Ford Protocol v8
DCHECK(sizeof(hash_id) == 4);
@@ -201,7 +198,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id,
uint32_t hash_id,
uint8_t service_type,
bool protection) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
utils::SemanticVersion fullVersion;
SendStartSessionAck(connection_id,
session_id,
@@ -220,7 +217,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
uint8_t service_type,
bool protection,
utils::SemanticVersion& full_version) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
BsonObject empty_param;
bson_object_initialize_default(&empty_param);
@@ -246,7 +243,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
bool protection,
utils::SemanticVersion& full_version,
BsonObject& params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool send_transport_update_event = false;
@@ -294,53 +291,51 @@ void ProtocolHandlerImpl::SendStartSessionAck(
protocol_header_validator_.max_payload_size_by_service_type(
serviceTypeValue)));
UNUSED(mtu_written)
- LOG4CXX_DEBUG(logger_,
- "MTU parameter was written to bson params: "
- << mtu_written << "; Value: "
- << static_cast<int32_t>(
- bson_object_get_int64(&params, strings::mtu)));
+ SDL_LOG_DEBUG(
+ "MTU parameter was written to bson params: "
+ << mtu_written << "; Value: "
+ << static_cast<int32_t>(bson_object_get_int64(&params, strings::mtu)));
if (serviceTypeValue == kRpc) {
// Hash ID is only used in RPC case
const bool hash_written = bson_object_put_int32(
&params, strings::hash_id, static_cast<int32_t>(hash_id));
UNUSED(hash_written);
- LOG4CXX_DEBUG(logger_,
- "Hash parameter was written to bson params: "
- << hash_written << "; Value: "
- << static_cast<int32_t>(bson_object_get_int32(
- &params, strings::hash_id)));
+ SDL_LOG_DEBUG("Hash parameter was written to bson params: "
+ << hash_written << "; Value: "
+ << static_cast<int32_t>(
+ bson_object_get_int32(&params, strings::hash_id)));
// Minimum protocol version supported by both
- utils::SemanticVersion* min_version =
+ const utils::SemanticVersion& min_version =
(full_version.major_version_ < PROTOCOL_VERSION_5)
- ? &default_protocol_version
- : utils::SemanticVersion::min(full_version,
- default_protocol_version);
+ ? default_protocol_version
+ : ((full_version < default_protocol_version)
+ ? full_version
+ : default_protocol_version);
char protocol_version_string[256];
- strncpy(protocol_version_string, (*min_version).toString().c_str(), 255);
+ strncpy(protocol_version_string, (min_version).toString().c_str(), 255);
const bool protocol_ver_written = bson_object_put_string(
&params, strings::protocol_version, protocol_version_string);
UNUSED(protocol_ver_written);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Protocol version parameter was written to bson params: "
- << protocol_ver_written << "; Value: "
- << bson_object_get_string(&params, strings::protocol_version));
+ << protocol_ver_written << "; Value: "
+ << bson_object_get_string(&params, strings::protocol_version));
- LOG4CXX_INFO(logger_,
- "Protocol Version String " << protocol_version_string);
+ SDL_LOG_INFO("Protocol Version String " << protocol_version_string);
std::vector<std::string> secondaryTransports;
std::vector<int32_t> audioServiceTransports;
std::vector<int32_t> videoServiceTransports;
- if (*min_version >= min_multiple_transports_version) {
+ if (min_version >= min_multiple_transports_version) {
if (ParseSecondaryTransportConfiguration(connection_id,
secondaryTransports,
audioServiceTransports,
videoServiceTransports)) {
- LOG4CXX_DEBUG(logger_, "Multiple transports are enabled.");
+ SDL_LOG_DEBUG("Multiple transports are enabled.");
BsonArray secondaryTransportsArr;
bson_array_initialize(&secondaryTransportsArr,
secondaryTransports.size());
@@ -350,11 +345,11 @@ void ProtocolHandlerImpl::SendStartSessionAck(
secondaryTransports[i].c_str(),
sizeof(secondaryTransport));
secondaryTransport[sizeof(secondaryTransport) - 1] = '\0';
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Adding "
- << secondaryTransport
- << " to secondaryTransports parameter of StartSessionAck");
+ << secondaryTransport
+ << " to secondaryTransports parameter of StartSessionAck");
bson_array_add_string(&secondaryTransportsArr, secondaryTransport);
}
bson_object_put_array(
@@ -364,8 +359,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
bson_array_initialize(&audioServiceTransportsArr,
audioServiceTransports.size());
for (unsigned int i = 0; i < audioServiceTransports.size(); i++) {
- LOG4CXX_DEBUG(logger_,
- "Adding " << audioServiceTransports[i]
+ SDL_LOG_DEBUG("Adding " << audioServiceTransports[i]
<< " to audioServiceTransports parameter "
"of StartSessionAck");
bson_array_add_int32(&audioServiceTransportsArr,
@@ -379,8 +373,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
bson_array_initialize(&videoServiceTransportsArr,
videoServiceTransports.size());
for (unsigned int i = 0; i < videoServiceTransports.size(); i++) {
- LOG4CXX_DEBUG(logger_,
- "Adding " << videoServiceTransports[i]
+ SDL_LOG_DEBUG("Adding " << videoServiceTransports[i]
<< " to videoServiceTransports parameter "
"of StartSessionAck");
bson_array_add_int32(&videoServiceTransportsArr,
@@ -393,8 +386,8 @@ void ProtocolHandlerImpl::SendStartSessionAck(
if (settings_.multiple_transports_enabled()) {
send_transport_update_event = true;
} else {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Multiple transports feature is disabled by configuration");
// In this case, we must remember that this session will never have
// a secondary transport.
@@ -402,21 +395,21 @@ void ProtocolHandlerImpl::SendStartSessionAck(
kDisabledSecondary);
}
} else {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Failed to set up secondary transport and service type params");
connection_handler_.SetSecondaryTransportID(session_id,
kDisabledSecondary);
}
} else {
- LOG4CXX_INFO(logger_, "Older protocol version. No multiple transports");
+ SDL_LOG_INFO("Older protocol version. No multiple transports");
connection_handler_.SetSecondaryTransportID(session_id,
kDisabledSecondary);
}
std::string policy_app_id =
connection_handler_.GetCloudAppID(connection_id);
- if (*min_version >= min_cloud_app_version && !policy_app_id.empty()) {
+ if (min_version >= min_cloud_app_version && !policy_app_id.empty()) {
sync_primitives::AutoLock lock(auth_token_map_lock_);
auto it = auth_token_map_.find(policy_app_id);
if (it != auth_token_map_.end()) {
@@ -437,20 +430,19 @@ void ProtocolHandlerImpl::SendStartSessionAck(
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_,
- "SendStartSessionAck() for connection "
- << connection_id << " for service_type "
- << static_cast<int32_t>(service_type) << " session_id "
- << static_cast<int32_t>(session_id) << " protection "
- << (protection ? "ON" : "OFF"));
+ SDL_LOG_DEBUG("SendStartSessionAck() for connection "
+ << connection_id << " for service_type "
+ << static_cast<int32_t>(service_type) << " session_id "
+ << static_cast<int32_t>(session_id) << " protection "
+ << (protection ? "ON" : "OFF"));
if (send_transport_update_event) {
// Wait until the StartService ACK has been processed for sending.
// The TransportUpdateEvent has a higher priority, being that it's
// a SERVICE_TYPE_CONTROL message. (The ACK is SERVICE_TYPE_RPC.)
- LOG4CXX_DEBUG(logger_, "Waiting for the MessageToMobile queue to be empty");
+ SDL_LOG_DEBUG("Waiting for the MessageToMobile queue to be empty");
raw_ford_messages_to_mobile_.WaitDumpQueue();
- LOG4CXX_DEBUG(logger_, "Sending the TransportUpdate event");
+ SDL_LOG_DEBUG("Sending the TransportUpdate event");
SendTransportUpdateEvent(connection_id, session_id);
}
}
@@ -458,13 +450,15 @@ void ProtocolHandlerImpl::SendStartSessionAck(
void ProtocolHandlerImpl::SendStartSessionNAck(ConnectionID connection_id,
uint8_t session_id,
uint8_t protocol_version,
- uint8_t service_type) {
+ uint8_t service_type,
+ const std::string reason) {
std::vector<std::string> rejectedParams;
SendStartSessionNAck(connection_id,
session_id,
protocol_version,
service_type,
- rejectedParams);
+ rejectedParams,
+ reason);
}
void ProtocolHandlerImpl::SendStartSessionNAck(
@@ -472,8 +466,9 @@ void ProtocolHandlerImpl::SendStartSessionNAck(
uint8_t session_id,
uint8_t protocol_version,
uint8_t service_type,
- std::vector<std::string>& rejectedParams) {
- LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<std::string>& rejectedParams,
+ const std::string reason) {
+ SDL_LOG_AUTO_TRACE();
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
@@ -488,20 +483,34 @@ void ProtocolHandlerImpl::SendStartSessionNAck(
uint8_t maxProtocolVersion = SupportedSDLProtocolVersion();
+ utils::SemanticVersion full_version;
+ if (!session_observer_.ProtocolVersionUsed(
+ connection_id, session_id, full_version)) {
+ SDL_LOG_WARN("Connection: " << connection_id << " and/or session: "
+ << session_id << "no longer exist(s).");
+ return;
+ }
+
if (protocol_version >= PROTOCOL_VERSION_5 &&
- maxProtocolVersion >= PROTOCOL_VERSION_5 && rejectedParams.size() > 0) {
+ maxProtocolVersion >= PROTOCOL_VERSION_5) {
BsonObject payloadObj;
bson_object_initialize_default(&payloadObj);
- BsonArray rejectedParamsArr;
- bson_array_initialize(&rejectedParamsArr, rejectedParams.size());
- for (std::string param : rejectedParams) {
- char paramPtr[256];
- strncpy(paramPtr, param.c_str(), sizeof(paramPtr));
- paramPtr[sizeof(paramPtr) - 1] = '\0';
- bson_array_add_string(&rejectedParamsArr, paramPtr);
+ if (rejectedParams.size() > 0) {
+ BsonArray rejectedParamsArr;
+ bson_array_initialize(&rejectedParamsArr, rejectedParams.size());
+ for (std::string param : rejectedParams) {
+ char paramPtr[256];
+ strncpy(paramPtr, param.c_str(), sizeof(paramPtr));
+ paramPtr[sizeof(paramPtr) - 1] = '\0';
+ bson_array_add_string(&rejectedParamsArr, paramPtr);
+ }
+ bson_object_put_array(
+ &payloadObj, strings::rejected_params, &rejectedParamsArr);
+ }
+ if (!reason.empty() && full_version >= min_reason_param_version) {
+ bson_object_put_string(
+ &payloadObj, strings::reason, const_cast<char*>(reason.c_str()));
}
- bson_object_put_array(
- &payloadObj, strings::rejected_params, &rejectedParamsArr);
uint8_t* payloadBytes = bson_object_to_bytes(&payloadObj);
ptr->set_data(payloadBytes, bson_object_size(&payloadObj));
free(payloadBytes);
@@ -511,23 +520,25 @@ void ProtocolHandlerImpl::SendStartSessionNAck(
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_,
- "SendStartSessionNAck() for connection "
- << connection_id << " for service_type "
- << static_cast<int32_t>(service_type) << " session_id "
- << static_cast<int32_t>(session_id));
+ SDL_LOG_DEBUG("SendStartSessionNAck() for connection "
+ << connection_id << " for service_type "
+ << static_cast<int32_t>(service_type) << " session_id "
+ << static_cast<int32_t>(session_id)
+ << (reason.empty() ? "" : " reason \"" + reason + "\""));
}
void ProtocolHandlerImpl::SendEndSessionNAck(ConnectionID connection_id,
uint32_t session_id,
uint8_t protocol_version,
- uint8_t service_type) {
+ uint8_t service_type,
+ const std::string reason) {
std::vector<std::string> rejectedParams;
SendEndSessionNAck(connection_id,
session_id,
protocol_version,
service_type,
- rejectedParams);
+ rejectedParams,
+ reason);
}
void ProtocolHandlerImpl::SendEndSessionNAck(
@@ -535,8 +546,9 @@ void ProtocolHandlerImpl::SendEndSessionNAck(
uint32_t session_id,
uint8_t protocol_version,
uint8_t service_type,
- std::vector<std::string>& rejectedParams) {
- LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<std::string>& rejectedParams,
+ const std::string reason) {
+ SDL_LOG_AUTO_TRACE();
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
@@ -551,20 +563,35 @@ void ProtocolHandlerImpl::SendEndSessionNAck(
uint8_t maxProtocolVersion = SupportedSDLProtocolVersion();
+ utils::SemanticVersion full_version;
+ if (!session_observer_.ProtocolVersionUsed(
+ connection_id, session_id, full_version)) {
+ SDL_LOG_WARN("Connection: " << connection_id << " and/or session: "
+ << session_id << "no longer exist(s).");
+ return;
+ }
+
if (protocol_version >= PROTOCOL_VERSION_5 &&
- maxProtocolVersion >= PROTOCOL_VERSION_5 && rejectedParams.size() > 0) {
+ maxProtocolVersion >= PROTOCOL_VERSION_5) {
BsonObject payloadObj;
bson_object_initialize_default(&payloadObj);
- BsonArray rejectedParamsArr;
- bson_array_initialize(&rejectedParamsArr, rejectedParams.size());
- for (std::string param : rejectedParams) {
- char paramPtr[256];
- strncpy(paramPtr, param.c_str(), sizeof(paramPtr));
- paramPtr[sizeof(paramPtr) - 1] = '\0';
- bson_array_add_string(&rejectedParamsArr, paramPtr);
+
+ if (rejectedParams.size() > 0) {
+ BsonArray rejectedParamsArr;
+ bson_array_initialize(&rejectedParamsArr, rejectedParams.size());
+ for (std::string param : rejectedParams) {
+ char paramPtr[256];
+ strncpy(paramPtr, param.c_str(), sizeof(paramPtr));
+ paramPtr[sizeof(paramPtr) - 1] = '\0';
+ bson_array_add_string(&rejectedParamsArr, paramPtr);
+ }
+ bson_object_put_array(
+ &payloadObj, strings::rejected_params, &rejectedParamsArr);
+ }
+ if (!reason.empty() && full_version >= min_reason_param_version) {
+ bson_object_put_string(
+ &payloadObj, strings::reason, const_cast<char*>(reason.c_str()));
}
- bson_object_put_array(
- &payloadObj, strings::rejected_params, &rejectedParamsArr);
uint8_t* payloadBytes = bson_object_to_bytes(&payloadObj);
ptr->set_data(payloadBytes, bson_object_size(&payloadObj));
free(payloadBytes);
@@ -574,11 +601,11 @@ void ProtocolHandlerImpl::SendEndSessionNAck(
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_,
- "SendEndSessionNAck() for connection "
- << connection_id << " for service_type "
- << static_cast<int32_t>(service_type) << " session_id "
- << static_cast<int32_t>(session_id));
+ SDL_LOG_DEBUG("SendEndSessionNAck() for connection "
+ << connection_id << " for service_type "
+ << static_cast<int32_t>(service_type) << " session_id "
+ << static_cast<int32_t>(session_id)
+ << (reason.empty() ? "" : " reason \"" + reason + "\""));
}
SessionObserver& ProtocolHandlerImpl::get_session_observer() {
@@ -589,7 +616,7 @@ void ProtocolHandlerImpl::SendEndSessionAck(ConnectionID connection_id,
uint8_t session_id,
uint8_t protocol_version,
uint8_t service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
@@ -605,25 +632,23 @@ void ProtocolHandlerImpl::SendEndSessionAck(ConnectionID connection_id,
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_,
- "SendEndSessionAck() for connection "
- << connection_id << " for service_type "
- << static_cast<int32_t>(service_type) << " session_id "
- << static_cast<int32_t>(session_id));
+ SDL_LOG_DEBUG("SendEndSessionAck() for connection "
+ << connection_id << " for service_type "
+ << static_cast<int32_t>(service_type) << " session_id "
+ << static_cast<int32_t>(session_id));
}
void ProtocolHandlerImpl::SendEndServicePrivate(int32_t primary_connection_id,
int32_t connection_id,
uint8_t session_id,
uint8_t service_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
primary_connection_id, session_id, protocol_version)) {
- LOG4CXX_TRACE(logger_,
- "SendEndServicePrivate using protocol version "
- << static_cast<int32_t>(protocol_version));
+ SDL_LOG_TRACE("SendEndServicePrivate using protocol version "
+ << static_cast<int32_t>(protocol_version));
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
protocol_version,
@@ -637,21 +662,21 @@ void ProtocolHandlerImpl::SendEndServicePrivate(int32_t primary_connection_id,
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_,
- "SendEndServicePrivate() for connection "
- << connection_id << " for service_type "
- << static_cast<int>(service_type)
- << " primary connection " << primary_connection_id
- << " session_id " << static_cast<int32_t>(session_id));
+ SDL_LOG_DEBUG("SendEndServicePrivate() for connection "
+ << connection_id << " for service_type "
+ << static_cast<int>(service_type) << " primary connection "
+ << primary_connection_id << " session_id "
+ << static_cast<int32_t>(session_id));
} else {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"SendEndServicePrivate is failed connection or session does not exist");
}
}
void ProtocolHandlerImpl::SendEndSession(int32_t connection_id,
uint8_t session_id) {
+ SDL_LOG_AUTO_TRACE();
// A session is always associated with a primary connection ID
SendEndServicePrivate(
connection_id, connection_id, session_id, SERVICE_TYPE_RPC);
@@ -661,6 +686,7 @@ void ProtocolHandlerImpl::SendEndService(int32_t primary_connection_id,
int32_t connection_id,
uint8_t session_id,
uint8_t service_type) {
+ SDL_LOG_AUTO_TRACE();
SendEndServicePrivate(
primary_connection_id, connection_id, session_id, service_type);
}
@@ -668,7 +694,7 @@ void ProtocolHandlerImpl::SendEndService(int32_t primary_connection_id,
RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id,
uint8_t session_id,
uint32_t message_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
@@ -688,15 +714,14 @@ RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id,
impl::RawFordMessageToMobile(ptr, false));
return RESULT_OK;
}
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"SendHeartBeatAck is failed connection or session does not exist");
return RESULT_FAIL;
}
void ProtocolHandlerImpl::SendTransportUpdateEvent(ConnectionID connection_id,
uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
@@ -729,9 +754,8 @@ void ProtocolHandlerImpl::SendTransportUpdateEvent(ConnectionID connection_id,
&payload_obj, strings::tcp_ip_address, tcp_ip_address);
// omit TCP port number
}
- LOG4CXX_INFO(logger_,
- "SendTransportUpdateEvent IP address: "
- << tcp_ip_address << " Port: " << tcp_port);
+ SDL_LOG_INFO("SendTransportUpdateEvent IP address: "
+ << tcp_ip_address << " Port: " << tcp_port);
uint8_t* payloadBytes = bson_object_to_bytes(&payload_obj);
ptr->set_data(payloadBytes, bson_object_size(&payload_obj));
@@ -741,14 +765,13 @@ void ProtocolHandlerImpl::SendTransportUpdateEvent(ConnectionID connection_id,
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_,
- "SendTransportUpdateEvent() for connection "
- << connection_id << " for session "
- << static_cast<int32_t>(session_id));
+ SDL_LOG_DEBUG("SendTransportUpdateEvent() for connection "
+ << connection_id << " for session "
+ << static_cast<int32_t>(session_id));
} else {
- LOG4CXX_WARN(logger_,
- "SendTransportUpdateEvent is failed connection or session "
- "does not exist");
+ SDL_LOG_WARN(
+ "SendTransportUpdateEvent is failed connection or session "
+ "does not exist");
}
}
@@ -756,7 +779,7 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportAck(
ConnectionID connection_id,
ConnectionID primary_transport_connection_id,
uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// acquire the protocol version from primary transport
uint8_t protocol_version;
@@ -777,9 +800,9 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportAck(
impl::RawFordMessageToMobile(ptr, false));
return RESULT_OK;
}
- LOG4CXX_WARN(logger_,
- "RegisterSecondaryTransportAck is failed connection or session "
- "does not exist");
+ SDL_LOG_WARN(
+ "RegisterSecondaryTransportAck is failed connection or session "
+ "does not exist");
return RESULT_FAIL;
}
@@ -788,7 +811,7 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportNAck(
ConnectionID primary_transport_connection_id,
uint8_t session_id,
BsonObject* reason) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// If mobile sends an invalid session ID and we cannot find out the Connection
// ID of primary transport, then we use version 5. (The multiple-transports
@@ -798,9 +821,9 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportNAck(
// acquire the protocol version from primary transport
if (!session_observer_.ProtocolVersionUsed(
primary_transport_connection_id, session_id, protocol_version)) {
- LOG4CXX_WARN(logger_,
- "Failed to acquire protocol version for "
- "RegisterSecondaryTransportNAck");
+ SDL_LOG_WARN(
+ "Failed to acquire protocol version for "
+ "RegisterSecondaryTransportNAck");
return RESULT_FAIL;
}
}
@@ -829,7 +852,7 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportNAck(
void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id,
uint8_t session_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
connection_id, session_id, protocol_version)) {
@@ -845,10 +868,9 @@ void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id,
message_counters_[session_id]++));
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_, "SendHeartBeat finished successfully");
+ SDL_LOG_DEBUG("SendHeartBeat finished successfully");
} else {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"SendHeartBeat is failed connection or session does not exist");
}
}
@@ -859,10 +881,9 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
#ifdef TELEMETRY_MONITOR
const date_time::TimeDuration start_time = date_time::getCurrentTime();
#endif // TELEMETRY_MONITOR
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!message) {
- LOG4CXX_ERROR(logger_,
- "Invalid message for sending to mobile app is received.");
+ SDL_LOG_ERROR("Invalid message for sending to mobile app is received.");
return;
}
@@ -904,15 +925,13 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
DCHECK(max_block_size > 0);
if (max_block_size > 0) {
frame_size = max_block_size;
- LOG4CXX_DEBUG(logger_,
- "Security set new optimal packet size " << frame_size);
+ SDL_LOG_DEBUG("Security set new optimal packet size " << frame_size);
} else {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Security could not return max block size, use the origin one");
}
}
- LOG4CXX_DEBUG(logger_, "Optimal packet size is " << frame_size);
+ SDL_LOG_DEBUG("Optimal packet size is " << frame_size);
#endif // ENABLE_SECURITY
if (message->data_size() <= frame_size) {
@@ -925,13 +944,11 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
needs_encryption,
final_message);
if (result != RESULT_OK) {
- LOG4CXX_ERROR(logger_,
- "ProtocolHandler failed to send single frame message.");
+ SDL_LOG_ERROR("ProtocolHandler failed to send single frame message.");
}
} else {
- LOG4CXX_DEBUG(logger_,
- "Message will be sent in multiple frames; max frame size is "
- << frame_size);
+ SDL_LOG_DEBUG("Message will be sent in multiple frames; max frame size is "
+ << frame_size);
RESULT_CODE result = SendMultiFrameMessage(connection_handle,
sessionID,
@@ -943,8 +960,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
needs_encryption,
final_message);
if (result != RESULT_OK) {
- LOG4CXX_ERROR(logger_,
- "ProtocolHandler failed to send multiframe messages.");
+ SDL_LOG_ERROR("ProtocolHandler failed to send multiframe messages.");
}
}
#ifdef TELEMETRY_MONITOR
@@ -959,34 +975,31 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
}
void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!tm_message) {
- LOG4CXX_ERROR(logger_,
- "Invalid incoming message received in"
- << " ProtocolHandler from Transport Manager.");
+ SDL_LOG_ERROR("Invalid incoming message received in"
+ << " ProtocolHandler from Transport Manager.");
return;
}
const uint32_t connection_key = tm_message->connection_key();
- LOG4CXX_DEBUG(logger_,
- "Received data from TM with connection id "
- << connection_key << " msg data_size "
- << tm_message->data_size());
+ SDL_LOG_DEBUG("Received data from TM with connection id "
+ << connection_key << " msg data_size "
+ << tm_message->data_size());
RESULT_CODE result;
size_t malformed_occurs = 0u;
const ProtocolFramePtrList protocol_frames =
incoming_data_handler_.ProcessData(
*tm_message, result, &malformed_occurs);
- LOG4CXX_DEBUG(logger_, "Processed " << protocol_frames.size() << " frames");
+ SDL_LOG_DEBUG("Processed " << protocol_frames.size() << " frames");
if (result != RESULT_OK) {
if (result == RESULT_MALFORMED_OCCURS) {
- LOG4CXX_WARN(
- logger_,
- "Malformed message occurs, connection id " << connection_key);
+ SDL_LOG_WARN("Malformed message occurs, connection id "
+ << connection_key);
if (!get_settings().malformed_message_filtering()) {
- LOG4CXX_DEBUG(logger_, "Malformed message filtering disabled");
+ SDL_LOG_DEBUG("Malformed message filtering disabled");
session_observer_.OnMalformedMessageCallback(connection_key);
// For tracking only malformed occurrence check output
} else {
@@ -995,7 +1008,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
}
}
} else {
- LOG4CXX_ERROR(logger_, "Incoming data processing failed.");
+ SDL_LOG_ERROR("Incoming data processing failed.");
transport_manager_.DisconnectForce(connection_key);
}
}
@@ -1010,7 +1023,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
#ifdef ENABLE_SECURITY
const RESULT_CODE result = DecryptFrame(frame);
if (result != RESULT_OK) {
- LOG4CXX_WARN(logger_, "Error frame decryption. Frame skipped.");
+ SDL_LOG_WARN("Error frame decryption. Frame skipped.");
continue;
}
#endif // ENABLE_SECURITY
@@ -1028,15 +1041,14 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
void ProtocolHandlerImpl::OnTMMessageReceiveFailed(
const transport_manager::DataReceiveError& error) {
// TODO(PV): implement
- LOG4CXX_ERROR(logger_, "Received error on attemping to recieve message.");
+ SDL_LOG_ERROR("Received error on attemping to recieve message.");
}
void ProtocolHandlerImpl::NotifySubscribers(const RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(protocol_observers_lock_);
if (protocol_observers_.empty()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Cannot handle multiframe message: no IProtocolObserver is set.");
}
for (ProtocolObservers::iterator it = protocol_observers_.begin();
@@ -1048,7 +1060,7 @@ void ProtocolHandlerImpl::NotifySubscribers(const RawMessagePtr message) {
}
void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) {
- LOG4CXX_DEBUG(logger_, "Sending message finished successfully.");
+ SDL_LOG_DEBUG("Sending message finished successfully.");
uint32_t connection_handle = 0;
uint8_t sessionID = 0;
@@ -1071,7 +1083,7 @@ void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) {
const RESULT_CODE result =
sent_message.deserializePacket(message->data(), message->data_size());
if (result != RESULT_OK) {
- LOG4CXX_ERROR(logger_, "Error while message deserialization.");
+ SDL_LOG_ERROR("Error while message deserialization.");
return;
}
std::map<uint8_t, uint32_t>::iterator it =
@@ -1101,11 +1113,28 @@ void ProtocolHandlerImpl::OnTMMessageSendFailed(
const RawMessagePtr message) {
DCHECK_OR_RETURN_VOID(message);
// TODO(PV): implement
- LOG4CXX_ERROR(logger_,
- "Sending message " << message->data_size()
- << "bytes failed, connection_key "
+ SDL_LOG_ERROR("Sending message " << message->data_size()
+ << " bytes failed, connection_key "
<< message->connection_key()
- << "Error_text: " << error.text());
+ << " Error_text: " << error.text());
+
+ uint32_t connection_handle = 0;
+ uint8_t session_id = 0;
+
+ session_observer_.PairFromKey(
+ message->connection_key(), &connection_handle, &session_id);
+
+ const auto connection_it = std::find(ready_to_close_connections_.begin(),
+ ready_to_close_connections_.end(),
+ connection_handle);
+ if (ready_to_close_connections_.end() != connection_it) {
+ ready_to_close_connections_.erase(connection_it);
+ }
+
+ const auto last_message_it = sessions_last_message_id_.find(session_id);
+ if (sessions_last_message_id_.end() != last_message_it) {
+ sessions_last_message_id_.erase(last_message_it);
+ }
}
void ProtocolHandlerImpl::OnConnectionPending(
@@ -1134,7 +1163,7 @@ void ProtocolHandlerImpl::OnUnexpectedDisconnect(
}
void ProtocolHandlerImpl::NotifyOnGetSystemTimeFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef ENABLE_SECURITY
security_manager_->ResetPendingSystemTimeRequests();
security_manager_->NotifyListenersOnGetSystemTimeFailed();
@@ -1149,19 +1178,19 @@ void ProtocolHandlerImpl::ProcessFailedPTU() {
#ifdef EXTERNAL_PROPRIETARY_MODE
void ProtocolHandlerImpl::ProcessFailedCertDecrypt() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
security_manager_->ProcessFailedCertDecrypt();
}
#endif
void ProtocolHandlerImpl::OnTransportConfigUpdated(
const transport_manager::transport_adapter::TransportConfig& configs) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_manager::transport_adapter::TransportConfig::const_iterator it =
configs.find(transport_manager::transport_adapter::tc_enabled);
if (configs.end() == it) {
- LOG4CXX_WARN(logger_, "No enabled field in OnTransportConfigUpdated");
+ SDL_LOG_WARN("No enabled field in OnTransportConfigUpdated");
return;
}
@@ -1171,14 +1200,14 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated(
if (tcp_enabled) {
it = configs.find(transport_manager::transport_adapter::tc_tcp_port);
if (configs.end() == it) {
- LOG4CXX_WARN(logger_, "No port field in OnTransportConfigUpdated");
+ SDL_LOG_WARN("No port field in OnTransportConfigUpdated");
return;
}
tcp_port = it->second;
it = configs.find(transport_manager::transport_adapter::tc_tcp_ip_address);
if (configs.end() == it) {
- LOG4CXX_WARN(logger_, "No IP address field in OnTransportConfigUpdated");
+ SDL_LOG_WARN("No IP address field in OnTransportConfigUpdated");
return;
}
tcp_enabled_ = true;
@@ -1190,10 +1219,9 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated(
tcp_ip_address_.clear();
}
- LOG4CXX_INFO(logger_,
- "OnTransportConfigUpdated: new config enabled is "
- << tcp_enabled_ << ". Port is " << tcp_port_
- << ". IP Address is " << tcp_ip_address_);
+ SDL_LOG_INFO("OnTransportConfigUpdated: new config enabled is "
+ << tcp_enabled_ << ". Port is " << tcp_port_
+ << ". IP Address is " << tcp_ip_address_);
// Walk the SessionConnection map and find all sessions that need a
// TransportUpdate Event. Sessions flagged with kDisabledSecondary in their
@@ -1208,11 +1236,10 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated(
session_connection_map.begin();
while (itr != session_connection_map.end()) {
const connection_handler::SessionTransports st = itr->second;
- LOG4CXX_INFO(logger_,
- "OnTransportConfigUpdated found session "
- << itr->first << " with primary connection "
- << st.primary_transport << " and secondary connection "
- << st.secondary_transport);
+ SDL_LOG_INFO("OnTransportConfigUpdated found session "
+ << itr->first << " with primary connection "
+ << st.primary_transport << " and secondary connection "
+ << st.secondary_transport);
if (st.secondary_transport != kDisabledSecondary) {
SendTransportUpdateEvent(st.primary_transport, itr->first);
}
@@ -1222,7 +1249,7 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated(
void ProtocolHandlerImpl::OnAuthTokenUpdated(const std::string& policy_app_id,
const std::string& auth_token) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(auth_token_map_lock_);
if (auth_token.empty()) {
auth_token_map_.erase(policy_app_id);
@@ -1233,7 +1260,7 @@ void ProtocolHandlerImpl::OnAuthTokenUpdated(const std::string& policy_app_id,
bool ProtocolHandlerImpl::IsRPCServiceSecure(
const uint32_t connection_key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef ENABLE_SECURITY
security_manager::SSLContext* context =
@@ -1245,37 +1272,35 @@ bool ProtocolHandlerImpl::IsRPCServiceSecure(
}
RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!packet) {
- LOG4CXX_ERROR(logger_, "Failed to send empty packet.");
+ SDL_LOG_ERROR("Failed to send empty packet.");
return RESULT_FAIL;
}
#ifdef ENABLE_SECURITY
// and return protect flag to Packet constructor for makeing design by Policy
const RESULT_CODE result = EncryptFrame(packet);
if (result != RESULT_OK) {
- LOG4CXX_WARN(logger_, "Error frame encryption. Frame droped.");
+ SDL_LOG_WARN("Error frame encryption. Frame droped.");
return RESULT_FAIL;
}
#endif // ENABLE_SECURITY
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Packet to be sent: "
- << ConvertPacketDataToString(packet->data(), packet->data_size())
- << " of size: " << packet->data_size());
+ << ConvertPacketDataToString(packet->data(), packet->data_size())
+ << " of size: " << packet->data_size());
const RawMessagePtr message_to_send = packet->serializePacket();
if (!message_to_send) {
- LOG4CXX_ERROR(logger_, "Serialization error");
+ SDL_LOG_ERROR("Serialization error");
return RESULT_FAIL;
}
- LOG4CXX_DEBUG(logger_,
- "Message to send with connection id "
- << static_cast<int>(packet->connection_id()));
+ SDL_LOG_DEBUG("Message to send with connection id "
+ << static_cast<int>(packet->connection_id()));
if (transport_manager::E_SUCCESS !=
transport_manager_.SendMessageToDevice(message_to_send)) {
- LOG4CXX_WARN(logger_, "Can't send message to device");
+ SDL_LOG_WARN("Can't send message to device");
return RESULT_FAIL;
}
return RESULT_OK;
@@ -1290,11 +1315,10 @@ RESULT_CODE ProtocolHandlerImpl::SendSingleFrameMessage(
const uint8_t* data,
const bool needs_encryption,
const bool is_final_message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_DEBUG(
- logger_,
- "Packet needs encryption: " << std::boolalpha << needs_encryption);
+ SDL_LOG_DEBUG("Packet needs encryption: " << std::boolalpha
+ << needs_encryption);
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
@@ -1323,11 +1347,10 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
const size_t max_frame_size,
const bool needs_encryption,
const bool is_final_message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_DEBUG(
- logger_,
- " data size " << data_size << " max_frame_size " << max_frame_size);
+ SDL_LOG_DEBUG(" data size " << data_size << " max_frame_size "
+ << max_frame_size);
// remainder of last frame
const size_t lastframe_remainder = data_size % max_frame_size;
@@ -1339,8 +1362,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
// add last frame if not empty
(lastframe_remainder > 0 ? 1 : 0);
- LOG4CXX_DEBUG(logger_,
- "Data " << data_size << " bytes in " << frames_count
+ SDL_LOG_DEBUG("Data " << data_size << " bytes in " << frames_count
<< " frames with last frame size " << lastframe_size);
DCHECK(max_frame_size >= FIRST_FRAME_DATA_SIZE);
@@ -1373,7 +1395,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(firstPacket, false));
- LOG4CXX_DEBUG(logger_, "First frame is sent.");
+ SDL_LOG_DEBUG("First frame is sent.");
for (uint32_t i = 0; i < frames_count; ++i) {
const bool is_last_frame = (i == (frames_count - 1));
@@ -1397,27 +1419,27 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, is_final_packet));
- LOG4CXX_DEBUG(logger_, '#' << i << " frame is sent.");
+ SDL_LOG_DEBUG('#' << i << " frame is sent.");
}
return RESULT_OK;
}
RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) {
DCHECK_OR_RETURN(packet, RESULT_UNKNOWN);
- LOG4CXX_DEBUG(logger_, "Handling message " << packet);
+ SDL_LOG_DEBUG("Handling message " << packet);
switch (packet->frame_type()) {
case FRAME_TYPE_CONTROL:
- LOG4CXX_TRACE(logger_, "FRAME_TYPE_CONTROL");
+ SDL_LOG_TRACE("FRAME_TYPE_CONTROL");
return HandleControlMessage(packet);
case FRAME_TYPE_SINGLE:
- LOG4CXX_TRACE(logger_, "FRAME_TYPE_SINGLE");
+ SDL_LOG_TRACE("FRAME_TYPE_SINGLE");
return HandleSingleFrameMessage(packet);
case FRAME_TYPE_FIRST:
case FRAME_TYPE_CONSECUTIVE:
- LOG4CXX_TRACE(logger_, "FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE");
+ SDL_LOG_TRACE("FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE");
return HandleMultiFrameMessage(packet);
default: {
- LOG4CXX_WARN(logger_, "Unknown frame type" << packet->frame_type());
+ SDL_LOG_WARN("Unknown frame type" << packet->frame_type());
return RESULT_FAIL;
}
}
@@ -1426,13 +1448,13 @@ RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) {
RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
+
+ SDL_LOG_DEBUG(
- LOG4CXX_DEBUG(
- logger_,
"FRAME_TYPE_SINGLE message of size "
- << packet->data_size() << "; message "
- << ConvertPacketDataToString(packet->data(), packet->data_size()));
+ << packet->data_size() << "; message "
+ << ConvertPacketDataToString(packet->data(), packet->data_size()));
// Replace a potential secondary transport ID in the packet with the primary
// transport ID
@@ -1471,7 +1493,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage(
const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Replace a potential secondary transport ID in the packet with the primary
// transport ID
@@ -1482,7 +1504,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage(
}
if (multiframe_builder_.AddFrame(packet) != RESULT_OK) {
- LOG4CXX_WARN(logger_, "Frame assembling issue");
+ SDL_LOG_WARN("Frame assembling issue");
}
return RESULT_OK;
@@ -1490,42 +1512,41 @@ RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage(
RESULT_CODE ProtocolHandlerImpl::HandleControlMessage(
const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO{ALeshin}: Rename "Session" to "Service" on PH, CH, AM levels
switch (packet->frame_data()) {
case FRAME_DATA_START_SERVICE: {
- LOG4CXX_TRACE(logger_, "FrameData: StartService");
+ SDL_LOG_TRACE("FrameData: StartService");
return HandleControlMessageStartSession(packet);
}
case FRAME_DATA_END_SERVICE: {
- LOG4CXX_TRACE(logger_, "FrameData: StopService");
+ SDL_LOG_TRACE("FrameData: StopService");
return HandleControlMessageEndSession(*packet);
}
case FRAME_DATA_END_SERVICE_ACK: {
- LOG4CXX_TRACE(logger_, "FrameData: StopService ACK");
+ SDL_LOG_TRACE("FrameData: StopService ACK");
return HandleControlMessageEndServiceACK(*packet);
}
case FRAME_DATA_HEART_BEAT: {
- LOG4CXX_TRACE(logger_, "FrameData: Heartbeat");
+ SDL_LOG_TRACE("FrameData: Heartbeat");
return HandleControlMessageHeartBeat(*packet);
}
case FRAME_DATA_HEART_BEAT_ACK: {
- LOG4CXX_TRACE(logger_, "FrameData Heartbeat ACK");
- LOG4CXX_DEBUG(logger_,
- "Received Heartbeat ACK from mobile,"
- " connection: "
- << packet->connection_id());
+ SDL_LOG_TRACE("FrameData Heartbeat ACK");
+ SDL_LOG_DEBUG(
+ "Received Heartbeat ACK from mobile,"
+ " connection: "
+ << packet->connection_id());
return RESULT_OK;
}
case FRAME_DATA_REGISTER_SECONDARY_TRANSPORT: {
- LOG4CXX_TRACE(logger_, "FrameData: RegisterSecondaryTransport");
+ SDL_LOG_TRACE("FrameData: RegisterSecondaryTransport");
return HandleControlMessageRegisterSecondaryTransport(packet);
}
default:
- LOG4CXX_WARN(logger_,
- "Control message of type "
- << static_cast<int>(packet->frame_data()) << " ignored");
+ SDL_LOG_WARN("Control message of type "
+ << static_cast<int>(packet->frame_data()) << " ignored");
return RESULT_OK;
}
return RESULT_OK;
@@ -1533,12 +1554,11 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessage(
uint32_t get_hash_id(const ProtocolPacket& packet) {
if (packet.protocol_version() < PROTOCOL_VERSION_2) {
- LOG4CXX_DEBUG(logger_,
- "Packet without hash data (protocol version less 2)");
+ SDL_LOG_DEBUG("Packet without hash data (protocol version less 2)");
return HASH_ID_NOT_SUPPORTED;
}
if (packet.data_size() < 4) {
- LOG4CXX_WARN(logger_, "Packet without hash data (data size less 4)");
+ SDL_LOG_WARN("Packet without hash data (data size less 4)");
return HASH_ID_WRONG;
}
if (packet.protocol_version() >= PROTOCOL_VERSION_5) {
@@ -1551,7 +1571,7 @@ uint32_t get_hash_id(const ProtocolPacket& packet) {
bson_object_deinitialize(&obj);
return hash_id;
} else {
- LOG4CXX_WARN(logger_, "Failed to parse BSON field for hash ID");
+ SDL_LOG_WARN("Failed to parse BSON field for hash ID");
return HASH_ID_WRONG;
}
} else {
@@ -1565,15 +1585,16 @@ uint32_t get_hash_id(const ProtocolPacket& packet) {
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(
const ProtocolPacket& packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint8_t current_session_id = packet.session_id();
uint32_t hash_id = get_hash_id(packet);
const ServiceType service_type = ServiceTypeFromByte(packet.service_type());
const ConnectionID connection_id = packet.connection_id();
+ std::string err_reason;
const uint32_t session_key = session_observer_.OnSessionEndedCallback(
- connection_id, current_session_id, &hash_id, service_type);
+ connection_id, current_session_id, &hash_id, service_type, &err_reason);
// TODO(EZamakhov): add clean up output queue (for removed service)
if (session_key != 0) {
@@ -1583,8 +1604,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(
service_type);
message_counters_.erase(current_session_id);
} else {
- LOG4CXX_WARN(logger_,
- "Refused to end session " << static_cast<int>(service_type)
+ SDL_LOG_WARN("Refused to end session " << static_cast<int>(service_type)
<< " type.");
if (packet.protocol_version() >= PROTOCOL_VERSION_5) {
std::vector<std::string> rejectedParams;
@@ -1596,12 +1616,14 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(
current_session_id,
packet.protocol_version(),
service_type,
- rejectedParams);
+ rejectedParams,
+ err_reason);
} else {
SendEndSessionNAck(connection_id,
current_session_id,
packet.protocol_version(),
- service_type);
+ service_type,
+ err_reason);
}
}
return RESULT_OK;
@@ -1612,7 +1634,7 @@ const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings(
const ConnectionID connection_id,
const uint8_t session_id,
const bool protection) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string& transport =
session_observer_.TransportTypeProfileStringFromConnHandle(connection_id);
@@ -1662,7 +1684,7 @@ const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings(
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK(
const ProtocolPacket& packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint8_t current_session_id = packet.session_id();
uint32_t hash_id = get_hash_id(packet);
@@ -1673,7 +1695,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK(
connection_id, current_session_id, &hash_id, service_type);
if (0 == session_key) {
- LOG4CXX_WARN(logger_, "Refused to end service");
+ SDL_LOG_WARN("Refused to end service");
return RESULT_FAIL;
}
@@ -1682,9 +1704,9 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK(
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG(
+
"Protocol version:" << static_cast<int>(packet->protocol_version()));
const ServiceType service_type = ServiceTypeFromByte(packet->service_type());
@@ -1710,18 +1732,20 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
service_type, connection_id, session_id, protection);
if (ServiceStatus::INVALID_ENUM != settings_check) {
- LOG4CXX_DEBUG(logger_,
- "Rejecting StartService for service:"
- << service_type << ", disallowed by settings.");
+ SDL_LOG_DEBUG("Rejecting StartService for service:"
+ << service_type << ", disallowed by settings.");
service_status_update_handler_->OnServiceUpdate(
connection_key, service_type, settings_check);
- SendStartSessionNAck(
- connection_id, session_id, protocol_version, service_type);
+ SendStartSessionNAck(connection_id,
+ session_id,
+ protocol_version,
+ service_type,
+ "Service type: " + std::to_string(service_type) +
+ " disallowed by settings");
return RESULT_OK;
}
- LOG4CXX_INFO(logger_,
- "StartSession ID " << static_cast<int>(session_id)
+ SDL_LOG_INFO("StartSession ID " << static_cast<int>(session_id)
<< " and Connection ID "
<< static_cast<int>(connection_id));
@@ -1736,8 +1760,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
size_t bson_obj_size = bson_object_from_bytes_len(
&bson_obj, packet->data(), packet->total_data_bytes());
if (bson_obj_size == 0) {
- LOG4CXX_WARN(logger_,
- "Failed to parse BSON field of start service packet");
+ SDL_LOG_WARN("Failed to parse BSON field of start service packet");
bson_object_initialize_default(&bson_obj);
}
} else {
@@ -1753,15 +1776,14 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageRegisterSecondaryTransport(
const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const uint8_t session_id = packet->session_id();
const ConnectionID connection_id = packet->connection_id();
ConnectionID primary_connection_id = 0;
- LOG4CXX_INFO(logger_,
- "RegisterSecondaryTransport ID "
- << static_cast<int>(session_id) << " and Connection ID "
- << static_cast<int>(connection_id));
+ SDL_LOG_INFO("RegisterSecondaryTransport ID "
+ << static_cast<int>(session_id) << " and Connection ID "
+ << static_cast<int>(connection_id));
if (connection_handler_.OnSecondaryTransportStarted(
primary_connection_id, connection_id, session_id)) {
@@ -1796,8 +1818,10 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageRegisterSecondaryTransport(
}
void ProtocolHandlerImpl::NotifySessionStarted(
- const SessionContext& context, std::vector<std::string>& rejected_params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ const SessionContext& context,
+ std::vector<std::string>& rejected_params,
+ const std::string err_reason) {
+ SDL_LOG_AUTO_TRACE();
ProtocolFramePtr packet;
{
@@ -1805,7 +1829,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
StartSessionFrameMap::iterator it = start_session_frame_map_.find(
std::make_pair(context.connection_id_, context.initial_session_id_));
if (it == start_session_frame_map_.end()) {
- LOG4CXX_ERROR(logger_, "Cannot find Session Started packet");
+ SDL_LOG_ERROR("Cannot find Session Started packet");
return;
}
packet = it->second;
@@ -1816,9 +1840,8 @@ void ProtocolHandlerImpl::NotifySessionStarted(
const uint8_t protocol_version = packet->protocol_version();
if (0 == context.new_session_id_) {
- LOG4CXX_WARN(logger_,
- "Refused by session_observer to create service "
- << static_cast<int32_t>(service_type) << " type.");
+ SDL_LOG_WARN("Refused by session_observer to create service "
+ << static_cast<int32_t>(service_type) << " type.");
const auto session_id = packet->session_id();
const auto connection_key =
session_observer_.KeyFromPair(context.connection_id_, session_id);
@@ -1830,7 +1853,8 @@ void ProtocolHandlerImpl::NotifySessionStarted(
session_id,
protocol_version,
packet->service_type(),
- rejected_params);
+ rejected_params,
+ err_reason);
return;
}
@@ -1876,8 +1900,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
}
bson_object_deinitialize(&req_param);
} else {
- LOG4CXX_WARN(logger_,
- "Failed to parse BSON field of start service (video)");
+ SDL_LOG_WARN("Failed to parse BSON field of start service (video)");
}
}
@@ -1895,14 +1918,18 @@ void ProtocolHandlerImpl::NotifySessionStarted(
bson_object_get_string(&request_params, strings::protocol_version);
std::string version_string(version_param == NULL ? "" : version_param);
fullVersion = std::make_shared<utils::SemanticVersion>(version_string);
+
+ const auto connection_key = session_observer_.KeyFromPair(
+ packet->connection_id(), context.new_session_id_);
+ connection_handler_.BindProtocolVersionWithSession(connection_key,
+ *fullVersion);
// Constructed payloads added in Protocol v5
if (fullVersion->major_version_ < PROTOCOL_VERSION_5) {
rejected_params.push_back(std::string(strings::protocol_version));
}
bson_object_deinitialize(&request_params);
} else {
- LOG4CXX_WARN(logger_,
- "Failed to parse start service packet for version string");
+ SDL_LOG_WARN("Failed to parse start service packet for version string");
fullVersion = std::make_shared<utils::SemanticVersion>();
}
} else {
@@ -1932,7 +1959,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
kUseExisting);
if (!ssl_context) {
const std::string error("CreateSSLContext failed");
- LOG4CXX_ERROR(logger_, error);
+ SDL_LOG_ERROR(error);
security_manager_->SendInternalError(
connection_key,
security_manager::SecurityManager::ERROR_INTERNAL,
@@ -1949,7 +1976,8 @@ void ProtocolHandlerImpl::NotifySessionStarted(
packet->session_id(),
protocol_version,
packet->service_type(),
- rejected_params);
+ rejected_params,
+ "SSL Handshake failed due to rejected parameters");
} else if (ssl_context->IsInitCompleted()) {
// mark service as protected
session_observer_.SetProtectionFlag(connection_key, service_type);
@@ -1967,8 +1995,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
*fullVersion,
*start_session_ack_params);
} else {
- LOG4CXX_DEBUG(logger_,
- "Adding Handshake handler to listeners: " << handler.get());
+ SDL_LOG_DEBUG("Adding Handshake handler to listeners: " << handler.get());
security_manager::SecurityManagerListener* listener =
new HandshakeHandler(*handler);
security_manager_->AddListener(listener);
@@ -1983,14 +2010,14 @@ void ProtocolHandlerImpl::NotifySessionStarted(
packet->session_id(),
protocol_version,
packet->service_type(),
- rejected_params);
+ rejected_params,
+ "System time provider is not ready");
}
}
}
- LOG4CXX_DEBUG(logger_,
- "Protection establishing for connection "
- << connection_key << " is in progress");
+ SDL_LOG_DEBUG("Protection establishing for connection "
+ << connection_key << " is in progress");
return;
}
#endif // ENABLE_SECURITY
@@ -2012,19 +2039,21 @@ void ProtocolHandlerImpl::NotifySessionStarted(
connection_key,
context.service_type_,
ServiceStatus::SERVICE_START_FAILED);
- SendStartSessionNAck(context.connection_id_,
- packet->session_id(),
- protocol_version,
- packet->service_type(),
- rejected_params);
+ SendStartSessionNAck(
+ context.connection_id_,
+ packet->session_id(),
+ protocol_version,
+ packet->service_type(),
+ rejected_params,
+ "Certain parameters in the StartService request were rejected");
}
}
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat(
const ProtocolPacket& packet) {
const ConnectionID connection_id = packet.connection_id();
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Sending heart beat acknowledgment for connection " << connection_id);
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
@@ -2035,20 +2064,19 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat(
return SendHeartBeatAck(
connection_id, packet.session_id(), packet.message_id());
} else {
- LOG4CXX_WARN(logger_, "HeartBeat is not supported");
+ SDL_LOG_WARN("HeartBeat is not supported");
return RESULT_HEARTBEAT_IS_NOT_SUPPORTED;
}
} else {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"SendHeartBeatAck is failed connection or session does not exist");
return RESULT_FAIL;
}
}
void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const ProtocolFramePtrList& frame_list = multiframe_builder_.PopMultiframes();
for (ProtocolFramePtrList::const_iterator it = frame_list.begin();
it != frame_list.end();
@@ -2061,9 +2089,8 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() {
const uint32_t connection_key = session_observer_.KeyFromPair(
frame->connection_id(), frame->session_id());
- LOG4CXX_DEBUG(
- logger_,
- "Result frame" << frame << "for connection " << connection_key);
+ SDL_LOG_DEBUG("Result frame" << frame << "for connection "
+ << connection_key);
const RawMessagePtr rawMessage(new RawMessage(connection_key,
frame->protocol_version(),
frame->data(),
@@ -2085,18 +2112,16 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() {
}
bool ProtocolHandlerImpl::TrackMessage(const uint32_t& connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const size_t& frequency_time = get_settings().message_frequency_time();
const size_t& frequency_count = get_settings().message_frequency_count();
if (frequency_time > 0u && frequency_count > 0u) {
const size_t message_frequency =
message_meter_.TrackMessage(connection_key);
- LOG4CXX_DEBUG(
- logger_,
- "Frequency of " << connection_key << " is " << message_frequency);
+ SDL_LOG_DEBUG("Frequency of " << connection_key << " is "
+ << message_frequency);
if (message_frequency > frequency_count) {
- LOG4CXX_WARN(logger_,
- "Frequency of " << connection_key << " is marked as high.");
+ SDL_LOG_WARN("Frequency of " << connection_key << " is marked as high.");
session_observer_.OnApplicationFloodCallBack(connection_key);
message_meter_.RemoveIdentifier(connection_key);
return true;
@@ -2109,18 +2134,17 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t& connection_key,
const size_t count) {
const size_t& malformed_frequency_count =
get_settings().malformed_frequency_count();
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (get_settings().malformed_frequency_time() > 0u &&
malformed_frequency_count > 0u) {
const size_t malformed_message_frequency =
malformed_message_meter_.TrackMessages(connection_key, count);
- LOG4CXX_DEBUG(logger_,
- "Malformed frequency of " << connection_key << " is "
+ SDL_LOG_DEBUG("Malformed frequency of " << connection_key << " is "
<< malformed_message_frequency);
if (!get_settings().malformed_message_filtering() ||
malformed_message_frequency > malformed_frequency_count) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Malformed frequency of " << connection_key << " is marked as high.");
session_observer_.OnMalformedMessageCallback(connection_key);
malformed_message_meter_.RemoveIdentifier(connection_key);
@@ -2131,7 +2155,7 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t& connection_key,
}
void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
switch (message->service_type()) {
case kMobileNav:
@@ -2145,7 +2169,7 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) {
}
} break;
}
- LOG4CXX_DEBUG(logger_, "Message : " << message.get());
+ SDL_LOG_DEBUG("Message : " << message.get());
const uint8_t c_id = message->connection_id();
const uint32_t m_id = message->session_id();
@@ -2157,25 +2181,23 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) {
if (((0 != message->data()) && (0 != message->data_size())) ||
FRAME_TYPE_CONTROL == message->frame_type() ||
FRAME_TYPE_FIRST == message->frame_type()) {
- LOG4CXX_DEBUG(logger_, "Packet: dataSize " << message->data_size());
+ SDL_LOG_DEBUG("Packet: dataSize " << message->data_size());
HandleMessage(message);
PopValideAndExpirateMultiframes();
} else {
- LOG4CXX_WARN(logger_,
- "handleMessagesFromMobileApp() - incorrect or NULL data");
+ SDL_LOG_WARN("handleMessagesFromMobileApp() - incorrect or NULL data");
}
}
void ProtocolHandlerImpl::Handle(const impl::RawFordMessageToMobile message) {
- LOG4CXX_DEBUG(logger_,
- "Message to mobile app: connection id "
- << static_cast<int>(message->connection_id())
- << ";"
- " dataSize: "
- << message->data_size()
- << " ;"
- " protocolVersion "
- << static_cast<int>(message->protocol_version()));
+ SDL_LOG_DEBUG("Message to mobile app: connection id "
+ << static_cast<int>(message->connection_id())
+ << ";"
+ " dataSize: "
+ << message->data_size()
+ << " ;"
+ " protocolVersion "
+ << static_cast<int>(message->protocol_version()));
if (message.is_final) {
sessions_last_message_id_.insert(std::pair<uint8_t, uint32_t>(
@@ -2202,7 +2224,7 @@ void ProtocolHandlerImpl::set_service_status_update_handler(
void ProtocolHandlerImpl::set_security_manager(
security_manager::SecurityManager* security_manager) {
if (!security_manager) {
- LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to SecurityManager.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to SecurityManager.");
return;
}
security_manager_ = security_manager;
@@ -2218,7 +2240,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
return RESULT_OK;
}
if (!security_manager_) {
- LOG4CXX_WARN(logger_, "No security_manager_ set.");
+ SDL_LOG_WARN("No security_manager_ set.");
return RESULT_FAIL;
}
const uint32_t connection_key = session_observer_.KeyFromPair(
@@ -2226,11 +2248,11 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
security_manager::SSLContext* context = session_observer_.GetSSLContext(
connection_key, ServiceTypeFromByte(packet->service_type()));
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Protection flag is: " << packet->protection_flag() << std::boolalpha);
if ((!context || !context->IsInitCompleted()) || !packet->protection_flag()) {
- LOG4CXX_DEBUG(logger_, "Ecryption is skipped!");
+ SDL_LOG_DEBUG("Ecryption is skipped!");
return RESULT_OK;
}
const uint8_t* out_data;
@@ -2238,7 +2260,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
if (!context->Encrypt(
packet->data(), packet->data_size(), &out_data, &out_data_size)) {
const std::string error_text(context->LastError());
- LOG4CXX_ERROR(logger_, "Enryption failed: " << error_text);
+ SDL_LOG_ERROR("Enryption failed: " << error_text);
security_manager_->SendInternalError(
connection_key,
security_manager::SecurityManager::ERROR_ENCRYPTION_FAILED,
@@ -2250,8 +2272,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
packet->connection_id(), packet->session_id(), &hash_id, kRpc);
return RESULT_OK;
}
- LOG4CXX_DEBUG(logger_,
- "Encrypted " << packet->data_size() << " bytes to "
+ SDL_LOG_DEBUG("Encrypted " << packet->data_size() << " bytes to "
<< out_data_size << " bytes");
DCHECK(out_data);
DCHECK(out_data_size);
@@ -2282,12 +2303,12 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
}
if (shoud_not_decrypt) {
- LOG4CXX_DEBUG(logger_, "Frame will not be decrypted");
+ SDL_LOG_DEBUG("Frame will not be decrypted");
return RESULT_OK;
}
if (!security_manager_) {
- LOG4CXX_WARN(logger_, "No security_manager_ set.");
+ SDL_LOG_WARN("No security_manager_ set.");
return RESULT_FAIL;
}
const uint32_t connection_key = session_observer_.KeyFromPair(
@@ -2296,8 +2317,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
connection_key, ServiceTypeFromByte(packet->service_type()));
if (!context || !context->IsInitCompleted()) {
const std::string error_text("Fail decryption for unprotected service ");
- LOG4CXX_ERROR(logger_,
- error_text << static_cast<int>(packet->service_type()));
+ SDL_LOG_ERROR(error_text << static_cast<int>(packet->service_type()));
security_manager_->SendInternalError(
connection_key,
security_manager::SecurityManager::ERROR_SERVICE_NOT_PROTECTED,
@@ -2309,7 +2329,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
if (!context->Decrypt(
packet->data(), packet->data_size(), &out_data, &out_data_size)) {
const std::string error_text(context->LastError());
- LOG4CXX_ERROR(logger_, "Decryption failed: " << error_text);
+ SDL_LOG_ERROR("Decryption failed: " << error_text);
security_manager_->SendInternalError(
connection_key,
security_manager::SecurityManager::ERROR_DECRYPTION_FAILED,
@@ -2321,8 +2341,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
packet->connection_id(), packet->session_id(), &hash_id, kRpc);
return RESULT_ENCRYPTION_FAILED;
}
- LOG4CXX_DEBUG(logger_,
- "Decrypted " << packet->data_size() << " bytes to "
+ SDL_LOG_DEBUG("Decrypted " << packet->data_size() << " bytes to "
<< out_data_size << " bytes");
DCHECK(out_data);
DCHECK(out_data_size);
@@ -2338,8 +2357,8 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key,
int32_t number_of_frames) {
- LOG4CXX_DEBUG(
- logger_, "SendFramesNumber MobileNaviAck for session " << connection_key);
+ SDL_LOG_DEBUG("SendFramesNumber MobileNaviAck for session "
+ << connection_key);
transport_manager::ConnectionUID connection_id = 0;
uint8_t session_id = 0;
@@ -2367,11 +2386,10 @@ void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key,
sizeof(number_of_frames));
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_, "SendFramesNumber finished successfully");
+ SDL_LOG_DEBUG("SendFramesNumber finished successfully");
}
} else {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"SendFramesNumber is failed connection or session does not exist");
}
}
@@ -2401,7 +2419,7 @@ std::string ConvertPacketDataToString(const uint8_t* data,
}
uint8_t ProtocolHandlerImpl::SupportedSDLProtocolVersion() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return get_settings().max_supported_protocol_version();
}
@@ -2444,7 +2462,7 @@ ProtocolHandlerImpl::GetTransportTypeFromConnectionType(
if (it != transportTypes.end()) {
result = it->second;
} else {
- LOG4CXX_ERROR(logger_, "Unknown connection type " << connection_type);
+ SDL_LOG_ERROR("Unknown connection type " << connection_type);
}
return result;
@@ -2455,7 +2473,7 @@ const bool ProtocolHandlerImpl::ParseSecondaryTransportConfiguration(
std::vector<std::string>& secondaryTransports,
std::vector<int32_t>& audioServiceTransports,
std::vector<int32_t>& videoServiceTransports) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<std::string> secondary_transport_types;
// First discover what the connection type of the primary transport is
@@ -2473,8 +2491,8 @@ const bool ProtocolHandlerImpl::ParseSecondaryTransportConfiguration(
} else if (td.transport_type_ == impl::TransportType::TT_WIFI) {
secondary_transport_types = settings_.secondary_transports_for_wifi();
} else {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Bad or unknown device type in ParseSecondaryTransportConfiguration");
return false;
}
@@ -2515,7 +2533,7 @@ void ProtocolHandlerImpl::GenerateSecondaryTransportsForStartSessionAck(
bool device_is_ios,
bool device_is_android,
std::vector<std::string>& secondaryTransports) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Parse the "secondary_transport_types" vector (which comes from
// smartDeviceLink.ini). For each entry in the vector, add an
@@ -2526,34 +2544,31 @@ void ProtocolHandlerImpl::GenerateSecondaryTransportsForStartSessionAck(
const utils::custom_string::CustomString transport_type(*it);
if (transport_type.CompareIgnoreCase("USB")) {
if (device_is_ios) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
"Adding IAP_USB to secondaryTransports for StartSessionAck");
secondaryTransports.push_back("IAP_USB");
}
if (device_is_android) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
"Adding AOA_USB to secondaryTransports for StartSessionAck");
secondaryTransports.push_back("AOA_USB");
}
} else if (transport_type.CompareIgnoreCase("Bluetooth")) {
if (device_is_ios) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"Adding IAP_BLUETOOTH to secondaryTransports for StartSessionAck");
secondaryTransports.push_back("IAP_BLUETOOTH");
}
if (device_is_android) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"Adding SPP_BLUETOOTH to secondaryTransports for StartSessionAck");
secondaryTransports.push_back("SPP_BLUETOOTH");
}
}
if (transport_type.CompareIgnoreCase("WiFi")) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
"Adding TCP_WIFI to secondaryTransports for StartSessionAck");
secondaryTransports.push_back("TCP_WIFI");
}
@@ -2569,13 +2584,13 @@ void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck(
const impl::TransportType primary_transport_type,
const std::vector<std::string>& secondary_transport_types,
std::vector<int32_t>& serviceTransports) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (service_transports.size() == 0) {
if (secondary_enabled && !secondary_transport_types.empty()) {
- LOG4CXX_TRACE(logger_,
- "Empty Service Transports. Allowing service to run on both "
- "connections");
+ SDL_LOG_TRACE(
+ "Empty Service Transports. Allowing service to run on both "
+ "connections");
serviceTransports.push_back(1);
serviceTransports.push_back(2);
} else {
@@ -2587,15 +2602,15 @@ void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck(
std::vector<std::string>::const_iterator it = service_transports.begin();
for (; it != service_transports.end(); it++) {
const utils::custom_string::CustomString transport(*it);
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"Service Allowed to run on " << transport.c_str() << " transport");
if (!fPrimaryAdded &&
(transport.CompareIgnoreCase(primary_connection_type.c_str()) ||
(transport.CompareIgnoreCase("IAP_USB") &&
primary_transport_type == impl::TransportType::TT_USB))) {
- LOG4CXX_TRACE(logger_, "Service allowed on primary transport");
+ SDL_LOG_TRACE("Service allowed on primary transport");
serviceTransports.push_back(1);
fPrimaryAdded = true;
}
@@ -2611,7 +2626,7 @@ void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck(
secondary_transport_type.c_str());
});
if (found != secondary_transport_types.end()) {
- LOG4CXX_TRACE(logger_, "Service allowed on secondary transport");
+ SDL_LOG_TRACE("Service allowed on secondary transport");
serviceTransports.push_back(2);
fSecondaryAdded = true;
}
diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc
index 5bee1c16b2..bd052c8660 100644
--- a/src/components/protocol_handler/src/protocol_packet.cc
+++ b/src/components/protocol_handler/src/protocol_packet.cc
@@ -46,7 +46,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
namespace {
std::string StringifyFrameType(uint8_t type) {
@@ -64,7 +64,7 @@ std::string StringifyFrameType(uint8_t type) {
return "FRAME_TYPE_FIRST";
default:
- LOG4CXX_ERROR(logger_, "Unknown frame type:" << static_cast<int>(type));
+ SDL_LOG_ERROR("Unknown frame type:" << static_cast<int>(type));
break;
}
@@ -117,11 +117,10 @@ inline uint32_t read_be_uint32(const uint8_t* const data) {
void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message,
const size_t messageSize) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(message);
if (messageSize < PROTOCOL_HEADER_V1_SIZE) {
- LOG4CXX_DEBUG(logger_,
- "Message size less " << PROTOCOL_HEADER_V1_SIZE << " bytes");
+ SDL_LOG_DEBUG("Message size less " << PROTOCOL_HEADER_V1_SIZE << " bytes");
return;
}
// first 4 bits
@@ -143,15 +142,14 @@ void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message,
case PROTOCOL_VERSION_4:
case PROTOCOL_VERSION_5: {
if (messageSize < PROTOCOL_HEADER_V2_SIZE) {
- LOG4CXX_DEBUG(
- logger_,
- "Message size less " << PROTOCOL_HEADER_V2_SIZE << " bytes");
+ SDL_LOG_DEBUG("Message size less " << PROTOCOL_HEADER_V2_SIZE
+ << " bytes");
return;
}
messageId = read_be_uint32(message + 8);
} break;
default:
- LOG4CXX_WARN(logger_, "Unknown version:" << static_cast<int>(version));
+ SDL_LOG_WARN("Unknown version:" << static_cast<int>(version));
messageId = 0;
break;
}
@@ -167,44 +165,39 @@ ProtocolPacket::ProtocolHeaderValidator::ProtocolHeaderValidator()
void ProtocolPacket::ProtocolHeaderValidator::set_max_payload_size(
const size_t max_payload_size) {
- LOG4CXX_DEBUG(logger_, "New maximum payload size is " << max_payload_size);
+ SDL_LOG_DEBUG("New maximum payload size is " << max_payload_size);
max_payload_size_ = max_payload_size;
}
void ProtocolPacket::ProtocolHeaderValidator::set_max_control_payload_size(
const size_t max_payload_size) {
- LOG4CXX_DEBUG(logger_,
- "New maximum Control payload size is " << max_payload_size);
+ SDL_LOG_DEBUG("New maximum Control payload size is " << max_payload_size);
max_control_payload_size_ = max_payload_size;
}
void ProtocolPacket::ProtocolHeaderValidator::set_max_rpc_payload_size(
const size_t max_payload_size) {
- LOG4CXX_DEBUG(logger_,
- "New maximum RPC payload size is " << max_payload_size);
+ SDL_LOG_DEBUG("New maximum RPC payload size is " << max_payload_size);
max_rpc_payload_size_ = max_payload_size;
}
void ProtocolPacket::ProtocolHeaderValidator::set_max_audio_payload_size(
const size_t max_payload_size) {
- LOG4CXX_DEBUG(logger_,
- "New maximum audio payload size is " << max_payload_size);
+ SDL_LOG_DEBUG("New maximum audio payload size is " << max_payload_size);
max_audio_payload_size_ = max_payload_size;
}
void ProtocolPacket::ProtocolHeaderValidator::set_max_video_payload_size(
const size_t max_payload_size) {
- LOG4CXX_DEBUG(logger_,
- "New maximum video payload size is " << max_payload_size);
+ SDL_LOG_DEBUG("New maximum video payload size is " << max_payload_size);
max_video_payload_size_ = max_payload_size;
}
void ProtocolPacket::ProtocolHeaderValidator::
set_max_protocol_version_supported(
const uint16_t max_protocol_version_supported) {
- LOG4CXX_DEBUG(logger_,
- "New maximum protocol version supported is "
- << max_protocol_version_supported);
+ SDL_LOG_DEBUG("New maximum protocol version supported is "
+ << max_protocol_version_supported);
max_protocol_version_supported_ = max_protocol_version_supported;
}
@@ -262,14 +255,14 @@ ProtocolPacket::ProtocolHeaderValidator::max_payload_size_by_service_type(
: max_video_payload_size_;
break;
case kInvalidServiceType:
- LOG4CXX_WARN(logger_, "Invalid service type: " << static_cast<int>(type));
+ SDL_LOG_WARN("Invalid service type: " << static_cast<int>(type));
}
return payload_size;
}
RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
const ProtocolHeader& header) const {
- LOG4CXX_DEBUG(logger_, "Validating header - " << header);
+ SDL_LOG_DEBUG("Validating header - " << header);
// expected payload size will be calculated depending
// on used protocol version and service type
size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE;
@@ -290,17 +283,15 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
ServiceTypeFromByte(header.serviceType));
break;
default:
- LOG4CXX_WARN(logger_,
- "Unknown version:" << static_cast<int>(header.version));
+ SDL_LOG_WARN("Unknown version:" << static_cast<int>(header.version));
return RESULT_FAIL;
}
// ServiceType shall be equal 0x0 (Control), 0x07 (RPC), 0x0A (PCM), 0x0B
// (Video), 0x0F (Bulk)
if (ServiceTypeFromByte(header.serviceType) == kInvalidServiceType) {
- LOG4CXX_WARN(
- logger_,
- "Invalide service type" << static_cast<int>(header.serviceType));
+ SDL_LOG_WARN("Invalide service type"
+ << static_cast<int>(header.serviceType));
return RESULT_FAIL;
}
// Check frame info for each frame type
@@ -327,26 +318,23 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
case FRAME_DATA_HEART_BEAT_ACK:
break;
default:
- LOG4CXX_WARN(logger_,
- "FRAME_TYPE_CONTROL - Invalide frame data "
- << static_cast<int>(header.frameData));
+ SDL_LOG_WARN("FRAME_TYPE_CONTROL - Invalide frame data "
+ << static_cast<int>(header.frameData));
return RESULT_FAIL;
}
break;
}
case FRAME_TYPE_SINGLE:
if (header.frameData != FRAME_DATA_SINGLE) {
- LOG4CXX_WARN(logger_,
- "FRAME_TYPE_SINGLE - Invalide frame data "
- << static_cast<int>(header.frameData));
+ SDL_LOG_WARN("FRAME_TYPE_SINGLE - Invalide frame data "
+ << static_cast<int>(header.frameData));
return RESULT_FAIL;
}
break;
case FRAME_TYPE_FIRST:
if (header.frameData != FRAME_DATA_FIRST) {
- LOG4CXX_WARN(logger_,
- "FRAME_TYPE_FIRST - Invalide frame data "
- << static_cast<int>(header.frameData));
+ SDL_LOG_WARN("FRAME_TYPE_FIRST - Invalide frame data "
+ << static_cast<int>(header.frameData));
return RESULT_FAIL;
}
break;
@@ -354,8 +342,7 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
// Could have any FrameInfo value
break;
default:
- LOG4CXX_WARN(logger_,
- "Unknown frame type " << static_cast<int>(header.frameType));
+ SDL_LOG_WARN("Unknown frame type " << static_cast<int>(header.frameType));
// All other Frame type is invalid
return RESULT_FAIL;
}
@@ -372,29 +359,27 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
if (header.dataSize > payload_size ||
(FRAME_TYPE_CONTROL != header.frameType && header.dataSize == 0u)) {
UNUSED(StringifyFrameType);
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Packet data size of "
- << StringifyFrameType(header.frameType)
- << " frame must be in range (0, payload_size=" << payload_size
- << "], but actual value is " << header.dataSize);
+ << StringifyFrameType(header.frameType)
+ << " frame must be in range (0, payload_size=" << payload_size
+ << "], but actual value is " << header.dataSize);
return RESULT_FAIL;
}
} break;
case FRAME_TYPE_FIRST:
if (FIRST_FRAME_DATA_SIZE != header.dataSize) {
- LOG4CXX_WARN(logger_,
- "Packet data size of FRAME_TYPE_FIRST frame must equal "
- << static_cast<int>(FIRST_FRAME_DATA_SIZE)
- << ", but actual value is " << header.dataSize);
+ SDL_LOG_WARN("Packet data size of FRAME_TYPE_FIRST frame must equal "
+ << static_cast<int>(FIRST_FRAME_DATA_SIZE)
+ << ", but actual value is " << header.dataSize);
return RESULT_FAIL;
}
break;
default:
- LOG4CXX_WARN(logger_,
- "Unknown frame type " << static_cast<int>(header.frameType));
+ SDL_LOG_WARN("Unknown frame type " << static_cast<int>(header.frameType));
return RESULT_FAIL;
}
// Message ID be equal or greater than 0x01 (not actual for 1 protocol version
@@ -402,11 +387,11 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
if (header.messageId <= 0) {
if (FRAME_TYPE_CONTROL != header.frameType &&
PROTOCOL_VERSION_1 != header.version) {
- LOG4CXX_WARN(logger_, "Message ID shall be greater than 0x00");
+ SDL_LOG_WARN("Message ID shall be greater than 0x00");
return RESULT_FAIL;
}
}
- LOG4CXX_DEBUG(logger_, "Message header is completely correct.");
+ SDL_LOG_DEBUG("Message header is completely correct.");
return RESULT_OK;
}
@@ -444,7 +429,7 @@ ProtocolPacket::ProtocolPacket(ConnectionID connection_id)
// Serialization
RawMessagePtr ProtocolPacket::serializePacket() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// TODO(EZamakhov): Move header serialization to ProtocolHeader
// version is low byte
const uint8_t version_byte = packet_header_.version << 4;
@@ -541,7 +526,7 @@ bool ProtocolPacket::operator==(const ProtocolPacket& other) const {
}
void ProtocolPacket::HandleRawFirstFrameData(const uint8_t* message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
payload_size_ = 0;
const uint8_t* data = message;
uint32_t total_data_bytes = data[0] << 24;
@@ -553,7 +538,7 @@ void ProtocolPacket::HandleRawFirstFrameData(const uint8_t* message) {
RESULT_CODE ProtocolPacket::deserializePacket(const uint8_t* message,
const size_t messageSize) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN(message, RESULT_FAIL);
packet_header_.deserialize(message, messageSize);
const uint8_t offset = packet_header_.version == PROTOCOL_VERSION_1
@@ -630,8 +615,8 @@ uint8_t* ProtocolPacket::data() const {
}
void ProtocolPacket::set_total_data_bytes(size_t dataBytes) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Data bytes : " << dataBytes);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Data bytes : " << dataBytes);
if (dataBytes) {
delete[] packet_data_.data;
packet_data_.data = new (std::nothrow) uint8_t[dataBytes];
diff --git a/src/components/protocol_handler/src/service_status_update_handler.cc b/src/components/protocol_handler/src/service_status_update_handler.cc
index 7b2c67ea23..71d11bcf5b 100644
--- a/src/components/protocol_handler/src/service_status_update_handler.cc
+++ b/src/components/protocol_handler/src/service_status_update_handler.cc
@@ -3,7 +3,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ServiceStatusUpdateHandler")
+SDL_CREATE_LOG_VARIABLE("ServiceStatusUpdateHandler")
hmi_apis::Common_ServiceType::eType GetHMIServiceType(
protocol_handler::ServiceType service_type) {
@@ -30,7 +30,7 @@ void ServiceStatusUpdateHandler::OnServiceUpdate(
using namespace hmi_apis;
typedef utils::Optional<Common_ServiceStatusUpdateReason::eType>
UpdateReasonOptional;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto hmi_service_type = GetHMIServiceType(service_type);
switch (service_status) {
@@ -107,9 +107,8 @@ void ServiceStatusUpdateHandler::OnServiceUpdate(
update_reason);
}
default: {
- LOG4CXX_WARN(logger_,
- "Received unknown ServiceStatus: "
- << static_cast<int32_t>(service_status));
+ SDL_LOG_WARN("Received unknown ServiceStatus: "
+ << static_cast<int32_t>(service_status));
return;
}
}
diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
index 312ec88930..d5d68d9b83 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -146,8 +146,8 @@ typedef std::shared_ptr<
MockServiceStatusUpdateHandlerListenerPtr;
// custom action to call a member function with 6 arguments
-ACTION_P4(InvokeMemberFuncWithArg2, ptr, memberFunc, a, b) {
- (ptr->*memberFunc)(a, b);
+ACTION_P5(InvokeMemberFuncWithArg3, ptr, memberFunc, a, b, c) {
+ (ptr->*memberFunc)(a, b, c);
}
namespace {
@@ -311,10 +311,11 @@ class ProtocolHandlerImplTest : public ::testing::Test {
// Return sessions start success
WillOnce(DoAll(
NotifyTestAsyncWaiter(waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
context,
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// Expect send Ack with PROTECTION_OFF (on no Security Manager)
@@ -520,7 +521,7 @@ TEST_F(ProtocolHandlerImplTest,
WillRepeatedly(
DoAll(NotifyTestAsyncWaiter(&waiter),
SaveArg<2>(&service_type),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -528,10 +529,16 @@ TEST_F(ProtocolHandlerImplTest,
service_type,
HASH_ID_WRONG,
PROTECTION_OFF),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times += call_times;
// Expect send NAck
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .Times(call_times)
+ .WillRepeatedly(Return(true));
+
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
@@ -606,7 +613,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
WillRepeatedly(DoAll(
NotifyTestAsyncWaiter(&waiter),
SaveArg<2>(&service_type),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -614,10 +621,16 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
service_type,
HASH_ID_WRONG,
callback_protection_flag),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times += call_times;
// Expect send NAck with encryption OFF
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .Times(call_times)
+ .WillRepeatedly(Return(true));
+
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
@@ -676,7 +689,7 @@ TEST_F(ProtocolHandlerImplTest,
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -684,7 +697,8 @@ TEST_F(ProtocolHandlerImplTest,
start_service,
HASH_ID_WRONG,
PROTECTION_OFF),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -837,6 +851,9 @@ TEST_F(ProtocolHandlerImplTest,
rejected_param_list.push_back(protocol_handler::strings::video_codec);
EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .WillOnce(Return(true));
+ EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id2,
session_id2,
start_service,
@@ -844,7 +861,7 @@ TEST_F(ProtocolHandlerImplTest,
An<const BsonObject*>()))
.WillOnce(DoAll(
NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id2,
session_id2,
@@ -852,8 +869,9 @@ TEST_F(ProtocolHandlerImplTest,
start_service,
HASH_ID_WRONG,
PROTECTION_OFF),
- ByRef(rejected_param_list)),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ ByRef(rejected_param_list),
+ std::string()),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id1,
session_id1,
@@ -861,7 +879,8 @@ TEST_F(ProtocolHandlerImplTest,
start_service,
HASH_ID_WRONG,
PROTECTION_OFF),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
BsonObject bson_ack_params;
@@ -963,6 +982,9 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Audio_RejectByTransportType) {
.WillOnce(ReturnRef(video_service_transports));
// Expect send Ack
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .WillRepeatedly(Return(true));
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
@@ -1002,6 +1024,10 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Video_RejectByTransportType) {
.WillOnce(ReturnRef(video_service_transports));
// Expect send Ack
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .WillRepeatedly(Return(true));
+
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
@@ -1028,8 +1054,11 @@ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) {
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
- OnSessionEndedCallback(
- connection_id, session_id, An<uint32_t*>(), service))
+ OnSessionEndedCallback(connection_id,
+ session_id,
+ An<uint32_t*>(),
+ service,
+ An<std::string*>()))
.
// reject session start
WillOnce(
@@ -1038,6 +1067,10 @@ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) {
SetProtocolVersion2();
// Expect send NAck
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .WillRepeatedly(Return(true));
+
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_END_SERVICE_NACK, PROTECTION_OFF)))
@@ -1062,8 +1095,11 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) {
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
- OnSessionEndedCallback(
- connection_id, session_id, An<uint32_t*>(), service))
+ OnSessionEndedCallback(connection_id,
+ session_id,
+ An<uint32_t*>(),
+ service,
+ An<std::string*>()))
.
// return sessions start success
WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(connection_key)));
@@ -1120,7 +1156,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -1128,7 +1164,8 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
start_service,
HASH_ID_WRONG,
PROTECTION_OFF),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1191,7 +1228,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -1199,7 +1236,8 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
start_service,
HASH_ID_WRONG,
PROTECTION_OFF),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1261,10 +1299,11 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) {
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
context,
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1329,7 +1368,7 @@ TEST_F(ProtocolHandlerImplTest,
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -1337,7 +1376,8 @@ TEST_F(ProtocolHandlerImplTest,
start_service,
HASH_ID_WRONG,
PROTECTION_ON),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1420,10 +1460,11 @@ TEST_F(ProtocolHandlerImplTest,
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
context,
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
std::vector<int> services;
@@ -1516,7 +1557,7 @@ TEST_F(ProtocolHandlerImplTest,
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -1524,7 +1565,8 @@ TEST_F(ProtocolHandlerImplTest,
start_service,
HASH_ID_WRONG,
PROTECTION_ON),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// call new SSLContext creation
@@ -1629,7 +1671,7 @@ TEST_F(
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -1637,7 +1679,8 @@ TEST_F(
start_service,
HASH_ID_WRONG,
PROTECTION_ON),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// call new SSLContext creation
@@ -1740,7 +1783,7 @@ TEST_F(ProtocolHandlerImplTest,
// Return sessions start success
WillOnce(
DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg2(protocol_handler_impl.get(),
+ InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
&ProtocolHandler::NotifySessionStarted,
GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -1748,7 +1791,8 @@ TEST_F(ProtocolHandlerImplTest,
start_service,
HASH_ID_WRONG,
PROTECTION_ON),
- ByRef(empty_rejected_param_))));
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// call new SSLContext creation
@@ -2121,7 +2165,7 @@ TEST_F(ProtocolHandlerImplTest,
// A TransportUpdateEvent is also issued after Start Service ACK. We don't
// check it in this test case.
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2173,7 +2217,7 @@ TEST_F(ProtocolHandlerImplTest,
std::vector<int32_t> expected_video_service_transports;
expected_video_service_transports.push_back(1);
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2228,7 +2272,7 @@ TEST_F(ProtocolHandlerImplTest,
std::vector<int32_t> expected_video_service_transports;
expected_video_service_transports.push_back(2);
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2282,7 +2326,7 @@ TEST_F(
std::vector<int32_t> expected_video_service_transports;
expected_video_service_transports.push_back(2);
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2339,7 +2383,7 @@ TEST_F(ProtocolHandlerImplTest,
SetSecondaryTransportID(_, kDisabledSecondary))
.WillOnce(Return(dummy_st));
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2383,7 +2427,7 @@ TEST_F(ProtocolHandlerImplTest,
expected_video_service_transports.push_back(1);
expected_video_service_transports.push_back(2);
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2424,7 +2468,7 @@ TEST_F(
SetSecondaryTransportID(_, kDisabledSecondary))
.WillOnce(Return(dummy_st));
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2526,7 +2570,7 @@ TEST_F(ProtocolHandlerImplTest,
// TransportEventUpdate frame. Enable ProtocolVersionUsed() call and verify
// that transport_manager_mock will NOT receive another SendMessageToDevice()
// call.
- ON_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ ON_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillByDefault(Return(true));
#ifdef ENABLE_SECURITY
@@ -2585,7 +2629,7 @@ TEST_F(ProtocolHandlerImplTest, StartSessionAck_PrimaryTransportUSBHostMode) {
// A TransportUpdateEvent is also issued after Start Service ACK. We don't
// check it in this test case.
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifySecondaryTransportParamsInStartSessionAck(
@@ -2607,7 +2651,7 @@ TEST_F(ProtocolHandlerImplTest, StartSessionAck_CloudAppAuthTokenAvailable) {
// A TransportUpdateEvent is also issued after Start Service ACK. We don't
// check it in this test case.
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(Return(false));
VerifyCloudAppParamsInStartSessionAck(policy_id, auth_token);
@@ -2688,7 +2732,7 @@ TEST_F(ProtocolHandlerImplTest,
.WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
times++;
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
@@ -2809,7 +2853,7 @@ TEST_F(ProtocolHandlerImplTest,
.WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
times++;
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
@@ -2890,7 +2934,7 @@ TEST_F(ProtocolHandlerImplTest,
.WillOnce(Return(DataAccessor<SessionConnectionMap>(
session_connection_map_, session_connection_map_lock_ptr_)));
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
@@ -2961,7 +3005,7 @@ TEST_F(ProtocolHandlerImplTest,
.WillOnce(Return(DataAccessor<SessionConnectionMap>(
session_connection_map_, session_connection_map_lock_ptr_)));
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
@@ -3011,7 +3055,7 @@ TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_SUCCESS) {
transport_manager::ConnectionUID primary_connection_id = 123;
EXPECT_CALL(session_observer_mock,
- ProtocolVersionUsed(primary_connection_id, _, _))
+ ProtocolVersionUsed(primary_connection_id, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
@@ -3046,7 +3090,7 @@ TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_FAILURE) {
transport_manager::ConnectionUID primary_connection_id = 123;
EXPECT_CALL(session_observer_mock,
- ProtocolVersionUsed(primary_connection_id, _, _))
+ ProtocolVersionUsed(primary_connection_id, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
@@ -3510,7 +3554,7 @@ TEST_F(ProtocolHandlerImplTest,
SendEndServicePrivate_NoConnection_MessageNotSent) {
// Expect check connection with ProtocolVersionUsed
EXPECT_CALL(session_observer_mock,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(false));
// Expect not send End Service
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)).Times(0);
@@ -3529,7 +3573,7 @@ TEST_F(ProtocolHandlerImplTest,
// Expect check connection with ProtocolVersionUsed
EXPECT_CALL(session_observer_mock,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
// Expect send End Service
EXPECT_CALL(
@@ -3553,7 +3597,7 @@ TEST_F(ProtocolHandlerImplTest,
// Expect check connection with ProtocolVersionUsed
EXPECT_CALL(session_observer_mock,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(DoAll(SetArgReferee<2>(PROTOCOL_VERSION_1), Return(true)));
// Expect send End Service
EXPECT_CALL(transport_manager_mock,
@@ -3574,7 +3618,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest, SendHeartBeat_NoConnection_NotSent) {
// Expect check connection with ProtocolVersionUsed
EXPECT_CALL(session_observer_mock,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(false));
// Expect not send HeartBeat
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_)).Times(0);
@@ -3592,7 +3636,7 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeat_Successful) {
// Expect check connection with ProtocolVersionUsed
EXPECT_CALL(session_observer_mock,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(DoAll(SetArgReferee<2>(PROTOCOL_VERSION_3), Return(true)));
// Expect send HeartBeat
EXPECT_CALL(
@@ -3617,7 +3661,8 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_Successful) {
// Expect double check connection and protocol version with
// ProtocolVersionUsed
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(connection_id, _, _))
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(connection_id, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_3), Return(true)));
// Expect send HeartBeatAck
@@ -3646,7 +3691,8 @@ TEST_F(ProtocolHandlerImplTest,
// Expect two checks of connection and protocol version with
// ProtocolVersionUsed
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(connection_id, _, _))
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(connection_id, _, An<uint8_t&>()))
.Times(2)
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_1), Return(true)));
@@ -3823,7 +3869,8 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_PreVersion5) {
EXPECT_CALL(session_observer_mock, PairFromKey(connection_key, _, _))
.WillOnce(
DoAll(SetArgPointee<1>(connection_id), SetArgPointee<2>(session_id)));
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(connection_id, _, _))
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(connection_id, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_4), Return(true)));
@@ -3849,7 +3896,8 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_AfterVersion5) {
EXPECT_CALL(session_observer_mock, PairFromKey(connection_key, _, _))
.WillOnce(
DoAll(SetArgPointee<1>(connection_id), SetArgPointee<2>(session_id)));
- EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(connection_id, _, _))
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(connection_id, _, An<uint8_t&>()))
.WillRepeatedly(
DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
@@ -3866,6 +3914,256 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_AfterVersion5) {
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
+/*
+ * ProtocolHandler shall send StartServiceNAK with a reason param when starting
+ * a video/audio service if the service type is disallowed by the settings
+ */
+TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_DisallowedBySettings) {
+ const ServiceType service_type = kMobileNav;
+ const utils::SemanticVersion min_reason_param_version(5, 3, 0);
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock,
+ GetSSLContext(connection_key, service_type))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ AddConnection();
+
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> allowed_transports{"AOA_USB"};
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(allowed_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(allowed_transports));
+
+ // Expect check connection with ProtocolVersionUsed
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(
+ connection_id, NEW_SESSION_ID, An<utils::SemanticVersion&>()))
+ .WillOnce(
+ DoAll(SetArgReferee<2>(min_reason_param_version), Return(true)));
+
+ BsonObject bson_nack_params;
+ bson_object_initialize_default(&bson_nack_params);
+ // NAK reason param
+ std::string reason = "Service type: " + std::to_string(service_type) +
+ " disallowed by settings";
+ bson_object_put_string(&bson_nack_params,
+ protocol_handler::strings::reason,
+ const_cast<char*>(reason.c_str()));
+ std::vector<uint8_t> nack_params =
+ CreateVectorFromBsonObject(&bson_nack_params);
+ bson_object_deinitialize(&bson_nack_params);
+
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
+ PROTECTION_OFF,
+ connection_id,
+ Eq(nack_params))))
+ .WillOnce(Return(E_SUCCESS));
+
+ SendControlMessage(PROTECTION_OFF,
+ service_type,
+ NEW_SESSION_ID,
+ FRAME_DATA_START_SERVICE,
+ PROTOCOL_VERSION_5);
+
+ usleep(kAddSessionWaitTimeMs * kMicrosecondsInMillisecond);
+}
+
+/*
+ * ProtocolHandler shall send StartServiceNAK with a reason param on
+ * session_observer rejection Check protection flag OFF for all services from
+ * kControl to kBulk
+ */
+TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_SessionObserverReject) {
+ const std::vector<ServiceType> service_types{
+ kControl, kRpc, kAudio, kMobileNav, kBulk};
+
+ const int call_times = service_types.size();
+ const utils::SemanticVersion min_reason_param_version(5, 3, 0);
+ const std::string err_reason = "Unable to create new session";
+ AddConnection();
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock,
+ GetSSLContext(connection_key,
+ AnyOf(kControl, kRpc, kAudio, kMobileNav, kBulk)))
+ .WillRepeatedly(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+ ServiceType service_type;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .Times(call_times)
+ .WillRepeatedly(Return("TCP_WIFI"));
+
+ std::vector<std::string> allowed_transports{"TCP_WIFI"};
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .Times(call_times)
+ .WillRepeatedly(ReturnRef(allowed_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .Times(call_times)
+ .WillRepeatedly(ReturnRef(allowed_transports));
+
+ // Expect ConnectionHandler check
+ EXPECT_CALL(
+ session_observer_mock,
+ OnSessionStartedCallback(connection_id,
+ NEW_SESSION_ID,
+ AnyOf(kControl, kRpc, kAudio, kMobileNav, kBulk),
+ PROTECTION_OFF,
+ An<const BsonObject*>()))
+ .Times(call_times)
+ .
+ // Return sessions start rejection
+ WillRepeatedly(
+ DoAll(NotifyTestAsyncWaiter(&waiter),
+ SaveArg<2>(&service_type),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ &protocol_handler::ProtocolHandler::NotifySessionStarted,
+ GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ SESSION_START_REJECT,
+ service_type,
+ protocol_handler::HASH_ID_WRONG,
+ PROTECTION_OFF),
+ ByRef(empty_rejected_param_),
+ err_reason)));
+ times += call_times;
+
+ // Expect send NAck
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .Times(call_times)
+ .WillRepeatedly(
+ DoAll(SetArgReferee<2>(min_reason_param_version), Return(true)));
+
+ BsonObject bson_nack_params;
+ bson_object_initialize_default(&bson_nack_params);
+ // NAK reason param
+ bson_object_put_string(&bson_nack_params,
+ protocol_handler::strings::reason,
+ const_cast<char*>(err_reason.c_str()));
+ std::vector<uint8_t> nack_params =
+ CreateVectorFromBsonObject(&bson_nack_params);
+ bson_object_deinitialize(&bson_nack_params);
+
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
+ PROTECTION_OFF,
+ connection_id,
+ Eq(nack_params))))
+ .Times(call_times)
+
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times += call_times;
+
+ for (const ServiceType& service_type : service_types) {
+ SendControlMessage(PROTECTION_OFF,
+ service_type,
+ NEW_SESSION_ID,
+ FRAME_DATA_START_SERVICE,
+ PROTOCOL_VERSION_5);
+ }
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+/*
+ * ProtocolHandler shall send EndServiceNAK with a reason param if
+ * OnSessionEndedCallback returns an 0
+ */
+TEST_F(ProtocolHandlerImplTest,
+ EndSession_NACKReason_OnSessionEndedCallbackFailed) {
+ const utils::SemanticVersion min_reason_param_version(5, 3, 0);
+ std::string err_reason =
+ "Wrong hash_id for session " + std::to_string(session_id);
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ uint32_t times = 0;
+
+ AddSession(waiter, times);
+ const ServiceType service_type = kRpc;
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock,
+ GetSSLContext(connection_key, service_type))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ // Expect ConnectionHandler check
+ EXPECT_CALL(session_observer_mock,
+ OnSessionEndedCallback(connection_id,
+ session_id,
+ An<uint32_t*>(),
+ service_type,
+ An<std::string*>()))
+ .
+ // reject session start
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
+ SetArgPointee<4>(err_reason),
+ Return(SESSION_START_REJECT)));
+ times++;
+
+ // Expect send NAck
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
+ .WillOnce(
+ DoAll(SetArgReferee<2>(min_reason_param_version), Return(true)));
+
+ std::vector<std::string> rejected_param_list;
+ rejected_param_list.push_back(protocol_handler::strings::hash_id);
+
+ BsonObject bson_nack_params;
+ bson_object_initialize_default(&bson_nack_params);
+ // Rejected params
+ BsonArray bson_arr;
+ bson_array_initialize(&bson_arr, 1);
+ bson_array_add_string(&bson_arr,
+ const_cast<char*>(protocol_handler::strings::hash_id));
+ bson_object_put_array(
+ &bson_nack_params, protocol_handler::strings::rejected_params, &bson_arr);
+ // NAK reason param
+ bson_object_put_string(&bson_nack_params,
+ protocol_handler::strings::reason,
+ const_cast<char*>(err_reason.c_str()));
+
+ std::vector<uint8_t> nack_params =
+ CreateVectorFromBsonObject(&bson_nack_params);
+ bson_object_deinitialize(&bson_nack_params);
+
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_NACK,
+ PROTECTION_OFF,
+ connection_id,
+ Eq(nack_params))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
+ times++;
+
+ SendControlMessage(PROTECTION_OFF,
+ service_type,
+ session_id,
+ FRAME_DATA_END_SERVICE,
+ PROTOCOL_VERSION_5);
+
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+}
+
} // namespace protocol_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/resumption/src/last_state_impl.cc b/src/components/resumption/src/last_state_impl.cc
index 05c801d762..f34d793c49 100644
--- a/src/components/resumption/src/last_state_impl.cc
+++ b/src/components/resumption/src/last_state_impl.cc
@@ -37,23 +37,23 @@
namespace resumption {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+SDL_CREATE_LOG_VARIABLE("Resumption")
LastStateImpl::LastStateImpl(const std::string& app_storage_folder,
const std::string& app_info_storage)
: app_storage_folder_(app_storage_folder)
, app_info_storage_(app_info_storage) {
LoadFromFileSystem();
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
LastStateImpl::~LastStateImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SaveToFileSystem();
}
void LastStateImpl::SaveStateToFileSystem() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string styled_string;
{
@@ -64,14 +64,13 @@ void LastStateImpl::SaveStateToFileSystem() {
const std::vector<uint8_t> char_vector_pdata(styled_string.begin(),
styled_string.end());
DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_));
- LOG4CXX_INFO(logger_,
- "LastState::SaveStateToFileSystem[DEPRECATED] "
- << app_info_storage_ << styled_string);
+ SDL_LOG_INFO("LastState::SaveStateToFileSystem[DEPRECATED] "
+ << app_info_storage_ << styled_string);
DCHECK(file_system::Write(app_info_storage_, char_vector_pdata));
}
void LastStateImpl::SaveToFileSystem() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string styled_string;
{
@@ -82,8 +81,8 @@ void LastStateImpl::SaveToFileSystem() {
const std::vector<uint8_t> char_vector_pdata(styled_string.begin(),
styled_string.end());
DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_));
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"LastState::SaveToFileSystem " << app_info_storage_ << styled_string);
DCHECK(file_system::Write(app_info_storage_, char_vector_pdata));
}
@@ -94,17 +93,16 @@ void LastStateImpl::LoadFromFileSystem() {
utils::JsonReader reader;
if (result && reader.parse(buffer, &dictionary_)) {
- LOG4CXX_INFO(logger_,
- "Valid last state was found." << dictionary_.toStyledString());
+ SDL_LOG_INFO("Valid last state was found." << dictionary_.toStyledString());
return;
}
- LOG4CXX_WARN(logger_, "No valid last state was found.");
+ SDL_LOG_WARN("No valid last state was found.");
}
void LastStateImpl::RemoveFromFileSystem() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!file_system::DeleteFile(app_info_storage_)) {
- LOG4CXX_WARN(logger_, "Failed attempt to delete " << app_info_storage_);
+ SDL_LOG_WARN("Failed attempt to delete " << app_info_storage_);
}
}
diff --git a/src/components/resumption/src/last_state_wrapper_impl.cc b/src/components/resumption/src/last_state_wrapper_impl.cc
index 61b325f53b..54351395c3 100644
--- a/src/components/resumption/src/last_state_wrapper_impl.cc
+++ b/src/components/resumption/src/last_state_wrapper_impl.cc
@@ -34,7 +34,7 @@
namespace resumption {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+SDL_CREATE_LOG_VARIABLE("Resumption")
LastStateWrapperImpl::LastStateWrapperImpl(
std::shared_ptr<LastState> last_state)
@@ -42,7 +42,7 @@ LastStateWrapperImpl::LastStateWrapperImpl(
, lock_(std::make_shared<sync_primitives::Lock>()) {}
LastStateAccessor LastStateWrapperImpl::get_accessor() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return MutableDataAccessor<LastState>(*last_state_, lock_);
}
diff --git a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
index 47cc557976..ae0866705a 100644
--- a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
+++ b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
@@ -6,6 +6,8 @@
namespace security_manager {
+SDL_CREATE_LOG_VARIABLE("SecurityManager")
+
class CryptoManagerSettingsImpl : public CryptoManagerSettings {
public:
CryptoManagerSettingsImpl(const profile::Profile& profile,
@@ -19,8 +21,6 @@ class CryptoManagerSettingsImpl : public CryptoManagerSettings {
}
Protocol security_manager_protocol_name() const OVERRIDE {
- CREATE_LOGGERPTR_LOCAL(logger_, "SecurityManager")
-
const std::string& protocol_str = profile_.security_manager_protocol_name();
if (protocol_str == "TLSv1.0") {
return security_manager::TLSv1;
@@ -38,8 +38,8 @@ class CryptoManagerSettingsImpl : public CryptoManagerSettings {
return security_manager::DTLSv1;
}
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Unknown protocol: " << profile_.security_manager_protocol_name());
return static_cast<security_manager::Protocol>(-1);
}
diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc
index 48b3119bec..9ee820b19d 100644
--- a/src/components/security_manager/src/crypto_manager_impl.cc
+++ b/src/components/security_manager/src/crypto_manager_impl.cc
@@ -55,7 +55,7 @@
namespace security_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager")
+SDL_CREATE_LOG_VARIABLE("SecurityManager")
uint32_t CryptoManagerImpl::instance_count_ = 0;
sync_primitives::Lock CryptoManagerImpl::instance_lock_;
@@ -70,10 +70,9 @@ int debug_callback(int preverify_ok, X509_STORE_CTX* ctx) {
// and expiration cert dates will be checked by SDL
return 1;
}
- LOG4CXX_WARN(logger_,
- "Certificate verification failed with error "
- << error << " \"" << X509_verify_cert_error_string(error)
- << '"');
+ SDL_LOG_WARN("Certificate verification failed with error "
+ << error << " \"" << X509_verify_cert_error_string(error)
+ << '"');
}
return preverify_ok;
}
@@ -89,11 +88,11 @@ void free_ctx(SSL_CTX** ctx) {
CryptoManagerImpl::CryptoManagerImpl(
const std::shared_ptr<const CryptoManagerSettings> set)
: settings_(set), context_(NULL) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(instance_lock_);
instance_count_++;
if (instance_count_ == 1) {
- LOG4CXX_DEBUG(logger_, "Openssl engine initialization");
+ SDL_LOG_DEBUG("Openssl engine initialization");
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();
@@ -102,24 +101,24 @@ CryptoManagerImpl::CryptoManagerImpl(
}
CryptoManagerImpl::~CryptoManagerImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(instance_lock_);
- LOG4CXX_DEBUG(logger_, "Deinitilization");
+ SDL_LOG_DEBUG("Deinitialization");
if (!context_) {
- LOG4CXX_WARN(logger_, "Manager is not initialized");
+ SDL_LOG_WARN("Manager is not initialized");
} else {
SSL_CTX_free(context_);
}
instance_count_--;
if (instance_count_ == 0) {
- LOG4CXX_DEBUG(logger_, "Openssl engine deinitialization");
+ SDL_LOG_DEBUG("Openssl engine deinitialization");
EVP_cleanup();
ERR_free_strings();
}
}
bool CryptoManagerImpl::AreForceProtectionSettingsCorrect() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::vector<int>& forced_unprotected_services =
get_settings().force_unprotected_service();
const std::vector<int>& forced_protected_services =
@@ -140,24 +139,23 @@ bool CryptoManagerImpl::AreForceProtectionSettingsCorrect() const {
}
bool CryptoManagerImpl::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const Mode mode = get_settings().security_manager_mode();
if (!AreForceProtectionSettingsCorrect()) {
- LOG4CXX_DEBUG(logger_, "Force protection settings of ini file are wrong!");
+ SDL_LOG_DEBUG("Force protection settings of ini file are wrong!");
return false;
}
const bool is_server = (mode == SERVER);
if (is_server) {
- LOG4CXX_DEBUG(logger_, "Server mode");
+ SDL_LOG_DEBUG("Server mode");
} else {
- LOG4CXX_DEBUG(logger_, "Client mode");
+ SDL_LOG_DEBUG("Client mode");
}
- LOG4CXX_DEBUG(logger_,
- "Peer verification "
- << (get_settings().verify_peer() ? "enabled" : "disabled"));
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG("Peer verification "
+ << (get_settings().verify_peer() ? "enabled" : "disabled"));
+ SDL_LOG_DEBUG(
+
"CA certificate file is \"" << get_settings().ca_cert_path() << '"');
#if OPENSSL_VERSION_NUMBER < CONST_SSL_METHOD_MINIMAL_VERSION
@@ -168,22 +166,21 @@ bool CryptoManagerImpl::Init() {
switch (get_settings().security_manager_protocol_name()) {
case SSLv3:
#ifdef OPENSSL_NO_SSL3
- LOG4CXX_WARN(logger_, "OpenSSL does not support SSL3 protocol");
+ SDL_LOG_WARN("OpenSSL does not support SSL3 protocol");
return false;
#else
- LOG4CXX_DEBUG(logger_, "SSLv3 is used");
+ SDL_LOG_DEBUG("SSLv3 is used");
method = is_server ? SSLv3_server_method() : SSLv3_client_method();
break;
#endif
case TLSv1:
- LOG4CXX_DEBUG(logger_, "TLSv1 is used");
+ SDL_LOG_DEBUG("TLSv1 is used");
method = is_server ? TLSv1_server_method() : TLSv1_client_method();
break;
case TLSv1_1:
- LOG4CXX_DEBUG(logger_, "TLSv1_1 is used");
+ SDL_LOG_DEBUG("TLSv1_1 is used");
#if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"OpenSSL has no TLSv1.1 with version lower 1.0.1, set TLSv1.0");
method = is_server ? TLSv1_server_method() : TLSv1_client_method();
#else
@@ -191,10 +188,9 @@ bool CryptoManagerImpl::Init() {
#endif
break;
case TLSv1_2:
- LOG4CXX_DEBUG(logger_, "TLSv1_2 is used");
+ SDL_LOG_DEBUG("TLSv1_2 is used");
#if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"OpenSSL has no TLSv1.2 with version lower 1.0.1, set TLSv1.0");
method = is_server ? TLSv1_server_method() : TLSv1_client_method();
#else
@@ -202,13 +198,12 @@ bool CryptoManagerImpl::Init() {
#endif
break;
case DTLSv1:
- LOG4CXX_DEBUG(logger_, "DTLSv1 is used");
+ SDL_LOG_DEBUG("DTLSv1 is used");
method = is_server ? DTLSv1_server_method() : DTLSv1_client_method();
break;
default:
- LOG4CXX_ERROR(logger_,
- "Unknown protocol: "
- << get_settings().security_manager_protocol_name());
+ SDL_LOG_ERROR("Unknown protocol: "
+ << get_settings().security_manager_protocol_name());
return false;
}
if (context_) {
@@ -224,37 +219,34 @@ bool CryptoManagerImpl::Init() {
SaveCertificateData(get_settings().certificate_data());
if (get_settings().ciphers_list().empty()) {
- LOG4CXX_WARN(logger_, "Empty ciphers list");
+ SDL_LOG_WARN("Empty ciphers list");
} else {
- LOG4CXX_DEBUG(logger_, "Cipher list: " << get_settings().ciphers_list());
+ SDL_LOG_DEBUG("Cipher list: " << get_settings().ciphers_list());
if (!SSL_CTX_set_cipher_list(context_,
get_settings().ciphers_list().c_str())) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Could not set cipher list: " << get_settings().ciphers_list());
return false;
}
}
if (get_settings().ca_cert_path().empty()) {
- LOG4CXX_WARN(logger_, "Setting up empty CA certificate location");
+ SDL_LOG_WARN("Setting up empty CA certificate location");
}
- LOG4CXX_DEBUG(logger_, "Setting up CA certificate location");
+ SDL_LOG_DEBUG("Setting up CA certificate location");
const int result = SSL_CTX_load_verify_locations(
context_, NULL, get_settings().ca_cert_path().c_str());
if (!result) {
const unsigned long error = ERR_get_error();
UNUSED(error);
- LOG4CXX_WARN(logger_,
- "Wrong certificate file '"
- << get_settings().ca_cert_path() << "', err 0x" << std::hex
- << error << " \"" << ERR_reason_error_string(error)
- << '"');
+ SDL_LOG_WARN("Wrong certificate file '"
+ << get_settings().ca_cert_path() << "', err 0x" << std::hex
+ << error << " \"" << ERR_reason_error_string(error) << '"');
}
- LOG4CXX_DEBUG(logger_, "Setting up module certificate and private key");
+ SDL_LOG_DEBUG("Setting up module certificate and private key");
X509* module_certificate = LoadModuleCertificateFromFile();
utils::ScopeGuard certificate_guard =
@@ -266,7 +258,7 @@ bool CryptoManagerImpl::Init() {
UNUSED(key_guard);
if (!UpdateModuleCertificateData(module_certificate, module_key)) {
- LOG4CXX_WARN(logger_, "Failed to update module key and certificate");
+ SDL_LOG_WARN("Failed to update module key and certificate");
}
guard.Dismiss();
@@ -275,22 +267,21 @@ bool CryptoManagerImpl::Init() {
get_settings().verify_peer()
? SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT
: SSL_VERIFY_NONE;
- LOG4CXX_DEBUG(logger_,
- "Setting up peer verification in mode: " << verify_mode);
+ SDL_LOG_DEBUG("Setting up peer verification in mode: " << verify_mode);
SSL_CTX_set_verify(context_, verify_mode, &debug_callback);
return true;
}
bool CryptoManagerImpl::OnCertificateUpdated(const std::string& data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(crypto_manager_lock_);
if (!context_) {
- LOG4CXX_WARN(logger_, "Not initialized");
+ SDL_LOG_WARN("Not initialized");
return false;
}
if (!SaveCertificateData(data)) {
- LOG4CXX_ERROR(logger_, "Failed to save certificate data");
+ SDL_LOG_ERROR("Failed to save certificate data");
return false;
}
@@ -308,7 +299,7 @@ bool CryptoManagerImpl::OnCertificateUpdated(const std::string& data) {
}
SSLContext* CryptoManagerImpl::CreateSSLContext() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(crypto_manager_lock_);
if (NULL == context_) {
return NULL;
@@ -343,17 +334,17 @@ std::string CryptoManagerImpl::LastError() const {
bool CryptoManagerImpl::IsCertificateUpdateRequired(
const time_t system_time, const time_t certificates_time) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const double seconds = difftime(certificates_time, system_time);
- LOG4CXX_DEBUG(
- logger_, "Certificate UTC time: " << asctime(gmtime(&certificates_time)));
+ SDL_LOG_DEBUG(
+ "Certificate UTC time: " << asctime(gmtime(&certificates_time)));
- LOG4CXX_DEBUG(logger_, "Host UTC time: " << asctime(gmtime(&system_time)));
- LOG4CXX_DEBUG(logger_, "Seconds before expiration: " << seconds);
+ SDL_LOG_DEBUG("Host UTC time: " << asctime(gmtime(&system_time)));
+ SDL_LOG_DEBUG("Seconds before expiration: " << seconds);
if (seconds < 0) {
- LOG4CXX_WARN(logger_, "Certificate is already expired.");
+ SDL_LOG_WARN("Certificate is already expired.");
return true;
}
@@ -367,10 +358,10 @@ const CryptoManagerSettings& CryptoManagerImpl::get_settings() const {
bool CryptoManagerImpl::SaveCertificateData(
const std::string& cert_data) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (cert_data.empty()) {
- LOG4CXX_WARN(logger_, "Empty certificate");
+ SDL_LOG_WARN("Empty certificate");
return false;
}
@@ -382,7 +373,7 @@ bool CryptoManagerImpl::SaveCertificateData(
X509* cert = NULL;
if (!PEM_read_bio_X509(bio_cert, &cert, 0, 0)) {
- LOG4CXX_WARN(logger_, "Could not read certificate data: " << LastError());
+ SDL_LOG_WARN("Could not read certificate data: " << LastError());
return false;
}
@@ -390,14 +381,14 @@ bool CryptoManagerImpl::SaveCertificateData(
UNUSED(cert_guard);
if (1 != BIO_reset(bio_cert)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Unabled to reset BIO in order to read private key, " << LastError());
}
EVP_PKEY* pkey = NULL;
if (!PEM_read_bio_PrivateKey(bio_cert, &pkey, 0, 0)) {
- LOG4CXX_WARN(logger_, "Could not read private key data: " << LastError());
+ SDL_LOG_WARN("Could not read private key data: " << LastError());
return false;
}
@@ -409,38 +400,37 @@ bool CryptoManagerImpl::SaveCertificateData(
bool CryptoManagerImpl::UpdateModuleCertificateData(X509* certificate,
EVP_PKEY* key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (certificate) {
if (!SSL_CTX_use_certificate(context_, certificate)) {
- LOG4CXX_WARN(logger_, "Could not use certificate: " << LastError());
+ SDL_LOG_WARN("Could not use certificate: " << LastError());
return false;
}
}
if (key) {
if (!SSL_CTX_use_PrivateKey(context_, key)) {
- LOG4CXX_ERROR(logger_, "Could not use key: " << LastError());
+ SDL_LOG_ERROR("Could not use key: " << LastError());
return false;
}
if (!SSL_CTX_check_private_key(context_)) {
- LOG4CXX_ERROR(logger_, "Private key is invalid: " << LastError());
+ SDL_LOG_ERROR("Private key is invalid: " << LastError());
return false;
}
}
- LOG4CXX_DEBUG(logger_, "Certificate and key are successfully updated");
+ SDL_LOG_DEBUG("Certificate and key are successfully updated");
return true;
}
X509* CryptoManagerImpl::LoadModuleCertificateFromFile() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string cert_path = get_settings().module_cert_path();
BIO* bio_cert = BIO_new_file(cert_path.c_str(), "r");
if (!bio_cert) {
- LOG4CXX_WARN(logger_,
- "Failed to open " << cert_path << " file: " << LastError());
+ SDL_LOG_WARN("Failed to open " << cert_path << " file: " << LastError());
return NULL;
}
@@ -449,24 +439,21 @@ X509* CryptoManagerImpl::LoadModuleCertificateFromFile() {
X509* module_certificate = NULL;
if (!PEM_read_bio_X509(bio_cert, &module_certificate, NULL, NULL)) {
- LOG4CXX_ERROR(logger_,
- "Failed to read certificate data from file: " << LastError());
+ SDL_LOG_ERROR("Failed to read certificate data from file: " << LastError());
return NULL;
}
- LOG4CXX_DEBUG(logger_,
- "Module certificate was loaded: " << module_certificate);
+ SDL_LOG_DEBUG("Module certificate was loaded: " << module_certificate);
return module_certificate;
}
EVP_PKEY* CryptoManagerImpl::LoadModulePrivateKeyFromFile() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string key_path = get_settings().module_key_path();
BIO* bio_key = BIO_new_file(key_path.c_str(), "r");
if (!bio_key) {
- LOG4CXX_WARN(logger_,
- "Failed to open " << key_path << " file: " << LastError());
+ SDL_LOG_WARN("Failed to open " << key_path << " file: " << LastError());
return NULL;
}
@@ -475,28 +462,26 @@ EVP_PKEY* CryptoManagerImpl::LoadModulePrivateKeyFromFile() {
EVP_PKEY* module_key = NULL;
if (!PEM_read_bio_PrivateKey(bio_key, &module_key, NULL, NULL)) {
- LOG4CXX_ERROR(logger_,
- "Failed to read private key data from file: " << LastError());
+ SDL_LOG_ERROR("Failed to read private key data from file: " << LastError());
return NULL;
}
- LOG4CXX_DEBUG(logger_, "Module private key was loaded: " << module_key);
+ SDL_LOG_DEBUG("Module private key was loaded: " << module_key);
return module_key;
}
bool CryptoManagerImpl::SaveModuleCertificateToFile(X509* certificate) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!certificate) {
- LOG4CXX_WARN(logger_, "Empty certificate. Saving will be skipped");
+ SDL_LOG_WARN("Empty certificate. Saving will be skipped");
return false;
}
const std::string cert_path = get_settings().module_cert_path();
BIO* bio_cert = BIO_new_file(cert_path.c_str(), "w");
if (!bio_cert) {
- LOG4CXX_ERROR(logger_,
- "Failed to open " << cert_path << " file: " << LastError());
+ SDL_LOG_ERROR("Failed to open " << cert_path << " file: " << LastError());
return false;
}
@@ -504,8 +489,7 @@ bool CryptoManagerImpl::SaveModuleCertificateToFile(X509* certificate) const {
UNUSED(bio_guard);
if (!PEM_write_bio_X509(bio_cert, certificate)) {
- LOG4CXX_ERROR(logger_,
- "Failed to write certificate to file: " << LastError());
+ SDL_LOG_ERROR("Failed to write certificate to file: " << LastError());
return false;
}
@@ -513,18 +497,17 @@ bool CryptoManagerImpl::SaveModuleCertificateToFile(X509* certificate) const {
}
bool CryptoManagerImpl::SaveModuleKeyToFile(EVP_PKEY* key) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!key) {
- LOG4CXX_WARN(logger_, "Empty private key. Saving will be skipped");
+ SDL_LOG_WARN("Empty private key. Saving will be skipped");
return false;
}
const std::string key_path = get_settings().module_key_path();
BIO* bio_key = BIO_new_file(key_path.c_str(), "w");
if (!bio_key) {
- LOG4CXX_ERROR(logger_,
- "Failed to open " << key_path << " file: " << LastError());
+ SDL_LOG_ERROR("Failed to open " << key_path << " file: " << LastError());
return false;
}
@@ -532,7 +515,7 @@ bool CryptoManagerImpl::SaveModuleKeyToFile(EVP_PKEY* key) const {
UNUSED(bio_guard);
if (!PEM_write_bio_PrivateKey(bio_key, key, NULL, NULL, 0, NULL, NULL)) {
- LOG4CXX_ERROR(logger_, "Failed to write key to file: " << LastError());
+ SDL_LOG_ERROR("Failed to write key to file: " << LastError());
return false;
}
diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc
index 5ae8c35084..50a58e0486 100644
--- a/src/components/security_manager/src/security_manager_impl.cc
+++ b/src/components/security_manager/src/security_manager_impl.cc
@@ -42,7 +42,7 @@
namespace security_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager")
+SDL_CREATE_LOG_VARIABLE("SecurityManager")
static const char* kErrId = "id";
static const char* kErrText = "text";
@@ -76,7 +76,7 @@ void SecurityManagerImpl::OnMessageReceived(
if (!result) {
// result will be false only if data less then query header
const std::string error_text("Incorrect message received");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
SendInternalError(
message->connection_key(), ERROR_INVALID_QUERY_SIZE, error_text);
return;
@@ -93,7 +93,7 @@ void SecurityManagerImpl::OnMobileMessageSent(
void SecurityManagerImpl::set_session_observer(
protocol_handler::SessionObserver* observer) {
if (!observer) {
- LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to SessionObserver.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to SessionObserver.");
return;
}
session_observer_ = observer;
@@ -102,7 +102,7 @@ void SecurityManagerImpl::set_session_observer(
void SecurityManagerImpl::set_protocol_handler(
protocol_handler::ProtocolHandler* handler) {
if (!handler) {
- LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to ProtocolHandler.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to ProtocolHandler.");
return;
}
protocol_handler_ = handler;
@@ -110,7 +110,7 @@ void SecurityManagerImpl::set_protocol_handler(
void SecurityManagerImpl::set_crypto_manager(CryptoManager* crypto_manager) {
if (!crypto_manager) {
- LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to CryptoManager.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to CryptoManager.");
return;
}
crypto_manager_ = crypto_manager;
@@ -118,10 +118,10 @@ void SecurityManagerImpl::set_crypto_manager(CryptoManager* crypto_manager) {
void SecurityManagerImpl::Handle(const SecurityMessage message) {
DCHECK(message);
- LOG4CXX_INFO(logger_, "Received Security message from Mobile side");
+ SDL_LOG_INFO("Received Security message from Mobile side");
if (!crypto_manager_) {
const std::string error_text("Invalid (NULL) CryptoManager.");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
SendInternalError(
message->get_connection_key(), ERROR_NOT_SUPPORTED, error_text);
return;
@@ -129,18 +129,18 @@ void SecurityManagerImpl::Handle(const SecurityMessage message) {
switch (message->get_header().query_id) {
case SecurityQuery::SEND_HANDSHAKE_DATA:
if (!ProcessHandshakeData(message)) {
- LOG4CXX_ERROR(logger_, "Process HandshakeData failed");
+ SDL_LOG_ERROR("Process HandshakeData failed");
}
break;
case SecurityQuery::SEND_INTERNAL_ERROR:
if (!ProcessInternalError(message)) {
- LOG4CXX_ERROR(logger_, "Processing income InternalError failed");
+ SDL_LOG_ERROR("Processing income InternalError failed");
}
break;
default: {
// SecurityQuery::InvalidQuery
const std::string error_text("Unknown query identifier.");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
SendInternalError(message->get_connection_key(),
ERROR_INVALID_QUERY_ID,
error_text,
@@ -151,7 +151,7 @@ void SecurityManagerImpl::Handle(const SecurityMessage message) {
security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext(
const uint32_t& connection_key, ContextCreationStrategy cc_strategy) {
- LOG4CXX_INFO(logger_, "ProtectService processing");
+ SDL_LOG_INFO("ProtectService processing");
DCHECK(session_observer_);
DCHECK(crypto_manager_);
@@ -169,7 +169,7 @@ security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext(
crypto_manager_->CreateSSLContext();
if (!ssl_context) {
const std::string error_text("CryptoManager could not create SSL context.");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
// Generate response query and post to security_messages_
SendInternalError(connection_key, ERROR_INTERNAL, error_text);
return NULL;
@@ -185,13 +185,12 @@ security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext(
}
DCHECK(session_observer_->GetSSLContext(connection_key,
protocol_handler::kControl));
- LOG4CXX_DEBUG(logger_,
- "Set SSL context to connection_key " << connection_key);
+ SDL_LOG_DEBUG("Set SSL context to connection_key " << connection_key);
return ssl_context;
}
void SecurityManagerImpl::PostponeHandshake(const uint32_t connection_key) {
- LOG4CXX_TRACE(logger_, "Handshake postponed");
+ SDL_LOG_TRACE("Handshake postponed");
sync_primitives::AutoLock lock(connections_lock_);
if (waiting_for_certificate_) {
awaiting_certificate_connections_.insert(connection_key);
@@ -202,24 +201,21 @@ void SecurityManagerImpl::PostponeHandshake(const uint32_t connection_key) {
}
void SecurityManagerImpl::ResumeHandshake(uint32_t connection_key) {
- LOG4CXX_TRACE(logger_, "Handshake resumed");
+ SDL_LOG_TRACE("Handshake resumed");
security_manager::SSLContext* ssl_context =
CreateSSLContext(connection_key, kForceRecreation);
if (!ssl_context) {
- LOG4CXX_WARN(logger_,
- "Unable to resume handshake. No SSL context for key "
- << connection_key);
+ SDL_LOG_WARN("Unable to resume handshake. No SSL context for key "
+ << connection_key);
return;
}
- LOG4CXX_DEBUG(logger_,
- "Connection key : "
- << connection_key
- << " is waiting for certificate: " << std::boolalpha
- << waiting_for_certificate_ << " and has certificate: "
- << ssl_context->HasCertificate());
+ SDL_LOG_DEBUG("Connection key : "
+ << connection_key << " is waiting for certificate: "
+ << std::boolalpha << waiting_for_certificate_
+ << " and has certificate: " << ssl_context->HasCertificate());
ssl_context->ResetConnection();
if (!waiting_for_certificate_ && !ssl_context->HasCertificate()) {
@@ -233,7 +229,7 @@ void SecurityManagerImpl::ResumeHandshake(uint32_t connection_key) {
void SecurityManagerImpl::StartHandshake(uint32_t connection_key) {
DCHECK(session_observer_);
- LOG4CXX_INFO(logger_, "StartHandshake: connection_key " << connection_key);
+ SDL_LOG_INFO("StartHandshake: connection_key " << connection_key);
security_manager::SSLContext* ssl_context = session_observer_->GetSSLContext(
connection_key, protocol_handler::kControl);
@@ -241,14 +237,14 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) {
const std::string error_text(
"StartHandshake failed, "
"connection is not protected");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
SendInternalError(connection_key, ERROR_INTERNAL, error_text);
NotifyListenersOnHandshakeDone(connection_key,
SSLContext::Handshake_Result_Fail);
return;
}
if (!ssl_context->HasCertificate()) {
- LOG4CXX_ERROR(logger_, "Security certificate is absent");
+ SDL_LOG_ERROR("Security certificate is absent");
sync_primitives::AutoLock lock(waiters_lock_);
waiting_for_certificate_ = true;
NotifyOnCertificateUpdateRequired();
@@ -269,11 +265,10 @@ bool SecurityManagerImpl::IsSystemTimeProviderReady() const {
void SecurityManagerImpl::ProceedHandshake(
security_manager::SSLContext* ssl_context, uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!ssl_context) {
- LOG4CXX_WARN(logger_,
- "Unable to process handshake. No SSL context for key "
- << connection_key);
+ SDL_LOG_WARN("Unable to process handshake. No SSL context for key "
+ << connection_key);
return;
}
@@ -285,14 +280,14 @@ void SecurityManagerImpl::ProceedHandshake(
time_t cert_due_date;
if (!ssl_context->GetCertificateDueDate(cert_due_date)) {
- LOG4CXX_ERROR(logger_, "Failed to get certificate due date!");
+ SDL_LOG_ERROR("Failed to get certificate due date!");
PostponeHandshake(connection_key);
return;
}
if (crypto_manager_->IsCertificateUpdateRequired(
system_time_handler_->GetUTCTime(), cert_due_date)) {
- LOG4CXX_DEBUG(logger_, "Host certificate update required");
+ SDL_LOG_DEBUG("Host certificate update required");
if (helpers::in_range(awaiting_certificate_connections_, connection_key)) {
NotifyListenersOnHandshakeDone(connection_key,
SSLContext::Handshake_Result_CertExpired);
@@ -319,7 +314,7 @@ void SecurityManagerImpl::ProceedHandshake(
ssl_context->StartHandshake(&data, &data_size);
if (security_manager::SSLContext::Handshake_Result_Success != result) {
const std::string error_text("StartHandshake failed, handshake step fail");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
SendInternalError(connection_key, ERROR_INTERNAL, error_text);
NotifyListenersOnHandshakeDone(connection_key,
SSLContext::Handshake_Result_Fail);
@@ -333,15 +328,14 @@ void SecurityManagerImpl::ProceedHandshake(
bool SecurityManagerImpl::IsCertificateUpdateRequired(
const uint32_t connection_key) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
security_manager::SSLContext* ssl_context =
CreateSSLContext(connection_key, kUseExisting);
DCHECK_OR_RETURN(ssl_context, true);
- LOG4CXX_DEBUG(logger_,
- "Set SSL context to connection_key " << connection_key);
+ SDL_LOG_DEBUG("Set SSL context to connection_key " << connection_key);
time_t cert_due_date;
if (!ssl_context->GetCertificateDueDate(cert_due_date)) {
- LOG4CXX_ERROR(logger_, "Failed to get certificate due date!");
+ SDL_LOG_ERROR("Failed to get certificate due date!");
return true;
}
return crypto_manager_->IsCertificateUpdateRequired(
@@ -350,8 +344,7 @@ bool SecurityManagerImpl::IsCertificateUpdateRequired(
void SecurityManagerImpl::AddListener(SecurityManagerListener* const listener) {
if (!listener) {
- LOG4CXX_ERROR(logger_,
- "Invalid (NULL) pointer to SecurityManagerListener.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to SecurityManagerListener.");
return;
}
listeners_.push_back(listener);
@@ -360,15 +353,14 @@ void SecurityManagerImpl::AddListener(SecurityManagerListener* const listener) {
void SecurityManagerImpl::RemoveListener(
SecurityManagerListener* const listener) {
if (!listener) {
- LOG4CXX_ERROR(logger_,
- "Invalid (NULL) pointer to SecurityManagerListener.");
+ SDL_LOG_ERROR("Invalid (NULL) pointer to SecurityManagerListener.");
return;
}
listeners_.remove(listener);
}
bool SecurityManagerImpl::OnCertificateUpdated(const std::string& data) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(waiters_lock_);
waiting_for_certificate_ = false;
@@ -384,7 +376,7 @@ bool SecurityManagerImpl::OnCertificateUpdated(const std::string& data) {
}
void SecurityManagerImpl::OnSystemTimeArrived(const time_t utc_time) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(waiters_lock_);
waiting_for_time_ = false;
@@ -399,7 +391,7 @@ void SecurityManagerImpl::OnSystemTimeArrived(const time_t utc_time) {
}
void SecurityManagerImpl::OnSystemTimeFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(waiters_lock_);
waiting_for_time_ = false;
@@ -411,9 +403,9 @@ void SecurityManagerImpl::OnSystemTimeFailed() {
}
void SecurityManagerImpl::ProcessFailedPTU() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (listeners_.empty()) {
- LOG4CXX_DEBUG(logger_, "listeners arrays IS EMPTY!");
+ SDL_LOG_DEBUG("listeners arrays IS EMPTY!");
return;
}
@@ -427,7 +419,7 @@ void SecurityManagerImpl::ProcessFailedPTU() {
for (auto& listener : listeners_to_remove) {
auto it = std::find(listeners_.begin(), listeners_.end(), listener);
DCHECK(it != listeners_.end());
- LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it);
+ SDL_LOG_DEBUG("Destroying listener: " << *it);
delete (*it);
listeners_.erase(it);
}
@@ -435,7 +427,7 @@ void SecurityManagerImpl::ProcessFailedPTU() {
#ifdef EXTERNAL_PROPRIETARY_MODE
void SecurityManagerImpl::ProcessFailedCertDecrypt() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
sync_primitives::AutoLock lock(waiters_lock_);
waiting_for_certificate_ = false;
@@ -451,7 +443,7 @@ void SecurityManagerImpl::ProcessFailedCertDecrypt() {
for (auto& listener : listeners_to_remove) {
auto it = std::find(listeners_.begin(), listeners_.end(), listener);
DCHECK(it != listeners_.end());
- LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it);
+ SDL_LOG_DEBUG("Destroying listener: " << *it);
delete (*it);
listeners_.erase(it);
}
@@ -462,11 +454,11 @@ void SecurityManagerImpl::ProcessFailedCertDecrypt() {
void SecurityManagerImpl::NotifyListenersOnHandshakeDone(
const uint32_t& connection_key, SSLContext::HandshakeResult error) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::list<SecurityManagerListener*>::iterator it = listeners_.begin();
while (it != listeners_.end()) {
if ((*it)->OnHandshakeDone(connection_key, error)) {
- LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it);
+ SDL_LOG_DEBUG("Destroying listener: " << *it);
delete (*it);
it = listeners_.erase(it);
} else {
@@ -476,7 +468,7 @@ void SecurityManagerImpl::NotifyListenersOnHandshakeDone(
}
void SecurityManagerImpl::NotifyOnCertificateUpdateRequired() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::list<SecurityManagerListener*>::iterator it = listeners_.begin();
while (it != listeners_.end()) {
(*it)->OnCertificateUpdateRequired();
@@ -489,11 +481,11 @@ void SecurityManagerImpl::ResetPendingSystemTimeRequests() {
}
void SecurityManagerImpl::NotifyListenersOnGetSystemTimeFailed() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::list<SecurityManagerListener*>::iterator it = listeners_.begin();
while (it != listeners_.end()) {
if ((*it)->OnGetSystemTimeFailed()) {
- LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it);
+ SDL_LOG_DEBUG("Destroying listener: " << *it);
delete (*it);
it = listeners_.erase(it);
} else {
@@ -503,12 +495,12 @@ void SecurityManagerImpl::NotifyListenersOnGetSystemTimeFailed() {
}
bool SecurityManagerImpl::IsPolicyCertificateDataEmpty() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string certificate_data;
for (auto it = listeners_.begin(); it != listeners_.end(); ++it) {
if ((*it)->GetPolicyCertificateData(certificate_data)) {
- LOG4CXX_DEBUG(logger_, "Certificate data received from listener");
+ SDL_LOG_DEBUG("Certificate data received from listener");
return certificate_data.empty();
}
}
@@ -517,20 +509,20 @@ bool SecurityManagerImpl::IsPolicyCertificateDataEmpty() {
bool SecurityManagerImpl::ProcessHandshakeData(
const SecurityMessage& inMessage) {
- LOG4CXX_INFO(logger_, "SendHandshakeData processing");
+ SDL_LOG_INFO("SendHandshakeData processing");
DCHECK(inMessage);
DCHECK(inMessage->get_header().query_id ==
SecurityQuery::SEND_HANDSHAKE_DATA);
const uint32_t seqNumber = inMessage->get_header().seq_number;
const uint32_t connection_key = inMessage->get_connection_key();
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Received " << inMessage->get_data_size() << " bytes handshake data ");
if (!inMessage->get_data_size()) {
const std::string error_text("SendHandshakeData: null arguments size.");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
SendInternalError(
connection_key, ERROR_INVALID_QUERY_SIZE, error_text, seqNumber);
return false;
@@ -540,7 +532,7 @@ bool SecurityManagerImpl::ProcessHandshakeData(
connection_key, protocol_handler::kControl);
if (!sslContext) {
const std::string error_text("SendHandshakeData: No ssl context.");
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
SendInternalError(
connection_key, ERROR_SERVICE_NOT_PROTECTED, error_text, seqNumber);
NotifyListenersOnHandshakeDone(connection_key,
@@ -557,8 +549,7 @@ bool SecurityManagerImpl::ProcessHandshakeData(
if (handshake_result == SSLContext::Handshake_Result_AbnormalFail) {
// Do not return handshake data on AbnormalFail or null returned values
const std::string error_text(sslContext->LastError());
- LOG4CXX_ERROR(logger_,
- "SendHandshakeData: Handshake failed: " << error_text);
+ SDL_LOG_ERROR("SendHandshakeData: Handshake failed: " << error_text);
SendInternalError(
connection_key, ERROR_SSL_INVALID_DATA, error_text, seqNumber);
NotifyListenersOnHandshakeDone(connection_key,
@@ -568,12 +559,12 @@ bool SecurityManagerImpl::ProcessHandshakeData(
}
if (sslContext->IsInitCompleted()) {
// On handshake success
- LOG4CXX_DEBUG(logger_, "SSL initialization finished success.");
+ SDL_LOG_DEBUG("SSL initialization finished success.");
NotifyListenersOnHandshakeDone(connection_key,
SSLContext::Handshake_Result_Success);
} else if (handshake_result != SSLContext::Handshake_Result_Success) {
// On handshake fail
- LOG4CXX_WARN(logger_, "SSL initialization finished with fail.");
+ SDL_LOG_WARN("SSL initialization finished with fail.");
NotifyListenersOnHandshakeDone(connection_key, handshake_result);
}
@@ -588,17 +579,16 @@ bool SecurityManagerImpl::ProcessInternalError(
const SecurityMessage& inMessage) {
std::string str = inMessage->get_json_message();
const uint32_t connection_key = inMessage->get_connection_key();
- LOG4CXX_INFO(logger_, "Received InternalError with Json message" << str);
+ SDL_LOG_INFO("Received InternalError with Json message" << str);
Json::Value root;
utils::JsonReader reader;
if (!reader.parse(str, &root)) {
- LOG4CXX_DEBUG(logger_, "Json parsing fails.");
+ SDL_LOG_DEBUG("Json parsing fails.");
return false;
}
uint8_t id = root[kErrId].asInt();
- LOG4CXX_DEBUG(logger_,
- "Received InternalError id " << std::to_string(id) << ", text: "
+ SDL_LOG_DEBUG("Received InternalError id " << std::to_string(id) << ", text: "
<< root[kErrText].asString());
if (ERROR_SSL_INVALID_DATA == id || ERROR_NOT_SUPPORTED == id) {
NotifyListenersOnHandshakeDone(connection_key,
@@ -618,7 +608,7 @@ void SecurityManagerImpl::SendHandshakeBinData(const uint32_t connection_key,
const SecurityQuery query =
SecurityQuery(header, connection_key, data, data_size);
SendQuery(query, connection_key);
- LOG4CXX_DEBUG(logger_, "Sent " << data_size << " bytes handshake data ");
+ SDL_LOG_DEBUG("Sent " << data_size << " bytes handshake data ");
}
void SecurityManagerImpl::SendInternalError(const uint32_t connection_key,
@@ -644,8 +634,7 @@ void SecurityManagerImpl::SendInternalError(const uint32_t connection_key,
const SecurityQuery query(
header, connection_key, &data_sending[0], data_sending.size());
SendQuery(query, connection_key);
- LOG4CXX_DEBUG(logger_,
- "Sent Internal error id " << static_cast<int>(error_id)
+ SDL_LOG_DEBUG("Sent Internal error id " << static_cast<int>(error_id)
<< " : \"" << error_text << "\".");
}
diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc
index d5c892c07a..5d151e854a 100644
--- a/src/components/security_manager/src/ssl_context_impl.cc
+++ b/src/components/security_manager/src/ssl_context_impl.cc
@@ -46,7 +46,7 @@
namespace security_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager")
+SDL_CREATE_LOG_VARIABLE("SecurityManager")
CryptoManagerImpl::SSLContextImpl::SSLContextImpl(SSL* conn,
Mode mode,
@@ -78,7 +78,7 @@ bool CryptoManagerImpl::SSLContextImpl::IsInitCompleted() const {
SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::StartHandshake(
const uint8_t** const out_data, size_t* out_data_size) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
is_handshake_pending_ = true;
return DoHandshakeStep(NULL, 0, out_data, out_data_size);
}
@@ -182,40 +182,38 @@ const std::string CryptoManagerImpl::SSLContextImpl::RemoveDisallowedInfo(
void CryptoManagerImpl::SSLContextImpl::PrintCertData(
X509* cert, const std::string& cert_owner) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!cert) {
- LOG4CXX_DEBUG(logger_, "Empty certificate data");
+ SDL_LOG_DEBUG("Empty certificate data");
return;
}
std::string subj = RemoveDisallowedInfo(X509_get_subject_name(cert));
if (!subj.empty()) {
std::replace(subj.begin(), subj.end(), '/', ' ');
- LOG4CXX_DEBUG(logger_, cert_owner << " subject:" << subj);
+ SDL_LOG_DEBUG(cert_owner << " subject:" << subj);
}
std::string issuer = RemoveDisallowedInfo(X509_get_issuer_name(cert));
if (!issuer.empty()) {
std::replace(issuer.begin(), issuer.end(), '/', ' ');
- LOG4CXX_DEBUG(logger_, cert_owner << " issuer:" << issuer);
+ SDL_LOG_DEBUG(cert_owner << " issuer:" << issuer);
}
ASN1_TIME* not_before = X509_get_notBefore(cert);
if (not_before) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"Start date: " << static_cast<unsigned char*>(not_before->data));
}
ASN1_TIME* not_after = X509_get_notAfter(cert);
if (not_after) {
- LOG4CXX_DEBUG(logger_,
- "End date: " << static_cast<unsigned char*>(not_after->data));
+ SDL_LOG_DEBUG("End date: " << static_cast<unsigned char*>(not_after->data));
}
}
void CryptoManagerImpl::SSLContextImpl::PrintCertInfo() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
PrintCertData(SSL_get_certificate(connection_), "HU's");
STACK_OF(X509)* peer_certs = SSL_get_peer_cert_chain(connection_);
@@ -227,7 +225,7 @@ void CryptoManagerImpl::SSLContextImpl::PrintCertInfo() {
SSLContext::HandshakeResult
CryptoManagerImpl::SSLContextImpl::CheckCertContext() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
X509* cert = SSL_get_peer_certificate(connection_);
if (!cert) {
// According to the openssl documentation the peer certificate
@@ -244,24 +242,20 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() {
const double end_seconds = difftime(end, hsh_context_.system_time);
if (start_seconds < 0) {
- LOG4CXX_ERROR(logger_,
- "Certificate is not yet valid. Time before validity "
- << start_seconds << " seconds");
+ SDL_LOG_ERROR("Certificate is not yet valid. Time before validity "
+ << start_seconds << " seconds");
return Handshake_Result_NotYetValid;
} else {
- LOG4CXX_DEBUG(
- logger_,
- "Time since certificate validity " << start_seconds << "seconds");
+ SDL_LOG_DEBUG("Time since certificate validity " << start_seconds
+ << "seconds");
}
if (end_seconds < 0) {
- LOG4CXX_ERROR(logger_,
- "Certificate already expired. Time after expiration "
- << end_seconds << " seconds");
+ SDL_LOG_ERROR("Certificate already expired. Time after expiration "
+ << end_seconds << " seconds");
return Handshake_Result_CertExpired;
} else {
- LOG4CXX_DEBUG(logger_,
- "Time until expiration " << end_seconds << "seconds");
+ SDL_LOG_DEBUG("Time until expiration " << end_seconds << "seconds");
}
X509_NAME* subj_name = X509_get_subject_name(cert);
@@ -269,10 +263,9 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() {
const std::string& sn = GetTextBy(subj_name, NID_serialNumber);
if (!(hsh_context_.expected_sn.CompareIgnoreCase(sn.c_str()))) {
- LOG4CXX_ERROR(logger_,
- "Trying to run handshake with wrong app id: "
- << sn << ". Expected app id: "
- << hsh_context_.expected_sn.AsMBString());
+ SDL_LOG_ERROR("Trying to run handshake with wrong app id: "
+ << sn << ". Expected app id: "
+ << hsh_context_.expected_sn.AsMBString());
return Handshake_Result_AppIDMismatch;
}
return Handshake_Result_Success;
@@ -334,12 +327,12 @@ time_t CryptoManagerImpl::SSLContextImpl::convert_asn1_time_to_time_t(
bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData(
const uint8_t** const out_data, size_t* out_data_size) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const size_t pend = BIO_ctrl_pending(bioOut_);
- LOG4CXX_DEBUG(logger_, "Available " << pend << " bytes for handshake");
+ SDL_LOG_DEBUG("Available " << pend << " bytes for handshake");
if (pend > 0) {
- LOG4CXX_DEBUG(logger_, "Reading handshake data");
+ SDL_LOG_DEBUG("Reading handshake data");
EnsureBufferSizeEnough(pend);
const int read_count = BIO_read(bioOut_, buffer_, pend);
@@ -347,7 +340,7 @@ bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData(
*out_data_size = read_count;
*out_data = buffer_;
} else {
- LOG4CXX_WARN(logger_, "BIO read fail");
+ SDL_LOG_WARN("BIO read fail");
is_handshake_pending_ = false;
ResetConnection();
return false;
@@ -359,7 +352,7 @@ bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData(
bool CryptoManagerImpl::SSLContextImpl::WriteHandshakeData(
const uint8_t* const in_data, size_t in_data_size) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (in_data && in_data_size) {
const int ret = BIO_write(bioIn_, in_data, in_data_size);
if (ret <= 0) {
@@ -373,9 +366,9 @@ bool CryptoManagerImpl::SSLContextImpl::WriteHandshakeData(
SSLContext::HandshakeResult
CryptoManagerImpl::SSLContextImpl::PerformHandshake() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int handshake_result = SSL_do_handshake(connection_);
- LOG4CXX_TRACE(logger_, "Handshake result: " << handshake_result);
+ SDL_LOG_TRACE("Handshake result: " << handshake_result);
if (handshake_result == 1) {
const HandshakeResult result = CheckCertContext();
if (result != Handshake_Result_Success) {
@@ -384,7 +377,7 @@ CryptoManagerImpl::SSLContextImpl::PerformHandshake() {
return result;
}
- LOG4CXX_DEBUG(logger_, "SSL handshake successfully finished");
+ SDL_LOG_DEBUG("SSL handshake successfully finished");
// Handshake is successful
bioFilter_ = BIO_new(BIO_f_ssl());
BIO_set_ssl(bioFilter_, connection_, BIO_NOCLOSE);
@@ -394,7 +387,7 @@ CryptoManagerImpl::SSLContextImpl::PerformHandshake() {
is_handshake_pending_ = false;
} else if (handshake_result == 0) {
- LOG4CXX_DEBUG(logger_, "SSL handshake failed");
+ SDL_LOG_DEBUG("SSL handshake failed");
SSL_clear(connection_);
is_handshake_pending_ = false;
return Handshake_Result_Fail;
@@ -403,10 +396,9 @@ CryptoManagerImpl::SSLContextImpl::PerformHandshake() {
if (error != SSL_ERROR_WANT_READ) {
const long error = SSL_get_verify_result(connection_);
SetHandshakeError(error);
- LOG4CXX_WARN(logger_,
- "Handshake failed with error "
- << " -> " << SSL_get_error(connection_, error) << " \""
- << LastError() << '"');
+ SDL_LOG_WARN("Handshake failed with error "
+ << " -> " << SSL_get_error(connection_, error) << " \""
+ << LastError() << '"');
ResetConnection();
is_handshake_pending_ = false;
@@ -426,7 +418,7 @@ SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::DoHandshakeStep(
size_t in_data_size,
const uint8_t** const out_data,
size_t* out_data_size) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(out_data);
DCHECK(out_data_size);
*out_data = NULL;
@@ -437,7 +429,7 @@ SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::DoHandshakeStep(
sync_primitives::AutoLock locker(bio_locker);
if (SSL_is_init_finished(connection_)) {
- LOG4CXX_DEBUG(logger_, "SSL initilization is finished");
+ SDL_LOG_DEBUG("SSL initialization is finished");
is_handshake_pending_ = false;
return Handshake_Result_Success;
}
@@ -491,15 +483,15 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data,
size_t in_data_size,
const uint8_t** const out_data,
size_t* out_data_size) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock locker(bio_locker);
if (!SSL_is_init_finished(connection_)) {
- LOG4CXX_ERROR(logger_, "SSL initilization is not finished");
+ SDL_LOG_ERROR("SSL initialization is not finished");
return false;
}
if (!in_data || (0 == in_data_size)) {
- LOG4CXX_ERROR(logger_, "IN data ptr or IN data size is 0");
+ SDL_LOG_ERROR("IN data ptr or IN data size is 0");
return false;
}
@@ -516,7 +508,7 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data,
// TODO(EZamakhov): investigate BIO_read return 0, -1 and -2 meanings
if (len <= 0) {
// Reset filter and connection deinitilization instead
- LOG4CXX_ERROR(logger_, "Read error occured. Read data lenght : " << len);
+ SDL_LOG_ERROR("Read error occurred. Read data length: " << len);
BIO_ctrl(bioFilter_, BIO_CTRL_RESET, 0, NULL);
return false;
}
@@ -529,7 +521,7 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data,
}
size_t CryptoManagerImpl::SSLContextImpl::get_max_block_size(size_t mtu) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!max_block_size_) {
// FIXME(EZamakhov): add correct logics for TLS1/1.2/SSL3
// For SSL3.0 set temporary value 90, old TLS1.2 value is 29
@@ -549,11 +541,11 @@ bool CryptoManagerImpl::SSLContextImpl::IsHandshakePending() const {
bool CryptoManagerImpl::SSLContextImpl::GetCertificateDueDate(
time_t& due_date) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
X509* cert = SSL_get_certificate(connection_);
if (!cert) {
- LOG4CXX_DEBUG(logger_, "Get certificate failed.");
+ SDL_LOG_DEBUG("Get certificate failed.");
return false;
}
@@ -583,19 +575,19 @@ void CryptoManagerImpl::SSLContextImpl::SetHandshakeError(const int error) {
}
void CryptoManagerImpl::SSLContextImpl::ResetConnection() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int shutdown_result = SSL_shutdown(connection_);
if (shutdown_result != 1) {
const size_t pend = BIO_ctrl_pending(bioOut_);
- LOG4CXX_DEBUG(logger_, "Available " << pend << " bytes for shutdown");
+ SDL_LOG_DEBUG("Available " << pend << " bytes for shutdown");
if (pend > 0) {
- LOG4CXX_DEBUG(logger_, "Reading shutdown data");
+ SDL_LOG_DEBUG("Reading shutdown data");
EnsureBufferSizeEnough(pend);
BIO_read(bioOut_, buffer_, pend);
}
SSL_shutdown(connection_);
}
- LOG4CXX_DEBUG(logger_, "SSL connection recreation");
+ SDL_LOG_DEBUG("SSL connection recreation");
SSL_CTX* ssl_context = connection_->ctx;
SSL_free(connection_);
connection_ = SSL_new(ssl_context);
@@ -647,8 +639,7 @@ std::string CryptoManagerImpl::SSLContextImpl::GetTextBy(X509_NAME* name,
const int req_len = X509_NAME_get_text_by_NID(name, object, NULL, 0);
if (-1 == req_len) {
- LOG4CXX_WARN(logger_,
- "Unable to obtain object: " << object << " from certificate");
+ SDL_LOG_WARN("Unable to obtain object: " << object << " from certificate");
return std::string();
}
diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc
index 0cbe204f38..4145334115 100644
--- a/src/components/security_manager/test/security_manager_test.cc
+++ b/src/components/security_manager/test/security_manager_test.cc
@@ -70,6 +70,7 @@ using security_manager::SSLContext;
using security_manager_test::InternalErrorWithErrId;
using ::testing::_;
+using ::testing::An;
using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnNull;
@@ -286,7 +287,7 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
TestAsyncWaiter waiter;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
EXPECT_CALL(mock_protocol_handler,
@@ -332,7 +333,7 @@ TEST_F(SecurityManagerTest, GetEmptyQuery) {
// uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
EXPECT_CALL(
@@ -354,7 +355,7 @@ TEST_F(SecurityManagerTest, GetWrongJSONSize) {
// uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
// Expect InternalError with ERROR_ID
EXPECT_CALL(
@@ -382,7 +383,7 @@ TEST_F(SecurityManagerTest, GetInvalidQueryId) {
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
times++;
@@ -429,7 +430,7 @@ TEST_F(SecurityManagerTest, CreateSSLContext_ErrorCreateSSL) {
// uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
EXPECT_CALL(mock_protocol_handler,
SendMessageToMobileApp(
@@ -459,7 +460,7 @@ TEST_F(SecurityManagerTest, CreateSSLContext_SetSSLContextError) {
// uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
EXPECT_CALL(
@@ -515,7 +516,7 @@ TEST_F(SecurityManagerTest, StartHandshake_ServiceStillUnprotected) {
// uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
// Expect InternalError with ERROR_INTERNAL
EXPECT_CALL(mock_protocol_handler,
@@ -548,7 +549,7 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInternalError) {
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
// Expect notifying listeners (unsuccess)
EXPECT_CALL(*mock_sm_listener,
@@ -579,7 +580,7 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_WrongDataSize) {
TestAsyncWaiter waiter;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(Return(true));
// Expect InternalError with ERROR_ID
@@ -612,7 +613,7 @@ TEST_F(SecurityManagerTest, DISABLED_ProcessHandshakeData_ServiceNotProtected) {
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
times++;
EXPECT_CALL(
@@ -664,7 +665,7 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_InvalidData) {
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
times += handshake_emulates;
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.Times(handshake_emulates)
.WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
times += handshake_emulates;
@@ -746,7 +747,7 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) {
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
times += handshake_emulates;
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.Times(handshake_emulates)
.WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
times += handshake_emulates;
@@ -877,7 +878,7 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_HandshakeFinished) {
// uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _)).Times(2);
EXPECT_CALL(mock_session_observer,
- ProtocolVersionUsed(connection_id, session_id, _))
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.Times(2)
.WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
times += 2; // matches to the number above
diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc
index c8eab82e8a..7e5c49bae0 100644
--- a/src/components/smart_objects/src/object_schema_item.cc
+++ b/src/components/smart_objects/src/object_schema_item.cc
@@ -42,6 +42,7 @@ namespace {
const char connection_key[] = "connection_key";
const char binary_data[] = "binary_data";
const char app_id[] = "appID";
+const char msg_params[] = "msg_params";
const utils::SemanticVersion kModuleVersion(application_manager::major_version,
application_manager::minor_version,
application_manager::patch_version);
@@ -132,6 +133,14 @@ errors::eType CObjectSchemaItem::validate(
std::string validation_info = "Missing mandatory parameter: " + key;
report->set_validation_info(validation_info);
return errors::MISSING_MANDATORY_PARAMETER;
+ } else if (key.compare(msg_params) == 0) {
+ // If the message params struct was filtered, that means that the
+ // app's version is too low to use the message.
+ std::string validation_info =
+ "Function is not available for SyncMsgVersion " +
+ MessageVersion.toString();
+ report->set_validation_info(validation_info);
+ return errors::INVALID_VALUE;
}
continue;
}
diff --git a/src/components/telemetry_monitor/src/protocol_handler_observer.cc b/src/components/telemetry_monitor/src/protocol_handler_observer.cc
index e696e58506..7752e6fb94 100644
--- a/src/components/telemetry_monitor/src/protocol_handler_observer.cc
+++ b/src/components/telemetry_monitor/src/protocol_handler_observer.cc
@@ -37,7 +37,7 @@
namespace telemetry_monitor {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor")
+SDL_CREATE_LOG_VARIABLE("TelemetryMonitor")
ProtocolHandlerObserver::ProtocolHandlerObserver(
TelemetryMonitor* telemetry_monitor)
@@ -49,8 +49,8 @@ void ProtocolHandlerObserver::StartMessageProcess(
return;
}
if (time_starts.find(message_id) != time_starts.end()) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Already waiting for stop processing for Message ID: " << message_id);
return;
}
@@ -63,7 +63,7 @@ void ProtocolHandlerObserver::EndMessageProcess(
std::map<uint32_t, date_time::TimeDuration>::const_iterator it =
time_starts.find(message_id);
if (it == time_starts.end()) {
- LOG4CXX_WARN(logger_, "Cant find start time for message" << message_id);
+ SDL_LOG_WARN("Cant find start time for message" << message_id);
return;
}
m->begin = time_starts[message_id];
diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc
index f6cac49f59..b1bb605de3 100644
--- a/src/components/telemetry_monitor/src/telemetry_monitor.cc
+++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc
@@ -47,7 +47,7 @@
namespace telemetry_monitor {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor")
+SDL_CREATE_LOG_VARIABLE("TelemetryMonitor")
TelemetryMonitor::TelemetryMonitor(const std::string& server_address,
uint16_t port)
@@ -64,12 +64,12 @@ void TelemetryMonitor::Start() {
}
void TelemetryMonitor::set_streamer(std::shared_ptr<Streamer> streamer) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (thread_ && !thread_->is_running()) {
+ SDL_LOG_AUTO_TRACE();
+ if (thread_ && !thread_->IsRunning()) {
+ thread_->SetDelegate(streamer_.get());
streamer_ = streamer;
- thread_->set_delegate(streamer_.get());
} else {
- LOG4CXX_ERROR(logger_, "Unable to replace streamer if it is active");
+ SDL_LOG_ERROR("Unable to replace streamer if it is active");
}
}
@@ -91,7 +91,7 @@ void TelemetryMonitor::Init(
TelemetryObservable<application_manager::AMTelemetryObserver>* app_manager,
TelemetryObservable<transport_manager::TMTelemetryObserver>*
transport_manager) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(streamer_);
app_manager->SetTelemetryObserver(&app_observer);
@@ -99,15 +99,14 @@ void TelemetryMonitor::Init(
protocol_handler->SetTelemetryObserver(&ph_observer);
DCHECK_OR_RETURN_VOID(thread_);
- thread_->start(threads::ThreadOptions());
+ thread_->Start(threads::ThreadOptions());
}
void TelemetryMonitor::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (thread_) {
- thread_->stop();
- thread_->join();
- if (thread_->delegate()) {
+ thread_->Stop(threads::Thread::kThreadSoftStop);
+ if (thread_->GetDelegate()) {
streamer_.reset();
}
threads::DeleteThread(thread_);
@@ -133,18 +132,18 @@ Streamer::~Streamer() {
}
void Streamer::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Start();
while (!stop_flag_) {
- LOG4CXX_INFO(logger_, "Server socket is listening ");
+ SDL_LOG_INFO("Server socket is listening ");
client_socket_fd_ = accept(server_socket_fd_, NULL, NULL);
if (0 > client_socket_fd_) {
- LOG4CXX_ERROR(logger_, "Cant open socket . Socket is busy ");
+ SDL_LOG_ERROR("Cant open socket . Socket is busy ");
Stop();
break;
}
- LOG4CXX_INFO(logger_, "Client connected");
+ SDL_LOG_INFO("Client connected");
is_client_connected_ = true;
while (is_client_connected_) {
@@ -157,7 +156,7 @@ void Streamer::threadMain() {
}
if (!IsReady()) {
- LOG4CXX_INFO(logger_, "Client disconnected.");
+ SDL_LOG_INFO("Client disconnected.");
break;
}
@@ -167,21 +166,21 @@ void Streamer::threadMain() {
}
void Streamer::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Stop();
messages_.Shutdown();
ThreadDelegate::exitThreadMain();
}
void Streamer::Start() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
server_socket_fd_ = socket(AF_INET, SOCK_STREAM, 0);
if (0 >= server_socket_fd_) {
- LOG4CXX_ERROR(logger_, "Server open error");
+ SDL_LOG_ERROR("Server open error");
return;
} else {
- LOG4CXX_DEBUG(logger_, "Server socket : " << server_socket_fd_);
+ SDL_LOG_DEBUG("Server socket : " << server_socket_fd_);
}
int32_t optval = 1;
@@ -190,7 +189,7 @@ void Streamer::Start() {
SO_REUSEADDR,
&optval,
sizeof optval)) {
- LOG4CXX_ERROR(logger_, "Unable to set sockopt");
+ SDL_LOG_ERROR("Unable to set sockopt");
return;
}
@@ -202,45 +201,44 @@ void Streamer::Start() {
if (-1 == bind(server_socket_fd_,
reinterpret_cast<struct sockaddr*>(&serv_addr_),
sizeof(serv_addr_))) {
- LOG4CXX_ERROR(logger_,
- "Unable to bind server " << kserver_->ip().c_str() << ':'
+ SDL_LOG_ERROR("Unable to bind server " << kserver_->ip().c_str() << ':'
<< kserver_->port());
return;
}
if (-1 == listen(server_socket_fd_, 1)) {
- LOG4CXX_ERROR(logger_, "Streamer listen error " << strerror(errno));
+ SDL_LOG_ERROR("Streamer listen error " << strerror(errno));
return;
}
}
void Streamer::ShutDownAndCloseSocket(int32_t socket_fd) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (0 < socket_fd) {
- LOG4CXX_INFO(logger_, "Shutdown socket");
+ SDL_LOG_INFO("Shutdown socket");
if (-1 == ::shutdown(socket_fd, SHUT_RDWR)) {
- LOG4CXX_ERROR(logger_, "Unable to shutdown socket");
+ SDL_LOG_ERROR("Unable to shutdown socket");
}
if (-1 == close(socket_fd)) {
- LOG4CXX_ERROR(logger_, "Unable to close socket");
+ SDL_LOG_ERROR("Unable to close socket");
}
} else {
- LOG4CXX_WARN(logger_, "Socket in not connected: " << socket_fd);
+ SDL_LOG_WARN("Socket in not connected: " << socket_fd);
}
}
void Streamer::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (stop_flag_) {
- LOG4CXX_WARN(logger_, "Already Stopped");
+ SDL_LOG_WARN("Already Stopped");
return;
}
stop_flag_ = true;
messages_.Reset();
- LOG4CXX_WARN(logger_, "Stop server_socket_fd_");
+ SDL_LOG_WARN("Stop server_socket_fd_");
ShutDownAndCloseSocket(server_socket_fd_);
server_socket_fd_ = -1;
- LOG4CXX_WARN(logger_, "Stop client_socket_fd_");
+ SDL_LOG_WARN("Stop client_socket_fd_");
ShutDownAndCloseSocket(client_socket_fd_);
client_socket_fd_ = -1;
is_client_connected_ = false;
@@ -259,10 +257,10 @@ bool Streamer::IsReady() const {
const int retval = select(client_socket_fd_ + 1, 0, &fds, 0, &tv);
if (-1 == retval) {
- LOG4CXX_ERROR(logger_, "An error occurred");
+ SDL_LOG_ERROR("An error occurred");
result = false;
} else if (0 == retval) {
- LOG4CXX_ERROR(logger_, "The timeout expired");
+ SDL_LOG_ERROR("The timeout expired");
result = false;
}
@@ -270,14 +268,14 @@ bool Streamer::IsReady() const {
}
bool Streamer::Send(const std::string& msg) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!IsReady()) {
- LOG4CXX_ERROR(logger_, " Socket is not ready");
+ SDL_LOG_ERROR(" Socket is not ready");
return false;
}
if (-1 == ::send(client_socket_fd_, msg.c_str(), msg.size(), MSG_NOSIGNAL)) {
- LOG4CXX_ERROR(logger_, " Unable to send");
+ SDL_LOG_ERROR(" Unable to send");
return false;
}
return true;
diff --git a/src/components/test_main.cc b/src/components/test_main.cc
index 8912ed9bd2..62442cb64f 100644
--- a/src/components/test_main.cc
+++ b/src/components/test_main.cc
@@ -1,16 +1,33 @@
#include <iostream>
#include "gmock/gmock.h"
#include "utils/custom_string.h"
+
+#ifdef ENABLE_LOG
+#include "utils/logger/log4cxxlogger.h"
+#include "utils/logger/logger_impl.h"
+#endif // ENABLE_LOG
+
#include "utils/logger.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
+SDL_CREATE_LOG_VARIABLE("SDLMain")
int main(int argc, char** argv) {
+#ifdef ENABLE_LOG
+ // --------------------------------------------------------------------------
+ // Logger initialization
+ // Redefine for each paticular logger implementation
+ auto logger = std::unique_ptr<logger::Log4CXXLogger>(
+ new logger::Log4CXXLogger("log4cxx.properties"));
+ auto logger_impl =
+ std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl(false));
+ logger::Logger::instance(logger_impl.get());
+#endif // ENABLE_LOG
+
namespace custom_str = utils::custom_string;
testing::InitGoogleMock(&argc, argv);
::testing::DefaultValue<custom_str::CustomString>::Set(
custom_str::CustomString(""));
const int result = RUN_ALL_TESTS();
- DEINIT_LOGGER();
+ SDL_DEINIT_LOGGER();
return result;
}
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h
index fb904d645e..b3dc04a897 100644
--- a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h
@@ -48,7 +48,6 @@ namespace transport_adapter {
using ::utils::MessageQueue;
-typedef ::protocol_handler::RawMessagePtr Message;
typedef std::queue<Message> AsyncQueue;
class TransportAdapterController;
@@ -75,10 +74,11 @@ class WebSocketConnection
TransportAdapter::Error Disconnect() OVERRIDE;
- TransportAdapter::Error SendData(
- protocol_handler::RawMessagePtr message) OVERRIDE;
+ TransportAdapter::Error SendData(Message message) OVERRIDE;
- void DataReceive(protocol_handler::RawMessagePtr frame);
+ void DataReceive(Message frame);
+ void DataSendDone(Message frame);
+ void DataSendFailed(Message frame);
void Run();
bool IsShuttingDown();
@@ -99,21 +99,17 @@ class WebSocketConnection
class LoopThreadDelegate : public threads::ThreadDelegate {
public:
LoopThreadDelegate(MessageQueue<Message, AsyncQueue>* message_queue,
- DataWriteCallback data_write,
- OnIOErrorCallback on_io_error);
+ DataWriteCallback data_write);
virtual void threadMain() OVERRIDE;
virtual void exitThreadMain() OVERRIDE;
- void OnWrite();
-
void SetShutdown();
private:
void DrainQueue();
MessageQueue<Message, AsyncQueue>& message_queue_;
DataWriteCallback data_write_;
- OnIOErrorCallback on_io_error_;
};
LoopThreadDelegate* thread_delegate_;
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h
index a3ead8e5a5..ed42207200 100644
--- a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h
@@ -37,15 +37,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(wss_logger_, "WebSocketSecureSession")
-
template <typename ExecutorType = ssl::stream<tcp::socket&> >
class WebSocketSecureSession : public WebSocketSession<ExecutorType> {
public:
WebSocketSecureSession(tcp::socket,
ssl::context& ctx,
DataReceiveCallback data_receive,
- OnIOErrorCallback on_errror);
+ DataSendDoneCallback data_send_done,
+ DataSendFailedCallback data_send_failed,
+ OnIOErrorCallback on_error);
void AsyncAccept() OVERRIDE;
virtual void AsyncHandshake(boost::system::error_code ec);
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
index a8dadc9831..f1be1a3b54 100644
--- a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
@@ -35,6 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/asio/strand.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
+#include <functional>
+
#include "protocol/raw_message.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
#include "utils/logger.h"
@@ -46,10 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace transport_manager {
namespace transport_adapter {
-using DataReceiveCallback =
- std::function<void(protocol_handler::RawMessagePtr)>;
-using DataWriteCallback = std::function<TransportAdapter::Error(
- protocol_handler::RawMessagePtr message)>;
+using Message = ::protocol_handler::RawMessagePtr;
+using DataReceiveCallback = std::function<void(Message)>;
+using DataSendDoneCallback = DataReceiveCallback;
+using DataSendFailedCallback = DataReceiveCallback;
+using DataWriteCallback = DataReceiveCallback;
using OnIOErrorCallback = std::function<void()>;
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
@@ -59,8 +62,6 @@ namespace websocket =
namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
#endif // ENABLE_SECURITY
-CREATE_LOGGERPTR_GLOBAL(ws_logger_, "WebSocketSession")
-
class TransportAdapterController;
template <typename ExecutorType = tcp::socket&>
@@ -69,12 +70,16 @@ class WebSocketSession
public:
WebSocketSession(boost::asio::ip::tcp::socket socket,
DataReceiveCallback data_receive,
+ DataSendDoneCallback data_send_done,
+ DataSendFailedCallback data_send_failed,
OnIOErrorCallback on_error);
#ifdef ENABLE_SECURITY
WebSocketSession(boost::asio::ip::tcp::socket socket,
ssl::context& ctx,
DataReceiveCallback data_receive,
+ DataSendDoneCallback data_send_done,
+ DataSendFailedCallback data_send_failed,
OnIOErrorCallback on_error);
#endif // ENABLE_SECURITY
@@ -84,8 +89,7 @@ class WebSocketSession
virtual void AsyncRead(boost::system::error_code ec);
- virtual TransportAdapter::Error WriteDown(
- ::protocol_handler::RawMessagePtr message);
+ virtual void WriteDown(Message message);
virtual void Read(boost::system::error_code ec,
std::size_t bytes_transferred);
@@ -98,6 +102,8 @@ class WebSocketSession
boost::asio::strand<boost::asio::io_context::executor_type> strand_;
boost::beast::flat_buffer buffer_;
DataReceiveCallback data_receive_;
+ DataSendDoneCallback data_send_done_;
+ DataSendFailedCallback data_send_failed_;
OnIOErrorCallback on_io_error_;
};
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc
index 19f4078443..ba48624adb 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc
@@ -41,7 +41,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
BluetoothConnectionFactory::BluetoothConnectionFactory(
TransportAdapterController* controller)
@@ -53,15 +53,14 @@ TransportAdapter::Error BluetoothConnectionFactory::Init() {
TransportAdapter::Error BluetoothConnectionFactory::CreateConnection(
const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::shared_ptr<BluetoothSocketConnection> connection =
std::make_shared<BluetoothSocketConnection>(
device_uid, app_handle, controller_);
controller_->ConnectionCreated(connection, device_uid, app_handle);
TransportAdapter::Error error = connection->Start();
if (TransportAdapter::OK != error) {
- LOG4CXX_ERROR(logger_,
- "Bluetooth connection::Start() failed with error: " << error);
+ SDL_LOG_ERROR("Bluetooth connection::Start() failed with error: " << error);
}
return error;
}
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device.cc
index 734d8fe1e9..91f561a7d9 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_device.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_device.cc
@@ -51,39 +51,38 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
bool BluetoothDevice::GetRfcommChannel(const ApplicationHandle app_handle,
uint8_t* channel_out) {
- LOG4CXX_TRACE(logger_,
- "enter. app_handle: " << app_handle
+ SDL_LOG_TRACE("enter. app_handle: " << app_handle
<< ", channel_out: " << std::hex
<< reinterpret_cast<void*>(channel_out));
if (app_handle < 0 || app_handle > std::numeric_limits<uint8_t>::max()) {
- LOG4CXX_TRACE(logger_,
- "exit with FALSE. Condition: app_handle < 0 || app_handle > "
- "numeric_limits::max()");
+ SDL_LOG_TRACE(
+ "exit with FALSE. Condition: app_handle < 0 || app_handle > "
+ "numeric_limits::max()");
return false;
}
const uint8_t channel = static_cast<uint8_t>(app_handle);
RfcommChannelVector::const_iterator it =
std::find(rfcomm_channels_.begin(), rfcomm_channels_.end(), channel);
if (it == rfcomm_channels_.end()) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"exit with FALSE. Condition: channel not found in RfcommChannelVector");
return false;
}
*channel_out = channel;
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
return true;
}
std::string BluetoothDevice::GetUniqueDeviceId(const bdaddr_t& device_address) {
- LOG4CXX_TRACE(logger_, "enter. device_adress: " << &device_address);
+ SDL_LOG_TRACE("enter. device_adress: " << &device_address);
char device_address_string[32];
ba2str(&device_address, device_address_string);
- LOG4CXX_TRACE(logger_, "exit with BT-" << device_address_string);
+ SDL_LOG_TRACE("exit with BT-" << device_address_string);
return std::string("BT-") + device_address_string;
}
@@ -95,7 +94,7 @@ BluetoothDevice::BluetoothDevice(const bdaddr_t& device_address,
, rfcomm_channels_(rfcomm_channels) {}
bool BluetoothDevice::IsSameAs(const Device* other) const {
- LOG4CXX_TRACE(logger_, "enter. device: " << other);
+ SDL_LOG_TRACE("enter. device: " << other);
bool result = false;
const BluetoothDevice* other_bluetooth_device =
@@ -109,9 +108,9 @@ bool BluetoothDevice::IsSameAs(const Device* other) const {
}
}
if (result) {
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
} else {
- LOG4CXX_TRACE(logger_, "exit with FALSE");
+ SDL_LOG_TRACE("exit with FALSE");
}
return result;
}
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
index 4759b2003a..f152f1f78d 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
@@ -57,7 +57,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
namespace {
char* SplitToAddr(char* dev_list_entry) {
@@ -71,14 +71,14 @@ char* SplitToAddr(char* dev_list_entry) {
}
int FindPairedDevs(std::vector<bdaddr_t>* result) {
- LOG4CXX_TRACE(logger_, "enter. result adress: " << result);
+ SDL_LOG_TRACE("enter. result address: " << result);
DCHECK(result != NULL);
const char* cmd = "bt-device -l";
FILE* pipe = popen(cmd, "r");
if (!pipe) {
- LOG4CXX_TRACE(logger_, "exit -1. Condition: !pipe");
+ SDL_LOG_TRACE("exit -1. Condition: !pipe");
return -1;
}
char* buffer = new char[1028];
@@ -96,7 +96,7 @@ int FindPairedDevs(std::vector<bdaddr_t>* result) {
buffer = new char[1028];
}
pclose(pipe);
- LOG4CXX_TRACE(logger_, "exit with 0");
+ SDL_LOG_TRACE("exit with 0");
delete[] buffer;
return 0;
}
@@ -158,17 +158,17 @@ BluetoothDeviceScanner::BluetoothDeviceScanner(
}
BluetoothDeviceScanner::~BluetoothDeviceScanner() {
- thread_->join();
- delete thread_->delegate();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete thread_->GetDelegate();
threads::DeleteThread(thread_);
}
bool BluetoothDeviceScanner::IsInitialised() const {
- return thread_ && thread_->is_running();
+ return thread_ && thread_->IsRunning();
}
void BluetoothDeviceScanner::UpdateTotalDeviceList() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceVector devices;
devices.insert(devices.end(),
paired_devices_with_sdl_.begin(),
@@ -180,11 +180,11 @@ void BluetoothDeviceScanner::UpdateTotalDeviceList() {
}
void BluetoothDeviceScanner::DoInquiry() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int device_id = hci_get_route(0);
if (device_id < 0) {
- LOG4CXX_INFO(logger_, "HCI device is not available");
+ SDL_LOG_INFO("HCI device is not available");
shutdown_requested_ = true;
controller_->SearchDeviceFailed(SearchDeviceError());
return;
@@ -197,15 +197,14 @@ void BluetoothDeviceScanner::DoInquiry() {
}
if (paired_devices_.empty()) {
- LOG4CXX_INFO(logger_, "Searching for paired devices.");
+ SDL_LOG_INFO("Searching for paired devices.");
if (-1 == FindPairedDevs(&paired_devices_)) {
- LOG4CXX_ERROR(logger_, "Failed to retrieve list of paired devices.");
+ SDL_LOG_ERROR("Failed to retrieve list of paired devices.");
controller_->SearchDeviceFailed(SearchDeviceError());
}
}
- LOG4CXX_INFO(logger_,
- "Check rfcomm channel on " << paired_devices_.size()
+ SDL_LOG_INFO("Check rfcomm channel on " << paired_devices_.size()
<< " paired devices.");
paired_devices_with_sdl_.clear();
@@ -213,7 +212,7 @@ void BluetoothDeviceScanner::DoInquiry() {
paired_devices_, device_handle, &paired_devices_with_sdl_);
UpdateTotalDeviceList();
- LOG4CXX_INFO(logger_, "Starting hci_inquiry on device " << device_id);
+ SDL_LOG_INFO("Starting hci_inquiry on device " << device_id);
const uint8_t inquiry_time = 8u; // Time unit is 1.28 seconds
const size_t max_devices = 256u;
inquiry_info* inquiry_info_list = new inquiry_info[max_devices];
@@ -226,8 +225,7 @@ void BluetoothDeviceScanner::DoInquiry() {
IREQ_CACHE_FLUSH);
if (number_of_devices >= 0) {
- LOG4CXX_INFO(logger_,
- "hci_inquiry: found " << number_of_devices << " devices");
+ SDL_LOG_INFO("hci_inquiry: found " << number_of_devices << " devices");
std::vector<bdaddr_t> found_devices(number_of_devices);
for (int i = 0; i < number_of_devices; ++i) {
found_devices[i] = inquiry_info_list[i].bdaddr;
@@ -243,7 +241,7 @@ void BluetoothDeviceScanner::DoInquiry() {
delete[] inquiry_info_list;
if (number_of_devices < 0) {
- LOG4CXX_DEBUG(logger_, "number_of_devices < 0");
+ SDL_LOG_DEBUG("number_of_devices < 0");
controller_->SearchDeviceFailed(SearchDeviceError());
}
}
@@ -252,10 +250,9 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices(
const std::vector<bdaddr_t>& bd_addresses,
int device_handle,
DeviceVector* discovered_devices) {
- LOG4CXX_TRACE(logger_,
- "enter. bd_addresses: "
- << &bd_addresses << ", device_handle: " << device_handle
- << ", discovered_devices: " << discovered_devices);
+ SDL_LOG_TRACE("enter. bd_addresses: "
+ << &bd_addresses << ", device_handle: " << device_handle
+ << ", discovered_devices: " << discovered_devices);
std::vector<RfcommChannelVector> sdl_rfcomm_channels =
DiscoverSmartDeviceLinkRFCOMMChannels(bd_addresses);
@@ -274,7 +271,7 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices(
0);
if (hci_read_remote_name_ret != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "hci_read_remote_name failed");
+ SDL_LOG_ERROR_WITH_ERRNO("hci_read_remote_name failed");
int name_len = sizeof(deviceName) / sizeof(deviceName[0]);
strncpy(deviceName,
BluetoothDevice::GetUniqueDeviceId(bd_address).c_str(),
@@ -285,19 +282,19 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices(
auto bluetooth_device = std::make_shared<BluetoothDevice>(
bd_address, deviceName, sdl_rfcomm_channels[i]);
if (bluetooth_device) {
- LOG4CXX_INFO(logger_, "Bluetooth device created successfully");
+ SDL_LOG_INFO("Bluetooth device created successfully");
discovered_devices->push_back(bluetooth_device);
} else {
- LOG4CXX_WARN(logger_, "Can't create bluetooth device " << deviceName);
+ SDL_LOG_WARN("Can't create bluetooth device " << deviceName);
}
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
std::vector<BluetoothDeviceScanner::RfcommChannelVector>
BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels(
const std::vector<bdaddr_t>& device_addresses) {
- LOG4CXX_TRACE(logger_, "enter device_addresses: " << &device_addresses);
+ SDL_LOG_TRACE("enter device_addresses: " << &device_addresses);
const size_t size = device_addresses.size();
std::vector<RfcommChannelVector> result(size);
@@ -322,16 +319,14 @@ BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels(
}
sleep(attempt_timeout);
}
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
"exit with vector<RfcommChannelVector>: size = " << result.size());
return result;
}
bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels(
const bdaddr_t& device_address, RfcommChannelVector* channels) {
- LOG4CXX_TRACE(logger_,
- "enter. device_address: " << &device_address
+ SDL_LOG_TRACE("enter. device_address: " << &device_address
<< ", channels: " << channels);
static bdaddr_t any_address = {{0, 0, 0, 0, 0, 0}};
@@ -340,9 +335,9 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels(
if (sdp_session == 0) {
bool result = !(errno == 31 || errno == 16 || errno == 117 || errno == 114);
if (result) {
- LOG4CXX_TRACE(logger_, "exit with TRUE. Condition: sdp_session == 0");
+ SDL_LOG_TRACE("exit with TRUE. Condition: sdp_session == 0");
} else {
- LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: sdp_session == 0");
+ SDL_LOG_TRACE("exit with FALSE. Condition: sdp_session == 0");
}
return result;
}
@@ -400,7 +395,7 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels(
sdp_close(sdp_session);
if (!channels->empty()) {
- LOG4CXX_INFO(logger_, "channels not empty");
+ SDL_LOG_INFO("channels not empty");
std::stringstream rfcomm_channels_string;
for (RfcommChannelVector::const_iterator it = channels->begin();
@@ -412,22 +407,19 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels(
rfcomm_channels_string << static_cast<uint32_t>(*it);
}
- LOG4CXX_INFO(
- logger_,
- "SmartDeviceLink service was discovered on device "
- << BluetoothDevice::GetUniqueDeviceId(device_address)
- << " at channel(s): " << rfcomm_channels_string.str().c_str());
+ SDL_LOG_INFO("SmartDeviceLink service was discovered on device "
+ << BluetoothDevice::GetUniqueDeviceId(device_address)
+ << " at channel(s): " << rfcomm_channels_string.str().c_str());
} else {
- LOG4CXX_INFO(logger_,
- "SmartDeviceLink service was not discovered on device "
- << BluetoothDevice::GetUniqueDeviceId(device_address));
+ SDL_LOG_INFO("SmartDeviceLink service was not discovered on device "
+ << BluetoothDevice::GetUniqueDeviceId(device_address));
}
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
return true;
}
void BluetoothDeviceScanner::Thread() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ready_ = true;
if (auto_repeat_search_) {
while (!shutdown_requested_) {
@@ -453,10 +445,10 @@ void BluetoothDeviceScanner::Thread() {
}
void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (auto_repeat_pause_sec_ == 0) {
- LOG4CXX_TRACE(logger_, "exit. Condition: auto_repeat_pause_sec_ == 0");
+ SDL_LOG_TRACE("exit. Condition: auto_repeat_pause_sec_ == 0");
return;
}
@@ -467,7 +459,7 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() {
device_scan_requested_cv_.WaitFor(auto_lock,
auto_repeat_pause_sec_ * 1000);
if (wait_status == sync_primitives::ConditionalVariable::kTimeout) {
- LOG4CXX_INFO(logger_, "Bluetooth scanner timeout, performing scan");
+ SDL_LOG_INFO("Bluetooth scanner timeout, performing scan");
device_scan_requested_ = true;
}
}
@@ -475,17 +467,17 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() {
}
TransportAdapter::Error BluetoothDeviceScanner::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!thread_->start()) {
- LOG4CXX_ERROR(logger_, "Bluetooth device scanner thread start failed");
+ SDL_LOG_AUTO_TRACE();
+ if (!thread_->Start()) {
+ SDL_LOG_ERROR("Bluetooth device scanner thread start failed");
return TransportAdapter::FAIL;
}
- LOG4CXX_INFO(logger_, "Bluetooth device scanner thread started");
+ SDL_LOG_INFO("Bluetooth device scanner thread started");
return TransportAdapter::OK;
}
void BluetoothDeviceScanner::Terminate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
shutdown_requested_ = true;
if (thread_) {
{
@@ -493,17 +485,16 @@ void BluetoothDeviceScanner::Terminate() {
device_scan_requested_ = false;
device_scan_requested_cv_.NotifyOne();
}
- LOG4CXX_INFO(logger_,
- "Waiting for bluetooth device scanner thread termination");
- thread_->stop();
- LOG4CXX_INFO(logger_, "Bluetooth device scanner thread stopped");
+ SDL_LOG_INFO("Waiting for bluetooth device scanner thread termination");
+ thread_->Stop(threads::Thread::kThreadStopDelegate);
+ SDL_LOG_INFO("Bluetooth device scanner thread stopped");
}
}
TransportAdapter::Error BluetoothDeviceScanner::Scan() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if ((!IsInitialised()) || shutdown_requested_) {
- LOG4CXX_WARN(logger_, "BAD_STATE");
+ SDL_LOG_WARN("BAD_STATE");
return TransportAdapter::BAD_STATE;
}
if (auto_repeat_pause_sec_ == 0) {
@@ -513,12 +504,12 @@ TransportAdapter::Error BluetoothDeviceScanner::Scan() {
sync_primitives::AutoLock auto_lock(device_scan_requested_lock_);
if (!device_scan_requested_) {
- LOG4CXX_TRACE(logger_, "Requesting device Scan");
+ SDL_LOG_TRACE("Requesting device Scan");
device_scan_requested_ = true;
device_scan_requested_cv_.NotifyOne();
} else {
ret = TransportAdapter::BAD_STATE;
- LOG4CXX_WARN(logger_, "BAD_STATE");
+ SDL_LOG_WARN("BAD_STATE");
}
return ret;
}
@@ -528,7 +519,7 @@ BluetoothDeviceScanner::BluetoothDeviceScannerDelegate::
: scanner_(scanner) {}
void BluetoothDeviceScanner::BluetoothDeviceScannerDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(scanner_);
scanner_->Thread();
}
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
index 78597ac2ad..b527bf1ef0 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
@@ -48,7 +48,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
BluetoothSocketConnection::BluetoothSocketConnection(
const DeviceUID& device_uid,
@@ -61,8 +61,8 @@ BluetoothSocketConnection::~BluetoothSocketConnection() {
}
bool BluetoothSocketConnection::Establish(ConnectError** error) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "error: " << error);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("error: " << error);
DeviceSptr device = controller()->FindDevice(device_handle());
BluetoothDevice* bluetooth_device =
@@ -71,10 +71,9 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) {
uint8_t rfcomm_channel;
if (!bluetooth_device->GetRfcommChannel(application_handle(),
&rfcomm_channel)) {
- LOG4CXX_DEBUG(logger_,
- "Application " << application_handle() << " not found");
+ SDL_LOG_DEBUG("Application " << application_handle() << " not found");
*error = new ConnectError();
- LOG4CXX_TRACE(logger_, "exit with FALSE");
+ SDL_LOG_TRACE("exit with FALSE");
return false;
}
@@ -89,25 +88,25 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) {
int attempts = 4;
int connect_status = 0;
- LOG4CXX_DEBUG(logger_, "start rfcomm Connect attempts");
+ SDL_LOG_DEBUG("start rfcomm Connect attempts");
do {
rfcomm_socket = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
if (-1 == rfcomm_socket) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_,
+ SDL_LOG_ERROR_WITH_ERRNO(
+
"Failed to create RFCOMM socket for device " << device_handle());
*error = new ConnectError();
- LOG4CXX_TRACE(logger_, "exit with FALSE");
+ SDL_LOG_TRACE("exit with FALSE");
return false;
}
connect_status = ::connect(rfcomm_socket,
(struct sockaddr*)&remoteSocketAddress,
sizeof(remoteSocketAddress));
if (0 == connect_status) {
- LOG4CXX_DEBUG(logger_, "rfcomm Connect ok");
+ SDL_LOG_DEBUG("rfcomm Connect ok");
break;
} else { // If connect_status is not 0, an errno is returned
- LOG4CXX_WARN_WITH_ERRNO(logger_, "rfcomm Connect failed");
+ SDL_LOG_WARN_WITH_ERRNO("rfcomm Connect failed");
close(rfcomm_socket); // Always close the socket upon error
if (errno != ECONNREFUSED && errno != ECONNRESET) {
break;
@@ -115,20 +114,20 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) {
}
sleep(2);
} while (--attempts > 0);
- LOG4CXX_INFO(logger_, "rfcomm Connect attempts finished");
+ SDL_LOG_INFO("rfcomm Connect attempts finished");
if (0 != connect_status) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Failed to Connect to remote device "
- << BluetoothDevice::GetUniqueDeviceId(remoteSocketAddress.rc_bdaddr)
- << " for session " << this);
+ << BluetoothDevice::GetUniqueDeviceId(remoteSocketAddress.rc_bdaddr)
+ << " for session " << this);
*error = new ConnectError();
- LOG4CXX_TRACE(logger_, "exit with FALSE");
+ SDL_LOG_TRACE("exit with FALSE");
return false;
}
set_socket(rfcomm_socket);
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
return true;
}
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
index 41e77af5bd..abeb50e798 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
@@ -52,7 +52,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
BluetoothTransportAdapter::BluetoothTransportAdapter(
resumption::LastStateWrapperPtr last_state_wrapper,
@@ -69,7 +69,7 @@ DeviceType BluetoothTransportAdapter::GetDeviceType() const {
}
void BluetoothTransportAdapter::Store() const {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
Json::Value bluetooth_adapter_dictionary;
Json::Value devices_dictionary;
DeviceList device_ids = GetDeviceList();
@@ -116,11 +116,11 @@ void BluetoothTransportAdapter::Store() const {
dictionary["TransportManager"]["BluetoothAdapter"] =
bluetooth_adapter_dictionary;
accessor.GetMutableData().set_dictionary(dictionary);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
bool BluetoothTransportAdapter::Restore() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
bool errors_occured = false;
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -159,9 +159,9 @@ bool BluetoothTransportAdapter::Restore() {
}
bool result = !errors_occured;
if (result) {
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
} else {
- LOG4CXX_TRACE(logger_, "exit with FALSE");
+ SDL_LOG_TRACE("exit with FALSE");
}
return result;
}
diff --git a/src/components/transport_manager/src/cloud/cloud_device.cc b/src/components/transport_manager/src/cloud/cloud_device.cc
index 9225589d57..06a8e66495 100644
--- a/src/components/transport_manager/src/cloud/cloud_device.cc
+++ b/src/components/transport_manager/src/cloud/cloud_device.cc
@@ -37,7 +37,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
CloudDevice::CloudDevice(std::string& host,
std::string& port,
@@ -53,7 +53,7 @@ CloudDevice::CloudDevice(CloudAppEndpoint& endpoint, std::string& name)
: Device(name, std::string(name)), endpoint_(endpoint) {}
bool CloudDevice::IsSameAs(const Device* other) const {
- LOG4CXX_TRACE(logger_, "enter. device: " << other);
+ SDL_LOG_TRACE("enter. device: " << other);
const CloudDevice* other_cloud_device =
dynamic_cast<const CloudDevice*>(other);
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
index d072685eef..a5d25c56c1 100644
--- a/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
@@ -43,7 +43,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
CloudWebsocketConnectionFactory::CloudWebsocketConnectionFactory(
TransportAdapterController* controller)
@@ -55,7 +55,7 @@ TransportAdapter::Error CloudWebsocketConnectionFactory::Init() {
TransportAdapter::Error CloudWebsocketConnectionFactory::CreateConnection(
const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto connection = controller_->FindPendingConnection(device_uid, app_handle);
std::shared_ptr<WebsocketClientConnection> ws_connection =
@@ -66,8 +66,8 @@ TransportAdapter::Error CloudWebsocketConnectionFactory::CreateConnection(
TransportAdapter::Error error = ws_connection->Start();
if (TransportAdapter::OK != error) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Cloud Websocket connection::Start() failed with error: " << error);
}
return error;
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
index 2d1de703b1..402a103910 100644
--- a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
@@ -41,7 +41,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
CloudWebsocketTransportAdapter::CloudWebsocketTransportAdapter(
resumption::LastStateWrapperPtr last_state_wrapper,
@@ -99,18 +99,18 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
std::string str = uid;
if (!boost::regex_search(str, results, group_pattern)) {
- LOG4CXX_DEBUG(logger_, "Invalid Pattern: " << uid);
+ SDL_LOG_DEBUG("Invalid Pattern: " << uid);
return;
}
- LOG4CXX_DEBUG(logger_, "#Results: " << results.size());
+ SDL_LOG_DEBUG("#Results: " << results.size());
std::string results_str;
for (size_t i = 0; i < results.size(); i++) {
results_str += " R[" + std::to_string(i) + "]:";
results_str +=
(results[i].length() != 0) ? results[i] : std::string("<EMPTY>");
}
- LOG4CXX_DEBUG(logger_, "Results: " << results_str);
+ SDL_LOG_DEBUG("Results: " << results_str);
std::string device_id = uid;
@@ -120,11 +120,10 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
.query = results[9],
.fragment = results[10]};
- LOG4CXX_DEBUG(logger_,
- "Creating Cloud Device For Host: "
- << endpoint.host << " at Port: " << endpoint.port
- << " with Target: "
- << (endpoint.path + endpoint.query + endpoint.fragment));
+ SDL_LOG_DEBUG("Creating Cloud Device For Host: "
+ << endpoint.host << " at Port: " << endpoint.port
+ << " with Target: "
+ << (endpoint.path + endpoint.query + endpoint.fragment));
auto cloud_device = std::make_shared<CloudDevice>(endpoint, device_id);
diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
index 794cf57208..f6b791f886 100644
--- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc
+++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
@@ -40,7 +40,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
WebsocketClientConnection::WebsocketClientConnection(
const DeviceUID& device_uid,
@@ -80,7 +80,7 @@ void WebsocketClientConnection::AddCertificateAuthority(
#endif // ENABLE_SECURITY
TransportAdapter::Error WebsocketClientConnection::Start() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceSptr device = controller_->FindDevice(device_uid_);
CloudDevice* cloud_device = static_cast<CloudDevice*>(device.get());
CloudWebsocketTransportAdapter* cloud_ta =
@@ -90,23 +90,20 @@ TransportAdapter::Error WebsocketClientConnection::Start() {
auto const port = cloud_device->GetPort();
boost::system::error_code ec;
- LOG4CXX_DEBUG(logger_, "Cloud app endpoint: " << cloud_properties.endpoint);
- LOG4CXX_DEBUG(logger_,
- "Cloud app certificate: " << cloud_properties.certificate);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG("Cloud app endpoint: " << cloud_properties.endpoint);
+ SDL_LOG_DEBUG("Cloud app certificate: " << cloud_properties.certificate);
+ SDL_LOG_DEBUG(
"Cloud app authentication token: " << cloud_properties.auth_token);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Cloud app transport type: " << cloud_properties.cloud_transport_type);
- LOG4CXX_DEBUG(logger_,
- "Cloud app hybrid app preference: "
- << cloud_properties.hybrid_app_preference);
+ SDL_LOG_DEBUG("Cloud app hybrid app preference: "
+ << cloud_properties.hybrid_app_preference);
auto const results = resolver_.resolve(host, port, ec);
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(logger_, "Could not resolve host/port: " << str_err);
+ SDL_LOG_ERROR("Could not resolve host/port: " << str_err);
return TransportAdapter::FAIL;
}
@@ -123,9 +120,8 @@ TransportAdapter::Error WebsocketClientConnection::Start() {
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(logger_,
- "Could not connect to websocket: " << host << ":" << port);
- LOG4CXX_ERROR(logger_, str_err);
+ SDL_LOG_ERROR("Could not connect to websocket: " << host << ":" << port);
+ SDL_LOG_ERROR(str_err);
return TransportAdapter::FAIL;
}
@@ -135,10 +131,9 @@ TransportAdapter::Error WebsocketClientConnection::Start() {
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(logger_,
- "Failed to add certificate authority: "
- << cloud_properties.certificate);
- LOG4CXX_ERROR(logger_, str_err);
+ SDL_LOG_ERROR("Failed to add certificate authority: "
+ << cloud_properties.certificate);
+ SDL_LOG_ERROR(str_err);
Shutdown();
return TransportAdapter::FAIL;
}
@@ -148,10 +143,9 @@ TransportAdapter::Error WebsocketClientConnection::Start() {
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(logger_,
- "Could not complete SSL Handshake failed with host/port: "
- << host << ":" << port);
- LOG4CXX_ERROR(logger_, str_err);
+ SDL_LOG_ERROR("Could not complete SSL Handshake failed with host/port: "
+ << host << ":" << port);
+ SDL_LOG_ERROR(str_err);
Shutdown();
return TransportAdapter::FAIL;
}
@@ -169,10 +163,10 @@ TransportAdapter::Error WebsocketClientConnection::Start() {
#endif // ENABLE_SECURITY
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Could not complete handshake with host/port: " << host << ":" << port);
- LOG4CXX_ERROR(logger_, str_err);
+ SDL_LOG_ERROR(str_err);
return TransportAdapter::FAIL;
}
@@ -185,7 +179,7 @@ TransportAdapter::Error WebsocketClientConnection::Start() {
wss_.binary(true);
}
#endif // ENABLE_SECURITY
- write_thread_->start(threads::ThreadOptions());
+ write_thread_->Start(threads::ThreadOptions());
controller_->ConnectDone(device_uid_, app_handle_);
// Start async read
@@ -208,8 +202,8 @@ TransportAdapter::Error WebsocketClientConnection::Start() {
boost::asio::post(io_pool_, [&]() { ioc_.run(); });
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Successfully started websocket connection @: " << host << ":" << port);
return TransportAdapter::OK;
}
@@ -221,7 +215,7 @@ void WebsocketClientConnection::Recv(boost::system::error_code ec) {
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(logger_, str_err);
+ SDL_LOG_ERROR(str_err);
Shutdown();
return;
}
@@ -248,7 +242,7 @@ void WebsocketClientConnection::OnRead(boost::system::error_code ec,
boost::ignore_unused(bytes_transferred);
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(logger_, str_err);
+ SDL_LOG_ERROR(str_err);
ws_.lowest_layer().close();
ioc_.stop();
Shutdown();
@@ -271,24 +265,25 @@ void WebsocketClientConnection::OnRead(boost::system::error_code ec,
TransportAdapter::Error WebsocketClientConnection::SendData(
::protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(frames_to_send_mutex_);
message_queue_.push(message);
return TransportAdapter::OK;
}
TransportAdapter::Error WebsocketClientConnection::Disconnect() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Shutdown();
return TransportAdapter::OK;
}
void WebsocketClientConnection::Shutdown() {
+ SDL_LOG_AUTO_TRACE();
shutdown_ = true;
if (thread_delegate_) {
thread_delegate_->SetShutdown();
- write_thread_->join();
+ write_thread_->Stop(threads::Thread::kThreadSoftStop);
delete thread_delegate_;
thread_delegate_ = NULL;
threads::DeleteThread(write_thread_);
@@ -337,7 +332,7 @@ void WebsocketClientConnection::LoopThreadDelegate::DrainQueue() {
}
#endif // ENABLE_SECURITY
if (ec) {
- LOG4CXX_ERROR(logger_, "Error writing to websocket");
+ SDL_LOG_ERROR("Error writing to websocket");
handler_.controller_->DataSendFailed(handler_.device_uid_,
handler_.app_handle_,
message_ptr,
diff --git a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
index 6a43f66c64..9fe79cade1 100644
--- a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
+++ b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
@@ -50,7 +50,7 @@ static const auto out_signals_channel = "iap_signals_out";
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "IAP2Emulation");
+SDL_CREATE_LOG_VARIABLE("IAP2Emulation");
IAP2BluetoothEmulationTransportAdapter::IAP2BluetoothEmulationTransportAdapter(
const uint16_t port,
@@ -60,7 +60,7 @@ IAP2BluetoothEmulationTransportAdapter::IAP2BluetoothEmulationTransportAdapter(
void IAP2BluetoothEmulationTransportAdapter::DeviceSwitched(
const DeviceUID& device_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
UNUSED(device_handle);
DCHECK(!"Switching for iAP2 Bluetooth is not supported.");
}
@@ -81,43 +81,43 @@ IAP2USBEmulationTransportAdapter::IAP2USBEmulationTransportAdapter(
: TcpTransportAdapter(port, last_state_wrapper, settings), out_(0) {
auto delegate = new IAPSignalHandlerDelegate(*this);
signal_handler_ = threads::CreateThread("iAP signal handler", delegate);
- signal_handler_->start();
+ signal_handler_->Start();
const auto result = mkfifo(out_signals_channel, mode);
UNUSED(result);
- LOG4CXX_DEBUG(logger_, "Out signals channel creation result: " << result);
+ SDL_LOG_DEBUG("Out signals channel creation result: " << result);
}
IAP2USBEmulationTransportAdapter::~IAP2USBEmulationTransportAdapter() {
- signal_handler_->join();
- auto delegate = signal_handler_->delegate();
- signal_handler_->set_delegate(NULL);
+ signal_handler_->Stop(threads::Thread::kThreadSoftStop);
+ auto delegate = signal_handler_->GetDelegate();
+ signal_handler_->SetDelegate(NULL);
delete delegate;
threads::DeleteThread(signal_handler_);
- LOG4CXX_DEBUG(logger_, "Out close result: " << close(out_));
- LOG4CXX_DEBUG(logger_, "Out unlink result: " << unlink(out_signals_channel));
+ SDL_LOG_DEBUG("Out close result: " << close(out_));
+ SDL_LOG_DEBUG("Out unlink result: " << unlink(out_signals_channel));
}
void IAP2USBEmulationTransportAdapter::DeviceSwitched(
const DeviceUID& device_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
UNUSED(device_handle);
const auto switch_signal_ack = std::string("SDL_TRANSPORT_SWITCH_ACK\n");
auto out_ = open(out_signals_channel, O_WRONLY);
- LOG4CXX_DEBUG(logger_, "Out channel descriptor: " << out_);
+ SDL_LOG_DEBUG("Out channel descriptor: " << out_);
if (out_ < 0) {
- LOG4CXX_ERROR(logger_, "Failed to open out signals channel");
+ SDL_LOG_ERROR("Failed to open out signals channel");
return;
}
const auto bytes =
write(out_, switch_signal_ack.c_str(), switch_signal_ack.size());
UNUSED(bytes);
- LOG4CXX_DEBUG(logger_, "Written bytes to out: " << bytes);
+ SDL_LOG_DEBUG("Written bytes to out: " << bytes);
- LOG4CXX_DEBUG(logger_, "Switching signal ACK is sent");
- LOG4CXX_DEBUG(logger_, "iAP2 USB device is switched with iAP2 Bluetooth");
+ SDL_LOG_DEBUG("Switching signal ACK is sent");
+ SDL_LOG_DEBUG("iAP2 USB device is switched with iAP2 Bluetooth");
close(out_);
}
@@ -135,19 +135,19 @@ IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::
: adapter_(adapter), run_flag_(true), in_(0) {
const auto result = mkfifo(in_signals_channel, mode);
UNUSED(result);
- LOG4CXX_DEBUG(logger_, "In signals channel creation result: " << result);
+ SDL_LOG_DEBUG("In signals channel creation result: " << result);
}
void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Signal handling is started");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Signal handling is started");
const auto switch_signal = "SDL_TRANSPORT_SWITCH";
- LOG4CXX_DEBUG(logger_, "Waiting for signal: " << switch_signal);
+ SDL_LOG_DEBUG("Waiting for signal: " << switch_signal);
in_ = open(in_signals_channel, O_RDONLY);
- LOG4CXX_DEBUG(logger_, "In channel descriptor: " << in_);
+ SDL_LOG_DEBUG("In channel descriptor: " << in_);
if (in_ < 0) {
- LOG4CXX_ERROR(logger_, "Failed to open in signals channel");
+ SDL_LOG_ERROR("Failed to open in signals channel");
return;
}
@@ -159,26 +159,26 @@ void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::threadMain() {
continue;
}
if (-1 == bytes) {
- LOG4CXX_DEBUG(logger_, "Error during input pipe read");
+ SDL_LOG_DEBUG("Error during input pipe read");
break;
}
- LOG4CXX_DEBUG(logger_, "Read in bytes: " << bytes);
+ SDL_LOG_DEBUG("Read in bytes: " << bytes);
buffer[bytes] = '\0';
std::string str(buffer);
if (std::string::npos != str.find(switch_signal)) {
- LOG4CXX_DEBUG(logger_, "Switch signal received.");
+ SDL_LOG_DEBUG("Switch signal received.");
adapter_.DoTransportSwitch();
}
}
- LOG4CXX_DEBUG(logger_, "In close result: " << close(in_));
- LOG4CXX_DEBUG(logger_, "In unlink result: " << unlink(in_signals_channel));
+ SDL_LOG_DEBUG("In close result: " << close(in_));
+ SDL_LOG_DEBUG("In unlink result: " << unlink(in_signals_channel));
}
void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::
exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Stopping signal handling.");
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Stopping signal handling.");
run_flag_ = false;
ThreadDelegate::exitThreadMain();
}
diff --git a/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc b/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc
index 85c479134d..3c2df28aca 100644
--- a/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc
+++ b/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc
@@ -4,37 +4,37 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
NetworkInterfaceListenerImpl::NetworkInterfaceListenerImpl(
TcpClientListener* tcp_client_listener,
const std::string designated_interface)
: platform_specific_impl_(new PlatformSpecificNetworkInterfaceListener(
tcp_client_listener, designated_interface)) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
NetworkInterfaceListenerImpl::~NetworkInterfaceListenerImpl() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool NetworkInterfaceListenerImpl::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return platform_specific_impl_->Init();
}
void NetworkInterfaceListenerImpl::Deinit() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
platform_specific_impl_->Deinit();
}
bool NetworkInterfaceListenerImpl::Start() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return platform_specific_impl_->Start();
}
bool NetworkInterfaceListenerImpl::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return platform_specific_impl_->Stop();
}
diff --git a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
index b37e5dc962..8da69b5f6b 100644
--- a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
+++ b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
@@ -21,7 +21,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
static bool SetNonblocking(int s);
@@ -93,31 +93,31 @@ PlatformSpecificNetworkInterfaceListener::
PlatformSpecificNetworkInterfaceListener::
~PlatformSpecificNetworkInterfaceListener() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Stop();
Deinit();
- delete thread_->delegate();
+ delete thread_->GetDelegate();
threads::DeleteThread(thread_);
}
bool PlatformSpecificNetworkInterfaceListener::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Init socket: " << socket_);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Init socket: " << socket_);
if (socket_ >= 0) {
- LOG4CXX_WARN(logger_, "Network interface listener is already initialized");
+ SDL_LOG_WARN("Network interface listener is already initialized");
return false;
}
socket_ = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (socket_ == -1) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create netlink socket");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to create netlink socket");
return false;
}
if (!SetNonblocking(socket_)) {
- LOG4CXX_WARN(logger_, "Failed to configure netlink socket to non-blocking");
+ SDL_LOG_WARN("Failed to configure netlink socket to non-blocking");
}
struct sockaddr_nl addr;
@@ -128,29 +128,29 @@ bool PlatformSpecificNetworkInterfaceListener::Init() {
addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;
if (bind(socket_, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to bind netlink socket");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to bind netlink socket");
close(socket_);
socket_ = -1;
return false;
}
if (pipe(pipe_fds_) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create internal pipe");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to create internal pipe");
close(socket_);
socket_ = -1;
return false;
}
if (!SetNonblocking(pipe_fds_[0])) {
- LOG4CXX_WARN(logger_, "Failed to configure pipe to non-blocking");
+ SDL_LOG_WARN("Failed to configure pipe to non-blocking");
}
return true;
}
void PlatformSpecificNetworkInterfaceListener::Deinit() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Deinit socket: " << socket_);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Deinit socket: " << socket_);
if (socket_ >= 0) {
close(socket_);
socket_ = -1;
@@ -166,43 +166,43 @@ void PlatformSpecificNetworkInterfaceListener::Deinit() {
}
bool PlatformSpecificNetworkInterfaceListener::Start() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (socket_ < 0) {
- LOG4CXX_WARN(logger_, "Interface listener is not initialized");
+ SDL_LOG_WARN("Interface listener is not initialized");
return false;
}
- if (thread_->is_running()) {
- LOG4CXX_WARN(logger_, "Interface listener is already started");
+ if (thread_->IsRunning()) {
+ SDL_LOG_WARN("Interface listener is already started");
return false;
}
- if (!thread_->start()) {
- LOG4CXX_ERROR(logger_, "Failed to start interface listener");
+ if (!thread_->Start()) {
+ SDL_LOG_ERROR("Failed to start interface listener");
return false;
}
- LOG4CXX_INFO(logger_, "Network interface listener started");
+ SDL_LOG_INFO("Network interface listener started");
return true;
}
bool PlatformSpecificNetworkInterfaceListener::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- if (!thread_->is_running()) {
- LOG4CXX_DEBUG(logger_, "interface listener is not running");
+ if (!thread_->IsRunning()) {
+ SDL_LOG_DEBUG("interface listener is not running");
return false;
}
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadStopDelegate);
- LOG4CXX_INFO(logger_, "Network interface listener stopped");
+ SDL_LOG_INFO("Network interface listener stopped");
return true;
}
void PlatformSpecificNetworkInterfaceListener::Loop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Initialize status_table_ by acquiring a list of interfaces and their
// current statuses. Also we will notify an event to the listener if IP
@@ -227,8 +227,7 @@ void PlatformSpecificNetworkInterfaceListener::Loop() {
if (errno == EINTR) {
continue;
} else {
- LOG4CXX_WARN(logger_,
- "select failed for netlink. Aborting interface listener.");
+ SDL_LOG_WARN("select failed for netlink. Aborting interface listener.");
break;
}
}
@@ -239,17 +238,15 @@ void PlatformSpecificNetworkInterfaceListener::Loop() {
ret = read(pipe_fds_[0], buf, sizeof(buf));
if (ret < 0) {
if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Failed to read from pipe. Aborting interface listener.");
break;
}
} else if (ret == 0) {
- LOG4CXX_WARN(logger_,
- "Pipe disconnected. Aborting interface listener.");
+ SDL_LOG_WARN("Pipe disconnected. Aborting interface listener.");
break;
} else {
- LOG4CXX_DEBUG(logger_, "received terminating event through pipe");
+ SDL_LOG_DEBUG("received terminating event through pipe");
break;
}
}
@@ -265,14 +262,13 @@ void PlatformSpecificNetworkInterfaceListener::Loop() {
ret = recv(socket_, buf, sizeof(buf), 0);
if (ret < 0) {
if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
- LOG4CXX_WARN(logger_,
- "Failed to read from netlink socket. Aborting interface "
- "listener.");
+ SDL_LOG_WARN(
+ "Failed to read from netlink socket. Aborting interface "
+ "listener.");
break;
}
} else if (ret == 0) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Netlink socket disconnected. Aborting interface listener.");
break;
} else {
@@ -283,7 +279,7 @@ void PlatformSpecificNetworkInterfaceListener::Loop() {
// time so we use for-loop to go through.
for (; NLMSG_OK(header, len); header = NLMSG_NEXT(header, len)) {
if (header->nlmsg_type == NLMSG_ERROR) {
- LOG4CXX_WARN(logger_, "received error event from netlink");
+ SDL_LOG_WARN("received error event from netlink");
break;
}
@@ -325,20 +321,20 @@ void PlatformSpecificNetworkInterfaceListener::Loop() {
}
bool PlatformSpecificNetworkInterfaceListener::StopLoop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
- LOG4CXX_INFO(logger_, "Stopping network interface listener");
+ SDL_LOG_INFO("Stopping network interface listener");
if (pipe_fds_[1] < 0) {
- LOG4CXX_WARN(logger_, "StopLoop called in invalid state");
+ SDL_LOG_WARN("StopLoop called in invalid state");
return false;
}
char dummy[1] = {0};
int ret = write(pipe_fds_[1], dummy, sizeof(dummy));
if (ret <= 0) {
- LOG4CXX_WARN_WITH_ERRNO(
- logger_, "Failed to send stop message to interface listener");
+ SDL_LOG_WARN_WITH_ERRNO(
+ "Failed to send stop message to interface listener");
return false;
}
@@ -346,7 +342,7 @@ bool PlatformSpecificNetworkInterfaceListener::StopLoop() {
}
bool PlatformSpecificNetworkInterfaceListener::InitializeStatus() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef BUILD_TESTS
if (testing_) {
@@ -357,9 +353,9 @@ bool PlatformSpecificNetworkInterfaceListener::InitializeStatus() {
struct ifaddrs *if_list, *interface;
if (getifaddrs(&if_list) != 0) {
- LOG4CXX_WARN(logger_,
- "getifaddr failed, interface status won't be available until "
- "a change occurs");
+ SDL_LOG_WARN(
+ "getifaddr failed, interface status won't be available until "
+ "a change occurs");
return false;
}
@@ -405,14 +401,14 @@ bool PlatformSpecificNetworkInterfaceListener::InitializeStatus() {
freeifaddrs(if_list);
- LOG4CXX_DEBUG(logger_, "Successfully acquired network interface status");
+ SDL_LOG_DEBUG("Successfully acquired network interface status");
DumpTable();
return true;
}
bool PlatformSpecificNetworkInterfaceListener::UpdateStatus(
uint16_t type, std::vector<EventParam>& params) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (std::vector<EventParam>::iterator it = params.begin();
it != params.end();
@@ -421,16 +417,16 @@ bool PlatformSpecificNetworkInterfaceListener::UpdateStatus(
switch (type) {
case RTM_NEWLINK: {
const std::string& ifname = GetInterfaceName(it->if_index);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"netlink event: interface " << ifname << " created or updated");
status.SetName(ifname);
status.SetFlags(it->flags);
break;
}
case RTM_DELLINK:
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"netlink event: interface " << status.GetName() << " removed");
status_table_.erase(it->if_index);
break;
@@ -439,37 +435,33 @@ bool PlatformSpecificNetworkInterfaceListener::UpdateStatus(
if (addr->sa_family == AF_INET) {
sockaddr_in* addr_in = reinterpret_cast<sockaddr_in*>(addr);
status.SetIPv4Address(&addr_in->sin_addr);
- LOG4CXX_DEBUG(logger_,
- "netlink event: IPv4 address of interface "
- << status.GetName() << " updated to "
- << status.GetIPv4Address());
+ SDL_LOG_DEBUG("netlink event: IPv4 address of interface "
+ << status.GetName() << " updated to "
+ << status.GetIPv4Address());
} else if (addr->sa_family == AF_INET6) {
sockaddr_in6* addr_in6 = reinterpret_cast<sockaddr_in6*>(addr);
status.SetIPv6Address(&addr_in6->sin6_addr);
- LOG4CXX_DEBUG(logger_,
- "netlink event: IPv6 address of interface "
- << status.GetName() << " updated to "
- << status.GetIPv6Address());
+ SDL_LOG_DEBUG("netlink event: IPv6 address of interface "
+ << status.GetName() << " updated to "
+ << status.GetIPv6Address());
}
break;
}
case RTM_DELADDR: {
sockaddr* addr = reinterpret_cast<sockaddr*>(&it->address);
if (addr->sa_family == AF_INET) {
- LOG4CXX_DEBUG(logger_,
- "netlink event: IPv4 address of interface "
- << status.GetName() << " removed");
+ SDL_LOG_DEBUG("netlink event: IPv4 address of interface "
+ << status.GetName() << " removed");
status.SetIPv4Address(NULL);
} else if (addr->sa_family == AF_INET6) {
- LOG4CXX_DEBUG(logger_,
- "netlink event: IPv6 address of interface "
- << status.GetName() << " removed");
+ SDL_LOG_DEBUG("netlink event: IPv6 address of interface "
+ << status.GetName() << " removed");
status.SetIPv6Address(NULL);
}
break;
}
default:
- LOG4CXX_WARN(logger_, "Unsupported netlink event (" << type << ")");
+ SDL_LOG_WARN("Unsupported netlink event (" << type << ")");
break;
}
}
@@ -477,7 +469,7 @@ bool PlatformSpecificNetworkInterfaceListener::UpdateStatus(
}
void PlatformSpecificNetworkInterfaceListener::NotifyIPAddresses() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::string ipv4_addr;
std::string ipv6_addr;
@@ -498,11 +490,9 @@ void PlatformSpecificNetworkInterfaceListener::NotifyIPAddresses() {
}
if (notified_ipv4_addr_ != ipv4_addr || notified_ipv6_addr_ != ipv6_addr) {
- LOG4CXX_INFO(logger_,
- "IP address updated: \"" << notified_ipv4_addr_ << "\" -> \""
- << ipv4_addr << "\", \""
- << notified_ipv6_addr_ << "\" -> \""
- << ipv6_addr << "\"");
+ SDL_LOG_INFO("IP address updated: \""
+ << notified_ipv4_addr_ << "\" -> \"" << ipv4_addr << "\", \""
+ << notified_ipv6_addr_ << "\" -> \"" << ipv6_addr << "\"");
notified_ipv4_addr_ = ipv4_addr;
notified_ipv6_addr_ = ipv6_addr;
@@ -513,7 +503,7 @@ void PlatformSpecificNetworkInterfaceListener::NotifyIPAddresses() {
}
const std::string PlatformSpecificNetworkInterfaceListener::SelectInterface() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!designated_interface_.empty()) {
return designated_interface_;
@@ -548,8 +538,7 @@ const std::string PlatformSpecificNetworkInterfaceListener::SelectInterface() {
}
selected_interface_ = status.GetName();
- LOG4CXX_DEBUG(logger_,
- "selecting network interface: " << selected_interface_);
+ SDL_LOG_DEBUG("selecting network interface: " << selected_interface_);
return selected_interface_;
}
@@ -560,7 +549,7 @@ const std::string PlatformSpecificNetworkInterfaceListener::SelectInterface() {
std::vector<PlatformSpecificNetworkInterfaceListener::EventParam>
PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage(
struct ifaddrmsg* message, unsigned int size) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::vector<EventParam> params;
@@ -577,8 +566,7 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage(
if (message->ifa_family == AF_INET) {
// make sure the size of data is >= 4 bytes
if (RTA_PAYLOAD(attr) < sizeof(struct in_addr)) {
- LOG4CXX_DEBUG(logger_,
- "Invalid netlink event: insufficient IPv4 address data");
+ SDL_LOG_DEBUG("Invalid netlink event: insufficient IPv4 address data");
continue;
}
@@ -594,8 +582,7 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage(
} else if (message->ifa_family == AF_INET6) {
// make sure the size of data is >= 16 bytes
if (RTA_PAYLOAD(attr) < sizeof(struct in6_addr)) {
- LOG4CXX_DEBUG(logger_,
- "Invalid netlink event: insufficient IPv6 address data");
+ SDL_LOG_DEBUG("Invalid netlink event: insufficient IPv6 address data");
continue;
}
@@ -609,8 +596,7 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage(
sockaddr->sin6_addr = *ipv6_addr;
} else {
- LOG4CXX_WARN(logger_,
- "Unsupported family (" << message->ifa_family << ")");
+ SDL_LOG_WARN("Unsupported family (" << message->ifa_family << ")");
continue;
}
@@ -621,20 +607,18 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage(
}
void PlatformSpecificNetworkInterfaceListener::DumpTable() const {
- LOG4CXX_DEBUG(logger_,
- "Number of network interfaces: " << status_table_.size());
+ SDL_LOG_DEBUG("Number of network interfaces: " << status_table_.size());
for (auto it = status_table_.begin(); it != status_table_.end(); ++it) {
const InterfaceStatus& status = it->second;
UNUSED(status);
- LOG4CXX_DEBUG(
- logger_,
- " " << status.GetName() << " : flags=" << status.GetFlags()
- << " : available: " << (status.IsAvailable() ? "yes" : "no")
- << " IPv4: " << status.GetIPv4Address()
- << " IPv6: " << status.GetIPv6Address()
- << (status.IsLoopback() ? " (loopback)" : ""));
+ SDL_LOG_DEBUG(" " << status.GetName() << " : flags=" << status.GetFlags()
+ << " : available: "
+ << (status.IsAvailable() ? "yes" : "no")
+ << " IPv4: " << status.GetIPv4Address()
+ << " IPv6: " << status.GetIPv6Address()
+ << (status.IsLoopback() ? " (loopback)" : ""));
}
}
@@ -677,14 +661,13 @@ void PlatformSpecificNetworkInterfaceListener::ListenerThreadDelegate::
static bool SetNonblocking(int s) {
int prev_flag = fcntl(s, F_GETFL, 0);
if (prev_flag == -1) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to acquire socket flag");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to acquire socket flag");
return false;
}
int ret = fcntl(s, F_SETFL, prev_flag | O_NONBLOCK);
if (ret == -1) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Failed to configure socket to non-blocking");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to configure socket to non-blocking");
return false;
}
diff --git a/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc
index 15b3814999..27046dab0b 100644
--- a/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc
+++ b/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc
@@ -3,7 +3,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
PlatformSpecificNetworkInterfaceListener::
PlatformSpecificNetworkInterfaceListener(
@@ -12,25 +12,25 @@ PlatformSpecificNetworkInterfaceListener::
PlatformSpecificNetworkInterfaceListener::
~PlatformSpecificNetworkInterfaceListener() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool PlatformSpecificNetworkInterfaceListener::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return true;
}
void PlatformSpecificNetworkInterfaceListener::Deinit() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
bool PlatformSpecificNetworkInterfaceListener::Start() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return true;
}
bool PlatformSpecificNetworkInterfaceListener::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return true;
}
diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
index df4409b8f3..0812cd39c9 100644
--- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc
+++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
@@ -66,7 +66,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
static bool SetNonblocking(int s);
@@ -96,7 +96,7 @@ TcpClientListener::TcpClientListener(TransportAdapterController* controller,
}
TransportAdapter::Error TcpClientListener::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
thread_stop_requested_ = false;
if (!IsListeningOnSpecificInterface()) {
@@ -104,17 +104,15 @@ TransportAdapter::Error TcpClientListener::Init() {
// using INADDR_ANY. If socket creation fails, we will treat it an error.
socket_ = CreateIPv4ServerSocket(port_);
if (-1 == socket_) {
- LOG4CXX_ERROR(logger_, "Failed to create TCP socket");
+ SDL_LOG_ERROR("Failed to create TCP socket");
return TransportAdapter::FAIL;
}
} else {
// Network interface is specified and we will listen only on the interface.
// In this case, the server socket will be created once
// NetworkInterfaceListener notifies the interface's IP address.
- LOG4CXX_INFO(logger_,
- "TCP server socket will listen on "
- << designated_interface_
- << " once it has an IPv4 address.");
+ SDL_LOG_INFO("TCP server socket will listen on "
+ << designated_interface_ << " once it has an IPv4 address.");
}
if (!interface_listener_->Init()) {
@@ -130,7 +128,7 @@ TransportAdapter::Error TcpClientListener::Init() {
}
void TcpClientListener::Terminate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!initialized_) {
return;
@@ -154,17 +152,17 @@ bool TcpClientListener::IsInitialised() const {
}
TcpClientListener::~TcpClientListener() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
StopListening();
- delete thread_->delegate();
+ delete thread_->GetDelegate();
threads::DeleteThread(thread_);
Terminate();
delete interface_listener_;
}
void SetKeepaliveOptions(const int fd) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "fd: " << fd);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("fd: " << fd);
int yes = 1;
int keepidle = 3; // 3 seconds to disconnection detecting
int keepcnt = 5;
@@ -172,26 +170,26 @@ void SetKeepaliveOptions(const int fd) {
#ifdef __linux__
int user_timeout = 7000; // milliseconds
if (0 != setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(yes))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_KEEPALIVE failed");
+ SDL_LOG_WARN_WITH_ERRNO("setsockopt SO_KEEPALIVE failed");
}
if (0 !=
setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepidle, sizeof(keepidle))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPIDLE failed");
+ SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_KEEPIDLE failed");
}
if (0 !=
setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPCNT failed");
+ SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_KEEPCNT failed");
}
if (0 != setsockopt(
fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPINTVL failed");
+ SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_KEEPINTVL failed");
}
if (0 != setsockopt(fd,
IPPROTO_TCP,
TCP_USER_TIMEOUT,
&user_timeout,
sizeof(user_timeout))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_USER_TIMEOUT failed");
+ SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_USER_TIMEOUT failed");
}
#elif defined(__QNX__) // __linux__
// TODO(KKolodiy): Out of order!
@@ -224,7 +222,7 @@ void SetKeepaliveOptions(const int fd) {
}
void TcpClientListener::Loop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
fd_set rfds;
char dummy[16];
std::vector<DeviceUID> device_uid_list;
@@ -240,7 +238,7 @@ void TcpClientListener::Loop() {
if (errno == EINTR) {
continue;
} else {
- LOG4CXX_WARN(logger_, "select failed for TCP server socket");
+ SDL_LOG_WARN("select failed for TCP server socket");
break;
}
}
@@ -249,18 +247,16 @@ void TcpClientListener::Loop() {
ret = read(pipe_fds_[0], dummy, sizeof(dummy));
if (ret < 0) {
if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Failed to read from pipe, aborting TCP server socket loop.");
break;
}
} else if (ret == 0) {
- LOG4CXX_WARN(logger_,
- "Pipe disconnected, aborting TCP server socket loop.");
+ SDL_LOG_WARN("Pipe disconnected, aborting TCP server socket loop.");
break;
} else {
- LOG4CXX_DEBUG(logger_,
- "received stop command of TCP server socket loop");
+ SDL_LOG_DEBUG("received stop command of TCP server socket loop");
break;
}
}
@@ -271,18 +267,18 @@ void TcpClientListener::Loop() {
const int connection_fd = accept(
socket_, (struct sockaddr*)&client_address, &client_address_size);
if (thread_stop_requested_) {
- LOG4CXX_DEBUG(logger_, "thread_stop_requested_");
+ SDL_LOG_DEBUG("thread_stop_requested_");
close(connection_fd);
break;
}
if (connection_fd < 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "accept() failed");
+ SDL_LOG_ERROR_WITH_ERRNO("accept() failed");
continue;
}
if (AF_INET != client_address.sin_family) {
- LOG4CXX_DEBUG(logger_, "Address of connected client is invalid");
+ SDL_LOG_DEBUG("Address of connected client is invalid");
close(connection_fd);
continue;
}
@@ -292,8 +288,8 @@ void TcpClientListener::Loop() {
strncpy(device_name, inet_ntoa(client_address.sin_addr), size);
device_name[size - 1] = '\0';
- LOG4CXX_INFO(logger_, "Connected client " << device_name);
- LOG4CXX_INFO(logger_, "Port is: " << port_);
+ SDL_LOG_INFO("Connected client " << device_name);
+ SDL_LOG_INFO("Port is: " << port_);
if (enable_keepalive_) {
SetKeepaliveOptions(connection_fd);
@@ -323,8 +319,7 @@ void TcpClientListener::Loop() {
connection->set_socket(connection_fd);
const TransportAdapter::Error error = connection->Start();
if (TransportAdapter::OK != error) {
- LOG4CXX_ERROR(logger_,
- "TCP connection::Start() failed with error: " << error);
+ SDL_LOG_ERROR("TCP connection::Start() failed with error: " << error);
} else {
device_uid_list.push_back(device->unique_device_id());
}
@@ -338,13 +333,13 @@ void TcpClientListener::Loop() {
controller_->DeviceDisconnected(*it, DisconnectDeviceError());
}
}
- LOG4CXX_INFO(logger_, "TCP server socket loop is terminated.");
+ SDL_LOG_INFO("TCP server socket loop is terminated.");
}
void TcpClientListener::StopLoop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (pipe_fds_[1] < 0) {
- LOG4CXX_WARN(logger_, "StopLoop called in invalid state");
+ SDL_LOG_WARN("StopLoop called in invalid state");
return;
}
@@ -353,16 +348,15 @@ void TcpClientListener::StopLoop() {
char dummy[1] = {0};
int ret = write(pipe_fds_[1], dummy, sizeof(dummy));
if (ret <= 0) {
- LOG4CXX_WARN_WITH_ERRNO(
- logger_, "Failed to send stop message to TCP server socket loop");
+ SDL_LOG_WARN_WITH_ERRNO(
+ "Failed to send stop message to TCP server socket loop");
}
}
TransportAdapter::Error TcpClientListener::StartListening() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (started_) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"TransportAdapter::BAD_STATE. Listener has already been started");
return TransportAdapter::BAD_STATE;
}
@@ -374,32 +368,32 @@ TransportAdapter::Error TcpClientListener::StartListening() {
if (!IsListeningOnSpecificInterface()) {
TransportAdapter::Error ret = StartListeningThread();
if (TransportAdapter::OK != ret) {
- LOG4CXX_ERROR(logger_, "Tcp client listener thread start failed");
+ SDL_LOG_ERROR("Tcp client listener thread start failed");
interface_listener_->Stop();
return ret;
}
}
started_ = true;
- LOG4CXX_INFO(logger_, "Tcp client listener has started successfully");
+ SDL_LOG_INFO("Tcp client listener has started successfully");
return TransportAdapter::OK;
}
TransportAdapter::Error TcpClientListener::ResumeListening() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
interface_listener_->Init();
StartListeningThread();
started_ = true;
- LOG4CXX_INFO(logger_, "Tcp client listener was resumed successfully");
+ SDL_LOG_INFO("Tcp client listener was resumed successfully");
return TransportAdapter::OK;
}
TransportAdapter::Error TcpClientListener::StopListening() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!started_) {
- LOG4CXX_DEBUG(logger_, "TcpClientListener is not running now");
+ SDL_LOG_DEBUG("TcpClientListener is not running now");
return TransportAdapter::BAD_STATE;
}
@@ -408,30 +402,30 @@ TransportAdapter::Error TcpClientListener::StopListening() {
StopListeningThread();
started_ = false;
- LOG4CXX_INFO(logger_, "Tcp client listener was stopped successfully");
+ SDL_LOG_INFO("Tcp client listener was stopped successfully");
return TransportAdapter::OK;
}
TransportAdapter::Error TcpClientListener::SuspendListening() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!started_) {
- LOG4CXX_DEBUG(logger_, "TcpClientListener is not running now");
+ SDL_LOG_DEBUG("TcpClientListener is not running now");
return TransportAdapter::BAD_STATE;
}
if (shutdown(socket_, SHUT_RDWR) != 0) {
- LOG4CXX_WARN(logger_, "Socket was unable to be shutdowned");
+ SDL_LOG_WARN("Socket was unable to be shutdowned");
}
if (close(socket_) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to close socket");
}
interface_listener_->Deinit();
StopListeningThread();
started_ = false;
- LOG4CXX_INFO(logger_, "Tcp client listener was suspended");
+ SDL_LOG_INFO("Tcp client listener was suspended");
return TransportAdapter::OK;
}
@@ -448,7 +442,7 @@ TcpClientListener::ListeningThreadDelegate::ListeningThreadDelegate(
: parent_(parent) {}
TransportAdapter::Error TcpClientListener::StartListeningThread() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// StartListening() can be called from multiple threads
sync_primitives::AutoLock auto_lock(start_stop_lock_);
@@ -457,29 +451,29 @@ TransportAdapter::Error TcpClientListener::StartListeningThread() {
// recreate the pipe every time, so that the thread loop will not get
// leftover data inside pipe after it is started
if (pipe(pipe_fds_) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create internal pipe");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to create internal pipe");
return TransportAdapter::FAIL;
}
if (!SetNonblocking(pipe_fds_[0])) {
- LOG4CXX_WARN(logger_, "Failed to configure pipe to non-blocking");
+ SDL_LOG_WARN("Failed to configure pipe to non-blocking");
}
}
thread_stop_requested_ = false;
- if (!thread_->start()) {
+ if (!thread_->Start()) {
return TransportAdapter::FAIL;
}
return TransportAdapter::OK;
}
TransportAdapter::Error TcpClientListener::StopListeningThread() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// StopListening() can be called from multiple threads
sync_primitives::AutoLock auto_lock(start_stop_lock_);
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadStopDelegate);
close(pipe_fds_[1]);
pipe_fds_[1] = -1;
@@ -491,7 +485,7 @@ TransportAdapter::Error TcpClientListener::StopListeningThread() {
void TcpClientListener::OnIPAddressUpdated(const std::string ipv4_addr,
const std::string ipv6_addr) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Since we only create a TCP socket with IPv4 option (AF_INET), currently we
// do not use IPv6 address.
@@ -499,15 +493,15 @@ void TcpClientListener::OnIPAddressUpdated(const std::string ipv4_addr,
if (IsListeningOnSpecificInterface()) {
if (!current_ip_address_.empty()) {
// the server socket is running, terminate it
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Stopping current TCP server socket on " << designated_interface_);
StopOnNetworkInterface();
}
if (!ipv4_addr.empty()) {
// start (or restart) server socket with the new IP address
- LOG4CXX_DEBUG(
- logger_, "Starting TCP server socket on " << designated_interface_);
+ SDL_LOG_DEBUG("Starting TCP server socket on "
+ << designated_interface_);
StartOnNetworkInterface();
}
}
@@ -528,7 +522,7 @@ void TcpClientListener::OnIPAddressUpdated(const std::string ipv4_addr,
}
bool TcpClientListener::StartOnNetworkInterface() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// this method is only for the case that network interface is specified
if (IsListeningOnSpecificInterface()) {
@@ -538,7 +532,7 @@ bool TcpClientListener::StartOnNetworkInterface() {
if (socket_ < 0) {
socket_ = CreateIPv4ServerSocket(port_, designated_interface_);
if (-1 == socket_) {
- LOG4CXX_WARN(logger_, "Failed to create TCP socket");
+ SDL_LOG_WARN("Failed to create TCP socket");
return false;
}
}
@@ -547,21 +541,20 @@ bool TcpClientListener::StartOnNetworkInterface() {
remove_devices_on_terminate_ = true;
if (TransportAdapter::OK != StartListeningThread()) {
- LOG4CXX_WARN(logger_, "Failed to start TCP client listener");
+ SDL_LOG_WARN("Failed to start TCP client listener");
return false;
}
- LOG4CXX_INFO(logger_,
- "TCP server socket started on " << designated_interface_);
+ SDL_LOG_INFO("TCP server socket started on " << designated_interface_);
}
return true;
}
bool TcpClientListener::StopOnNetworkInterface() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (IsListeningOnSpecificInterface()) {
if (TransportAdapter::OK != StopListeningThread()) {
- LOG4CXX_WARN(logger_, "Failed to stop TCP client listener");
+ SDL_LOG_WARN("Failed to stop TCP client listener");
return false;
}
@@ -573,9 +566,8 @@ bool TcpClientListener::StopOnNetworkInterface() {
remove_devices_on_terminate_ = false;
- LOG4CXX_INFO(
- logger_,
- "TCP server socket on " << designated_interface_ << " stopped");
+ SDL_LOG_INFO("TCP server socket on " << designated_interface_
+ << " stopped");
}
return true;
}
@@ -586,7 +578,7 @@ bool TcpClientListener::IsListeningOnSpecificInterface() const {
int TcpClientListener::CreateIPv4ServerSocket(
uint16_t port, const std::string interface_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
struct in_addr ipv4_address;
memset(&ipv4_address, 0, sizeof(ipv4_address));
@@ -598,7 +590,7 @@ int TcpClientListener::CreateIPv4ServerSocket(
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (-1 == sock) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create socket");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to create socket");
return -1;
}
@@ -610,20 +602,20 @@ int TcpClientListener::CreateIPv4ServerSocket(
int optval = 1;
if (0 !=
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_REUSEADDR failed");
+ SDL_LOG_WARN_WITH_ERRNO("setsockopt SO_REUSEADDR failed");
}
if (bind(sock,
reinterpret_cast<sockaddr*>(&server_address),
sizeof(server_address)) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "bind() failed");
+ SDL_LOG_ERROR_WITH_ERRNO("bind() failed");
close(sock);
return -1;
}
const int kBacklog = 128;
if (0 != listen(sock, kBacklog)) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "listen() failed");
+ SDL_LOG_ERROR_WITH_ERRNO("listen() failed");
close(sock);
return -1;
}
@@ -632,20 +624,20 @@ int TcpClientListener::CreateIPv4ServerSocket(
}
void TcpClientListener::DestroyServerSocket(int sock) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (sock >= 0) {
if (shutdown(sock, SHUT_RDWR) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to shutdown socket");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to shutdown socket");
}
if (close(sock) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to close socket");
}
}
}
bool TcpClientListener::GetIPv4Address(const std::string interface_name,
struct in_addr* ip_address) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
#ifdef BUILD_TESTS
if (testing_) {
@@ -663,7 +655,7 @@ bool TcpClientListener::GetIPv4Address(const std::string interface_name,
struct ifaddrs* if_list;
if (getifaddrs(&if_list) != 0) {
- LOG4CXX_WARN(logger_, "getifaddrs failed");
+ SDL_LOG_WARN("getifaddrs failed");
return false;
}
@@ -703,14 +695,13 @@ bool TcpClientListener::GetIPv4Address(const std::string interface_name,
static bool SetNonblocking(int s) {
int prev_flag = fcntl(s, F_GETFL, 0);
if (prev_flag == -1) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to acquire socket flag");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to acquire socket flag");
return false;
}
int ret = fcntl(s, F_SETFL, prev_flag | O_NONBLOCK);
if (ret == -1) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Failed to configure socket to non-blocking");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to configure socket to non-blocking");
return false;
}
diff --git a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc
index 50d1c74fa7..42da741611 100644
--- a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc
+++ b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc
@@ -39,7 +39,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TcpConnectionFactory::TcpConnectionFactory(
TransportAdapterController* controller)
@@ -51,9 +51,9 @@ TransportAdapter::Error TcpConnectionFactory::Init() {
TransportAdapter::Error TcpConnectionFactory::CreateConnection(
const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG(
+
"DeviceUID: " << &device_uid << ", ApplicationHandle: " << &app_handle);
std::shared_ptr<TcpServerOriginatedSocketConnection> connection =
std::make_shared<TcpServerOriginatedSocketConnection>(
@@ -61,9 +61,8 @@ TransportAdapter::Error TcpConnectionFactory::CreateConnection(
controller_->ConnectionCreated(connection, device_uid, app_handle);
const TransportAdapter::Error error = connection->Start();
if (TransportAdapter::OK != error) {
- LOG4CXX_ERROR(logger_,
- "TCP ServerOriginated connection::Start() failed with error: "
- << error);
+ SDL_LOG_ERROR("TCP ServerOriginated connection::Start() failed with error: "
+ << error);
}
return error;
}
diff --git a/src/components/transport_manager/src/tcp/tcp_device.cc b/src/components/transport_manager/src/tcp/tcp_device.cc
index d9bc8aec78..bccafd934f 100644
--- a/src/components/transport_manager/src/tcp/tcp_device.cc
+++ b/src/components/transport_manager/src/tcp/tcp_device.cc
@@ -36,14 +36,14 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TcpDevice::TcpDevice(const in_addr_t& in_addr, const std::string& name)
: Device(name, name)
, applications_mutex_()
, in_addr_(in_addr)
, last_handle_(0) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
#if defined(ENABLE_IAP2EMULATION)
@@ -54,33 +54,32 @@ TcpDevice::TcpDevice(const in_addr_t& in_addr,
, applications_mutex_()
, in_addr_(in_addr)
, last_handle_(0) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Device created with transport switch emulation support.");
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device created with transport switch emulation support.");
+ SDL_LOG_DEBUG(
+
"Device parameters: " << device_uid << " / " << transport_switch_id);
}
#endif // ENABLE_IAP2EMULATION
bool TcpDevice::IsSameAs(const Device* other) const {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device: " << other);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Device: " << other);
const TcpDevice* other_tcp_device = dynamic_cast<const TcpDevice*>(other);
if (other_tcp_device && other_tcp_device->in_addr_ == in_addr_) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"exit with TRUE. Condition: other_tcp_device->in_addr_ == in_addr_");
return true;
} else {
- LOG4CXX_TRACE(logger_, "exit with FALSE");
+ SDL_LOG_TRACE("exit with FALSE");
return false;
}
}
ApplicationList TcpDevice::GetApplicationList() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock locker(applications_mutex_);
ApplicationList app_list;
for (std::map<ApplicationHandle, Application>::const_iterator it =
@@ -93,8 +92,8 @@ ApplicationList TcpDevice::GetApplicationList() const {
}
ApplicationHandle TcpDevice::AddIncomingApplication(int socket_fd) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Socket_fd: " << socket_fd);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Socket_fd: " << socket_fd);
Application app;
app.incoming = true;
app.socket = socket_fd;
@@ -102,13 +101,13 @@ ApplicationHandle TcpDevice::AddIncomingApplication(int socket_fd) {
sync_primitives::AutoLock locker(applications_mutex_);
const ApplicationHandle app_handle = ++last_handle_;
applications_[app_handle] = app;
- LOG4CXX_DEBUG(logger_, "App_handle " << app_handle);
+ SDL_LOG_DEBUG("App_handle " << app_handle);
return app_handle;
}
ApplicationHandle TcpDevice::AddDiscoveredApplication(int port) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Port " << port);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Port " << port);
Application app;
app.incoming = false;
app.socket = 0; // this line removes compiler warning
@@ -116,52 +115,52 @@ ApplicationHandle TcpDevice::AddDiscoveredApplication(int port) {
sync_primitives::AutoLock locker(applications_mutex_);
const ApplicationHandle app_handle = ++last_handle_;
applications_[app_handle] = app;
- LOG4CXX_DEBUG(logger_, "App_handle " << app_handle);
+ SDL_LOG_DEBUG("App_handle " << app_handle);
return app_handle;
}
void TcpDevice::RemoveApplication(const ApplicationHandle app_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "ApplicationHandle: " << app_handle);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("ApplicationHandle: " << app_handle);
sync_primitives::AutoLock locker(applications_mutex_);
applications_.erase(app_handle);
}
TcpDevice::~TcpDevice() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
int TcpDevice::GetApplicationSocket(const ApplicationHandle app_handle) const {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "ApplicationHandle: " << app_handle);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("ApplicationHandle: " << app_handle);
std::map<ApplicationHandle, Application>::const_iterator it =
applications_.find(app_handle);
if (applications_.end() == it) {
- LOG4CXX_WARN(logger_, "Application was not found");
+ SDL_LOG_WARN("Application was not found");
return -1;
}
if (!it->second.incoming) {
- LOG4CXX_WARN(logger_, "Application is not incoming");
+ SDL_LOG_WARN("Application is not incoming");
return -1;
}
- LOG4CXX_DEBUG(logger_, "socket " << it->second.socket);
+ SDL_LOG_DEBUG("socket " << it->second.socket);
return it->second.socket;
}
int TcpDevice::GetApplicationPort(const ApplicationHandle app_handle) const {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "ApplicationHandle: " << app_handle);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("ApplicationHandle: " << app_handle);
std::map<ApplicationHandle, Application>::const_iterator it =
applications_.find(app_handle);
if (applications_.end() == it) {
- LOG4CXX_WARN(logger_, "Application was not found");
+ SDL_LOG_WARN("Application was not found");
return -1;
}
if (it->second.incoming) {
- LOG4CXX_DEBUG(logger_, "Application is incoming");
+ SDL_LOG_DEBUG("Application is incoming");
return -1;
}
- LOG4CXX_DEBUG(logger_, "port " << it->second.port);
+ SDL_LOG_DEBUG("port " << it->second.port);
return it->second.port;
}
diff --git a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc
index 690b2d25b3..0571867c10 100644
--- a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc
+++ b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc
@@ -39,7 +39,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TcpServerOriginatedSocketConnection::TcpServerOriginatedSocketConnection(
const DeviceUID& device_uid,
@@ -52,12 +52,12 @@ TcpServerOriginatedSocketConnection::~TcpServerOriginatedSocketConnection() {
}
bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(error);
- LOG4CXX_DEBUG(logger_, "error " << error);
+ SDL_LOG_DEBUG("error " << error);
DeviceSptr device = controller()->FindDevice(device_handle());
if (device.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "Device " << device_handle() << " not found");
+ SDL_LOG_ERROR("Device " << device_handle() << " not found");
*error = new ConnectError();
return false;
}
@@ -65,16 +65,14 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) {
const int port = tcp_device->GetApplicationPort(application_handle());
if (-1 == port) {
- LOG4CXX_ERROR(
- logger_,
- "Application port for " << application_handle() << " not found");
+ SDL_LOG_ERROR("Application port for " << application_handle()
+ << " not found");
*error = new ConnectError();
return false;
}
if (IsConnectionTerminated()) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Connection is already terminated. Socket will not be created");
*error = new ConnectError();
return false;
@@ -82,7 +80,7 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) {
const int socket = ::socket(AF_INET, SOCK_STREAM, 0);
if (socket < 0) {
- LOG4CXX_ERROR(logger_, "Failed to create socket");
+ SDL_LOG_ERROR("Failed to create socket");
*error = new ConnectError();
return false;
}
@@ -92,12 +90,10 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) {
addr.sin_addr.s_addr = tcp_device->in_addr();
addr.sin_port = htons(port);
- LOG4CXX_DEBUG(logger_,
- "Connecting " << inet_ntoa(addr.sin_addr) << ":" << port);
+ SDL_LOG_DEBUG("Connecting " << inet_ntoa(addr.sin_addr) << ":" << port);
set_socket(socket);
if (::connect(get_socket(), (struct sockaddr*)&addr, sizeof(addr)) < 0) {
- LOG4CXX_ERROR(logger_,
- "Failed to connect for application " << application_handle()
+ SDL_LOG_ERROR("Failed to connect for application " << application_handle()
<< ", error " << errno);
*error = new ConnectError();
ShutdownAndCloseSocket();
diff --git a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc
index a2ef38f3cb..85e02318c3 100644
--- a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc
+++ b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc
@@ -39,7 +39,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TcpSocketConnection::TcpSocketConnection(const DeviceUID& device_uid,
const ApplicationHandle& app_handle,
diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
index 54eb3a7b6d..8d174d89a1 100644
--- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
+++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
@@ -49,7 +49,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TcpTransportAdapter::TcpTransportAdapter(
const uint16_t port,
@@ -70,7 +70,7 @@ TcpTransportAdapter::~TcpTransportAdapter() {}
void TcpTransportAdapter::TransportConfigUpdated(
const TransportConfig& new_config) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_config_ = new_config;
@@ -80,7 +80,7 @@ void TcpTransportAdapter::TransportConfigUpdated(
}
TransportConfig TcpTransportAdapter::GetTransportConfiguration() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return transport_config_;
}
@@ -89,7 +89,7 @@ DeviceType TcpTransportAdapter::GetDeviceType() const {
}
void TcpTransportAdapter::Store() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Json::Value tcp_adapter_dictionary;
Json::Value devices_dictionary;
DeviceList device_ids = GetDeviceList();
@@ -138,7 +138,7 @@ void TcpTransportAdapter::Store() const {
}
bool TcpTransportAdapter::Restore() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool errors_occurred = false;
resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
Json::Value dictionary = accessor.GetData().dictionary();
@@ -166,7 +166,7 @@ bool TcpTransportAdapter::Restore() {
}
}
bool result = !errors_occurred;
- LOG4CXX_DEBUG(logger_, "result " << std::boolalpha << result);
+ SDL_LOG_DEBUG("result " << std::boolalpha << result);
return result;
}
diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
index 7d96c685f1..eb92599ae5 100644
--- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
+++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
@@ -46,7 +46,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
ThreadedSocketConnection::ThreadedSocketConnection(
const DeviceUID& device_id,
@@ -69,7 +69,7 @@ ThreadedSocketConnection::ThreadedSocketConnection(
}
ThreadedSocketConnection::~ThreadedSocketConnection() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(nullptr == thread_);
if (-1 != read_fd_) {
@@ -83,54 +83,54 @@ ThreadedSocketConnection::~ThreadedSocketConnection() {
void ThreadedSocketConnection::StopAndJoinThread() {
Disconnect();
if (thread_) {
- thread_->join();
- delete thread_->delegate();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete thread_->GetDelegate();
threads::DeleteThread(thread_);
thread_ = nullptr;
}
}
void ThreadedSocketConnection::Abort() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
unexpected_disconnect_ = true;
terminate_flag_ = true;
}
TransportAdapter::Error ThreadedSocketConnection::Start() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
int fds[2];
const int pipe_ret = pipe(fds);
if (0 == pipe_ret) {
- LOG4CXX_DEBUG(logger_, "pipe created");
+ SDL_LOG_DEBUG("pipe created");
read_fd_ = fds[0];
write_fd_ = fds[1];
} else {
- LOG4CXX_ERROR(logger_, "pipe creation failed");
+ SDL_LOG_ERROR("pipe creation failed");
return TransportAdapter::FAIL;
}
const int fcntl_ret =
fcntl(read_fd_, F_SETFL, fcntl(read_fd_, F_GETFL) | O_NONBLOCK);
if (0 != fcntl_ret) {
- LOG4CXX_ERROR(logger_, "fcntl failed");
+ SDL_LOG_ERROR("fcntl failed");
return TransportAdapter::FAIL;
}
- if (!thread_->start()) {
- LOG4CXX_ERROR(logger_, "thread creation failed");
+ if (!thread_->Start()) {
+ SDL_LOG_ERROR("thread creation failed");
return TransportAdapter::FAIL;
}
- LOG4CXX_INFO(logger_, "thread created");
+ SDL_LOG_INFO("thread created");
return TransportAdapter::OK;
}
void ThreadedSocketConnection::Finalize() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (unexpected_disconnect_) {
- LOG4CXX_DEBUG(logger_, "unexpected_disconnect");
+ SDL_LOG_DEBUG("unexpected_disconnect");
controller_->ConnectionAborted(
device_handle(), application_handle(), CommunicationError());
} else {
- LOG4CXX_DEBUG(logger_, "not unexpected_disconnect");
+ SDL_LOG_DEBUG("not unexpected_disconnect");
controller_->ConnectionFinished(device_handle(), application_handle());
}
@@ -138,17 +138,17 @@ void ThreadedSocketConnection::Finalize() {
}
TransportAdapter::Error ThreadedSocketConnection::Notify() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (-1 == write_fd_) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_, "Failed to wake up connection thread for connection " << this);
- LOG4CXX_TRACE(logger_, "exit with TransportAdapter::BAD_STATE");
+ SDL_LOG_ERROR_WITH_ERRNO(
+ "Failed to wake up connection thread for connection " << this);
+ SDL_LOG_TRACE("exit with TransportAdapter::BAD_STATE");
return TransportAdapter::BAD_STATE;
}
uint8_t c = 0;
if (1 != write(write_fd_, &c, 1)) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_, "Failed to wake up connection thread for connection " << this);
+ SDL_LOG_ERROR_WITH_ERRNO(
+ "Failed to wake up connection thread for connection " << this);
return TransportAdapter::FAIL;
}
return TransportAdapter::OK;
@@ -156,44 +156,44 @@ TransportAdapter::Error ThreadedSocketConnection::Notify() const {
TransportAdapter::Error ThreadedSocketConnection::SendData(
::protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(frames_to_send_mutex_);
frames_to_send_.push(message);
return Notify();
}
TransportAdapter::Error ThreadedSocketConnection::Disconnect() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
terminate_flag_ = true;
ShutdownAndCloseSocket();
return Notify();
}
void ThreadedSocketConnection::Terminate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
StopAndJoinThread();
}
void ThreadedSocketConnection::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ConnectError* connect_error = nullptr;
if (!Establish(&connect_error)) {
- LOG4CXX_ERROR(logger_, "Connection Establish failed");
+ SDL_LOG_ERROR("Connection Establish failed");
delete connect_error;
Abort();
} else {
- LOG4CXX_DEBUG(logger_, "Connection established");
+ SDL_LOG_DEBUG("Connection established");
controller_->ConnectDone(device_handle(), application_handle());
}
while (!terminate_flag_) {
Transmit();
}
- LOG4CXX_DEBUG(logger_, "Connection is to finalize");
+ SDL_LOG_DEBUG("Connection is to finalize");
Finalize();
sync_primitives::AutoLock auto_lock(frames_to_send_mutex_);
while (!frames_to_send_.empty()) {
- LOG4CXX_INFO(logger_, "removing message");
+ SDL_LOG_INFO("removing message");
::protocol_handler::RawMessagePtr message = frames_to_send_.front();
frames_to_send_.pop();
controller_->DataSendFailed(
@@ -208,23 +208,23 @@ bool ThreadedSocketConnection::IsFramesToSendQueueEmpty() const {
}
void ThreadedSocketConnection::ShutdownAndCloseSocket() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const int socket = socket_;
socket_ = -1;
if (socket != -1) {
if (shutdown(socket, SHUT_RDWR) != 0) {
- LOG4CXX_WARN(logger_, "Socket was unable to be shutdowned");
+ SDL_LOG_WARN("Socket was unable to be shutdowned");
}
if (close(socket) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket");
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to close socket");
}
} else {
- LOG4CXX_WARN(logger_, "Socket has been already closed or not created yet");
+ SDL_LOG_WARN("Socket has been already closed or not created yet");
}
}
void ThreadedSocketConnection::Transmit() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const nfds_t kPollFdsSize = 2;
pollfd poll_fds[kPollFdsSize];
@@ -237,26 +237,24 @@ void ThreadedSocketConnection::Transmit() {
poll_fds[1].fd = read_fd_;
poll_fds[1].events = POLLIN | POLLPRI;
- LOG4CXX_DEBUG(logger_, "poll " << this);
+ SDL_LOG_DEBUG("poll " << this);
if (-1 == poll(poll_fds, kPollFdsSize, -1)) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "poll failed for connection " << this);
+ SDL_LOG_ERROR_WITH_ERRNO("poll failed for connection " << this);
Abort();
return;
}
- LOG4CXX_DEBUG(logger_,
- "poll is ok " << this << " revents0: " << std::hex
+ SDL_LOG_DEBUG("poll is ok " << this << " revents0: " << std::hex
<< poll_fds[0].revents << " revents1:" << std::hex
<< poll_fds[1].revents);
// error check
if (0 != (poll_fds[1].revents & (POLLERR | POLLHUP | POLLNVAL))) {
- LOG4CXX_ERROR(logger_,
- "Notification pipe for connection " << this << " terminated");
+ SDL_LOG_ERROR("Notification pipe for connection " << this << " terminated");
Abort();
return;
}
if (poll_fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
- LOG4CXX_WARN(logger_, "Connection " << this << " terminated");
+ SDL_LOG_WARN("Connection " << this << " terminated");
Abort();
return;
}
@@ -268,8 +266,8 @@ void ThreadedSocketConnection::Transmit() {
bytes_read = read(read_fd_, buffer, sizeof(buffer));
} while (bytes_read > 0);
if ((bytes_read < 0) && (EAGAIN != errno)) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to clear notification pipe");
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "poll failed for connection " << this);
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to clear notification pipe");
+ SDL_LOG_ERROR_WITH_ERRNO("poll failed for connection " << this);
Abort();
return;
}
@@ -278,12 +276,12 @@ void ThreadedSocketConnection::Transmit() {
// Send data if possible
if (!is_queue_empty && (poll_fds[0].revents & POLLOUT)) {
- LOG4CXX_DEBUG(logger_, "frames_to_send_ not empty() ");
+ SDL_LOG_DEBUG("frames_to_send_ not empty() ");
// send data
const bool send_ok = Send();
if (!send_ok) {
- LOG4CXX_ERROR(logger_, "Send() failed ");
+ SDL_LOG_ERROR("Send() failed ");
Abort();
return;
}
@@ -293,7 +291,7 @@ void ThreadedSocketConnection::Transmit() {
if (poll_fds[0].revents & (POLLIN | POLLPRI)) {
const bool receive_ok = Receive();
if (!receive_ok) {
- LOG4CXX_ERROR(logger_, "Receive() failed ");
+ SDL_LOG_ERROR("Receive() failed ");
Abort();
return;
}
@@ -301,7 +299,7 @@ void ThreadedSocketConnection::Transmit() {
}
bool ThreadedSocketConnection::Receive() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint8_t buffer[4096];
ssize_t bytes_read = -1;
@@ -309,21 +307,19 @@ bool ThreadedSocketConnection::Receive() {
bytes_read = recv(socket_, buffer, sizeof(buffer), MSG_DONTWAIT);
if (bytes_read > 0) {
- LOG4CXX_DEBUG(
- logger_,
- "Received " << bytes_read << " bytes for connection " << this);
+ SDL_LOG_DEBUG("Received " << bytes_read << " bytes for connection "
+ << this);
::protocol_handler::RawMessagePtr frame(
new protocol_handler::RawMessage(0, 0, buffer, bytes_read, false));
controller_->DataReceiveDone(
device_handle(), application_handle(), frame);
} else if (bytes_read < 0) {
if (EAGAIN != errno && EWOULDBLOCK != errno) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "recv() failed for connection " << this);
+ SDL_LOG_ERROR_WITH_ERRNO("recv() failed for connection " << this);
return false;
}
} else {
- LOG4CXX_WARN(logger_, "Connection " << this << " closed by remote peer");
+ SDL_LOG_WARN("Connection " << this << " closed by remote peer");
return false;
}
} while (bytes_read > 0);
@@ -332,7 +328,7 @@ bool ThreadedSocketConnection::Receive() {
}
bool ThreadedSocketConnection::Send() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FrameQueue frames_to_send_local;
{
@@ -342,13 +338,13 @@ bool ThreadedSocketConnection::Send() {
size_t offset = 0;
while (!frames_to_send_local.empty()) {
- LOG4CXX_INFO(logger_, "frames_to_send is not empty");
+ SDL_LOG_INFO("frames_to_send is not empty");
::protocol_handler::RawMessagePtr frame = frames_to_send_local.front();
const ssize_t bytes_sent =
::send(socket_, frame->data() + offset, frame->data_size() - offset, 0);
if (bytes_sent >= 0) {
- LOG4CXX_DEBUG(logger_, "bytes_sent >= 0");
+ SDL_LOG_DEBUG("bytes_sent >= 0");
offset += bytes_sent;
if (offset == frame->data_size()) {
frames_to_send_local.pop();
@@ -356,8 +352,8 @@ bool ThreadedSocketConnection::Send() {
controller_->DataSendDone(device_handle(), application_handle(), frame);
}
} else {
- LOG4CXX_DEBUG(logger_, "bytes_sent < 0");
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Send failed for connection " << this);
+ SDL_LOG_DEBUG("bytes_sent < 0");
+ SDL_LOG_ERROR_WITH_ERRNO("Send failed for connection " << this);
frames_to_send_local.pop();
offset = 0;
controller_->DataSendFailed(
@@ -373,13 +369,13 @@ ThreadedSocketConnection::SocketConnectionDelegate::SocketConnectionDelegate(
: connection_(connection) {}
void ThreadedSocketConnection::SocketConnectionDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(connection_);
connection_->threadMain();
}
void ThreadedSocketConnection::SocketConnectionDelegate::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
}
} // namespace transport_adapter
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
index 36f6dd98d0..7d0eda9773 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
@@ -51,7 +51,7 @@ const char* tc_enabled = "enabled";
const char* tc_tcp_port = "tcp_port";
const char* tc_tcp_ip_address = "tcp_ip_address";
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
namespace {
DeviceTypes devicesType = {
std::make_pair(DeviceType::AOA, std::string("USB_AOA")),
@@ -99,42 +99,39 @@ TransportAdapterImpl::~TransportAdapterImpl() {
Terminate();
if (device_scanner_) {
- LOG4CXX_DEBUG(logger_, "Deleting device_scanner_ " << device_scanner_);
+ SDL_LOG_DEBUG("Deleting device_scanner_ " << device_scanner_);
delete device_scanner_;
- LOG4CXX_DEBUG(logger_, "device_scanner_ deleted.");
+ SDL_LOG_DEBUG("device_scanner_ deleted.");
}
if (server_connection_factory_) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Deleting server_connection_factory " << server_connection_factory_);
delete server_connection_factory_;
- LOG4CXX_DEBUG(logger_, "server_connection_factory deleted.");
+ SDL_LOG_DEBUG("server_connection_factory deleted.");
}
if (client_connection_listener_) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Deleting client_connection_listener_ " << client_connection_listener_);
delete client_connection_listener_;
- LOG4CXX_DEBUG(logger_, "client_connection_listener_ deleted.");
+ SDL_LOG_DEBUG("client_connection_listener_ deleted.");
}
}
void TransportAdapterImpl::Terminate() {
if (device_scanner_) {
device_scanner_->Terminate();
- LOG4CXX_DEBUG(logger_,
- "device_scanner_ " << device_scanner_ << " terminated.");
+ SDL_LOG_DEBUG("device_scanner_ " << device_scanner_ << " terminated.");
}
if (server_connection_factory_) {
server_connection_factory_->Terminate();
- LOG4CXX_DEBUG(logger_,
- "server_connection_factory " << server_connection_factory_
+ SDL_LOG_DEBUG("server_connection_factory " << server_connection_factory_
<< " terminated.");
}
if (client_connection_listener_) {
client_connection_listener_->Terminate();
- LOG4CXX_DEBUG(logger_,
- "client_connection_listener_ " << client_connection_listener_
+ SDL_LOG_DEBUG("client_connection_listener_ " << client_connection_listener_
<< " terminated.");
}
@@ -150,7 +147,7 @@ void TransportAdapterImpl::Terminate() {
}
connections.clear();
- LOG4CXX_DEBUG(logger_, "Connections deleted");
+ SDL_LOG_DEBUG("Connections deleted");
DeviceMap devices;
devices_mutex_.Acquire();
@@ -158,11 +155,11 @@ void TransportAdapterImpl::Terminate() {
devices_mutex_.Release();
devices.clear();
- LOG4CXX_DEBUG(logger_, "Devices deleted");
+ SDL_LOG_DEBUG("Devices deleted");
}
TransportAdapter::Error TransportAdapterImpl::Init() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
Error error = OK;
@@ -180,42 +177,42 @@ TransportAdapter::Error TransportAdapterImpl::Init() {
if (get_settings().use_last_state() && initialised_) {
if (!Restore()) {
- LOG4CXX_WARN(logger_, "could not restore transport adapter state");
+ SDL_LOG_WARN("could not restore transport adapter state");
}
}
- LOG4CXX_TRACE(logger_, "exit with error: " << error);
+ SDL_LOG_TRACE("exit with error: " << error);
return error;
}
TransportAdapter::Error TransportAdapterImpl::SearchDevices() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (device_scanner_ == NULL) {
- LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED");
+ SDL_LOG_TRACE("exit with NOT_SUPPORTED");
return NOT_SUPPORTED;
} else if (!device_scanner_->IsInitialised()) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
+ SDL_LOG_TRACE("exit with BAD_STATE");
return BAD_STATE;
}
TransportAdapter::Error er = device_scanner_->Scan();
- LOG4CXX_TRACE(logger_, "exit with error: " << er);
+ SDL_LOG_TRACE("exit with error: " << er);
return er;
}
TransportAdapter::Error TransportAdapterImpl::Connect(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"enter. DeviceUID " << device_id << " ApplicationHandle " << app_handle);
if (server_connection_factory_ == 0) {
- LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED");
+ SDL_LOG_TRACE("exit with NOT_SUPPORTED");
return NOT_SUPPORTED;
}
if (!server_connection_factory_->IsInitialised()) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
+ SDL_LOG_TRACE("exit with BAD_STATE");
return BAD_STATE;
}
if (!initialised_) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
+ SDL_LOG_TRACE("exit with BAD_STATE");
return BAD_STATE;
}
@@ -235,7 +232,7 @@ TransportAdapter::Error TransportAdapterImpl::Connect(
connections_lock_.Release();
if (already_exists && !pending_app) {
- LOG4CXX_TRACE(logger_, "exit with ALREADY_EXISTS");
+ SDL_LOG_TRACE("exit with ALREADY_EXISTS");
return ALREADY_EXISTS;
}
@@ -246,19 +243,18 @@ TransportAdapter::Error TransportAdapterImpl::Connect(
RemoveConnection(device_id, app_handle);
}
}
- LOG4CXX_TRACE(logger_, "exit with error: " << err);
+ SDL_LOG_TRACE("exit with error: " << err);
return err;
}
TransportAdapter::Error TransportAdapterImpl::ConnectDevice(
const DeviceUID& device_handle) {
- LOG4CXX_TRACE(logger_, "enter with device_handle: " << &device_handle);
+ SDL_LOG_TRACE("enter with device_handle: " << &device_handle);
DeviceSptr device = FindDevice(device_handle);
if (device) {
TransportAdapter::Error err = ConnectDevice(device);
if (FAIL == err && GetDeviceType() == DeviceType::CLOUD_WEBSOCKET) {
- LOG4CXX_TRACE(logger_,
- "Error occurred while connecting cloud app: " << err);
+ SDL_LOG_TRACE("Error occurred while connecting cloud app: " << err);
// Update retry count
if (device->retry_count() >=
get_settings().cloud_app_max_retry_attempts()) {
@@ -283,10 +279,10 @@ TransportAdapter::Error TransportAdapterImpl::ConnectDevice(
} else if (OK == err) {
ConnectionStatusUpdated(device, ConnectionStatus::CONNECTED);
}
- LOG4CXX_TRACE(logger_, "exit with error: " << err);
+ SDL_LOG_TRACE("exit with error: " << err);
return err;
} else {
- LOG4CXX_TRACE(logger_, "exit with BAD_PARAM");
+ SDL_LOG_TRACE("exit with BAD_PARAM");
return BAD_PARAM;
}
}
@@ -295,8 +291,7 @@ void TransportAdapterImpl::RetryConnection() {
ClearCompletedTimers();
const DeviceUID device_id = GetNextRetryDevice();
if (device_id.empty()) {
- LOG4CXX_ERROR(logger_,
- "Unable to find timer, ignoring RetryConnection request");
+ SDL_LOG_ERROR("Unable to find timer, ignoring RetryConnection request");
return;
}
ConnectDevice(device_id);
@@ -347,36 +342,36 @@ void TransportAdapterImpl::ConnectionStatusUpdated(DeviceSptr device,
TransportAdapter::Error TransportAdapterImpl::Disconnect(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"enter. device_id: " << &device_id << ", device_id: " << &device_id);
if (!initialised_) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
+ SDL_LOG_TRACE("exit with BAD_STATE");
return BAD_STATE;
}
ConnectionSPtr connection = FindEstablishedConnection(device_id, app_handle);
if (connection) {
TransportAdapter::Error err = connection->Disconnect();
- LOG4CXX_TRACE(logger_, "exit with error: " << err);
+ SDL_LOG_TRACE("exit with error: " << err);
return err;
} else {
- LOG4CXX_TRACE(logger_, "exit with BAD_PARAM");
+ SDL_LOG_TRACE("exit with BAD_PARAM");
return BAD_PARAM;
}
}
TransportAdapter::Error TransportAdapterImpl::DisconnectDevice(
const DeviceUID& device_id) {
- LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id);
+ SDL_LOG_TRACE("enter. device_id: " << &device_id);
if (!initialised_) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
+ SDL_LOG_TRACE("exit with BAD_STATE");
return BAD_STATE;
}
Error error = OK;
DeviceSptr device = FindDevice(device_id);
if (!device) {
- LOG4CXX_WARN(logger_, "Device with id: " << device_id << " Not found");
+ SDL_LOG_WARN("Device with id: " << device_id << " Not found");
return BAD_PARAM;
}
ConnectionStatusUpdated(device, ConnectionStatus::CLOSING);
@@ -400,7 +395,7 @@ TransportAdapter::Error TransportAdapterImpl::DisconnectDevice(
ConnectionInfo info = *j;
if (OK != info.connection->Disconnect()) {
error = FAIL;
- LOG4CXX_ERROR(logger_, "Error on disconnect " << error);
+ SDL_LOG_ERROR("Error on disconnect " << error);
}
}
@@ -411,34 +406,33 @@ TransportAdapter::Error TransportAdapterImpl::SendData(
const DeviceUID& device_id,
const ApplicationHandle& app_handle,
const ::protocol_handler::RawMessagePtr data) {
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_id << ", app_handle: "
+ SDL_LOG_TRACE("enter. device_id: " << &device_id << ", app_handle: "
<< &app_handle << ", data: " << data);
if (!initialised_) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
+ SDL_LOG_TRACE("exit with BAD_STATE");
return BAD_STATE;
}
ConnectionSPtr connection = FindEstablishedConnection(device_id, app_handle);
if (connection) {
TransportAdapter::Error err = connection->SendData(data);
- LOG4CXX_TRACE(logger_, "exit with error: " << err);
+ SDL_LOG_TRACE("exit with error: " << err);
return err;
} else {
- LOG4CXX_TRACE(logger_, "exit with BAD_PARAM");
+ SDL_LOG_TRACE("exit with BAD_PARAM");
return BAD_PARAM;
}
}
TransportAdapter::Error TransportAdapterImpl::ChangeClientListening(
TransportAction required_change) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (client_connection_listener_ == 0) {
- LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED");
+ SDL_LOG_TRACE("exit with NOT_SUPPORTED");
return NOT_SUPPORTED;
}
if (!client_connection_listener_->IsInitialised()) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
+ SDL_LOG_TRACE("exit with BAD_STATE");
return BAD_STATE;
}
@@ -477,30 +471,28 @@ TransportAdapter::Error TransportAdapterImpl::ChangeClientListening(
default:
NOTREACHED();
}
- LOG4CXX_TRACE(logger_, "Exit with error: " << err);
+ SDL_LOG_TRACE("Exit with error: " << err);
return err;
}
DeviceList TransportAdapterImpl::GetDeviceList() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceList devices;
sync_primitives::AutoLock locker(devices_mutex_);
for (DeviceMap::const_iterator it = devices_.begin(); it != devices_.end();
++it) {
devices.push_back(it->first);
}
- LOG4CXX_TRACE(logger_,
- "exit with DeviceList. It's' size = " << devices.size());
+ SDL_LOG_TRACE("exit with DeviceList. It's' size = " << devices.size());
return devices;
}
DeviceSptr TransportAdapterImpl::GetWebEngineDevice() const {
#ifndef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
- LOG4CXX_TRACE(logger_,
- "Web engine support is disabled. Device does not exist");
+ SDL_LOG_TRACE("Web engine support is disabled. Device does not exist");
return DeviceSptr();
#else
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock locker(devices_mutex_);
auto web_engine_device =
@@ -515,13 +507,14 @@ DeviceSptr TransportAdapterImpl::GetWebEngineDevice() const {
return web_engine_device->second;
}
- LOG4CXX_ERROR(logger_, "WebEngine device not found!");
+ SDL_LOG_ERROR("WebEngine device not found!");
return std::make_shared<transport_adapter::WebSocketDevice>("", "");
#endif
}
DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) {
- LOG4CXX_TRACE(logger_, "enter. device: " << device);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("enter. device: " << device);
DeviceSptr existing_device;
bool same_device_found = false;
devices_mutex_.Acquire();
@@ -530,7 +523,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) {
existing_device = i->second;
if (device->IsSameAs(existing_device.get())) {
same_device_found = true;
- LOG4CXX_DEBUG(logger_, "device " << device << "already exists");
+ SDL_LOG_DEBUG("Device " << device << " already exists");
break;
}
}
@@ -539,7 +532,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) {
}
devices_mutex_.Release();
if (same_device_found) {
- LOG4CXX_TRACE(logger_, "exit with TRUE. Condition: same_device_found");
+ SDL_LOG_TRACE("Exit with TRUE. Condition: same_device_found");
return existing_device;
} else {
device->set_connection_status(ConnectionStatus::PENDING);
@@ -551,13 +544,13 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) {
if (ToBeAutoConnected(device)) {
ConnectDevice(device);
}
- LOG4CXX_TRACE(logger_, "exit with DeviceSptr " << device);
+ SDL_LOG_TRACE("exit with DeviceSptr " << device);
return device;
}
}
void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) {
- LOG4CXX_TRACE(logger_, "enter. devices: " << &devices);
+ SDL_LOG_TRACE("enter. devices: " << &devices);
DeviceMap new_devices;
for (DeviceVector::const_iterator it = devices.begin(); it != devices.end();
++it) {
@@ -571,15 +564,14 @@ void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) {
if (device->IsSameAs(existing_device.get())) {
existing_device->set_keep_on_disconnect(true);
device_found = true;
- LOG4CXX_DEBUG(logger_, "device found. DeviceSptr" << it->second);
+ SDL_LOG_DEBUG("device found. DeviceSptr" << it->second);
break;
}
}
devices_mutex_.Release();
if (!device_found) {
- LOG4CXX_INFO(logger_,
- "Adding new device " << device->unique_device_id() << " (\""
+ SDL_LOG_INFO("Adding new device " << device->unique_device_id() << " (\""
<< device->name() << "\")");
}
@@ -628,7 +620,7 @@ void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) {
ConnectDevice(device);
}
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::ApplicationListUpdated(
@@ -638,38 +630,38 @@ void TransportAdapterImpl::ApplicationListUpdated(
}
void TransportAdapterImpl::FindNewApplicationsRequest() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
for (TransportAdapterListenerList::iterator i = listeners_.begin();
i != listeners_.end();
++i) {
TransportAdapterListener* listener = *i;
listener->OnFindNewApplicationsRequest(this);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::SearchDeviceFailed(const SearchDeviceError& error) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
(*it)->OnSearchDeviceFailed(this, error);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
bool TransportAdapterImpl::IsSearchDevicesSupported() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return device_scanner_ != 0;
}
bool TransportAdapterImpl::IsServerOriginatedConnectSupported() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return server_connection_factory_ != 0;
}
bool TransportAdapterImpl::IsClientOriginatedConnectSupported() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return client_connection_listener_ != 0;
}
@@ -677,8 +669,8 @@ void TransportAdapterImpl::ConnectionCreated(
ConnectionSPtr connection,
const DeviceUID& device_id,
const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(logger_,
- "enter connection:" << connection
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("enter connection:" << connection
<< ", device_id: " << &device_id
<< ", app_handle: " << &app_handle);
connections_lock_.AcquireForReading();
@@ -692,10 +684,10 @@ void TransportAdapterImpl::ConnectionCreated(
void TransportAdapterImpl::DeviceDisconnected(
const DeviceUID& device_handle, const DisconnectDeviceError& error) {
+ SDL_LOG_AUTO_TRACE();
const DeviceUID device_uid = device_handle;
- LOG4CXX_TRACE(
- logger_,
- "enter. device_handle: " << &device_uid << ", error: " << &error);
+ SDL_LOG_TRACE("enter. device_handle: " << &device_uid
+ << ", error: " << &error);
ApplicationList app_list = GetApplicationList(device_uid);
for (ApplicationList::const_iterator i = app_list.begin();
i != app_list.end();
@@ -725,11 +717,12 @@ void TransportAdapterImpl::DeviceDisconnected(
}
RemoveDevice(device_uid);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
bool TransportAdapterImpl::IsSingleApplication(
const DeviceUID& device_uid, const ApplicationHandle& app_uid) {
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoReadLock locker(connections_lock_);
for (ConnectionMap::const_iterator it = connections_.begin();
it != connections_.end();
@@ -737,9 +730,9 @@ bool TransportAdapterImpl::IsSingleApplication(
const DeviceUID& current_device_id = it->first.first;
const ApplicationHandle& current_app_handle = it->first.second;
if (current_device_id == device_uid && current_app_handle != app_uid) {
- LOG4CXX_DEBUG(logger_,
- "break. Condition: current_device_id == device_id && "
- "current_app_handle != app_handle");
+ SDL_LOG_DEBUG(
+ "break. Condition: current_device_id == device_id && "
+ "current_app_handle != app_handle");
return false;
}
@@ -749,14 +742,15 @@ bool TransportAdapterImpl::IsSingleApplication(
void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) {
+ SDL_LOG_AUTO_TRACE();
const DeviceUID device_uid = device_handle;
const ApplicationHandle app_uid = app_handle;
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"enter. device_id: " << &device_uid << ", app_handle: " << &app_uid);
DeviceSptr device = FindDevice(device_handle);
if (!device) {
- LOG4CXX_WARN(logger_, "Device: uid " << &device_uid << " not found");
+ SDL_LOG_WARN("Device: uid " << &device_uid << " not found");
return;
}
@@ -775,19 +769,19 @@ void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle,
RemoveConnection(device_uid, app_uid);
if (device_disconnected) {
+ SDL_LOG_DEBUG("Removing device...");
RemoveDevice(device_uid);
}
Store();
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::DataReceiveDone(
const DeviceUID& device_id,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message) {
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_id
+ SDL_LOG_TRACE("enter. device_id: " << &device_id
<< ", app_handle: " << &app_handle
<< ", message: " << message);
@@ -802,33 +796,33 @@ void TransportAdapterImpl::DataReceiveDone(
++it) {
(*it)->OnDataReceiveDone(this, device_id, app_handle, message);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::DataReceiveFailed(
const DeviceUID& device_id,
const ApplicationHandle& app_handle,
const DataReceiveError& error) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
(*it)->OnDataReceiveFailed(this, device_id, app_handle, error);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::DataSendDone(
const DeviceUID& device_id,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
(*it)->OnDataSendDone(this, device_id, app_handle, message);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::DataSendFailed(
@@ -836,18 +830,18 @@ void TransportAdapterImpl::DataSendFailed(
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message,
const DataSendError& error) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
(*it)->OnDataSendFailed(this, device_id, app_handle, message, error);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::TransportConfigUpdated(
const TransportConfig& new_config) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
@@ -856,7 +850,7 @@ void TransportAdapterImpl::TransportConfigUpdated(
}
void TransportAdapterImpl::DoTransportSwitch() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::for_each(
listeners_.begin(),
listeners_.end(),
@@ -866,16 +860,15 @@ void TransportAdapterImpl::DoTransportSwitch() const {
}
void TransportAdapterImpl::DeviceSwitched(const DeviceUID& device_handle) {
- LOG4CXX_DEBUG(logger_,
- "Switching is not implemented for that adapter type "
- << GetConnectionType().c_str());
+ SDL_LOG_DEBUG("Switching is not implemented for that adapter type "
+ << GetConnectionType().c_str());
UNUSED(device_handle);
}
ConnectionSPtr TransportAdapterImpl::FindPendingConnection(
const DeviceUID& device_id, const ApplicationHandle& app_handle) const {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
ConnectionSPtr connection;
connections_lock_.AcquireForReading();
@@ -888,28 +881,28 @@ ConnectionSPtr TransportAdapterImpl::FindPendingConnection(
}
}
connections_lock_.Release();
- LOG4CXX_TRACE(logger_, "exit with Connection: " << connection);
+ SDL_LOG_TRACE("exit with Connection: " << connection);
return connection;
}
DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const {
- LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id);
+ SDL_LOG_TRACE("enter. device_id: " << &device_id);
DeviceSptr ret;
sync_primitives::AutoLock locker(devices_mutex_);
- LOG4CXX_DEBUG(logger_, "devices_.size() = " << devices_.size());
+ SDL_LOG_DEBUG("devices_.size() = " << devices_.size());
DeviceMap::const_iterator it = devices_.find(device_id);
if (it != devices_.end()) {
ret = it->second;
} else {
- LOG4CXX_WARN(logger_, "Device " << device_id << " not found.");
+ SDL_LOG_WARN("Device " << device_id << " not found.");
}
- LOG4CXX_TRACE(logger_, "exit with DeviceSptr: " << ret);
+ SDL_LOG_TRACE("exit with DeviceSptr: " << ret);
return ret;
}
void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id,
const ApplicationHandle& app_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
connections_lock_.AcquireForWriting();
ConnectionMap::iterator it_conn =
connections_.find(std::make_pair(device_id, app_handle));
@@ -921,8 +914,8 @@ void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id,
DeviceSptr device = FindDevice(device_id);
if (device.use_count() == 0) {
- LOG4CXX_ERROR(
- logger_, "Unable to find device, cannot set connection pending status");
+ SDL_LOG_ERROR(
+ "Unable to find device, cannot set connection pending status");
return;
} else {
device->set_connection_status(ConnectionStatus::PENDING);
@@ -937,8 +930,8 @@ void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id,
void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id,
const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
connections_lock_.AcquireForReading();
ConnectionMap::iterator it_conn =
@@ -956,7 +949,7 @@ void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id,
}
Store();
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle,
@@ -964,8 +957,7 @@ void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle,
const ConnectError& error) {
const DeviceUID device_uid = device_handle;
const ApplicationHandle app_uid = app_handle;
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_uid << ", app_handle: "
+ SDL_LOG_TRACE("enter. device_id: " << &device_uid << ", app_handle: "
<< &app_uid << ", error: " << &error);
RemoveConnection(device_uid, app_uid);
for (TransportAdapterListenerList::iterator it = listeners_.begin();
@@ -973,27 +965,25 @@ void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle,
++it) {
(*it)->OnConnectFailed(this, device_uid, app_uid, error);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterImpl::RemoveFinalizedConnection(
const DeviceUID& device_handle, const ApplicationHandle& app_handle) {
const DeviceUID device_uid = device_handle;
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
{
connections_lock_.AcquireForWriting();
auto it_conn = connections_.find(std::make_pair(device_uid, app_handle));
if (connections_.end() == it_conn) {
- LOG4CXX_WARN(logger_,
- "Device_id: " << &device_uid << ", app_handle: "
+ SDL_LOG_WARN("Device_id: " << &device_uid << ", app_handle: "
<< &app_handle << " connection not found");
connections_lock_.Release();
return;
}
const ConnectionInfo& info = it_conn->second;
if (ConnectionInfo::FINALISING != info.state) {
- LOG4CXX_WARN(logger_,
- "Device_id: " << &device_uid << ", app_handle: "
+ SDL_LOG_WARN("Device_id: " << &device_uid << ", app_handle: "
<< &app_handle << " connection not finalized");
connections_lock_.Release();
return;
@@ -1001,20 +991,18 @@ void TransportAdapterImpl::RemoveFinalizedConnection(
// By copying the info.connection shared pointer into this local variable,
// we can delay the connection's destructor until after
// connections_lock_.Release.
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"RemoveFinalizedConnection copying connection with Device_id: "
- << &device_uid << ", app_handle: " << &app_handle);
+ << &device_uid << ", app_handle: " << &app_handle);
ConnectionSPtr connection = info.connection;
connections_.erase(it_conn);
connections_lock_.Release();
- LOG4CXX_DEBUG(logger_,
- "RemoveFinalizedConnection Connections Lock Released");
+ SDL_LOG_DEBUG("RemoveFinalizedConnection Connections Lock Released");
}
DeviceSptr device = FindDevice(device_handle);
if (!device) {
- LOG4CXX_WARN(logger_, "Device: uid " << &device_uid << " not found");
+ SDL_LOG_WARN("Device: uid " << &device_uid << " not found");
return;
}
@@ -1026,6 +1014,7 @@ void TransportAdapterImpl::RemoveFinalizedConnection(
void TransportAdapterImpl::RemoveConnection(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
+ SDL_LOG_AUTO_TRACE();
ConnectionSPtr connection;
connections_lock_.AcquireForWriting();
ConnectionMap::const_iterator it =
@@ -1033,47 +1022,45 @@ void TransportAdapterImpl::RemoveConnection(
if (it != connections_.end()) {
// By copying the connection from the map to this shared pointer,
// we can erase the object from the map without triggering the destructor
- LOG4CXX_DEBUG(logger_,
- "Copying connection with Device_id: "
- << &device_id << ", app_handle: " << &app_handle);
+ SDL_LOG_DEBUG("Copying connection with Device_id: "
+ << &device_id << ", app_handle: " << &app_handle);
connection = it->second.connection;
connections_.erase(it);
}
connections_lock_.Release();
- LOG4CXX_DEBUG(logger_, "Connections Lock Released");
+ SDL_LOG_DEBUG("Connections Lock Released");
// And now, "connection" goes out of scope, triggering the destructor outside
// of the "connections_lock_"
}
void TransportAdapterImpl::AddListener(TransportAdapterListener* listener) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
listeners_.push_back(listener);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
ApplicationList TransportAdapterImpl::GetApplicationList(
const DeviceUID& device_id) const {
- LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id);
+ SDL_LOG_TRACE("enter. device_id: " << &device_id);
DeviceSptr device = FindDevice(device_id);
if (device.use_count() != 0) {
ApplicationList lst = device->GetApplicationList();
- LOG4CXX_TRACE(logger_,
- "exit with ApplicationList. It's size = "
- << lst.size() << " Condition: device.use_count() != 0");
+ SDL_LOG_TRACE("exit with ApplicationList. It's size = "
+ << lst.size() << " Condition: device.use_count() != 0");
return lst;
}
- LOG4CXX_TRACE(logger_,
- "exit with empty ApplicationList. Condition: NOT "
- "device.use_count() != 0");
+ SDL_LOG_TRACE(
+ "exit with empty ApplicationList. Condition: NOT "
+ "device.use_count() != 0");
return ApplicationList();
}
void TransportAdapterImpl::ConnectionFinished(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(
- logger_,
- "enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("enter. device_id: " << &device_id
+ << ", app_handle: " << &app_handle);
connections_lock_.AcquireForReading();
ConnectionMap::iterator it =
connections_.find(std::make_pair(device_id, app_handle));
@@ -1088,6 +1075,7 @@ void TransportAdapterImpl::ConnectionAborted(
const DeviceUID& device_id,
const ApplicationHandle& app_handle,
const CommunicationError& error) {
+ SDL_LOG_AUTO_TRACE();
ConnectionFinished(device_id, app_handle);
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
@@ -1097,32 +1085,32 @@ void TransportAdapterImpl::ConnectionAborted(
}
bool TransportAdapterImpl::IsInitialised() const {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (!initialised_) {
- LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !initialised_");
+ SDL_LOG_TRACE("exit with FALSE. Condition: !initialised_");
return false;
}
if (device_scanner_ && !device_scanner_->IsInitialised()) {
- LOG4CXX_TRACE(logger_,
- "exit with FALSE. Condition: device_scanner_ && "
- "!device_scanner_->IsInitialised()");
+ SDL_LOG_TRACE(
+ "exit with FALSE. Condition: device_scanner_ && "
+ "!device_scanner_->IsInitialised()");
return false;
}
if (server_connection_factory_ &&
!server_connection_factory_->IsInitialised()) {
- LOG4CXX_TRACE(logger_,
- "exit with FALSE. Condition: server_connection_factory_ && "
- "!server_connection_factory_->IsInitialised()");
+ SDL_LOG_TRACE(
+ "exit with FALSE. Condition: server_connection_factory_ && "
+ "!server_connection_factory_->IsInitialised()");
return false;
}
if (client_connection_listener_ &&
!client_connection_listener_->IsInitialised()) {
- LOG4CXX_TRACE(logger_,
- "exit with FALSE. Condition: client_connection_listener_ && "
- "!client_connection_listener_->IsInitialised()");
+ SDL_LOG_TRACE(
+ "exit with FALSE. Condition: client_connection_listener_ && "
+ "!client_connection_listener_->IsInitialised()");
return false;
}
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
return true;
}
@@ -1136,7 +1124,7 @@ std::string TransportAdapterImpl::DeviceName(const DeviceUID& device_id) const {
}
void TransportAdapterImpl::StopDevice(const DeviceUID& device_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceSptr device = FindDevice(device_id);
if (device) {
device->Stop();
@@ -1148,7 +1136,7 @@ std::string TransportAdapterImpl::GetConnectionType() const {
}
SwitchableDevices TransportAdapterImpl::GetSwitchableDevices() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
SwitchableDevices devices;
sync_primitives::AutoLock locker(devices_mutex_);
for (DeviceMap::const_iterator it = devices_.begin(); it != devices_.end();
@@ -1157,15 +1145,13 @@ SwitchableDevices TransportAdapterImpl::GetSwitchableDevices() const {
const auto device = it->second;
const auto transport_switch_id = device->transport_switch_id();
if (transport_switch_id.empty()) {
- LOG4CXX_DEBUG(logger_,
- "Device is not suitable for switching: " << device_uid);
+ SDL_LOG_DEBUG("Device is not suitable for switching: " << device_uid);
continue;
}
- LOG4CXX_DEBUG(logger_, "Device is suitable for switching: " << device_uid);
+ SDL_LOG_DEBUG("Device is suitable for switching: " << device_uid);
devices.insert(std::make_pair(device_uid, transport_switch_id));
}
- LOG4CXX_INFO(logger_,
- "Found number of switchable devices: " << devices.size());
+ SDL_LOG_INFO("Found number of switchable devices: " << devices.size());
return devices;
}
@@ -1192,13 +1178,14 @@ bool TransportAdapterImpl::ToBeAutoConnected(DeviceSptr device) const {
}
bool TransportAdapterImpl::ToBeAutoDisconnected(DeviceSptr device) const {
+ SDL_LOG_AUTO_TRACE();
return true;
}
ConnectionSPtr TransportAdapterImpl::FindEstablishedConnection(
const DeviceUID& device_id, const ApplicationHandle& app_handle) const {
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
ConnectionSPtr connection;
connections_lock_.AcquireForReading();
@@ -1211,59 +1198,55 @@ ConnectionSPtr TransportAdapterImpl::FindEstablishedConnection(
}
}
connections_lock_.Release();
- LOG4CXX_TRACE(logger_, "exit with Connection: " << connection);
+ SDL_LOG_TRACE("exit with Connection: " << connection);
return connection;
}
TransportAdapter::Error TransportAdapterImpl::ConnectDevice(DeviceSptr device) {
- LOG4CXX_TRACE(logger_, "enter. device: " << device);
+ SDL_LOG_TRACE("enter. device: " << device);
DeviceUID device_id = device->unique_device_id();
ApplicationList app_list = device->GetApplicationList();
- LOG4CXX_INFO(logger_,
- "Device " << device->name() << " has " << app_list.size()
+ SDL_LOG_INFO("Device " << device->name() << " has " << app_list.size()
<< " applications.");
bool errors_occurred = false;
for (ApplicationList::iterator it = app_list.begin(); it != app_list.end();
++it) {
const ApplicationHandle app_handle = *it;
- LOG4CXX_DEBUG(logger_,
- "Attempt to connect device " << device_id << ", channel "
+ SDL_LOG_DEBUG("Attempt to connect device " << device_id << ", channel "
<< app_handle);
const Error error = Connect(device_id, app_handle);
switch (error) {
case OK:
- LOG4CXX_DEBUG(logger_, "error = OK");
+ SDL_LOG_DEBUG("error = OK");
break;
case ALREADY_EXISTS:
- LOG4CXX_DEBUG(logger_, "error = ALREADY_EXISTS");
+ SDL_LOG_DEBUG("error = ALREADY_EXISTS");
break;
default:
- LOG4CXX_ERROR(logger_,
- "Connect to device " << device_id << ", channel "
+ SDL_LOG_ERROR("Connect to device " << device_id << ", channel "
<< app_handle
<< " failed with error " << error);
errors_occurred = true;
- LOG4CXX_DEBUG(logger_, "switch (error), default case");
+ SDL_LOG_DEBUG("switch (error), default case");
break;
}
}
if (errors_occurred) {
- LOG4CXX_TRACE(logger_, "exit with error:FAIL");
+ SDL_LOG_TRACE("exit with error:FAIL");
return FAIL;
} else {
- LOG4CXX_TRACE(logger_, "exit with error:OK");
+ SDL_LOG_TRACE("exit with error:OK");
return OK;
}
}
void TransportAdapterImpl::RunAppOnDevice(const DeviceUID& device_uid,
const std::string& bundle_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceSptr device = FindDevice(device_uid);
if (!device) {
- LOG4CXX_WARN(logger_,
- "Device with id: " << device_uid << " Not found"
+ SDL_LOG_WARN("Device with id: " << device_uid << " Not found"
<< "withing list of connected deviced");
return;
}
@@ -1272,8 +1255,8 @@ void TransportAdapterImpl::RunAppOnDevice(const DeviceUID& device_uid,
}
void TransportAdapterImpl::RemoveDevice(const DeviceUID& device_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Remove Device_handle: " << &device_handle);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Remove Device_handle: " << &device_handle);
sync_primitives::AutoLock locker(devices_mutex_);
DeviceMap::iterator i = devices_.find(device_handle);
if (i != devices_.end()) {
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
index bf2d3dbdf4..1d07e01c7a 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
@@ -39,7 +39,7 @@
#include "transport_manager/transport_manager_impl.h"
namespace transport_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TransportAdapterListenerImpl::TransportAdapterListenerImpl(
TransportManager* manager, TransportAdapter* adapter)
@@ -47,7 +47,7 @@ TransportAdapterListenerImpl::TransportAdapterListenerImpl(
void TransportAdapterListenerImpl::OnSearchDeviceDone(
const TransportAdapter* adapter) {
- LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter);
+ SDL_LOG_TRACE("enter. adapter* " << adapter);
const TransportAdapterEvent event(EventTypeEnum::ON_SEARCH_DONE,
transport_adapter_,
"",
@@ -57,15 +57,14 @@ void TransportAdapterListenerImpl::OnSearchDeviceDone(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnSearchDeviceFailed(
const TransportAdapter* adapter, const SearchDeviceError& error) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", error: " << &error);
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", error: " << &error);
SearchDeviceError* err = new SearchDeviceError(error);
const TransportAdapterEvent event(EventTypeEnum::ON_SEARCH_FAIL,
transport_adapter_,
@@ -76,14 +75,14 @@ void TransportAdapterListenerImpl::OnSearchDeviceFailed(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnDeviceListUpdated(
const TransportAdapter* adapter) {
- LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter);
+ SDL_LOG_TRACE("enter. adapter* " << adapter);
const TransportAdapterEvent event(EventTypeEnum::ON_DEVICE_LIST_UPDATED,
transport_adapter_,
"",
@@ -93,14 +92,14 @@ void TransportAdapterListenerImpl::OnDeviceListUpdated(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnFindNewApplicationsRequest(
const TransportAdapter* adapter) {
- LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter);
+ SDL_LOG_TRACE("enter. adapter* " << adapter);
const TransportAdapterEvent event(
EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST,
transport_adapter_,
@@ -111,14 +110,14 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnConnectionStatusUpdated(
const TransportAdapter* adapter) {
- LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter);
+ SDL_LOG_TRACE("enter. adapter* " << adapter);
const TransportAdapterEvent event(EventTypeEnum::ON_CONNECTION_STATUS_UPDATED,
transport_adapter_,
"",
@@ -128,17 +127,16 @@ void TransportAdapterListenerImpl::OnConnectionStatusUpdated(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnConnectPending(
const TransportAdapter* adapter,
const DeviceUID& device,
const ApplicationHandle& application_id) {
- LOG4CXX_TRACE(logger_,
- "enter adapter*: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter adapter*: " << adapter << ", device: " << &device
<< ", application_id: " << &application_id);
const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_PENDING,
transport_adapter_,
@@ -149,17 +147,16 @@ void TransportAdapterListenerImpl::OnConnectPending(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnConnectDone(
const TransportAdapter* adapter,
const DeviceUID& device,
const ApplicationHandle& application_id) {
- LOG4CXX_TRACE(logger_,
- "enter adapter*: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter adapter*: " << adapter << ", device: " << &device
<< ", application_id: " << &application_id);
const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_DONE,
transport_adapter_,
@@ -170,9 +167,9 @@ void TransportAdapterListenerImpl::OnConnectDone(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnConnectFailed(
@@ -180,8 +177,7 @@ void TransportAdapterListenerImpl::OnConnectFailed(
const DeviceUID& device,
const ApplicationHandle& app_id,
const ConnectError& error) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id
<< ", error: " << &error);
ConnectError* err = new ConnectError(error);
@@ -194,17 +190,17 @@ void TransportAdapterListenerImpl::OnConnectFailed(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnDisconnectDone(
const TransportAdapter* adapter,
const DeviceUID& device,
const ApplicationHandle& app_id) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id);
const TransportAdapterEvent event(EventTypeEnum::ON_DISCONNECT_DONE,
transport_adapter_,
@@ -215,9 +211,9 @@ void TransportAdapterListenerImpl::OnDisconnectDone(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnDisconnectFailed(
@@ -225,8 +221,7 @@ void TransportAdapterListenerImpl::OnDisconnectFailed(
const DeviceUID& device,
const ApplicationHandle& app_id,
const DisconnectError& error) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id
<< ", error: " << &error);
DisconnectError* err = new DisconnectError(error);
@@ -239,13 +234,15 @@ void TransportAdapterListenerImpl::OnDisconnectFailed(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnDisconnectDeviceDone(
- const TransportAdapter* adapter, const DeviceUID& device) {}
+ const TransportAdapter* adapter, const DeviceUID& device) {
+ SDL_LOG_AUTO_TRACE();
+}
void TransportAdapterListenerImpl::OnDisconnectDeviceFailed(
const TransportAdapter* adapter,
@@ -257,8 +254,7 @@ void TransportAdapterListenerImpl::OnDataReceiveDone(
const DeviceUID& device,
const ApplicationHandle& app_id,
const ::protocol_handler::RawMessagePtr data_container) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id
<< ", data_container: " << data_container);
const TransportAdapterEvent event(EventTypeEnum::ON_RECEIVED_DONE,
@@ -270,9 +266,9 @@ void TransportAdapterListenerImpl::OnDataReceiveDone(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnDataReceiveFailed(
@@ -280,8 +276,7 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed(
const DeviceUID& device,
const ApplicationHandle& app_id,
const DataReceiveError& error) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id
<< ", error: " << &error);
DataReceiveError* err = new DataReceiveError(error);
@@ -294,9 +289,9 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnDataSendDone(
@@ -304,8 +299,7 @@ void TransportAdapterListenerImpl::OnDataSendDone(
const DeviceUID& device,
const ApplicationHandle& app_id,
const ::protocol_handler::RawMessagePtr data_container) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id
<< ", data_container: " << data_container);
const TransportAdapterEvent event(EventTypeEnum::ON_SEND_DONE,
@@ -317,9 +311,9 @@ void TransportAdapterListenerImpl::OnDataSendDone(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnDataSendFailed(
@@ -328,8 +322,7 @@ void TransportAdapterListenerImpl::OnDataSendFailed(
const ApplicationHandle& app_id,
const ::protocol_handler::RawMessagePtr data_container,
const DataSendError& error) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id
<< ", data_container: " << data_container
<< ", error: " << &error);
@@ -343,9 +336,9 @@ void TransportAdapterListenerImpl::OnDataSendFailed(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnConnectRequested(
@@ -358,8 +351,7 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect(
const DeviceUID& device,
const ApplicationHandle& application,
const CommunicationError& error) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application: " << &application
<< ", error: " << &error);
CommunicationError* err = new CommunicationError(error);
@@ -372,17 +364,16 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnCommunicationError(
const TransportAdapter* adapter,
const DeviceUID& device,
const ApplicationHandle& app_id) {
- LOG4CXX_TRACE(logger_,
- "enter. adapter: " << adapter << ", device: " << &device
+ SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device
<< ", application_id: " << &app_id);
const TransportAdapterEvent event(EventTypeEnum::ON_COMMUNICATION_ERROR,
transport_adapter_,
@@ -393,14 +384,14 @@ void TransportAdapterListenerImpl::OnCommunicationError(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportAdapterListenerImpl::OnTransportSwitchRequested(
const transport_adapter::TransportAdapter* adapter) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const TransportAdapterEvent event(
EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED,
transport_adapter_,
@@ -411,13 +402,13 @@ void TransportAdapterListenerImpl::OnTransportSwitchRequested(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
}
void TransportAdapterListenerImpl::OnTransportConfigUpdated(
const transport_adapter::TransportAdapter* adapter) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const TransportAdapterEvent event(EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED,
transport_adapter_,
@@ -429,7 +420,7 @@ void TransportAdapterListenerImpl::OnTransportConfigUpdated(
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
- LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ SDL_LOG_WARN("Failed to receive event from device");
}
}
diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc
index 74c5b9ceee..45d0b04528 100644
--- a/src/components/transport_manager/src/transport_manager_default.cc
+++ b/src/components/transport_manager/src/transport_manager_default.cc
@@ -57,7 +57,7 @@
#endif // ENABLE_IAP2EMULATION
namespace transport_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TransportAdapterFactory::TransportAdapterFactory() {
#ifdef BLUETOOTH_SUPPORT
@@ -104,11 +104,11 @@ TransportManagerDefault::TransportManagerDefault(
int TransportManagerDefault::Init(
resumption::LastStateWrapperPtr last_state_wrapper) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (E_SUCCESS != TransportManagerImpl::Init(last_state_wrapper)) {
- LOG4CXX_TRACE(logger_,
- "exit with E_TM_IS_NOT_INITIALIZED. Condition: E_SUCCESS != "
- "TransportManagerImpl::Init()");
+ SDL_LOG_TRACE(
+ "exit with E_TM_IS_NOT_INITIALIZED. Condition: E_SUCCESS != "
+ "TransportManagerImpl::Init()");
return E_TM_IS_NOT_INITIALIZED;
}
@@ -186,7 +186,7 @@ int TransportManagerDefault::Init(
AddTransportAdapter(iap2_usb_emu_adapter);
#endif // ENABLE_IAP2EMULATION
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index ddff4f3780..a0d019cd69 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -76,19 +76,18 @@ struct ConnectionFinder {
namespace transport_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
TransportManagerImpl::Connection TransportManagerImpl::convert(
const TransportManagerImpl::ConnectionInternal& p) {
- LOG4CXX_TRACE(logger_, "enter. ConnectionInternal: " << &p);
+ SDL_LOG_TRACE("enter. ConnectionInternal: " << &p);
TransportManagerImpl::Connection c;
c.application = p.application;
c.device = p.device;
c.id = p.id;
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
"exit with TransportManagerImpl::Connection. It's ConnectionUID = "
- << c.id);
+ << c.id);
return c;
}
@@ -113,11 +112,11 @@ TransportManagerImpl::TransportManagerImpl(
"",
webengine_constants::kWebEngineDeviceName,
webengine_constants::kWebEngineConnectionType) {
- LOG4CXX_TRACE(logger_, "TransportManager has created");
+ SDL_LOG_TRACE("TransportManager has created");
}
TransportManagerImpl::~TransportManagerImpl() {
- LOG4CXX_DEBUG(logger_, "TransportManager object destroying");
+ SDL_LOG_DEBUG("TransportManager object destroying");
message_queue_.Shutdown();
event_queue_.Shutdown();
@@ -135,11 +134,11 @@ TransportManagerImpl::~TransportManagerImpl() {
delete it->second;
}
- LOG4CXX_INFO(logger_, "TransportManager object destroyed");
+ SDL_LOG_INFO("TransportManager object destroyed");
}
void TransportManagerImpl::ReconnectionTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
RaiseEvent(&TransportManagerListener::OnDeviceSwitchingFinish,
device_to_reconnect_);
}
@@ -148,7 +147,7 @@ void TransportManagerImpl::AddCloudDevice(
const transport_manager::transport_adapter::CloudAppProperties&
cloud_properties) {
#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
- LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ SDL_LOG_TRACE("Cloud app support is disabled. Exiting function");
#else
transport_adapter::DeviceType type = transport_adapter::DeviceType::UNKNOWN;
if (cloud_properties.cloud_transport_type == "WS") {
@@ -179,7 +178,7 @@ void TransportManagerImpl::AddCloudDevice(
void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) {
#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
- LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ SDL_LOG_TRACE("Cloud app support is disabled. Exiting function");
return;
#else
DisconnectDevice(device_handle);
@@ -187,30 +186,30 @@ void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) {
}
int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
- LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
+ SDL_LOG_TRACE("enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_ERROR("TransportManager is not initialized.");
+ SDL_LOG_TRACE(
+
"exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
DeviceUID device_id = converter_.HandleToUid(device_handle);
- LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id);
+ SDL_LOG_DEBUG("Convert handle to id:" << device_id);
sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_);
DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id);
if (it == device_to_adapter_map_.end()) {
- LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_id);
- LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta");
+ SDL_LOG_ERROR("No device adapter found by id " << device_id);
+ SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta");
return E_INVALID_HANDLE;
}
transport_adapter::TransportAdapter* ta = it->second;
TransportAdapter::Error ta_error = ta->ConnectDevice(device_id);
int err = (TransportAdapter::OK == ta_error) ? E_SUCCESS : E_INTERNAL_ERROR;
- LOG4CXX_TRACE(logger_, "exit with error: " << err);
+ SDL_LOG_TRACE("exit with error: " << err);
return err;
}
@@ -222,8 +221,8 @@ ConnectionStatus TransportManagerImpl::GetConnectionStatus(
DeviceToAdapterMap::const_iterator it =
device_to_adapter_map_.find(device_id);
if (it == device_to_adapter_map_.end()) {
- LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_handle);
- LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta");
+ SDL_LOG_ERROR("No device adapter found by id " << device_handle);
+ SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta");
return ConnectionStatus::INVALID;
}
transport_adapter::TransportAdapter* ta = it->second;
@@ -231,36 +230,36 @@ ConnectionStatus TransportManagerImpl::GetConnectionStatus(
}
int TransportManagerImpl::DisconnectDevice(const DeviceHandle device_handle) {
- LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
+ SDL_LOG_TRACE("enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_ERROR("TransportManager is not initialized.");
+ SDL_LOG_TRACE(
+
"exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
DeviceUID device_id = converter_.HandleToUid(device_handle);
- LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id);
+ SDL_LOG_DEBUG("Convert handle to id:" << device_id);
sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_);
DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id);
if (it == device_to_adapter_map_.end()) {
- LOG4CXX_WARN(logger_, "No device adapter found by id " << device_id);
- LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta");
+ SDL_LOG_WARN("No device adapter found by id " << device_id);
+ SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta");
return E_INVALID_HANDLE;
}
transport_adapter::TransportAdapter* ta = it->second;
ta->DisconnectDevice(device_id);
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
int TransportManagerImpl::Disconnect(const ConnectionUID cid) {
- LOG4CXX_TRACE(logger_, "enter. ConnectionUID: " << &cid);
+ SDL_LOG_TRACE("enter. ConnectionUID: " << &cid);
if (!this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_ERROR("TransportManager is not initialized.");
+ SDL_LOG_TRACE(
+
"exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
@@ -268,11 +267,9 @@ int TransportManagerImpl::Disconnect(const ConnectionUID cid) {
sync_primitives::AutoReadLock lock(connections_lock_);
ConnectionInternal* connection = GetConnection(cid);
if (NULL == connection) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"TransportManagerImpl::Disconnect: Connection does not exist.");
- LOG4CXX_TRACE(logger_,
- "exit with E_INVALID_HANDLE. Condition: NULL == connection");
+ SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == connection");
return E_INVALID_HANDLE;
}
@@ -296,51 +293,50 @@ int TransportManagerImpl::Disconnect(const ConnectionUID cid) {
const uint32_t disconnect_timeout =
get_settings().transport_manager_disconnect_timeout();
if (disconnect_timeout > 0) {
- connection->timer->start(disconnect_timeout);
+ connection->timer->Start(disconnect_timeout);
}
} else {
connection->transport_adapter->Disconnect(connection->device,
connection->application);
}
*/
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
int TransportManagerImpl::DisconnectForce(const ConnectionUID cid) {
- LOG4CXX_TRACE(logger_, "enter ConnectionUID: " << &cid);
+ SDL_LOG_TRACE("enter ConnectionUID: " << &cid);
if (false == this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
- LOG4CXX_TRACE(logger_,
- "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
- "this->is_initialized_");
+ SDL_LOG_ERROR("TransportManager is not initialized.");
+ SDL_LOG_TRACE(
+ "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
+ "this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
sync_primitives::AutoReadLock lock(connections_lock_);
const ConnectionInternal* connection = GetConnection(cid);
if (NULL == connection) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"TransportManagerImpl::DisconnectForce: Connection does not exist.");
- LOG4CXX_TRACE(logger_,
- "exit with E_INVALID_HANDLE. Condition: NULL == connection");
+ SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == connection");
return E_INVALID_HANDLE;
}
connection->transport_adapter->Disconnect(connection->device,
connection->application);
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
int TransportManagerImpl::AddEventListener(TransportManagerListener* listener) {
- LOG4CXX_TRACE(logger_, "enter. TransportManagerListener: " << listener);
+ SDL_LOG_TRACE("enter. TransportManagerListener: " << listener);
transport_manager_listener_.push_back(listener);
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
void TransportManagerImpl::DisconnectAllDevices() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoReadLock lock(device_list_lock_);
for (DeviceInfoList::iterator i = device_list_.begin();
i != device_list_.end();
@@ -351,7 +347,7 @@ void TransportManagerImpl::DisconnectAllDevices() {
}
void TransportManagerImpl::TerminateAllAdapters() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (std::vector<TransportAdapter*>::iterator i = transport_adapters_.begin();
i != transport_adapters_.end();
++i) {
@@ -360,7 +356,7 @@ void TransportManagerImpl::TerminateAllAdapters() {
}
int TransportManagerImpl::InitAllAdapters() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
for (std::vector<TransportAdapter*>::iterator i = transport_adapters_.begin();
i != transport_adapters_.end();
++i) {
@@ -372,9 +368,9 @@ int TransportManagerImpl::InitAllAdapters() {
}
int TransportManagerImpl::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!is_initialized_) {
- LOG4CXX_WARN(logger_, "TransportManager is not initialized_");
+ SDL_LOG_WARN("TransportManager is not initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
@@ -390,15 +386,14 @@ int TransportManagerImpl::Stop() {
int TransportManagerImpl::SendMessageToDevice(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_TRACE(logger_, "enter. RawMessageSptr: " << message);
- LOG4CXX_INFO(
- logger_,
- "Send message to device called with arguments " << message.get());
+ SDL_LOG_TRACE("enter. RawMessageSptr: " << message);
+ SDL_LOG_INFO("Send message to device called with arguments "
+ << message.get());
if (false == this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TM is not initialized.");
- LOG4CXX_TRACE(logger_,
- "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
- "this->is_initialized_");
+ SDL_LOG_ERROR("TM is not initialized.");
+ SDL_LOG_TRACE(
+ "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
+ "this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
@@ -407,21 +402,20 @@ int TransportManagerImpl::SendMessageToDevice(
const ConnectionInternal* connection =
GetConnection(message->connection_key());
if (NULL == connection) {
- LOG4CXX_ERROR(logger_,
- "Connection with id " << message->connection_key()
+ SDL_LOG_ERROR("Connection with id " << message->connection_key()
<< " does not exist.");
- LOG4CXX_TRACE(
- logger_, "exit with E_INVALID_HANDLE. Condition: NULL == connection");
+ SDL_LOG_TRACE(
+ "exit with E_INVALID_HANDLE. Condition: NULL == connection");
return E_INVALID_HANDLE;
}
if (connection->shutdown_) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"TransportManagerImpl::Disconnect: Connection is to shut down.");
- LOG4CXX_TRACE(logger_,
- "exit with E_CONNECTION_IS_TO_SHUTDOWN. Condition: "
- "connection->shutDown");
+ SDL_LOG_TRACE(
+ "exit with E_CONNECTION_IS_TO_SHUTDOWN. Condition: "
+ "connection->shutDown");
return E_CONNECTION_IS_TO_SHUTDOWN;
}
}
@@ -431,30 +425,29 @@ int TransportManagerImpl::SendMessageToDevice(
}
#endif // TELEMETRY_MONITOR
this->PostMessage(message);
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
void TransportManagerImpl::RunAppOnDevice(const DeviceHandle device_handle,
const std::string& bundle_id) {
if (!this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
+ SDL_LOG_ERROR("TransportManager is not initialized.");
return;
}
DeviceUID device_id = converter_.HandleToUid(device_handle);
- LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id);
+ SDL_LOG_DEBUG("Convert handle to id:" << device_id);
sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_);
DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id);
if (it == device_to_adapter_map_.end()) {
- LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_id);
+ SDL_LOG_ERROR("No device adapter found by id " << device_id);
return;
}
transport_adapter::TransportAdapter* ta = it->second;
if (!ta) {
- LOG4CXX_ERROR(logger_,
- "Transport adapter for device: " << device_id << " is NULL");
+ SDL_LOG_ERROR("Transport adapter for device: " << device_id << " is NULL");
return;
}
@@ -465,46 +458,46 @@ void TransportManagerImpl::RunAppOnDevice(const DeviceHandle device_handle,
int TransportManagerImpl::ReceiveEventFromDevice(
const TransportAdapterEvent& event) {
- LOG4CXX_TRACE(logger_, "enter. TransportAdapterEvent: " << &event);
+ SDL_LOG_TRACE("enter. TransportAdapterEvent: " << &event);
if (!is_initialized_) {
- LOG4CXX_ERROR(logger_, "TM is not initialized.");
- LOG4CXX_TRACE(logger_,
- "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
- "this->is_initialized_");
+ SDL_LOG_ERROR("TM is not initialized.");
+ SDL_LOG_TRACE(
+ "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
+ "this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
this->PostEvent(event);
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
int TransportManagerImpl::RemoveDevice(const DeviceHandle device_handle) {
- LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
+ SDL_LOG_TRACE("enter. DeviceHandle: " << &device_handle);
DeviceUID device_id = converter_.HandleToUid(device_handle);
if (false == this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TM is not initialized.");
- LOG4CXX_TRACE(logger_,
- "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
- "this->is_initialized_");
+ SDL_LOG_ERROR("TM is not initialized.");
+ SDL_LOG_TRACE(
+ "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
+ "this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_);
device_to_adapter_map_.erase(device_id);
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
int TransportManagerImpl::AddTransportAdapter(
transport_adapter::TransportAdapter* transport_adapter) {
- LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << transport_adapter);
+ SDL_LOG_TRACE("enter. TransportAdapter: " << transport_adapter);
if (transport_adapter_listeners_.find(transport_adapter) !=
transport_adapter_listeners_.end()) {
- LOG4CXX_ERROR(logger_, "Adapter already exists.");
- LOG4CXX_TRACE(logger_,
- "exit with E_ADAPTER_EXISTS. Condition: "
- "transport_adapter_listeners_.find(transport_adapter) != "
- "transport_adapter_listeners_.end()");
+ SDL_LOG_ERROR("Adapter already exists.");
+ SDL_LOG_TRACE(
+ "exit with E_ADAPTER_EXISTS. Condition: "
+ "transport_adapter_listeners_.find(transport_adapter) != "
+ "transport_adapter_listeners_.end()");
return E_ADAPTER_EXISTS;
}
@@ -520,21 +513,21 @@ int TransportManagerImpl::AddTransportAdapter(
delete listener;
delete transport_adapter;
}
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
int TransportManagerImpl::SearchDevices() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (!this->is_initialized_) {
- LOG4CXX_ERROR(logger_, "TM is not initialized");
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_ERROR("TM is not initialized");
+ SDL_LOG_TRACE(
+
"exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
- LOG4CXX_INFO(logger_, "Search device called");
+ SDL_LOG_INFO("Search device called");
bool success_occurred = false;
@@ -542,33 +535,29 @@ int TransportManagerImpl::SearchDevices() {
transport_adapters_.begin();
it != transport_adapters_.end();
++it) {
- LOG4CXX_DEBUG(logger_, "Iterating over transport adapters");
+ SDL_LOG_DEBUG("Iterating over transport adapters");
TransportAdapter::Error scanResult = (*it)->SearchDevices();
if (transport_adapter::TransportAdapter::OK == scanResult) {
success_occurred = true;
} else {
- LOG4CXX_ERROR(logger_,
- "Transport Adapter search failed "
- << *it << "[" << (*it)->GetDeviceType() << "]");
+ SDL_LOG_ERROR("Transport Adapter search failed "
+ << *it << "[" << (*it)->GetDeviceType() << "]");
switch (scanResult) {
case transport_adapter::TransportAdapter::NOT_SUPPORTED: {
- LOG4CXX_ERROR(logger_,
- "Search feature is not supported "
- << *it << "[" << (*it)->GetDeviceType() << "]");
- LOG4CXX_DEBUG(logger_,
- "scanResult = TransportAdapter::NOT_SUPPORTED");
+ SDL_LOG_ERROR("Search feature is not supported "
+ << *it << "[" << (*it)->GetDeviceType() << "]");
+ SDL_LOG_DEBUG("scanResult = TransportAdapter::NOT_SUPPORTED");
break;
}
case transport_adapter::TransportAdapter::BAD_STATE: {
- LOG4CXX_ERROR(logger_,
- "Transport Adapter has bad state "
- << *it << "[" << (*it)->GetDeviceType() << "]");
- LOG4CXX_DEBUG(logger_, "scanResult = TransportAdapter::BAD_STATE");
+ SDL_LOG_ERROR("Transport Adapter has bad state "
+ << *it << "[" << (*it)->GetDeviceType() << "]");
+ SDL_LOG_DEBUG("scanResult = TransportAdapter::BAD_STATE");
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Invalid scan result");
- LOG4CXX_DEBUG(logger_, "scanResult = default switch case");
+ SDL_LOG_ERROR("Invalid scan result");
+ SDL_LOG_DEBUG("scanResult = default switch case");
return E_ADAPTERS_FAIL;
}
}
@@ -578,13 +567,13 @@ int TransportManagerImpl::SearchDevices() {
(success_occurred || transport_adapters_.empty()) ? E_SUCCESS
: E_ADAPTERS_FAIL;
if (transport_adapter_search == E_SUCCESS) {
- LOG4CXX_TRACE(logger_,
- "exit with E_SUCCESS. Condition: success_occured || "
- "transport_adapters_.empty()");
+ SDL_LOG_TRACE(
+ "exit with E_SUCCESS. Condition: success_occured || "
+ "transport_adapters_.empty()");
} else {
- LOG4CXX_TRACE(logger_,
- "exit with E_ADAPTERS_FAIL. Condition: success_occured || "
- "transport_adapters_.empty()");
+ SDL_LOG_TRACE(
+ "exit with E_ADAPTERS_FAIL. Condition: success_occured || "
+ "transport_adapters_.empty()");
}
return transport_adapter_search;
}
@@ -593,23 +582,23 @@ int TransportManagerImpl::Init(
resumption::LastStateWrapperPtr last_state_wrapper) {
// Last state wrapper required to initialize Transport adapters
UNUSED(last_state_wrapper);
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
is_initialized_ = true;
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
int TransportManagerImpl::Init(resumption::LastState& last_state) {
// Last state required to initialize Transport adapters
UNUSED(last_state);
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
is_initialized_ = true;
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
void TransportManagerImpl::Deinit() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DisconnectAllDevices();
TerminateAllAdapters();
device_to_adapter_map_.clear();
@@ -622,27 +611,26 @@ int TransportManagerImpl::Reinit() {
}
void TransportManagerImpl::StopEventsProcessing() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
events_processing_is_active_ = false;
}
void TransportManagerImpl::StartEventsProcessing() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
events_processing_is_active_ = true;
events_processing_cond_var_.Broadcast();
}
int TransportManagerImpl::PerformActionOnClients(
const TransportAction required_action) const {
- LOG4CXX_TRACE(logger_,
- "The following action requested: "
- << static_cast<int>(required_action)
- << " to be performed on connected clients");
+ SDL_LOG_TRACE("The following action requested: "
+ << static_cast<int>(required_action)
+ << " to be performed on connected clients");
if (!is_initialized_) {
- LOG4CXX_ERROR(logger_, "TM is not initialized");
- LOG4CXX_TRACE(logger_,
- "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
- "is_initialized_");
+ SDL_LOG_ERROR("TM is not initialized");
+ SDL_LOG_TRACE(
+ "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == "
+ "is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
@@ -652,22 +640,21 @@ int TransportManagerImpl::PerformActionOnClients(
ret = adapter_ptr->ChangeClientListening(required_action);
if (TransportAdapter::Error::NOT_SUPPORTED == ret) {
- LOG4CXX_DEBUG(logger_,
- "Requested action on client is not supported for adapter "
- << adapter_ptr << "[" << adapter_ptr->GetDeviceType()
- << "]");
+ SDL_LOG_DEBUG("Requested action on client is not supported for adapter "
+ << adapter_ptr << "[" << adapter_ptr->GetDeviceType()
+ << "]");
}
}
- LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ SDL_LOG_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
}
void TransportManagerImpl::CreateWebEngineDevice() {
#ifndef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
- LOG4CXX_TRACE(logger_, "Web engine support is disabled. Exiting function");
+ SDL_LOG_TRACE("Web engine support is disabled. Exiting function");
#else
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
auto web_socket_ta_iterator = std::find_if(
transport_adapters_.begin(),
transport_adapters_.end(),
@@ -677,9 +664,9 @@ void TransportManagerImpl::CreateWebEngineDevice() {
});
if (transport_adapters_.end() == web_socket_ta_iterator) {
- LOG4CXX_WARN(logger_,
- "WebSocketServerTransportAdapter not found."
- "Impossible to create WebEngineDevice");
+ SDL_LOG_WARN(
+ "WebSocketServerTransportAdapter not found."
+ "Impossible to create WebEngineDevice");
return;
}
@@ -688,10 +675,10 @@ void TransportManagerImpl::CreateWebEngineDevice() {
*web_socket_ta_iterator);
if (!web_socket_ta) {
- LOG4CXX_ERROR(logger_,
- "Unable to cast from Transport Adapter to "
- "WebSocketServerTransportAdapter."
- "Impossible to create WebEngineDevice");
+ SDL_LOG_ERROR(
+ "Unable to cast from Transport Adapter to "
+ "WebSocketServerTransportAdapter."
+ "Impossible to create WebEngineDevice");
return;
}
@@ -717,12 +704,12 @@ void TransportManagerImpl::CreateWebEngineDevice() {
}
const DeviceInfo& TransportManagerImpl::GetWebEngineDeviceInfo() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return web_engine_device_info_;
}
bool TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
- LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta);
+ SDL_LOG_TRACE("enter. TransportAdapter: " << ta);
std::set<DeviceInfo> old_devices;
std::set<DeviceInfo> new_devices;
{
@@ -774,20 +761,20 @@ bool TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
RaiseEvent(&TransportManagerListener::OnDeviceRemoved, *it);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
return added_devices.size() + removed_devices.size() > 0;
}
void TransportManagerImpl::PostMessage(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_TRACE(logger_, "enter. RawMessageSptr: " << message);
+ SDL_LOG_TRACE("enter. RawMessageSptr: " << message);
message_queue_.PostMessage(message);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportManagerImpl::PostEvent(const TransportAdapterEvent& event) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "TransportAdapterEvent: " << &event);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("TransportAdapterEvent: " << &event);
event_queue_.PostMessage(event);
}
@@ -796,18 +783,18 @@ const TransportManagerSettings& TransportManagerImpl::get_settings() const {
}
void TransportManagerImpl::AddConnection(const ConnectionInternal& c) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "ConnectionInternal: " << &c);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("ConnectionInternal: " << &c);
sync_primitives::AutoWriteLock lock(connections_lock_);
connections_.push_back(c);
}
void TransportManagerImpl::RemoveConnection(
const uint32_t id, transport_adapter::TransportAdapter* transport_adapter) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Id: " << id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Id: " << id);
sync_primitives::AutoWriteLock lock(connections_lock_);
- LOG4CXX_DEBUG(logger_, "Removing connection with id: " << id);
+ SDL_LOG_DEBUG("Removing connection with id: " << id);
const std::vector<ConnectionInternal>::iterator it = std::find_if(
connections_.begin(), connections_.end(), ConnectionFinder(id));
if (connections_.end() != it) {
@@ -820,11 +807,10 @@ void TransportManagerImpl::RemoveConnection(
void TransportManagerImpl::DeactivateDeviceConnections(
const DeviceUID& device_uid) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoWriteLock lock(connections_lock_);
- LOG4CXX_DEBUG(logger_,
- "Deactivating connections for device with UID: " << device_uid);
+ SDL_LOG_DEBUG("Deactivating connections for device with UID: " << device_uid);
size_t counter = 0;
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
@@ -835,21 +821,20 @@ void TransportManagerImpl::DeactivateDeviceConnections(
++counter;
}
}
- LOG4CXX_DEBUG(logger_,
- "Deactivated "
- << counter
- << " connections for device with UID: " << device_uid);
+ SDL_LOG_DEBUG("Deactivated "
+ << counter
+ << " connections for device with UID: " << device_uid);
}
TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
const ConnectionUID id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "ConnectionUID: " << id);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("ConnectionUID: " << id);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end();
++it) {
if (it->id == id) {
- LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it);
+ SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it);
return &*it;
}
}
@@ -858,14 +843,14 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
const DeviceUID& device, const ApplicationHandle& application) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_, "DeviceUID: " << device << "ApplicationHandle: " << application);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("DeviceUID: " << device
+ << "ApplicationHandle: " << application);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end();
++it) {
if (it->device == device && it->application == application) {
- LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it);
+ SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it);
return &*it;
}
}
@@ -875,15 +860,14 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
TransportManagerImpl::ConnectionInternal*
TransportManagerImpl::GetActiveConnection(
const DeviceUID& device, const ApplicationHandle& application) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "DeviceUID: " << device << " ApplicationHandle: " << application);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("DeviceUID: " << device
+ << " ApplicationHandle: " << application);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end();
++it) {
if (it->device == device && it->application == application && it->active_) {
- LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it);
+ SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it);
return &*it;
}
}
@@ -913,9 +897,9 @@ struct SwitchableFinder {
void TransportManagerImpl::TryDeviceSwitch(
transport_adapter::TransportAdapter* adapter) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (adapter->GetDeviceType() != transport_adapter::DeviceType::IOS_USB) {
- LOG4CXX_ERROR(logger_, "Switching requested not from iAP-USB transport.");
+ SDL_LOG_ERROR("Switching requested not from iAP-USB transport.");
return;
}
@@ -924,9 +908,9 @@ void TransportManagerImpl::TryDeviceSwitch(
IOSBTAdapterFinder());
if (transport_adapters_.end() == ios_bt_adapter) {
- LOG4CXX_WARN(logger_,
- "There is no iAP2 Bluetooth adapter found. Switching is not "
- "possible.");
+ SDL_LOG_WARN(
+ "There is no iAP2 Bluetooth adapter found. Switching is not "
+ "possible.");
return;
}
@@ -946,25 +930,22 @@ void TransportManagerImpl::TryDeviceSwitch(
}
if (bt_switchable_devices.end() == bt) {
- LOG4CXX_WARN(logger_,
- "No suitable for switching iAP2 Bluetooth device found.");
+ SDL_LOG_WARN("No suitable for switching iAP2 Bluetooth device found.");
return;
}
- LOG4CXX_DEBUG(logger_,
- "Found UUID suitable for transport switching: " << bt->second);
- LOG4CXX_DEBUG(
- logger_, "Device to switch from: " << bt->first << " to: " << usb->first);
+ SDL_LOG_DEBUG("Found UUID suitable for transport switching: " << bt->second);
+ SDL_LOG_DEBUG("Device to switch from: " << bt->first
+ << " to: " << usb->first);
sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_);
const auto bt_device_uid = bt->first;
const auto device_to_switch = device_to_adapter_map_.find(bt_device_uid);
if (device_to_adapter_map_.end() == device_to_switch) {
- LOG4CXX_ERROR(logger_,
- "There is no known device found with UID "
- << bt_device_uid
- << " . Transport switching is not possible.");
+ SDL_LOG_ERROR("There is no known device found with UID "
+ << bt_device_uid
+ << " . Transport switching is not possible.");
DCHECK_OR_RETURN_VOID(false);
return;
}
@@ -973,9 +954,8 @@ void TransportManagerImpl::TryDeviceSwitch(
const auto bt_uid = device_to_switch->first;
const auto bt_adapter = device_to_switch->second;
- LOG4CXX_DEBUG(logger_,
- "Known device with UID "
- << bt_uid << " is appropriate for transport switching.");
+ SDL_LOG_DEBUG("Known device with UID "
+ << bt_uid << " is appropriate for transport switching.");
RaiseEvent(
&TransportManagerListener::OnDeviceSwitchingStart, bt_uid, usb_uid);
@@ -991,21 +971,19 @@ void TransportManagerImpl::TryDeviceSwitch(
get_settings().app_transport_change_timer_addition();
device_switch_timer_.Start(timeout, timer::kSingleShot);
- LOG4CXX_DEBUG(logger_,
- "Device switch for device id " << bt_uid << " is done.");
+ SDL_LOG_DEBUG("Device switch for device id " << bt_uid << " is done.");
return;
}
bool TransportManagerImpl::UpdateDeviceMapping(
transport_adapter::TransportAdapter* ta) {
const DeviceList adapter_device_list = ta->GetDeviceList();
- LOG4CXX_DEBUG(logger_, "DEVICE_LIST_UPDATED " << adapter_device_list.size());
+ SDL_LOG_DEBUG("DEVICE_LIST_UPDATED " << adapter_device_list.size());
sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_);
- LOG4CXX_DEBUG(logger_,
- "Before cleanup and update. Device map size is "
- << device_to_adapter_map_.size());
+ SDL_LOG_DEBUG("Before cleanup and update. Device map size is "
+ << device_to_adapter_map_.size());
for (auto item = device_to_adapter_map_.begin();
device_to_adapter_map_.end() != item;) {
@@ -1027,8 +1005,8 @@ bool TransportManagerImpl::UpdateDeviceMapping(
item = device_to_adapter_map_.begin();
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"After cleanup. Device map size is " << device_to_adapter_map_.size());
for (DeviceList::const_iterator it = adapter_device_list.begin();
@@ -1038,8 +1016,7 @@ bool TransportManagerImpl::UpdateDeviceMapping(
const auto result =
device_to_adapter_map_.insert(std::make_pair(device_uid, ta));
if (!result.second) {
- LOG4CXX_WARN(logger_,
- "Device UID " << device_uid
+ SDL_LOG_WARN("Device UID " << device_uid
<< " is known already. Processing skipped."
"Connection type is: "
<< ta->GetConnectionType());
@@ -1054,22 +1031,22 @@ bool TransportManagerImpl::UpdateDeviceMapping(
RaiseEvent(&TransportManagerListener::OnDeviceFound, info);
}
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"After update. Device map size is " << device_to_adapter_map_.size());
return true;
}
void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) {
- LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta);
+ SDL_LOG_TRACE("enter. TransportAdapter: " << ta);
if (!UpdateDeviceMapping(ta)) {
- LOG4CXX_ERROR(logger_, "Device list update failed.");
+ SDL_LOG_ERROR("Device list update failed.");
return;
}
if (!UpdateDeviceList(ta)) {
- LOG4CXX_DEBUG(logger_, "Device list was not changed");
+ SDL_LOG_DEBUG("Device list was not changed");
return;
}
@@ -1082,14 +1059,14 @@ void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) {
}
device_list_lock_.Release();
RaiseEvent(&TransportManagerListener::OnDeviceListUpdated, device_infos);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void TransportManagerImpl::Handle(TransportAdapterEvent event) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (!events_processing_is_active_) {
- LOG4CXX_DEBUG(logger_, "Waiting for events handling unlock");
+ SDL_LOG_DEBUG("Waiting for events handling unlock");
sync_primitives::AutoLock auto_lock(events_processing_lock_);
events_processing_cond_var_.Wait(auto_lock);
}
@@ -1097,34 +1074,34 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
switch (event.event_type) {
case EventTypeEnum::ON_SEARCH_DONE: {
RaiseEvent(&TransportManagerListener::OnScanDevicesFinished);
- LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_DONE");
+ SDL_LOG_DEBUG("event_type = ON_SEARCH_DONE");
break;
}
case EventTypeEnum::ON_SEARCH_FAIL: {
// error happened in real search process (external error)
RaiseEvent(&TransportManagerListener::OnScanDevicesFailed,
*static_cast<SearchDeviceError*>(event.event_error.get()));
- LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_FAIL");
+ SDL_LOG_DEBUG("event_type = ON_SEARCH_FAIL");
break;
}
case EventTypeEnum::ON_DEVICE_LIST_UPDATED: {
OnDeviceListUpdated(event.transport_adapter);
- LOG4CXX_DEBUG(logger_, "event_type = ON_DEVICE_LIST_UPDATED");
+ SDL_LOG_DEBUG("event_type = ON_DEVICE_LIST_UPDATED");
break;
}
case EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED: {
TryDeviceSwitch(event.transport_adapter);
- LOG4CXX_DEBUG(logger_, "event_type = ON_TRANSPORT_SWITCH_REQUESTED");
+ SDL_LOG_DEBUG("event_type = ON_TRANSPORT_SWITCH_REQUESTED");
break;
}
case EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST: {
RaiseEvent(&TransportManagerListener::OnFindNewApplicationsRequest);
- LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST");
+ SDL_LOG_DEBUG("event_type = ON_FIND_NEW_APPLICATIONS_REQUEST");
break;
}
case EventTypeEnum::ON_CONNECTION_STATUS_UPDATED: {
RaiseEvent(&TransportManagerListener::OnConnectionStatusUpdated);
- LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECTION_STATUS_UPDATED");
+ SDL_LOG_DEBUG("event_type = ON_CONNECTION_STATUS_UPDATED");
break;
}
case EventTypeEnum::ON_CONNECT_PENDING: {
@@ -1143,7 +1120,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
} else if (it->device_handle_ != device_handle) {
continue;
} else {
- LOG4CXX_DEBUG(logger_, "Connection Object Already Exists");
+ SDL_LOG_DEBUG("Connection Object Already Exists");
connection_id = it->Connection::id;
break;
}
@@ -1166,7 +1143,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
event.transport_adapter->DeviceName(event.device_uid),
event.transport_adapter->GetConnectionType()),
connection_id);
- LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_PENDING");
+ SDL_LOG_DEBUG("event_type = ON_CONNECT_PENDING");
break;
}
case EventTypeEnum::ON_CONNECT_DONE: {
@@ -1186,7 +1163,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
} else if (it->device_handle_ != device_handle) {
continue;
} else {
- LOG4CXX_DEBUG(logger_, "Connection Object Already Exists");
+ SDL_LOG_DEBUG("Connection Object Already Exists");
connection_id = it->Connection::id;
break;
}
@@ -1209,7 +1186,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
event.transport_adapter->DeviceName(event.device_uid),
event.transport_adapter->GetConnectionType()),
connection_id);
- LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE");
+ SDL_LOG_DEBUG("event_type = ON_CONNECT_DONE");
break;
}
case EventTypeEnum::ON_CONNECT_FAIL: {
@@ -1222,7 +1199,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
event.transport_adapter->DeviceName(event.device_uid),
event.transport_adapter->GetConnectionType()),
ConnectError());
- LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_FAIL");
+ SDL_LOG_DEBUG("event_type = ON_CONNECT_FAIL");
break;
}
case EventTypeEnum::ON_DISCONNECT_DONE: {
@@ -1230,9 +1207,8 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
ConnectionInternal* connection =
GetConnection(event.device_uid, event.application_id);
if (NULL == connection) {
- LOG4CXX_ERROR(logger_, "Connection not found");
- LOG4CXX_DEBUG(logger_,
- "event_type = ON_DISCONNECT_DONE && NULL == connection");
+ SDL_LOG_ERROR("Connection not found");
+ SDL_LOG_DEBUG("event_type = ON_DISCONNECT_DONE && NULL == connection");
connections_lock_.Release();
break;
}
@@ -1241,7 +1217,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
RaiseEvent(&TransportManagerListener::OnConnectionClosed, id);
RemoveConnection(id, connection->transport_adapter);
- LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_DONE");
+ SDL_LOG_DEBUG("event_type = ON_DISCONNECT_DONE");
break;
}
case EventTypeEnum::ON_DISCONNECT_FAIL: {
@@ -1250,7 +1226,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
RaiseEvent(&TransportManagerListener::OnDisconnectFailed,
device_handle,
DisconnectDeviceError());
- LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_FAIL");
+ SDL_LOG_DEBUG("event_type = ON_DISCONNECT_FAIL");
break;
}
case EventTypeEnum::ON_SEND_DONE: {
@@ -1263,11 +1239,9 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
ConnectionInternal* connection =
GetConnection(event.device_uid, event.application_id);
if (connection == NULL) {
- LOG4CXX_ERROR(logger_,
- "Connection ('" << event.device_uid << ", "
+ SDL_LOG_ERROR("Connection ('" << event.device_uid << ", "
<< event.application_id << ") not found");
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"event_type = ON_SEND_DONE. Condition: NULL == connection");
break;
}
@@ -1277,7 +1251,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
connection->transport_adapter->Disconnect(connection->device,
connection->application);
}
- LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE");
+ SDL_LOG_DEBUG("event_type = ON_SEND_DONE");
break;
}
case EventTypeEnum::ON_SEND_FAIL: {
@@ -1291,12 +1265,10 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
ConnectionInternal* connection =
GetConnection(event.device_uid, event.application_id);
if (connection == NULL) {
- LOG4CXX_ERROR(logger_,
- "Connection ('" << event.device_uid << ", "
+ SDL_LOG_ERROR("Connection ('" << event.device_uid << ", "
<< event.application_id
<< ") not found");
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"event_type = ON_SEND_FAIL. Condition: NULL == connection");
break;
}
@@ -1304,15 +1276,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
// TODO(YK): start timer here to wait before notify caller
// and remove unsent messages
- LOG4CXX_ERROR(logger_, "Transport adapter failed to send data");
- // TODO(YK): potential error case -> thread unsafe
- // update of message content
- if (event.event_data.use_count() != 0) {
- event.event_data->set_waiting(true);
- } else {
- LOG4CXX_DEBUG(logger_, "Data is invalid");
- }
- LOG4CXX_DEBUG(logger_, "eevent_type = ON_SEND_FAIL");
+ SDL_LOG_ERROR("Transport adapter failed to send data");
+ RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed,
+ DataSendError(),
+ event.event_data);
+ SDL_LOG_DEBUG("event_type = ON_SEND_FAIL");
break;
}
case EventTypeEnum::ON_RECEIVED_DONE: {
@@ -1321,12 +1289,10 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
ConnectionInternal* connection =
GetActiveConnection(event.device_uid, event.application_id);
if (connection == NULL) {
- LOG4CXX_ERROR(logger_,
- "Connection ('" << event.device_uid << ", "
+ SDL_LOG_ERROR("Connection ('" << event.device_uid << ", "
<< event.application_id
<< ") not found");
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
"event_type = ON_RECEIVED_DONE. Condition: NULL == connection");
break;
}
@@ -1339,17 +1305,16 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
#endif // TELEMETRY_MONITOR
RaiseEvent(&TransportManagerListener::OnTMMessageReceived,
event.event_data);
- LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE");
+ SDL_LOG_DEBUG("event_type = ON_RECEIVED_DONE");
break;
}
case EventTypeEnum::ON_RECEIVED_FAIL: {
- LOG4CXX_DEBUG(logger_, "Event ON_RECEIVED_FAIL");
+ SDL_LOG_DEBUG("Event ON_RECEIVED_FAIL");
connections_lock_.AcquireForReading();
ConnectionInternal* connection =
GetActiveConnection(event.device_uid, event.application_id);
if (connection == NULL) {
- LOG4CXX_ERROR(logger_,
- "Connection ('" << event.device_uid << ", "
+ SDL_LOG_ERROR("Connection ('" << event.device_uid << ", "
<< event.application_id << ") not found");
connections_lock_.Release();
break;
@@ -1358,11 +1323,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
RaiseEvent(&TransportManagerListener::OnTMMessageReceiveFailed,
*static_cast<DataReceiveError*>(event.event_error.get()));
- LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_FAIL");
+ SDL_LOG_DEBUG("event_type = ON_RECEIVED_FAIL");
break;
}
case EventTypeEnum::ON_COMMUNICATION_ERROR: {
- LOG4CXX_DEBUG(logger_, "event_type = ON_COMMUNICATION_ERROR");
+ SDL_LOG_DEBUG("event_type = ON_COMMUNICATION_ERROR");
break;
}
case EventTypeEnum::ON_UNEXPECTED_DISCONNECT: {
@@ -1378,22 +1343,21 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
RemoveConnection(id, connection->transport_adapter);
} else {
connections_lock_.Release();
- LOG4CXX_ERROR(logger_,
- "Connection ('" << event.device_uid << ", "
+ SDL_LOG_ERROR("Connection ('" << event.device_uid << ", "
<< event.application_id << ") not found");
}
- LOG4CXX_DEBUG(logger_, "eevent_type = ON_UNEXPECTED_DISCONNECT");
+ SDL_LOG_DEBUG("eevent_type = ON_UNEXPECTED_DISCONNECT");
break;
}
case EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED: {
- LOG4CXX_DEBUG(logger_, "event_type = ON_TRANSPORT_CONFIG_UPDATED");
+ SDL_LOG_DEBUG("event_type = ON_TRANSPORT_CONFIG_UPDATED");
transport_adapter::TransportConfig config =
event.transport_adapter->GetTransportConfiguration();
RaiseEvent(&TransportManagerListener::OnTransportConfigUpdated, config);
break;
}
} // switch
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
#ifdef TELEMETRY_MONITOR
@@ -1403,10 +1367,10 @@ void TransportManagerImpl::SetTelemetryObserver(TMTelemetryObserver* observer) {
#endif // TELEMETRY_MONITOR
void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (!events_processing_is_active_) {
- LOG4CXX_DEBUG(logger_, "Waiting for events handling unlock");
+ SDL_LOG_DEBUG("Waiting for events handling unlock");
sync_primitives::AutoLock auto_lock(events_processing_lock_);
events_processing_cond_var_.Wait(auto_lock);
}
@@ -1414,8 +1378,7 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) {
sync_primitives::AutoReadLock lock(connections_lock_);
ConnectionInternal* connection = GetConnection(msg->connection_key());
if (connection == NULL) {
- LOG4CXX_WARN(logger_,
- "Connection " << msg->connection_key() << " not found");
+ SDL_LOG_WARN("Connection " << msg->connection_key() << " not found");
RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed,
DataSendTimeoutError(),
msg);
@@ -1423,30 +1386,28 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) {
}
TransportAdapter* transport_adapter = connection->transport_adapter;
- LOG4CXX_DEBUG(logger_,
- "Got adapter " << transport_adapter << "["
- << transport_adapter->GetDeviceType() << "]"
- << " by session id " << msg->connection_key());
-
if (NULL == transport_adapter) {
std::string error_text = "Transport adapter is not found";
- LOG4CXX_ERROR(logger_, error_text);
+ SDL_LOG_ERROR(error_text);
RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed,
DataSendError(error_text),
msg);
} else {
+ SDL_LOG_DEBUG("Got adapter " << transport_adapter << "["
+ << transport_adapter->GetDeviceType() << "]"
+ << " by session id " << msg->connection_key());
if (TransportAdapter::OK ==
transport_adapter->SendData(
connection->device, connection->application, msg)) {
- LOG4CXX_TRACE(logger_, "Data sent to adapter");
+ SDL_LOG_TRACE("Data sent to adapter");
} else {
- LOG4CXX_ERROR(logger_, "Data sent error");
+ SDL_LOG_ERROR("Data sent error");
RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed,
DataSendError("Send failed"),
msg);
}
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
TransportManagerImpl::ConnectionInternal::ConnectionInternal(
@@ -1474,13 +1435,13 @@ TransportManagerImpl::ConnectionInternal::ConnectionInternal(
}
void TransportManagerImpl::ConnectionInternal::DisconnectFailedRoutine() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
transport_manager->RaiseEvent(&TransportManagerListener::OnDisconnectFailed,
device_handle_,
DisconnectDeviceError());
shutdown_ = false;
timer->Stop();
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
DeviceHandle TransportManagerImpl::Handle2GUIDConverter::UidToHandle(
@@ -1495,8 +1456,7 @@ DeviceHandle TransportManagerImpl::Handle2GUIDConverter::UidToHandle(
HandleFinder(handle));
if (it != conversion_table_.end()) {
- LOG4CXX_DEBUG(logger_,
- "Handle for UID is found: " << std::get<0>(*it) << "/"
+ SDL_LOG_DEBUG("Handle for UID is found: " << std::get<0>(*it) << "/"
<< std::get<1>(*it) << "/"
<< std::get<2>(*it));
return std::get<2>(*it);
@@ -1508,8 +1468,7 @@ DeviceHandle TransportManagerImpl::Handle2GUIDConverter::UidToHandle(
auto t = std::make_tuple(dev_uid, connection_type, handle);
conversion_table_.push_back(
std::make_tuple(dev_uid, connection_type, handle));
- LOG4CXX_DEBUG(logger_,
- "Handle for UID is added: " << std::get<0>(t) << "/"
+ SDL_LOG_DEBUG("Handle for UID is added: " << std::get<0>(t) << "/"
<< std::get<1>(t) << "/"
<< std::get<2>(t));
return handle;
@@ -1523,14 +1482,13 @@ DeviceUID TransportManagerImpl::Handle2GUIDConverter::HandleToUid(
conversion_table_.begin(), conversion_table_.end(), HandleFinder(handle));
if (it != conversion_table_.end()) {
- LOG4CXX_DEBUG(logger_,
- "Handle is found: " << std::get<0>(*it) << "/"
+ SDL_LOG_DEBUG("Handle is found: " << std::get<0>(*it) << "/"
<< std::get<1>(*it) << "/"
<< std::get<2>(*it));
return std::get<0>(*it);
}
- LOG4CXX_DEBUG(logger_, "Handle is not found: " << handle);
+ SDL_LOG_DEBUG("Handle is not found: " << handle);
return DeviceUID("uknown_uid");
}
diff --git a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc
index 7d7fb49e6e..7e55f1caf9 100644
--- a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc
+++ b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc
@@ -39,7 +39,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
PlatformUsbDevice::PlatformUsbDevice(
uint8_t bus_number,
@@ -56,18 +56,17 @@ PlatformUsbDevice::PlatformUsbDevice(
, libusb_device_(device_libusb) {}
std::string PlatformUsbDevice::GetDescString(uint8_t index) const {
- LOG4CXX_TRACE(logger_, "enter. index: " << int(index));
+ SDL_LOG_TRACE("enter. index: " << int(index));
unsigned char buf[128];
const int libusb_ret = libusb_get_string_descriptor_ascii(
libusb_device_handle_, index, buf, sizeof(buf));
if (libusb_ret < 0) {
- LOG4CXX_ERROR(logger_,
- "Failed to get USB string descriptor: "
- << libusb_error_name(libusb_ret));
- LOG4CXX_TRACE(logger_, "exit with empty string");
+ SDL_LOG_ERROR("Failed to get USB string descriptor: "
+ << libusb_error_name(libusb_ret));
+ SDL_LOG_TRACE("exit with empty string");
return "";
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
return std::string(reinterpret_cast<char*>(buf));
}
diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
index 4b7b22394d..fbe217f243 100644
--- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc
+++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
@@ -50,7 +50,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
UsbConnection::UsbConnection(const DeviceUID& device_uid,
const ApplicationHandle& app_handle,
@@ -79,11 +79,11 @@ UsbConnection::UsbConnection(const DeviceUID& device_uid,
, waiting_out_transfer_cancel_(false) {}
UsbConnection::~UsbConnection() {
- LOG4CXX_TRACE(logger_, "enter with this" << this);
+ SDL_LOG_TRACE("enter with this" << this);
Finalise();
libusb_free_transfer(in_transfer_);
delete[] in_buffer_;
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
// Callback for handling income and outcome data from lib_usb
@@ -96,7 +96,7 @@ void OutTransferCallback(libusb_transfer* transfer) {
}
bool UsbConnection::PostInTransfer() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
libusb_fill_bulk_transfer(in_transfer_,
device_handle_,
in_endpoint_,
@@ -107,15 +107,15 @@ bool UsbConnection::PostInTransfer() {
0);
const int libusb_ret = libusb_submit_transfer(in_transfer_);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"libusb_submit_transfer failed: " << libusb_error_name(libusb_ret));
- LOG4CXX_TRACE(
- logger_,
+ SDL_LOG_TRACE(
+
"exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_submit_transfer");
return false;
}
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
return true;
}
@@ -130,19 +130,17 @@ std::string hex_data(const unsigned char* const buffer,
}
void UsbConnection::OnInTransfer(libusb_transfer* transfer) {
- LOG4CXX_TRACE(logger_, "enter with Libusb_transfer*: " << transfer);
+ SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer);
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
- LOG4CXX_DEBUG(logger_,
- "USB incoming transfer, size:"
- << transfer->actual_length << ", data:"
- << hex_data(transfer->buffer, transfer->actual_length));
+ SDL_LOG_DEBUG("USB incoming transfer, size:"
+ << transfer->actual_length << ", data:"
+ << hex_data(transfer->buffer, transfer->actual_length));
::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage(
0, 0, in_buffer_, transfer->actual_length, false));
controller_->DataReceiveDone(device_uid_, app_handle_, data);
} else {
- LOG4CXX_ERROR(logger_,
- "USB incoming transfer failed: "
- << libusb_error_name(transfer->status));
+ SDL_LOG_ERROR("USB incoming transfer failed: "
+ << libusb_error_name(transfer->status));
controller_->DataReceiveFailed(
device_uid_, app_handle_, DataReceiveError());
}
@@ -150,17 +148,16 @@ void UsbConnection::OnInTransfer(libusb_transfer* transfer) {
waiting_in_transfer_cancel_ = false;
} else {
if (!PostInTransfer()) {
- LOG4CXX_ERROR(logger_,
- "USB incoming transfer failed with "
- << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection.");
+ SDL_LOG_ERROR("USB incoming transfer failed with "
+ << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection.");
AbortConnection();
}
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
TransportAdapter::Error UsbConnection::PopOutMessage() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
bytes_sent_ = 0;
auto error_code = TransportAdapter::OK;
if (out_messages_.empty()) {
@@ -170,18 +167,18 @@ TransportAdapter::Error UsbConnection::PopOutMessage() {
out_messages_.pop_front();
error_code = PostOutTransfer();
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
return error_code;
}
TransportAdapter::Error UsbConnection::PostOutTransfer() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
out_transfer_ = libusb_alloc_transfer(0);
if (nullptr == out_transfer_) {
- LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed");
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::BAD_STATE. Condition: nullptr "
- "== out_transfer_");
+ SDL_LOG_ERROR("libusb_alloc_transfer failed");
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::BAD_STATE. Condition: nullptr "
+ "== out_transfer_");
return TransportAdapter::BAD_STATE;
}
libusb_fill_bulk_transfer(out_transfer_,
@@ -194,36 +191,35 @@ TransportAdapter::Error UsbConnection::PostOutTransfer() {
0);
const int libusb_ret = libusb_submit_transfer(out_transfer_);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"libusb_submit_transfer failed: " << libusb_error_name(libusb_ret));
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::FAIL. Condition: "
- << "LIBUSB_SUCCESS != libusb_fill_bulk_transfer");
+ SDL_LOG_TRACE("exit with TransportAdapter::FAIL. Condition: "
+ << "LIBUSB_SUCCESS != libusb_fill_bulk_transfer");
return TransportAdapter::FAIL;
}
- LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK");
+ SDL_LOG_TRACE("exit with TransportAdapter::OK");
return TransportAdapter::OK;
}
void UsbConnection::OnOutTransfer(libusb_transfer* transfer) {
- LOG4CXX_TRACE(logger_, "enter with Libusb_transfer*: " << transfer);
+ SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer);
auto error_code = TransportAdapter::OK;
{
sync_primitives::AutoLock locker(out_messages_mutex_);
if (LIBUSB_TRANSFER_COMPLETED == transfer->status) {
bytes_sent_ += transfer->actual_length;
if (current_out_message_->data_size() == bytes_sent_) {
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"USB out transfer, data sent: " << current_out_message_.get());
controller_->DataSendDone(
device_uid_, app_handle_, current_out_message_);
error_code = PopOutMessage();
}
} else {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"USB out transfer failed: " << libusb_error_name(transfer->status));
controller_->DataSendFailed(
device_uid_, app_handle_, current_out_message_, DataSendError());
@@ -240,16 +236,15 @@ void UsbConnection::OnOutTransfer(libusb_transfer* transfer) {
AbortConnection();
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
TransportAdapter::Error UsbConnection::SendData(
::protocol_handler::RawMessagePtr message) {
- LOG4CXX_TRACE(logger_, "enter with RawMessagePtr: " << message.get());
+ SDL_LOG_TRACE("enter with RawMessagePtr: " << message.get());
if (disconnecting_) {
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::BAD_STATE. Condition: "
- << "disconnecting_");
+ SDL_LOG_TRACE("exit with TransportAdapter::BAD_STATE. Condition: "
+ << "disconnecting_");
return TransportAdapter::BAD_STATE;
}
@@ -266,7 +261,7 @@ TransportAdapter::Error UsbConnection::SendData(
auto error_code = process_message();
if (TransportAdapter::OK == error_code) {
- LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK.");
+ SDL_LOG_TRACE("exit with TransportAdapter::OK.");
return TransportAdapter::OK;
}
@@ -277,15 +272,14 @@ TransportAdapter::Error UsbConnection::SendData(
AbortConnection();
}
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::FAIL. PostOutTransfer сondition: "
- << error_code);
+ SDL_LOG_TRACE("exit with TransportAdapter::FAIL. PostOutTransfer сondition: "
+ << error_code);
return TransportAdapter::FAIL;
}
void UsbConnection::Finalise() {
- LOG4CXX_TRACE(logger_, "enter");
- LOG4CXX_DEBUG(logger_, "Finalise USB connection " << device_uid_);
+ SDL_LOG_TRACE("enter");
+ SDL_LOG_DEBUG("Finalise USB connection " << device_uid_);
{
sync_primitives::AutoLock locker(out_messages_mutex_);
disconnecting_ = true;
@@ -312,15 +306,15 @@ void UsbConnection::Finalise() {
while (waiting_in_transfer_cancel_ || waiting_out_transfer_cancel_) {
pthread_yield();
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void UsbConnection::AbortConnection() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
Finalise();
controller_->ConnectionAborted(
device_uid_, app_handle_, CommunicationError());
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
TransportAdapter::Error UsbConnection::Disconnect() {
@@ -330,10 +324,10 @@ TransportAdapter::Error UsbConnection::Disconnect() {
}
bool UsbConnection::Init() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (!FindEndpoints()) {
- LOG4CXX_ERROR(logger_, "EndPoints was not found");
- LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !FindEndpoints()");
+ SDL_LOG_ERROR("EndPoints was not found");
+ SDL_LOG_TRACE("exit with FALSE. Condition: !FindEndpoints()");
return false;
}
@@ -346,35 +340,33 @@ bool UsbConnection::Init() {
in_buffer_ = new unsigned char[in_buffer_size_];
in_transfer_ = libusb_alloc_transfer(0);
if (NULL == in_transfer_) {
- LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed");
- LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: NULL == in_transfer_");
+ SDL_LOG_ERROR("libusb_alloc_transfer failed");
+ SDL_LOG_TRACE("exit with FALSE. Condition: NULL == in_transfer_");
return false;
}
controller_->ConnectDone(device_uid_, app_handle_);
if (!PostInTransfer()) {
- LOG4CXX_ERROR(logger_, "PostInTransfer failed. Call ConnectionAborted");
+ SDL_LOG_ERROR("PostInTransfer failed. Call ConnectionAborted");
controller_->ConnectionAborted(
device_uid_, app_handle_, CommunicationError());
- LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !PostInTransfer()");
+ SDL_LOG_TRACE("exit with FALSE. Condition: !PostInTransfer()");
return false;
}
- LOG4CXX_TRACE(logger_, "exit with TRUE");
+ SDL_LOG_TRACE("exit with TRUE");
return true;
}
bool UsbConnection::FindEndpoints() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
struct libusb_config_descriptor* config;
const int libusb_ret =
libusb_get_active_config_descriptor(libusb_device_, &config);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(logger_,
- "libusb_get_active_config_descriptor failed: "
- << libusb_error_name(libusb_ret));
- LOG4CXX_TRACE(logger_,
- "exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_ret");
+ SDL_LOG_ERROR("libusb_get_active_config_descriptor failed: "
+ << libusb_error_name(libusb_ret));
+ SDL_LOG_TRACE("exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_ret");
return false;
}
@@ -406,7 +398,7 @@ bool UsbConnection::FindEndpoints() {
libusb_free_config_descriptor(config);
const bool result = !(find_in_endpoint || find_out_endpoint);
- LOG4CXX_TRACE(logger_, "exit with " << (result ? "TRUE" : "FALSE"));
+ SDL_LOG_TRACE("exit with " << (result ? "TRUE" : "FALSE"));
return result;
}
} // namespace transport_adapter
diff --git a/src/components/transport_manager/src/usb/libusb/usb_handler.cc b/src/components/transport_manager/src/usb/libusb/usb_handler.cc
index d1fc0af7f7..c8973dfcc1 100644
--- a/src/components/transport_manager/src/usb/libusb/usb_handler.cc
+++ b/src/components/transport_manager/src/usb/libusb/usb_handler.cc
@@ -46,7 +46,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
class UsbHandler::ControlTransferSequenceState {
public:
@@ -90,7 +90,7 @@ UsbHandler::UsbHandler()
UsbHandler::~UsbHandler() {
shutdown_requested_ = true;
- LOG4CXX_INFO(logger_, "UsbHandler thread finished");
+ SDL_LOG_INFO("UsbHandler thread finished");
if (libusb_context_) {
// The libusb_hotplug_deregister_callback() wakes up blocking call of
@@ -100,8 +100,8 @@ UsbHandler::~UsbHandler() {
libusb_hotplug_deregister_callback(libusb_context_, left_callback_handle_);
}
- thread_->join();
- delete thread_->delegate();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
+ delete thread_->GetDelegate();
threads::DeleteThread(thread_);
if (libusb_context_) {
@@ -111,34 +111,32 @@ UsbHandler::~UsbHandler() {
}
void UsbHandler::DeviceArrived(libusb_device* device_libusb) {
- LOG4CXX_TRACE(logger_, "enter. libusb_device* " << device_libusb);
+ SDL_LOG_TRACE("enter. libusb_device* " << device_libusb);
const uint8_t bus_number = libusb_get_bus_number(device_libusb);
const uint8_t device_address = libusb_get_device_address(device_libusb);
libusb_device_descriptor descriptor;
int libusb_ret = libusb_get_device_descriptor(device_libusb, &descriptor);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(logger_,
- "libusb_get_device_descriptor failed: " << libusb_ret);
- LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret");
+ SDL_LOG_ERROR("libusb_get_device_descriptor failed: " << libusb_ret);
+ SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret");
return;
}
libusb_device_handle* device_handle_libusb;
libusb_ret = libusb_open(device_libusb, &device_handle_libusb);
if (libusb_ret != LIBUSB_SUCCESS) {
- LOG4CXX_ERROR(logger_,
- "libusb_open failed: " << libusb_error_name(libusb_ret));
- LOG4CXX_TRACE(logger_, "exit. Condition: libusb_ret != LIBUSB_SUCCESS");
+ SDL_LOG_ERROR("libusb_open failed: " << libusb_error_name(libusb_ret));
+ SDL_LOG_TRACE("exit. Condition: libusb_ret != LIBUSB_SUCCESS");
return;
}
int configuration;
libusb_ret = libusb_get_configuration(device_handle_libusb, &configuration);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"libusb_get_configuration failed: " << libusb_error_name(libusb_ret));
- LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret");
+ SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret");
return;
}
@@ -146,21 +144,21 @@ void UsbHandler::DeviceArrived(libusb_device* device_libusb) {
libusb_ret =
libusb_set_configuration(device_handle_libusb, kUsbConfiguration);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"libusb_set_configuration failed: " << libusb_error_name(libusb_ret));
- LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret");
+ SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret");
return;
}
}
libusb_ret = libusb_claim_interface(device_handle_libusb, 0);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
+
"libusb_claim_interface failed: " << libusb_error_name(libusb_ret));
CloseDeviceHandle(device_handle_libusb);
- LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret");
+ SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret");
return;
}
@@ -177,11 +175,11 @@ void UsbHandler::DeviceArrived(libusb_device* device_libusb) {
++it) {
(*it)->OnDeviceArrived(device);
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void UsbHandler::DeviceLeft(libusb_device* device_libusb) {
- LOG4CXX_TRACE(logger_, "enter. libusb_device* " << device_libusb);
+ SDL_LOG_TRACE("enter. libusb_device* " << device_libusb);
PlatformUsbDevice* device = NULL;
for (Devices::iterator it = devices_.begin(); it != devices_.end(); ++it) {
if ((*it)->GetLibusbDevice() == device_libusb) {
@@ -190,7 +188,7 @@ void UsbHandler::DeviceLeft(libusb_device* device_libusb) {
}
}
if (NULL == device) {
- LOG4CXX_TRACE(logger_, "enter. Condition: NULL == device");
+ SDL_LOG_TRACE("enter. Condition: NULL == device");
return;
}
@@ -213,19 +211,18 @@ void UsbHandler::DeviceLeft(libusb_device* device_libusb) {
CloseDeviceHandle(device->GetLibusbHandle());
}
delete device;
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void UsbHandler::StartControlTransferSequence(
UsbControlTransferSequence* sequence, PlatformUsbDevice* device) {
- LOG4CXX_TRACE(logger_,
- "enter. UsbControlTransferSequence* "
- << sequence << "PlatformUsbDevice* " << device);
+ SDL_LOG_TRACE("enter. UsbControlTransferSequence* "
+ << sequence << "PlatformUsbDevice* " << device);
TransferSequences::iterator it = transfer_sequences_.insert(
transfer_sequences_.end(),
new ControlTransferSequenceState(this, sequence, device));
SubmitControlTransfer(*it);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void UsbHandler::CloseDeviceHandle(libusb_device_handle* device_handle) {
@@ -236,15 +233,13 @@ int ArrivedCallback(libusb_context* context,
libusb_device* device,
libusb_hotplug_event event,
void* data) {
- LOG4CXX_TRACE(logger_,
- "enter. libusb device arrived (bus number "
- << static_cast<int>(libusb_get_bus_number(device))
- << ", device address "
- << static_cast<int>(libusb_get_device_address(device))
- << ")");
+ SDL_LOG_TRACE("enter. libusb device arrived (bus number "
+ << static_cast<int>(libusb_get_bus_number(device))
+ << ", device address "
+ << static_cast<int>(libusb_get_device_address(device)) << ")");
UsbHandler* usb_handler = static_cast<UsbHandler*>(data);
usb_handler->DeviceArrived(device);
- LOG4CXX_TRACE(logger_, "exit with 0");
+ SDL_LOG_TRACE("exit with 0");
return 0;
}
@@ -252,35 +247,33 @@ int LeftCallback(libusb_context* context,
libusb_device* device,
libusb_hotplug_event event,
void* data) {
- LOG4CXX_TRACE(logger_,
- "enter libusb device left (bus number "
- << static_cast<int>(libusb_get_bus_number(device))
- << ", device address "
- << static_cast<int>(libusb_get_device_address(device))
- << ")");
+ SDL_LOG_TRACE("enter libusb device left (bus number "
+ << static_cast<int>(libusb_get_bus_number(device))
+ << ", device address "
+ << static_cast<int>(libusb_get_device_address(device)) << ")");
UsbHandler* usb_handler = static_cast<UsbHandler*>(data);
usb_handler->DeviceLeft(device);
- LOG4CXX_TRACE(logger_, "exit with 0");
+ SDL_LOG_TRACE("exit with 0");
return 0;
}
TransportAdapter::Error UsbHandler::Init() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
int libusb_ret = libusb_init(&libusb_context_);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(logger_, "libusb_init failed: " << libusb_ret);
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS "
- "!= libusb_ret");
+ SDL_LOG_ERROR("libusb_init failed: " << libusb_ret);
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS "
+ "!= libusb_ret");
return TransportAdapter::FAIL;
}
if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
- LOG4CXX_ERROR(logger_, "LIBUSB_CAP_HAS_HOTPLUG not supported");
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::FAIL. Condition: "
- "!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)");
+ SDL_LOG_ERROR("LIBUSB_CAP_HAS_HOTPLUG not supported");
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::FAIL. Condition: "
+ "!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)");
return TransportAdapter::FAIL;
}
@@ -296,11 +289,10 @@ TransportAdapter::Error UsbHandler::Init() {
&arrived_callback_handle_);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(logger_,
- "libusb_hotplug_register_callback failed: " << libusb_ret);
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS "
- "!= libusb_ret");
+ SDL_LOG_ERROR("libusb_hotplug_register_callback failed: " << libusb_ret);
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS "
+ "!= libusb_ret");
return TransportAdapter::FAIL;
}
@@ -316,25 +308,23 @@ TransportAdapter::Error UsbHandler::Init() {
&left_callback_handle_);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(logger_,
- "libusb_hotplug_register_callback failed: " << libusb_ret);
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS "
- "!= libusb_ret");
+ SDL_LOG_ERROR("libusb_hotplug_register_callback failed: " << libusb_ret);
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS "
+ "!= libusb_ret");
return TransportAdapter::FAIL;
}
- if (!thread_->start()) {
- LOG4CXX_ERROR(logger_,
- "USB device scanner thread start failed, error code");
- LOG4CXX_TRACE(logger_, "exit with TransportAdapter::FAIL.");
+ if (!thread_->Start()) {
+ SDL_LOG_ERROR("USB device scanner thread start failed, error code");
+ SDL_LOG_TRACE("exit with TransportAdapter::FAIL.");
return TransportAdapter::FAIL;
}
return TransportAdapter::OK;
}
void UsbHandler::Thread() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
int completed = 0;
while (!shutdown_requested_) {
libusb_handle_events_completed(libusb_context_, &completed);
@@ -357,33 +347,32 @@ void UsbHandler::Thread() {
libusb_close(*it);
}
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void UsbTransferSequenceCallback(libusb_transfer* transfer) {
- LOG4CXX_TRACE(logger_, "enter. libusb_transfer* " << transfer);
+ SDL_LOG_TRACE("enter. libusb_transfer* " << transfer);
UsbHandler::ControlTransferSequenceState* sequence_state =
static_cast<UsbHandler::ControlTransferSequenceState*>(
transfer->user_data);
sequence_state->usb_handler()->ControlTransferCallback(transfer);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void UsbHandler::SubmitControlTransfer(
ControlTransferSequenceState* sequence_state) {
- LOG4CXX_TRACE(logger_,
- "enter. ControlTransferSequenceState* " << sequence_state);
+ SDL_LOG_TRACE("enter. ControlTransferSequenceState* " << sequence_state);
UsbControlTransfer* transfer = sequence_state->CurrentTransfer();
if (NULL == transfer) {
- LOG4CXX_TRACE(logger_, "exit. Condition: NULL == transfer");
+ SDL_LOG_TRACE("exit. Condition: NULL == transfer");
return;
}
libusb_transfer* libusb_transfer = libusb_alloc_transfer(0);
if (0 == libusb_transfer) {
- LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed");
+ SDL_LOG_ERROR("libusb_alloc_transfer failed");
sequence_state->Finish();
- LOG4CXX_TRACE(logger_, "exit. Condition: 0 == libusb_transfer");
+ SDL_LOG_TRACE("exit. Condition: 0 == libusb_transfer");
return;
}
@@ -406,10 +395,10 @@ void UsbHandler::SubmitControlTransfer(
unsigned char* buffer =
static_cast<unsigned char*>(malloc(length + LIBUSB_CONTROL_SETUP_SIZE));
if (NULL == buffer) {
- LOG4CXX_ERROR(logger_, "buffer allocation failed");
+ SDL_LOG_ERROR("buffer allocation failed");
libusb_free_transfer(libusb_transfer);
sequence_state->Finish();
- LOG4CXX_TRACE(logger_, "exit. Condition: NULL == buffer");
+ SDL_LOG_TRACE("exit. Condition: NULL == buffer");
return;
}
@@ -430,21 +419,21 @@ void UsbHandler::SubmitControlTransfer(
const int libusb_ret = libusb_submit_transfer(libusb_transfer);
if (LIBUSB_SUCCESS != libusb_ret) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"libusb_submit_transfer failed: " << libusb_error_name(libusb_ret));
libusb_free_transfer(libusb_transfer);
sequence_state->Finish();
}
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
void UsbHandler::ControlTransferCallback(libusb_transfer* transfer) {
- LOG4CXX_TRACE(logger_, "enter. libusb_transfer* " << transfer);
+ SDL_LOG_TRACE("enter. libusb_transfer* " << transfer);
ControlTransferSequenceState* sequence_state =
static_cast<ControlTransferSequenceState*>(transfer->user_data);
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
- LOG4CXX_INFO(logger_, "USB control transfer completed");
+ SDL_LOG_INFO("USB control transfer completed");
UsbControlTransfer* current_transfer = sequence_state->CurrentTransfer();
bool submit_next = true;
if (current_transfer &&
@@ -461,11 +450,11 @@ void UsbHandler::ControlTransferCallback(libusb_transfer* transfer) {
sequence_state->Finish();
}
} else {
- LOG4CXX_ERROR(logger_, "USB control transfer failed: " << transfer->status);
+ SDL_LOG_ERROR("USB control transfer failed: " << transfer->status);
sequence_state->Finish();
}
libusb_free_transfer(transfer);
- LOG4CXX_TRACE(logger_, "exit");
+ SDL_LOG_TRACE("exit");
}
UsbHandler::ControlTransferSequenceState::ControlTransferSequenceState(
@@ -483,23 +472,22 @@ UsbHandler::ControlTransferSequenceState::~ControlTransferSequenceState() {
}
UsbControlTransfer* UsbHandler::ControlTransferSequenceState::Next() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
if (finished_) {
- LOG4CXX_TRACE(logger_, "exit with NULL. Condition: finished_");
+ SDL_LOG_TRACE("exit with NULL. Condition: finished_");
return NULL;
}
if (++current_transfer_ == sequence_->transfers().end()) {
Finish();
- LOG4CXX_TRACE(logger_,
- "exit with NULL. Condition: ++current_transfer_ == "
- "sequence_->transfers().end()");
+ SDL_LOG_TRACE(
+ "exit with NULL. Condition: ++current_transfer_ == "
+ "sequence_->transfers().end()");
return NULL;
} else {
- LOG4CXX_TRACE(logger_,
- "exit with UsbControlTransfer* "
- << *current_transfer_
- << ".Condition: ++current_transfer_ !== "
- "sequence_->transfers().end()");
+ SDL_LOG_TRACE("exit with UsbControlTransfer* "
+ << *current_transfer_
+ << ".Condition: ++current_transfer_ !== "
+ "sequence_->transfers().end()");
return *current_transfer_;
}
}
@@ -517,13 +505,13 @@ UsbHandler::UsbHandlerDelegate::UsbHandlerDelegate(UsbHandler* handler)
: handler_(handler) {}
void UsbHandler::UsbHandlerDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(handler_);
handler_->Thread();
}
void UsbHandler::UsbHandlerDelegate::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Empty method required in order to avoid force delegate thread
// finishing by exitThreadMain() of the base class
}
diff --git a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc
index bb6e341659..61d3f08b28 100644
--- a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc
+++ b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc
@@ -41,7 +41,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
PlatformUsbDevice::PlatformUsbDevice(
usbd_device_instance_t* instance,
@@ -58,7 +58,7 @@ PlatformUsbDevice::PlatformUsbDevice(
std::string PlatformUsbDevice::GetDescString(uint8_t index) const {
char* str = usbd_string(usbd_device_, index, 0);
if (NULL == str) {
- LOG4CXX_INFO(logger_, "Failed to get USB string descriptor");
+ SDL_LOG_INFO("Failed to get USB string descriptor");
return "";
}
return std::string(str);
diff --git a/src/components/transport_manager/src/usb/qnx/usb_connection.cc b/src/components/transport_manager/src/usb/qnx/usb_connection.cc
index 2945639ce9..eeaa758621 100644
--- a/src/components/transport_manager/src/usb/qnx/usb_connection.cc
+++ b/src/components/transport_manager/src/usb/qnx/usb_connection.cc
@@ -45,7 +45,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
UsbConnection::UsbConnection(const DeviceUID& device_uid,
const ApplicationHandle& app_handle,
@@ -81,13 +81,13 @@ UsbConnection::~UsbConnection() {
if (in_pipe_) {
const int close_pipe_rc = usbd_close_pipe(in_pipe_);
if (EOK != close_pipe_rc) {
- LOG4CXX_ERROR(logger_, "Failed to close pipe: " << close_pipe_rc);
+ SDL_LOG_ERROR("Failed to close pipe: " << close_pipe_rc);
}
}
if (out_pipe_) {
const int close_pipe_rc = usbd_close_pipe(out_pipe_);
if (EOK != close_pipe_rc) {
- LOG4CXX_ERROR(logger_, "Failed to close pipe: " << close_pipe_rc);
+ SDL_LOG_ERROR("Failed to close pipe: " << close_pipe_rc);
}
}
}
@@ -107,7 +107,7 @@ bool UsbConnection::PostInTransfer() {
usbd_io(in_urb_, in_pipe_, InTransferCallback, this, USBD_TIME_INFINITY);
if (EOK != io_rc) {
pending_in_transfer_ = false;
- LOG4CXX_ERROR(logger_, "Failed to post in transfer: " << io_rc);
+ SDL_LOG_ERROR("Failed to post in transfer: " << io_rc);
return false;
}
return true;
@@ -119,11 +119,10 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) {
bool error = false;
const int urb_status_rc = usbd_urb_status(urb, &status, &len);
if (EOK != urb_status_rc && EIO != urb_status_rc) { // EIO is OK
- LOG4CXX_ERROR(logger_, "Get in urb status failed: " << urb_status_rc);
+ SDL_LOG_ERROR("Get in urb status failed: " << urb_status_rc);
error = true;
}
- LOG4CXX_INFO(logger_,
- "USB in transfer, status " << std::hex << status << ", length "
+ SDL_LOG_INFO("USB in transfer, status " << std::hex << status << ", length "
<< std::dec << len);
if (!error) {
@@ -139,7 +138,7 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) {
}
if (error) {
- LOG4CXX_ERROR(logger_, "USB in transfer failed");
+ SDL_LOG_ERROR("USB in transfer failed");
controller_->DataReceiveFailed(
device_uid_, app_handle_, DataReceiveError());
} else {
@@ -173,14 +172,14 @@ bool UsbConnection::PostOutTransfer() {
out_buffer_ = usbd_alloc(len);
memmove(out_buffer_, current_out_message_->data() + bytes_sent_, len);
usbd_setup_bulk(out_urb_, URB_DIR_OUT, out_buffer_, len);
- LOG4CXX_INFO(logger_, "out transfer :" << len);
+ SDL_LOG_INFO("out transfer :" << len);
pending_out_transfer_ = true;
const int io_rc = usbd_io(
out_urb_, out_pipe_, OutTransferCallback, this, USBD_TIME_INFINITY);
if (EOK != io_rc) {
pending_out_transfer_ = false;
usbd_free(out_buffer_);
- LOG4CXX_ERROR(logger_, "Failed to post out transfer: " << io_rc);
+ SDL_LOG_ERROR("Failed to post out transfer: " << io_rc);
return false;
}
return true;
@@ -193,11 +192,10 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) {
bool error = false;
const int urb_status_rc = usbd_urb_status(urb, &status, &len);
if (EOK != urb_status_rc && EIO != urb_status_rc) { // EIO is OK
- LOG4CXX_ERROR(logger_, "Get out urb status failed: " << urb_status_rc);
+ SDL_LOG_ERROR("Get out urb status failed: " << urb_status_rc);
error = true;
}
- LOG4CXX_INFO(logger_,
- "USB out transfer, status " << std::hex << status << ", length "
+ SDL_LOG_INFO("USB out transfer, status " << std::hex << status << ", length "
<< std::dec << len);
if (!error) {
@@ -215,15 +213,14 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) {
sync_primitives::AutoLock locker(out_messages_mutex_);
if (error) {
- LOG4CXX_ERROR(logger_, "USB out transfer failed");
+ SDL_LOG_ERROR("USB out transfer failed");
controller_->DataSendFailed(
device_uid_, app_handle_, current_out_message_, DataSendError());
PopOutMessage();
} else {
bytes_sent_ += len;
if (bytes_sent_ == current_out_message_->data_size()) {
- LOG4CXX_INFO(
- logger_,
+ SDL_LOG_INFO(
"USB out transfer, data sent: " << current_out_message_.get());
controller_->DataSendDone(device_uid_, app_handle_, current_out_message_);
PopOutMessage();
@@ -256,7 +253,7 @@ TransportAdapter::Error UsbConnection::SendData(
}
void UsbConnection::Finalise() {
- LOG4CXX_INFO(logger_, "Finalising");
+ SDL_LOG_INFO("Finalising");
sync_primitives::AutoLock locker(out_messages_mutex_);
disconnecting_ = true;
usbd_abort_pipe(in_pipe_);
@@ -272,7 +269,7 @@ void UsbConnection::Finalise() {
}
TransportAdapter::Error UsbConnection::Disconnect() {
- LOG4CXX_INFO(logger_, "Disconnecting");
+ SDL_LOG_INFO("Disconnecting");
Finalise();
controller_->DisconnectDone(device_uid_, app_handle_);
return TransportAdapter::OK;
@@ -285,13 +282,13 @@ bool UsbConnection::Init() {
in_urb_ = usbd_alloc_urb(NULL);
out_urb_ = usbd_alloc_urb(NULL);
if (NULL == in_urb_ || NULL == out_urb_) {
- LOG4CXX_ERROR(logger_, "usbd_alloc_urb failed");
+ SDL_LOG_ERROR("usbd_alloc_urb failed");
return false;
}
in_buffer_ = static_cast<unsigned char*>(usbd_alloc(kInBufferSize));
if (NULL == in_buffer_) {
- LOG4CXX_ERROR(logger_, "usbd_alloc failed");
+ SDL_LOG_ERROR("usbd_alloc failed");
return false;
}
@@ -314,7 +311,7 @@ bool UsbConnection::OpenEndpoints() {
usbd_device_descriptor_t* device_desc =
usbd_device_descriptor(usbd_device_, &device_desc_node);
if (0 == device_desc) {
- LOG4CXX_ERROR(logger_, "Device descriptor not found");
+ SDL_LOG_ERROR("Device descriptor not found");
return false;
}
usbd_desc_node* cfg_desc_node = NULL;
@@ -331,8 +328,7 @@ bool UsbConnection::OpenEndpoints() {
if (config_desc == NULL) {
break;
}
- LOG4CXX_INFO(logger_,
- "USB configuration " << static_cast<int>(
+ SDL_LOG_INFO("USB configuration " << static_cast<int>(
config_desc->configuration.bConfigurationValue));
int iface = 0;
usbd_desc_node* iface_desc_node;
@@ -350,11 +346,10 @@ bool UsbConnection::OpenEndpoints() {
#endif
const uint8_t interface_subclass =
iface_desc->interface.bInterfaceSubClass;
- LOG4CXX_INFO(logger_,
- "USB interface number "
- << static_cast<int>(interface_number) << ", subclass "
- << std::hex << static_cast<int>(interface_subclass)
- << std::dec);
+ SDL_LOG_INFO("USB interface number "
+ << static_cast<int>(interface_number) << ", subclass "
+ << std::hex << static_cast<int>(interface_subclass)
+ << std::dec);
if (interface_subclass != 0xff) {
continue;
}
@@ -370,10 +365,9 @@ bool UsbConnection::OpenEndpoints() {
if ((attributes & 0x03) == USB_ATTRIB_BULK) {
const uint8_t endpoint_address =
endpoint_desc->endpoint.bEndpointAddress;
- LOG4CXX_INFO(logger_,
- "Endpoint with address "
- << std::hex << static_cast<int>(endpoint_address)
- << std::dec << " found");
+ SDL_LOG_INFO("Endpoint with address "
+ << std::hex << static_cast<int>(endpoint_address)
+ << std::dec << " found");
if (endpoint_address & USB_ENDPOINT_IN) {
if (NULL == in_endpoint_desc) {
in_endpoint_desc = endpoint_desc;
@@ -396,13 +390,13 @@ bool UsbConnection::OpenEndpoints() {
int open_pipe_rc = usbd_open_pipe(usbd_device_, in_endpoint_desc, &in_pipe_);
if (EOK != open_pipe_rc) {
- LOG4CXX_ERROR(logger_, "Cannot open input pipe, error " << open_pipe_rc);
+ SDL_LOG_ERROR("Cannot open input pipe, error " << open_pipe_rc);
return false;
}
open_pipe_rc = usbd_open_pipe(usbd_device_, out_endpoint_desc, &out_pipe_);
if (EOK != open_pipe_rc) {
- LOG4CXX_ERROR(logger_, "Cannot open output pipe, error " << open_pipe_rc);
+ SDL_LOG_ERROR("Cannot open output pipe, error " << open_pipe_rc);
return false;
}
diff --git a/src/components/transport_manager/src/usb/qnx/usb_handler.cc b/src/components/transport_manager/src/usb/qnx/usb_handler.cc
index 9ac4a40d92..441fc8b664 100644
--- a/src/components/transport_manager/src/usb/qnx/usb_handler.cc
+++ b/src/components/transport_manager/src/usb/qnx/usb_handler.cc
@@ -46,7 +46,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
namespace {
UsbHandler* usb_handler;
@@ -65,15 +65,13 @@ UsbHandler::~UsbHandler() {
if (usbd_general_connection_) {
const int disconnect_rc = usbd_disconnect(usbd_general_connection_);
if (EOK != disconnect_rc) {
- LOG4CXX_ERROR(logger_,
- "usbd_disconnect failed, error code " << disconnect_rc);
+ SDL_LOG_ERROR("usbd_disconnect failed, error code " << disconnect_rc);
}
}
if (usbd_aoa_connection_) {
const int disconnect_rc = usbd_disconnect(usbd_aoa_connection_);
if (EOK != disconnect_rc) {
- LOG4CXX_ERROR(logger_,
- "usbd_disconnect failed, error code " << disconnect_rc);
+ SDL_LOG_ERROR("usbd_disconnect failed, error code " << disconnect_rc);
}
}
}
@@ -93,7 +91,7 @@ void UsbHandler::DeviceArrived(usbd_connection* connection,
usbd_device* device_usbd = 0;
const int attach_rc = usbd_attach(connection, instance, 0, &device_usbd);
if (EOK != attach_rc) {
- LOG4CXX_ERROR(logger_, "usbd_attach failed: " << attach_rc);
+ SDL_LOG_ERROR("usbd_attach failed: " << attach_rc);
return;
}
@@ -101,7 +99,7 @@ void UsbHandler::DeviceArrived(usbd_connection* connection,
usbd_device_descriptor_t* descriptor =
usbd_device_descriptor(device_usbd, &node);
if (NULL == descriptor) {
- LOG4CXX_ERROR(logger_, "usbd_device_descriptor failed");
+ SDL_LOG_ERROR("usbd_device_descriptor failed");
return;
}
@@ -139,7 +137,7 @@ void UsbHandler::DeviceLeft(usbd_device_instance_t* instance) {
if ((*it)->GetDeviceInstance() == *instance) {
const int detach_rc = usbd_detach((*it)->GetUsbdDevice());
if (EOK != detach_rc)
- LOG4CXX_ERROR(logger_, "usbd_detach failed: " << detach_rc);
+ SDL_LOG_ERROR("usbd_detach failed: " << detach_rc);
devices_.erase(it);
break;
}
@@ -153,14 +151,14 @@ void UsbHandler::StartControlTransferSequence(
usbd_descriptors_t* descriptor = usbd_parse_descriptors(
device->GetUsbdDevice(), NULL, USB_DESC_DEVICE, 0, NULL);
if (NULL == descriptor) {
- LOG4CXX_ERROR(logger_, "usbd_parse_descriptors failed");
+ SDL_LOG_ERROR("usbd_parse_descriptors failed");
}
usbd_pipe* usb_pipe = 0;
const int open_pipe_rc =
usbd_open_pipe(device->GetUsbdDevice(), descriptor, &usb_pipe);
if (EOK != open_pipe_rc) {
- LOG4CXX_ERROR(logger_, "usbd_open_pipe failed, error " << open_pipe_rc);
+ SDL_LOG_ERROR("usbd_open_pipe failed, error " << open_pipe_rc);
return;
}
@@ -172,14 +170,14 @@ void UsbHandler::StartControlTransferSequence(
usbd_urb* urb = usbd_alloc_urb(NULL);
if (NULL == urb) {
- LOG4CXX_ERROR(logger_, "usbd_alloc_urb failed");
+ SDL_LOG_ERROR("usbd_alloc_urb failed");
break;
}
unsigned char* buf =
static_cast<unsigned char*>(usbd_alloc(transfer->Length()));
if (NULL == buf) {
- LOG4CXX_ERROR(logger_, "usbd_alloc failed");
+ SDL_LOG_ERROR("usbd_alloc failed");
break;
}
@@ -216,7 +214,7 @@ void UsbHandler::StartControlTransferSequence(
static_cast<UsbControlInTransfer*>(transfer)->OnCompleted(buf);
}
} else {
- LOG4CXX_ERROR(logger_, "usbd_io failed, error " << io_rc);
+ SDL_LOG_ERROR("usbd_io failed, error " << io_rc);
submit_next = false;
}
usbd_free(buf);
@@ -233,12 +231,11 @@ void ArrivedCallback(usbd_connection* connection,
usbd_device_instance_t* instance) {
if (kAoaVid == instance->ident.vendor)
return;
- LOG4CXX_INFO(logger_,
- "USB device arrived (path "
- << static_cast<int>(instance->path) << ", devno "
- << static_cast<int>(instance->devno) << ", config "
- << static_cast<int>(instance->config) << ", iface "
- << static_cast<int>(instance->iface) << ")");
+ SDL_LOG_INFO("USB device arrived (path "
+ << static_cast<int>(instance->path) << ", devno "
+ << static_cast<int>(instance->devno) << ", config "
+ << static_cast<int>(instance->config) << ", iface "
+ << static_cast<int>(instance->iface) << ")");
usb_handler->DeviceArrived(connection, instance);
}
@@ -246,12 +243,11 @@ void ArrivedAoaCallback(usbd_connection* connection,
usbd_device_instance_t* instance) {
if (kAoaVid != instance->ident.vendor)
return;
- LOG4CXX_INFO(logger_,
- "USB AOA device arrived (path "
- << static_cast<int>(instance->path) << ", devno "
- << static_cast<int>(instance->devno) << ", config "
- << static_cast<int>(instance->config) << ", iface "
- << static_cast<int>(instance->iface) << ")");
+ SDL_LOG_INFO("USB AOA device arrived (path "
+ << static_cast<int>(instance->path) << ", devno "
+ << static_cast<int>(instance->devno) << ", config "
+ << static_cast<int>(instance->config) << ", iface "
+ << static_cast<int>(instance->iface) << ")");
usb_handler->DeviceArrived(connection, instance);
}
@@ -259,12 +255,11 @@ void LeftCallback(usbd_connection* connection,
usbd_device_instance_t* instance) {
if (kAoaVid == instance->ident.vendor)
return;
- LOG4CXX_INFO(logger_,
- "USB device left (path "
- << static_cast<int>(instance->path) << ", devno "
- << static_cast<int>(instance->devno) << ", config "
- << static_cast<int>(instance->config) << ", iface "
- << static_cast<int>(instance->iface) << ")");
+ SDL_LOG_INFO("USB device left (path "
+ << static_cast<int>(instance->path) << ", devno "
+ << static_cast<int>(instance->devno) << ", config "
+ << static_cast<int>(instance->config) << ", iface "
+ << static_cast<int>(instance->iface) << ")");
usb_handler->DeviceLeft(instance);
}
@@ -272,12 +267,11 @@ void LeftAoaCallback(usbd_connection* connection,
usbd_device_instance_t* instance) {
if (kAoaVid != instance->ident.vendor)
return;
- LOG4CXX_INFO(logger_,
- "USB AOA device left (path "
- << static_cast<int>(instance->path) << ", devno "
- << static_cast<int>(instance->devno) << ", config "
- << static_cast<int>(instance->config) << ", iface "
- << static_cast<int>(instance->iface) << ")");
+ SDL_LOG_INFO("USB AOA device left (path "
+ << static_cast<int>(instance->path) << ", devno "
+ << static_cast<int>(instance->devno) << ", config "
+ << static_cast<int>(instance->config) << ", iface "
+ << static_cast<int>(instance->iface) << ")");
usb_handler->DeviceLeft(instance);
}
@@ -295,7 +289,7 @@ TransportAdapter::Error UsbHandler::Init() {
const int connect_rc = usbd_connect(&cparms, &usbd_general_connection_);
if (EOK != connect_rc) {
- LOG4CXX_ERROR(logger_, "usbd_connect failed, error code " << connect_rc);
+ SDL_LOG_ERROR("usbd_connect failed, error code " << connect_rc);
return TransportAdapter::FAIL;
}
}
@@ -313,7 +307,7 @@ TransportAdapter::Error UsbHandler::Init() {
const int connect_rc = usbd_connect(&cparms, &usbd_aoa_connection_);
if (EOK != connect_rc) {
- LOG4CXX_ERROR(logger_, "usbd_connect failed, error code " << connect_rc);
+ SDL_LOG_ERROR("usbd_connect failed, error code " << connect_rc);
return TransportAdapter::FAIL;
}
}
diff --git a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc
index 9ce571eb6c..a80ce341fa 100644
--- a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc
+++ b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc
@@ -42,7 +42,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
UsbAoaAdapter::UsbAoaAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings)
: TransportAdapterImpl(new UsbDeviceScanner(this, settings),
@@ -68,23 +68,21 @@ bool UsbAoaAdapter::IsInitialised() const {
}
TransportAdapter::Error UsbAoaAdapter::Init() {
- LOG4CXX_TRACE(logger_, "enter");
+ SDL_LOG_TRACE("enter");
TransportAdapter::Error error = usb_handler_->Init();
if (error != TransportAdapter::OK) {
- LOG4CXX_TRACE(logger_,
- "exit with error "
- << error << ". Condition: error != TransportAdapter::OK");
+ SDL_LOG_TRACE("exit with error "
+ << error << ". Condition: error != TransportAdapter::OK");
return error;
}
error = TransportAdapterImpl::Init();
if (error != TransportAdapter::OK) {
- LOG4CXX_TRACE(logger_,
- "exit with error "
- << error << ". Condition: error != TransportAdapter::OK");
+ SDL_LOG_TRACE("exit with error "
+ << error << ". Condition: error != TransportAdapter::OK");
return error;
}
is_initialised_ = true;
- LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK");
+ SDL_LOG_TRACE("exit with TransportAdapter::OK");
return TransportAdapter::OK;
}
diff --git a/src/components/transport_manager/src/usb/usb_connection_factory.cc b/src/components/transport_manager/src/usb/usb_connection_factory.cc
index 401dde2534..bf1635bd64 100644
--- a/src/components/transport_manager/src/usb/usb_connection_factory.cc
+++ b/src/components/transport_manager/src/usb/usb_connection_factory.cc
@@ -44,7 +44,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
UsbConnectionFactory::UsbConnectionFactory(
TransportAdapterController* controller)
@@ -60,15 +60,14 @@ void UsbConnectionFactory::SetUsbHandler(const UsbHandlerSptr usb_handler) {
TransportAdapter::Error UsbConnectionFactory::CreateConnection(
const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(logger_,
- "enter DeviceUID: " << &device_uid
+ SDL_LOG_TRACE("enter DeviceUID: " << &device_uid
<< ", ApplicationHandle: " << &app_handle);
DeviceSptr device = controller_->FindDevice(device_uid);
if (device.use_count() == 0) {
- LOG4CXX_ERROR(logger_, "device " << device_uid << " not found");
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::BAD_PARAM. Condition: "
- "device.use_count() == 0");
+ SDL_LOG_ERROR("device " << device_uid << " not found");
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::BAD_PARAM. Condition: "
+ "device.use_count() == 0");
return TransportAdapter::BAD_PARAM;
}
@@ -81,15 +80,15 @@ TransportAdapter::Error UsbConnectionFactory::CreateConnection(
usb_device->usb_device());
controller_->ConnectionCreated(connection, device_uid, app_handle);
if (connection->Init()) {
- LOG4CXX_INFO(logger_, "USB connection initialised");
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::OK. Condition: USB connection "
- "initialised");
+ SDL_LOG_INFO("USB connection initialised");
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::OK. Condition: USB connection "
+ "initialised");
return TransportAdapter::OK;
} else {
- LOG4CXX_TRACE(logger_,
- "exit with TransportAdapter::FAIL. Condition: USB connection "
- "NOT initialised");
+ SDL_LOG_TRACE(
+ "exit with TransportAdapter::FAIL. Condition: USB connection "
+ "NOT initialised");
return TransportAdapter::FAIL;
}
}
diff --git a/src/components/transport_manager/src/usb/usb_device_scanner.cc b/src/components/transport_manager/src/usb/usb_device_scanner.cc
index 51d521c1bf..b0749728a6 100644
--- a/src/components/transport_manager/src/usb/usb_device_scanner.cc
+++ b/src/components/transport_manager/src/usb/usb_device_scanner.cc
@@ -42,7 +42,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
class AoaInitSequence : public UsbControlTransferSequence {
public:
@@ -57,7 +57,7 @@ class AoaInitSequence : public UsbControlTransferSequence {
};
void UsbDeviceScanner::OnDeviceArrived(PlatformUsbDevice* device) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (IsAppleDevice(device)) {
SupportedDeviceFound(device);
} else {
@@ -70,8 +70,8 @@ void UsbDeviceScanner::OnDeviceArrived(PlatformUsbDevice* device) {
}
void UsbDeviceScanner::OnDeviceLeft(PlatformUsbDevice* device) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "PlatformUsbDevice " << device);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("PlatformUsbDevice " << device);
bool list_changed = false;
devices_mutex_.Acquire();
for (Devices::iterator it = devices_.begin(); it != devices_.end(); ++it) {
@@ -112,7 +112,7 @@ class AoaInitSequence::AoaGetProtocolRequest : public UsbControlInTransfer {
}
virtual bool OnCompleted(unsigned char* data) const {
const int protocol_version = data[1] << 8 | data[0];
- LOG4CXX_DEBUG(logger_, "AOA protocol version " << protocol_version);
+ SDL_LOG_DEBUG("AOA protocol version " << protocol_version);
if (protocol_version == 0) {
// AOA protocol not supported
return false;
@@ -192,26 +192,24 @@ AoaInitSequence::AoaInitSequence(const TransportManagerSettings& settings)
}
void UsbDeviceScanner::TurnIntoAccessoryMode(PlatformUsbDevice* device) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "PlatformUsbDevice: " << device);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("PlatformUsbDevice: " << device);
GetUsbHandler()->StartControlTransferSequence(new AoaInitSequence(settings_),
device);
}
void UsbDeviceScanner::SupportedDeviceFound(PlatformUsbDevice* device) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_TRACE(logger_, "PlatformUsbDevice: " << device);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_TRACE("PlatformUsbDevice: " << device);
devices_mutex_.Acquire();
devices_.push_back(device);
devices_mutex_.Release();
- LOG4CXX_DEBUG(logger_,
- "USB device (bus number "
- << static_cast<int>(device->bus_number()) << ", address "
- << static_cast<int>(device->address())
- << ") identified as: " << device->GetManufacturer() << ", "
- << device->GetProductName()
- << ", serial: " << device->GetSerialNumber());
+ SDL_LOG_DEBUG("USB device (bus number "
+ << static_cast<int>(device->bus_number()) << ", address "
+ << static_cast<int>(device->address()) << ") identified as: "
+ << device->GetManufacturer() << ", " << device->GetProductName()
+ << ", serial: " << device->GetSerialNumber());
UpdateList();
}
@@ -224,7 +222,7 @@ TransportAdapter::Error UsbDeviceScanner::Scan() {
}
void UsbDeviceScanner::UpdateList() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DeviceVector device_vector;
devices_mutex_.Acquire();
for (Devices::const_iterator it = devices_.begin(); it != devices_.end();
@@ -240,7 +238,7 @@ void UsbDeviceScanner::UpdateList() {
}
devices_mutex_.Release();
- LOG4CXX_DEBUG(logger_, "USB search done " << device_vector.size());
+ SDL_LOG_DEBUG("USB search done " << device_vector.size());
controller_->SearchDeviceDone(device_vector);
}
diff --git a/src/components/transport_manager/src/websocket_server/websocket_connection.cc b/src/components/transport_manager/src/websocket_server/websocket_connection.cc
index 7bcc4baef2..d10d456ca4 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_connection.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_connection.cc
@@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(wsc_logger_, "WebSocketConnection")
+SDL_CREATE_LOG_VARIABLE("WebSocketConnection")
using namespace boost::beast::websocket;
@@ -49,19 +49,17 @@ WebSocketConnection<WebSocketSession<> >::WebSocketConnection(
, app_handle_(app_handle)
, session_(new WebSocketSession<>(
std::move(socket),
- std::bind(
- &WebSocketConnection::DataReceive, this, std::placeholders::_1),
- std::bind(&WebSocketConnection::OnError, this)))
+ [this](Message frame) { DataReceive(frame); },
+ [this](Message frame) { DataSendDone(frame); },
+ [this](Message frame) { DataSendFailed(frame); },
+ [this]() { OnError(); }))
, controller_(controller)
, shutdown_(false)
, thread_delegate_(new LoopThreadDelegate(
&message_queue_,
- std::bind(&WebSocketSession<>::WriteDown,
- session_.get(),
- std::placeholders::_1),
- std::bind(&WebSocketConnection::OnError, this)))
+ [this](Message frame) { session_->WriteDown(frame); }))
, thread_(threads::CreateThread("WS Async Send", thread_delegate_)) {
- thread_->start(threads::ThreadOptions());
+ thread_->Start(threads::ThreadOptions());
}
#ifdef ENABLE_SECURITY
@@ -77,19 +75,17 @@ WebSocketConnection<WebSocketSecureSession<> >::WebSocketConnection(
, session_(new WebSocketSecureSession<>(
std::move(socket),
ctx,
- std::bind(
- &WebSocketConnection::DataReceive, this, std::placeholders::_1),
- std::bind(&WebSocketConnection::OnError, this)))
+ [this](Message frame) { DataReceive(frame); },
+ [this](Message frame) { DataSendDone(frame); },
+ [this](Message frame) { DataSendFailed(frame); },
+ [this]() { OnError(); }))
, controller_(controller)
, shutdown_(false)
, thread_delegate_(new LoopThreadDelegate(
&message_queue_,
- std::bind(&WebSocketSecureSession<>::WriteDown,
- session_.get(),
- std::placeholders::_1),
- std::bind(&WebSocketConnection::OnError, this)))
+ [this](Message frame) { session_->WriteDown(frame); }))
, thread_(threads::CreateThread("WS Async Send", thread_delegate_)) {
- thread_->start(threads::ThreadOptions());
+ thread_->Start(threads::ThreadOptions());
}
template class WebSocketConnection<WebSocketSecureSession<> >;
#endif // ENABLE_SECURITY
@@ -103,7 +99,17 @@ WebSocketConnection<Session>::~WebSocketConnection() {
template <typename Session>
void WebSocketConnection<Session>::OnError() {
- LOG4CXX_AUTO_TRACE(wsc_logger_);
+ SDL_LOG_AUTO_TRACE();
+
+ if (IsShuttingDown()) {
+ SDL_LOG_DEBUG("Session is shutting down...");
+ return;
+ }
+
+ Message message_ptr;
+ while (message_queue_.pop(message_ptr)) {
+ DataSendFailed(message_ptr);
+ }
controller_->ConnectionAborted(
device_uid_, app_handle_, CommunicationError());
@@ -113,7 +119,7 @@ void WebSocketConnection<Session>::OnError() {
template <typename Session>
TransportAdapter::Error WebSocketConnection<Session>::Disconnect() {
- LOG4CXX_AUTO_TRACE(wsc_logger_);
+ SDL_LOG_AUTO_TRACE();
if (!IsShuttingDown()) {
Shutdown();
controller_->DisconnectDone(device_uid_, app_handle_);
@@ -124,7 +130,7 @@ TransportAdapter::Error WebSocketConnection<Session>::Disconnect() {
template <typename Session>
TransportAdapter::Error WebSocketConnection<Session>::SendData(
- ::protocol_handler::RawMessagePtr message) {
+ Message message) {
if (IsShuttingDown()) {
return TransportAdapter::BAD_STATE;
}
@@ -135,25 +141,34 @@ TransportAdapter::Error WebSocketConnection<Session>::SendData(
}
template <typename Session>
-void WebSocketConnection<Session>::DataReceive(
- protocol_handler::RawMessagePtr frame) {
+void WebSocketConnection<Session>::DataReceive(Message frame) {
controller_->DataReceiveDone(device_uid_, app_handle_, frame);
}
template <typename Session>
+void WebSocketConnection<Session>::DataSendDone(Message frame) {
+ controller_->DataSendDone(device_uid_, app_handle_, frame);
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::DataSendFailed(Message frame) {
+ controller_->DataSendFailed(device_uid_, app_handle_, frame, DataSendError());
+}
+
+template <typename Session>
void WebSocketConnection<Session>::Run() {
- LOG4CXX_AUTO_TRACE(wsc_logger_);
+ SDL_LOG_AUTO_TRACE();
session_->AsyncAccept();
}
template <typename Session>
void WebSocketConnection<Session>::Shutdown() {
- LOG4CXX_AUTO_TRACE(wsc_logger_);
+ SDL_LOG_AUTO_TRACE();
shutdown_ = true;
if (thread_delegate_) {
session_->Shutdown();
thread_delegate_->SetShutdown();
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
delete thread_delegate_;
thread_delegate_ = nullptr;
threads::DeleteThread(thread_);
@@ -169,11 +184,8 @@ bool WebSocketConnection<Session>::IsShuttingDown() {
template <typename Session>
WebSocketConnection<Session>::LoopThreadDelegate::LoopThreadDelegate(
MessageQueue<Message, AsyncQueue>* message_queue,
- DataWriteCallback data_write,
- OnIOErrorCallback on_io_error)
- : message_queue_(*message_queue)
- , data_write_(data_write)
- , on_io_error_(on_io_error) {}
+ DataWriteCallback data_write)
+ : message_queue_(*message_queue), data_write_(data_write) {}
template <typename Session>
void WebSocketConnection<Session>::LoopThreadDelegate::threadMain() {
@@ -186,22 +198,14 @@ void WebSocketConnection<Session>::LoopThreadDelegate::threadMain() {
template <typename Session>
void WebSocketConnection<Session>::LoopThreadDelegate::exitThreadMain() {
- if (!message_queue_.IsShuttingDown()) {
- message_queue_.Shutdown();
- }
+ SetShutdown();
}
template <typename Session>
void WebSocketConnection<Session>::LoopThreadDelegate::DrainQueue() {
Message message_ptr;
while (!message_queue_.IsShuttingDown() && message_queue_.pop(message_ptr)) {
- auto res = data_write_(message_ptr);
- if (TransportAdapter::FAIL == res) {
- LOG4CXX_WARN(wsc_logger_,
- "Writing to websocket stream failed. Will now close "
- "websocket connection.");
- on_io_error_();
- }
+ data_write_(message_ptr);
}
}
diff --git a/src/components/transport_manager/src/websocket_server/websocket_device.cc b/src/components/transport_manager/src/websocket_server/websocket_device.cc
index 502daf349b..401c242caf 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_device.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_device.cc
@@ -37,7 +37,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+SDL_CREATE_LOG_VARIABLE("TransportManager")
WebSocketDevice::WebSocketDevice(const std::string& name,
const DeviceUID& unique_device_id)
@@ -46,7 +46,7 @@ WebSocketDevice::WebSocketDevice(const std::string& name,
, protocol_(boost::asio::ip::tcp::v4()) {}
bool WebSocketDevice::IsSameAs(const Device* other) const {
- LOG4CXX_TRACE(logger_, "enter. device: " << other);
+ SDL_LOG_TRACE("enter. device: " << other);
const WebSocketDevice* other_websocket_device =
dynamic_cast<const WebSocketDevice*>(other);
diff --git a/src/components/transport_manager/src/websocket_server/websocket_listener.cc b/src/components/transport_manager/src/websocket_server/websocket_listener.cc
index 87fff3acbc..fed29fbfb4 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_listener.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_listener.cc
@@ -5,7 +5,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "WebSocketListener")
+SDL_CREATE_LOG_VARIABLE("WebSocketListener")
WebSocketListener::WebSocketListener(TransportAdapterController* controller,
const TransportManagerSettings& settings,
@@ -29,7 +29,7 @@ WebSocketListener::~WebSocketListener() {
}
TransportAdapter::Error WebSocketListener::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto old_shutdown_value = shutdown_.exchange(false);
if (old_shutdown_value) {
ioc_.restart();
@@ -39,12 +39,12 @@ TransportAdapter::Error WebSocketListener::Init() {
}
void WebSocketListener::Terminate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
Shutdown();
}
TransportAdapter::Error WebSocketListener::StartListening() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (acceptor_.is_open()) {
return TransportAdapter::OK;
}
@@ -65,8 +65,7 @@ TransportAdapter::Error WebSocketListener::StartListening() {
acceptor_.open(endpoint.protocol(), ec);
if (ec) {
auto str_err = "ErrorOpen: " + ec.message();
- LOG4CXX_ERROR(logger_,
- str_err << " host/port: " << endpoint.address().to_string()
+ SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string()
<< "/" << endpoint.port());
return TransportAdapter::FAIL;
}
@@ -74,8 +73,7 @@ TransportAdapter::Error WebSocketListener::StartListening() {
acceptor_.set_option(boost::asio::socket_base::reuse_address(true), ec);
if (ec) {
std::string str_err = "ErrorSetOption: " + ec.message();
- LOG4CXX_ERROR(logger_,
- str_err << " host/port: " << endpoint.address().to_string()
+ SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string()
<< "/" << endpoint.port());
return TransportAdapter::FAIL;
}
@@ -84,8 +82,7 @@ TransportAdapter::Error WebSocketListener::StartListening() {
acceptor_.bind(endpoint, ec);
if (ec) {
std::string str_err = "ErrorBind: " + ec.message();
- LOG4CXX_ERROR(logger_,
- str_err << " host/port: " << endpoint.address().to_string()
+ SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string()
<< "/" << endpoint.port());
return TransportAdapter::FAIL;
}
@@ -94,8 +91,7 @@ TransportAdapter::Error WebSocketListener::StartListening() {
acceptor_.listen(boost::asio::socket_base::max_listen_connections, ec);
if (ec) {
std::string str_err = "ErrorListen: " + ec.message();
- LOG4CXX_ERROR(logger_,
- str_err << " host/port: " << endpoint.address().to_string()
+ SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string()
<< "/" << endpoint.port());
return TransportAdapter::FAIL;
}
@@ -109,20 +105,20 @@ TransportAdapter::Error WebSocketListener::StartListening() {
#ifdef ENABLE_SECURITY
TransportAdapter::Error WebSocketListener::AddCertificateAuthority() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const auto cert_path = settings_.ws_server_cert_path();
- LOG4CXX_DEBUG(logger_, "Path to certificate : " << cert_path);
+ SDL_LOG_DEBUG("Path to certificate : " << cert_path);
const auto key_path = settings_.ws_server_key_path();
- LOG4CXX_DEBUG(logger_, "Path to key : " << key_path);
+ SDL_LOG_DEBUG("Path to key : " << key_path);
const auto ca_cert_path = settings_.ws_server_ca_cert_path();
- LOG4CXX_DEBUG(logger_, "Path to ca cert : " << ca_cert_path);
+ SDL_LOG_DEBUG("Path to ca cert : " << ca_cert_path);
start_secure_ = settings_.wss_server_supported();
if (start_secure_ && (!file_system::FileExists(cert_path) ||
!file_system::FileExists(key_path) ||
!file_system::FileExists(ca_cert_path))) {
- LOG4CXX_ERROR(logger_, "Certificate or key file not found");
+ SDL_LOG_ERROR("Certificate or key file not found");
return TransportAdapter::FAIL;
}
@@ -131,12 +127,11 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() {
const std::string config_name) {
bool start_unsecure = config.empty();
if (!start_unsecure) {
- LOG4CXX_ERROR(logger_,
- "Configuration for secure WS is incomplete. "
- << config_name
- << " config is "
- "present, meanwhile others may be missing. Please "
- "check INI file");
+ SDL_LOG_ERROR("Configuration for secure WS is incomplete. "
+ << config_name
+ << " config is "
+ "present, meanwhile others may be missing. Please "
+ "check INI file");
}
return start_unsecure;
};
@@ -146,7 +141,7 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() {
return TransportAdapter::FAIL;
}
} else {
- LOG4CXX_INFO(logger_, "WebSocket server will start secure connection");
+ SDL_LOG_INFO("WebSocket server will start secure connection");
ctx_.add_verify_path(cert_path);
ctx_.set_options(boost::asio::ssl::context::default_workarounds);
using context = boost::asio::ssl::context_base;
@@ -155,16 +150,14 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() {
ctx_.use_certificate_chain_file(cert_path, sec_ec);
ctx_.load_verify_file(ca_cert_path);
if (sec_ec) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Loading WS server certificate failed: " << sec_ec.message());
return TransportAdapter::FAIL;
}
sec_ec.clear();
ctx_.use_private_key_file(key_path, context::pem, sec_ec);
if (sec_ec) {
- LOG4CXX_ERROR(logger_,
- "Loading WS server key failed: " << sec_ec.message());
+ SDL_LOG_ERROR("Loading WS server key failed: " << sec_ec.message());
return TransportAdapter::FAIL;
}
}
@@ -174,19 +167,19 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() {
#endif // ENABLE_SECURITY
bool WebSocketListener::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool is_connection_open = WaitForConnection();
if (is_connection_open) {
boost::asio::post(*io_pool_.get(), [&]() { ioc_.run(); });
} else {
- LOG4CXX_ERROR(logger_, "Connection is shutdown or acceptor isn't open");
+ SDL_LOG_ERROR("Connection is shutdown or acceptor isn't open");
}
return is_connection_open;
}
bool WebSocketListener::WaitForConnection() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!shutdown_ && acceptor_.is_open()) {
acceptor_.async_accept(
socket_,
@@ -202,7 +195,7 @@ void WebSocketListener::ProcessConnection(
std::shared_ptr<WebSocketConnection<WebSocketSession<> > > connection,
const DeviceSptr device,
const ApplicationHandle app_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
controller_->ConnectionCreated(
connection, device->unique_device_id(), app_handle);
@@ -223,7 +216,7 @@ void WebSocketListener::ProcessConnection(
std::shared_ptr<WebSocketConnection<WebSocketSecureSession<> > > connection,
const DeviceSptr device,
const ApplicationHandle app_handle) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
controller_->ConnectionCreated(
connection, device->unique_device_id(), app_handle);
@@ -240,10 +233,10 @@ void WebSocketListener::ProcessConnection(
#endif // ENABLE_SECURITY
void WebSocketListener::StartSession(boost::system::error_code ec) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (ec) {
std::string str_err = "ErrorAccept: " + ec.message();
- LOG4CXX_ERROR(logger_, str_err);
+ SDL_LOG_ERROR(str_err);
return;
}
@@ -257,7 +250,7 @@ void WebSocketListener::StartSession(boost::system::error_code ec) {
std::static_pointer_cast<WebSocketDevice>(
controller_->GetWebEngineDevice());
- LOG4CXX_INFO(logger_, "Connected client: " << app_handle);
+ SDL_LOG_INFO("Connected client: " << app_handle);
#ifdef ENABLE_SECURITY
if (start_secure_) {
@@ -279,7 +272,7 @@ void WebSocketListener::StartSession(boost::system::error_code ec) {
}
void WebSocketListener::Shutdown() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (false == shutdown_.exchange(true)) {
ioc_.stop();
socket_.close();
@@ -287,7 +280,7 @@ void WebSocketListener::Shutdown() {
acceptor_.close(ec);
if (ec) {
- LOG4CXX_ERROR(logger_, "Acceptor closed with error: " << ec);
+ SDL_LOG_ERROR("Acceptor closed with error: " << ec);
}
io_pool_->stop();
diff --git a/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
index 9be94119b6..a533bdcffc 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
@@ -35,6 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace transport_manager {
namespace transport_adapter {
+SDL_CREATE_LOG_VARIABLE("WebSocketSecureSession")
+
using namespace boost::beast::websocket;
template <typename ExecutorType>
@@ -42,13 +44,19 @@ WebSocketSecureSession<ExecutorType>::WebSocketSecureSession(
tcp::socket socket,
ssl::context& ctx,
DataReceiveCallback data_receive,
+ DataSendDoneCallback data_send_done,
+ DataSendFailedCallback data_send_failed,
OnIOErrorCallback on_error)
- : WebSocketSession<ExecutorType>(
- std::move(socket), ctx, data_receive, on_error) {}
+ : WebSocketSession<ExecutorType>(std::move(socket),
+ ctx,
+ data_receive,
+ data_send_done,
+ data_send_failed,
+ on_error) {}
template <typename ExecutorType>
void WebSocketSecureSession<ExecutorType>::AsyncAccept() {
- LOG4CXX_AUTO_TRACE(ws_logger_);
+ SDL_LOG_AUTO_TRACE();
// Perform the SSL handshake
WebSocketSecureSession<ExecutorType>::ws_.next_layer().async_handshake(
ssl::stream_base::server,
@@ -62,10 +70,10 @@ void WebSocketSecureSession<ExecutorType>::AsyncAccept() {
template <typename ExecutorType>
void WebSocketSecureSession<ExecutorType>::AsyncHandshake(
boost::system::error_code ec) {
- LOG4CXX_AUTO_TRACE(ws_logger_);
+ SDL_LOG_AUTO_TRACE();
if (ec) {
auto str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(ws_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
WebSocketSession<ExecutorType>::on_io_error_();
return;
}
diff --git a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
index ac8789eee8..68f23a6326 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
@@ -48,7 +48,7 @@
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "WebSocketTransportAdapter")
+SDL_CREATE_LOG_VARIABLE("WebSocketTransportAdapter")
WebSocketServerTransportAdapter::WebSocketServerTransportAdapter(
resumption::LastStateWrapperPtr last_state_wrapper,
@@ -63,7 +63,7 @@ WebSocketServerTransportAdapter::~WebSocketServerTransportAdapter() {}
void WebSocketServerTransportAdapter::TransportConfigUpdated(
const TransportConfig& new_config) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
transport_config_ = new_config;
@@ -74,7 +74,7 @@ void WebSocketServerTransportAdapter::TransportConfigUpdated(
TransportConfig WebSocketServerTransportAdapter::GetTransportConfiguration()
const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return transport_config_;
}
@@ -83,14 +83,14 @@ DeviceType WebSocketServerTransportAdapter::GetDeviceType() const {
}
DeviceSptr WebSocketServerTransportAdapter::AddDevice(DeviceSptr device) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
webengine_device_ = device;
Store();
return TransportAdapterImpl::AddDevice(webengine_device_);
}
TransportAdapter::Error WebSocketServerTransportAdapter::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (webengine_device_) {
AddDevice(webengine_device_);
}
@@ -98,12 +98,12 @@ TransportAdapter::Error WebSocketServerTransportAdapter::Init() {
}
void WebSocketServerTransportAdapter::Store() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (webengine_device_) {
Json::Value& dictionary = last_state().get_dictionary();
if (dictionary["TransportManager"].isMember("WebsocketServerAdapter")) {
- LOG4CXX_DEBUG(
- logger_, "WebsocketServerAdapter already exists. Storing is skipped");
+ SDL_LOG_DEBUG(
+ "WebsocketServerAdapter already exists. Storing is skipped");
return;
}
@@ -118,7 +118,7 @@ void WebSocketServerTransportAdapter::Store() const {
}
bool WebSocketServerTransportAdapter::Restore() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const Json::Value& dictionary = last_state().get_dictionary();
const Json::Value ws_adapter_dictionary =
dictionary["TransportManager"]["WebsocketServerAdapter"];
@@ -133,7 +133,7 @@ bool WebSocketServerTransportAdapter::Restore() {
}
std::string WebSocketServerTransportAdapter::GetStoredDeviceID() const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return webengine_device_id_;
}
diff --git a/src/components/transport_manager/src/websocket_server/websocket_session.cc b/src/components/transport_manager/src/websocket_server/websocket_session.cc
index ab62530963..8a05b9d9aa 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_session.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_session.cc
@@ -35,17 +35,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace transport_manager {
namespace transport_adapter {
+SDL_CREATE_LOG_VARIABLE("WebSocketSession")
+
using namespace boost::beast::websocket;
template <>
WebSocketSession<tcp::socket&>::WebSocketSession(
boost::asio::ip::tcp::socket socket,
DataReceiveCallback data_receive,
+ DataSendDoneCallback data_send_done,
+ DataSendFailedCallback data_send_failed,
OnIOErrorCallback on_error)
: socket_(std::move(socket))
, ws_(socket_)
, strand_(ws_.get_executor())
, data_receive_(data_receive)
+ , data_send_done_(data_send_done)
+ , data_send_failed_(data_send_failed)
, on_io_error_(on_error) {
ws_.binary(true);
}
@@ -56,11 +62,15 @@ WebSocketSession<ssl::stream<tcp::socket&> >::WebSocketSession(
boost::asio::ip::tcp::socket socket,
ssl::context& ctx,
DataReceiveCallback data_receive,
+ DataSendDoneCallback data_send_done,
+ DataSendFailedCallback data_send_failed,
OnIOErrorCallback on_error)
: socket_(std::move(socket))
, ws_(socket_, ctx)
, strand_(ws_.get_executor())
, data_receive_(data_receive)
+ , data_send_done_(data_send_done)
+ , data_send_failed_(data_send_failed)
, on_io_error_(on_error) {
ws_.binary(true);
}
@@ -72,7 +82,7 @@ WebSocketSession<ExecutorType>::~WebSocketSession() {}
template <typename ExecutorType>
void WebSocketSession<ExecutorType>::AsyncAccept() {
- LOG4CXX_AUTO_TRACE(ws_logger_);
+ SDL_LOG_AUTO_TRACE();
ws_.async_accept(
boost::asio::bind_executor(strand_,
std::bind(&WebSocketSession::AsyncRead,
@@ -82,10 +92,10 @@ void WebSocketSession<ExecutorType>::AsyncAccept() {
template <typename ExecutorType>
void WebSocketSession<ExecutorType>::AsyncRead(boost::system::error_code ec) {
- LOG4CXX_AUTO_TRACE(ws_logger_);
+ SDL_LOG_AUTO_TRACE();
if (ec) {
auto str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(ws_logger_, str_err);
+ SDL_LOG_ERROR(str_err);
return;
}
@@ -98,26 +108,26 @@ void WebSocketSession<ExecutorType>::AsyncRead(boost::system::error_code ec) {
}
template <typename ExecutorType>
-TransportAdapter::Error WebSocketSession<ExecutorType>::WriteDown(
- ::protocol_handler::RawMessagePtr message) {
+void WebSocketSession<ExecutorType>::WriteDown(Message message) {
boost::system::error_code ec;
ws_.write(boost::asio::buffer(message->data(), message->data_size()), ec);
if (ec) {
- LOG4CXX_ERROR(ws_logger_, "A system error has occurred: " << ec.message());
- return TransportAdapter::FAIL;
+ SDL_LOG_ERROR("A system error has occurred: " << ec.message());
+ data_send_failed_(message);
+ on_io_error_();
+ return;
}
-
- return TransportAdapter::OK;
+ data_send_done_(message);
}
template <typename ExecutorType>
void WebSocketSession<ExecutorType>::Read(boost::system::error_code ec,
std::size_t bytes_transferred) {
- LOG4CXX_AUTO_TRACE(ws_logger_);
+ SDL_LOG_AUTO_TRACE();
boost::ignore_unused(bytes_transferred);
if (ec) {
- LOG4CXX_ERROR(ws_logger_, ec.message());
+ SDL_LOG_ERROR(ec.message());
buffer_.consume(buffer_.size());
on_io_error_();
return;
@@ -127,12 +137,11 @@ void WebSocketSession<ExecutorType>::Read(boost::system::error_code ec,
const auto data = boost::asio::buffer_cast<const uint8_t*>(
boost::beast::buffers_front(buffer_.data()));
- LOG4CXX_DEBUG(ws_logger_,
- "Msg: " << boost::beast::buffers_to_string(buffer_.data())
+ SDL_LOG_DEBUG("Msg: " << boost::beast::buffers_to_string(buffer_.data())
<< " Size: " << size;);
- ::protocol_handler::RawMessagePtr frame(
- new protocol_handler::RawMessage(0, 0, data, size, false));
+ auto frame =
+ std::make_shared<protocol_handler::RawMessage>(0, 0, data, size, false);
data_receive_(frame);
@@ -142,7 +151,7 @@ void WebSocketSession<ExecutorType>::Read(boost::system::error_code ec,
template <typename ExecutorType>
bool WebSocketSession<ExecutorType>::Shutdown() {
- LOG4CXX_AUTO_TRACE(ws_logger_);
+ SDL_LOG_AUTO_TRACE();
boost::system::error_code ec;
if (socket_.is_open()) {
socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
@@ -150,7 +159,7 @@ bool WebSocketSession<ExecutorType>::Shutdown() {
}
buffer_.consume(buffer_.size());
if (ec) {
- LOG4CXX_ERROR(ws_logger_, ec.message());
+ SDL_LOG_ERROR(ec.message());
return false;
}
return true;
diff --git a/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc b/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
index 0f2f0a2045..befba30fbd 100644
--- a/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
+++ b/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
@@ -129,7 +129,7 @@ TEST_F(NetworkInterfaceListenerTest, Start_success) {
// the "isThreadRunning_" flag of the thread will be update slightly later
SleepFor(kThreadStartWaitMsec);
- EXPECT_TRUE(interface_listener_impl_->GetThread()->is_running());
+ EXPECT_TRUE(interface_listener_impl_->GetThread()->IsRunning());
EXPECT_TRUE(waiter.WaitFor(1, kStartNotificationTimeoutMsec));
@@ -166,7 +166,7 @@ TEST_F(NetworkInterfaceListenerTest, Stop_success) {
EXPECT_TRUE(interface_listener_impl_->Stop());
SleepFor(kThreadStartWaitMsec);
- EXPECT_FALSE(interface_listener_impl_->GetThread()->is_running());
+ EXPECT_FALSE(interface_listener_impl_->GetThread()->IsRunning());
Deinit();
}
diff --git a/src/components/transport_manager/test/tcp_client_listener_test.cc b/src/components/transport_manager/test/tcp_client_listener_test.cc
index dbd7799b62..d71db3e770 100644
--- a/src/components/transport_manager/test/tcp_client_listener_test.cc
+++ b/src/components/transport_manager/test/tcp_client_listener_test.cc
@@ -166,9 +166,9 @@ TEST_P(TcpClientListenerTest, StartListening) {
SleepFor(kThreadStartWaitMsec);
if (InterfaceNameSpecified()) {
- EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+ EXPECT_FALSE(tcp_client_listener_->thread()->IsRunning());
} else {
- EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ EXPECT_TRUE(tcp_client_listener_->thread()->IsRunning());
}
// Stop() and Deinit() will be called during destructor
@@ -200,7 +200,7 @@ TEST_P(TcpClientListenerTest, StopListening) {
EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StopListening());
- EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+ EXPECT_FALSE(tcp_client_listener_->thread()->IsRunning());
EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
}
@@ -310,7 +310,7 @@ TEST_P(TcpClientListenerTest, OnIPAddressUpdated_ValidIPv4Address) {
SleepFor(kThreadStartWaitMsec);
- EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ EXPECT_TRUE(tcp_client_listener_->thread()->IsRunning());
}
EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
@@ -357,7 +357,7 @@ TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_changed) {
SleepFor(kThreadStartWaitMsec);
- EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ EXPECT_TRUE(tcp_client_listener_->thread()->IsRunning());
}
EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
@@ -403,7 +403,7 @@ TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_same) {
SleepFor(kThreadStartWaitMsec);
- EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ EXPECT_TRUE(tcp_client_listener_->thread()->IsRunning());
}
EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
@@ -450,7 +450,7 @@ TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_disabled) {
SleepFor(kThreadStartWaitMsec);
- EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+ EXPECT_FALSE(tcp_client_listener_->thread()->IsRunning());
}
EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
@@ -509,7 +509,7 @@ TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_reenabled) {
SleepFor(kThreadStartWaitMsec);
- EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ EXPECT_TRUE(tcp_client_listener_->thread()->IsRunning());
}
EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
@@ -539,7 +539,7 @@ TEST_P(TcpClientListenerTest, OnIPAddressUpdated_EmptyIPv4Address) {
SleepFor(kThreadStartWaitMsec);
- EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+ EXPECT_FALSE(tcp_client_listener_->thread()->IsRunning());
}
EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc
index db4813be9a..227367e750 100644
--- a/src/components/transport_manager/test/transport_manager_impl_test.cc
+++ b/src/components/transport_manager/test/transport_manager_impl_test.cc
@@ -633,15 +633,17 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice_SendDone) {
EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
}
-TEST_F(TransportManagerImplTest, SendMessageFailed_GetHandleSendFailed) {
+TEST_F(
+ TransportManagerImplTest,
+ SendMessageToDevice_AdapterSendDataOkAndOnSendFailEvent_OnTMMessageSendFailed) {
// Arrange
HandleConnection();
TestAsyncWaiter waiter;
EXPECT_CALL(*mock_adapter_,
SendData(mac_address_, application_id_, test_message_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
- Return(TransportAdapter::FAIL)));
+ .WillOnce(
+ DoAll(NotifyTestAsyncWaiter(&waiter), Return(TransportAdapter::OK)));
#ifdef TELEMETRY_MONITOR
EXPECT_CALL(mock_metric_observer_, StartRawMsg(test_message_.get()));
diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt
index 451a8a629e..b65b19253a 100644
--- a/src/components/utils/CMakeLists.txt
+++ b/src/components/utils/CMakeLists.txt
@@ -78,11 +78,8 @@ if(ENABLE_LOG)
)
else()
list(APPEND EXCLUDE_PATHS
- push_log.cc
- log_message_loop_thread.cc
- logger_status.cc
auto_trace.cc
- logger.cc
+ logger/log4cxxlogger.cc
)
endif()
diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h
index f575da129f..f06ca15281 100644
--- a/src/components/utils/include/utils/file_system.h
+++ b/src/components/utils/include/utils/file_system.h
@@ -297,6 +297,14 @@ bool CopyFile(const std::string& src, const std::string& dst);
*/
bool MoveFile(const std::string& src, const std::string& dst);
+/**
+ * @brief Get filename from full path
+ *
+ * @param full_path Source file path
+ * @return parsed filename
+ */
+std::string GetFileName(const std::string& full_path);
+
} // namespace file_system
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_FILE_SYSTEM_H_
diff --git a/src/components/utils/src/logger_status.cc b/src/components/utils/include/utils/logger/log4cxxlogger.h
index ea9dfa3f22..170e6e871c 100644
--- a/src/components/utils/src/logger_status.cc
+++ b/src/components/utils/include/utils/logger/log4cxxlogger.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,10 +30,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/logger_status.h"
+#pragma once
+
+#include <log4cxx/logger.h>
+#include "utils/ilogger.h"
namespace logger {
-volatile LoggerStatus logger_status = LoggerThreadNotCreated;
+class Log4CXXLogger : public ThirdPartyLoggerInterface {
+ public:
+ Log4CXXLogger(const std::string& filename);
+ void Init() override;
+ void DeInit() override;
+ bool IsEnabledFor(const std::string& component,
+ LogLevel log_level) const override;
+ void PushLog(const LogMessage& log_message) override;
+
+ private:
+ std::string filename_;
+};
} // namespace logger
diff --git a/src/components/utils/include/utils/log_message_loop_thread.h b/src/components/utils/include/utils/logger/logger_impl.h
index b0cac75c71..faff8f167d 100644
--- a/src/components/utils/include/utils/log_message_loop_thread.h
+++ b/src/components/utils/include/utils/logger/logger_impl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,43 +30,56 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_
-#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_
+#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_LOGGER_IMPL_H_
+#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_LOGGER_IMPL_H_
-#include <log4cxx/logger.h>
-#include <queue>
-#include <string>
+#include "utils/ilogger.h"
+
+#include <functional>
-#include "utils/macro.h"
#include "utils/threads/message_loop_thread.h"
namespace logger {
-typedef struct {
- log4cxx::LoggerPtr logger;
- log4cxx::LevelPtr level;
- std::string entry;
- log4cxx_time_t timeStamp;
- log4cxx::spi::LocationInfo location;
- log4cxx::LogString threadName;
-} LogMessage;
-
typedef std::queue<LogMessage> LogMessageQueue;
typedef threads::MessageLoopThread<LogMessageQueue>
LogMessageLoopThreadTemplate;
+template <typename T>
+using LoopThreadPtr = std::unique_ptr<T, std::function<void(T*)> >;
+
class LogMessageLoopThread : public LogMessageLoopThreadTemplate,
public LogMessageLoopThreadTemplate::Handler {
public:
- LogMessageLoopThread();
+ LogMessageLoopThread(std::function<void(LogMessage)> handler);
+
+ void Push(const LogMessage& message);
+
+ void Handle(const LogMessage message);
+
~LogMessageLoopThread();
- void Handle(const LogMessage message) OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(LogMessageLoopThread);
+ std::function<void(LogMessage)> force_log_;
+};
+
+class LoggerImpl : public Logger, public LoggerInitializer {
+ public:
+ LoggerImpl(bool use_message_loop_thread = true);
+ void Init(std::unique_ptr<ThirdPartyLoggerInterface>&& impl) override;
+ void DeInit() override;
+ void Flush() override;
+
+ bool IsEnabledFor(const std::string& component,
+ LogLevel log_level) const override;
+ void PushLog(const LogMessage& log_message) override;
+
+ std::unique_ptr<ThirdPartyLoggerInterface> impl_;
+ LoopThreadPtr<LogMessageLoopThread> loop_thread_;
+ bool use_message_loop_thread_;
};
} // namespace logger
-#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_
+#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_LOGGER_IMPL_H_
diff --git a/src/components/utils/src/auto_trace.cc b/src/components/utils/src/auto_trace.cc
index 0379630319..3d9c82a955 100644
--- a/src/components/utils/src/auto_trace.cc
+++ b/src/components/utils/src/auto_trace.cc
@@ -30,36 +30,35 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <apr_time.h>
-#include <log4cxx/spi/loggingevent.h>
-
#include "utils/auto_trace.h"
-#include "utils/push_log.h"
+#include "utils/logger.h"
namespace logger {
-AutoTrace::AutoTrace(log4cxx::LoggerPtr logger,
- const log4cxx::spi::LocationInfo& location)
- : logger_(logger), location_(location) {
- if (logger::logs_enabled() && logger_->isTraceEnabled()) {
- push_log(logger_,
- ::log4cxx::Level::getTrace(),
- "Enter",
- apr_time_now(),
- location_,
- ::log4cxx::spi::LoggingEvent::getCurrentThreadName());
+AutoTrace::AutoTrace(const std::string& component, const LocationInfo& location)
+ : component_(component), location_(location) {
+ if (logger::Logger::instance().IsEnabledFor(component_,
+ logger::LogLevel::TRACE_LEVEL)) {
+ logger::LogMessage message{component_,
+ LogLevel::TRACE_LEVEL,
+ "Enter",
+ std::chrono::high_resolution_clock::now(),
+ location_,
+ std::this_thread::get_id()};
+ logger::Logger::instance().PushLog(message);
}
}
AutoTrace::~AutoTrace() {
- if (logger::logs_enabled() && logger_->isTraceEnabled()) {
- push_log(logger_,
- ::log4cxx::Level::getTrace(),
- "Exit",
- apr_time_now(),
- location_, // the location corresponds rather to creation of
- // autotrace object than to deletion
- ::log4cxx::spi::LoggingEvent::getCurrentThreadName());
+ if (logger::Logger::instance().IsEnabledFor(component_,
+ logger::LogLevel::TRACE_LEVEL)) {
+ logger::LogMessage message{component_,
+ LogLevel::TRACE_LEVEL,
+ "Exit",
+ std::chrono::high_resolution_clock::now(),
+ location_,
+ std::this_thread::get_id()};
+ logger::Logger::instance().PushLog(message);
}
}
diff --git a/src/components/utils/src/conditional_variable_boost.cc b/src/components/utils/src/conditional_variable_boost.cc
index c70b727d66..81fad8ebe7 100644
--- a/src/components/utils/src/conditional_variable_boost.cc
+++ b/src/components/utils/src/conditional_variable_boost.cc
@@ -46,7 +46,7 @@ const long kNanosecondsPerMillisecond = 1000000;
namespace sync_primitives {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
ConditionalVariable::ConditionalVariable() {}
@@ -75,13 +75,13 @@ bool ConditionalVariable::Wait(BaseLock& lock) {
cond_var_.wait<boost::recursive_mutex>(test_rec_lock->mutex_);
} else {
// unknown, give up the lock
- LOG4CXX_ERROR(logger_, "Unknown lock type!");
+ SDL_LOG_ERROR("Unknown lock type!");
NOTREACHED();
}
lock.AssertFreeAndMarkTaken();
} catch (const boost::exception& error) {
std::string error_string = boost::diagnostic_information(error);
- LOG4CXX_FATAL(logger_, error_string);
+ SDL_LOG_FATAL(error_string);
NOTREACHED();
}
return true;
@@ -115,7 +115,7 @@ ConditionalVariable::WaitStatus ConditionalVariable::WaitFor(
test_rec_lock->mutex_, boost::posix_time::milliseconds(milliseconds));
} else {
// this is an unknown lock, we have an issue
- LOG4CXX_ERROR(logger_, "Unknown lock type!");
+ SDL_LOG_ERROR("Unknown lock type!");
NOTREACHED();
}
@@ -125,7 +125,7 @@ ConditionalVariable::WaitStatus ConditionalVariable::WaitFor(
lock.AssertFreeAndMarkTaken();
} catch (const boost::exception& error) {
std::string error_string = boost::diagnostic_information(error);
- LOG4CXX_FATAL(logger_, error_string);
+ SDL_LOG_FATAL(error_string);
NOTREACHED();
}
diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc
index 015dc25a22..e5c98183ac 100644
--- a/src/components/utils/src/file_system.cc
+++ b/src/components/utils/src/file_system.cc
@@ -47,36 +47,35 @@
#include <cstdio>
#include <fstream>
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils::FileSystem")
+SDL_CREATE_LOG_VARIABLE("Utils::FileSystem")
// Easier reference
namespace fs = boost::filesystem;
using boost::system::error_code;
uint64_t file_system::GetAvailableDiskSpace(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
fs::space_info si = {0, 0, 0};
si = fs::space(path, ec);
if (ec) {
// If something went wrong, assume no free space
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to get available disk space: '"
- << path << "', reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to get available disk space: '"
+ << path << "', reason: " << ec.message());
}
return si.free;
}
uint64_t file_system::FileSize(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
// Boost returns sizes as unsigned
const uint64_t fsize = static_cast<uint64_t>(fs::file_size(path, ec));
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_,
+ SDL_LOG_ERROR_WITH_ERRNO(
+
"Unable to get file size: '" << path << "', reason: " << ec.message());
return 0;
}
@@ -84,15 +83,14 @@ uint64_t file_system::FileSize(const std::string& path) {
}
size_t file_system::DirectorySize(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
size_t dir_size = 0;
error_code ec;
// Recursively iterate through directory to accumulate file sizes
fs::recursive_directory_iterator iter(path, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to get directory size: '"
- << path << "', reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to get directory size: '"
+ << path << "', reason: " << ec.message());
return 0;
}
@@ -101,31 +99,28 @@ size_t file_system::DirectorySize(const std::string& path) {
while (end != iter) {
const bool is_directory = fs::is_directory(iter->path(), ec);
if (ec) {
- LOG4CXX_WARN_WITH_ERRNO(
- logger_,
- "Failed check if '" << iter->path()
+ SDL_LOG_WARN_WITH_ERRNO("Failed check if '"
+ << iter->path()
<< "' is directory, reason: " << ec.message());
}
if (!is_directory && !ec) {
const size_t fsize = fs::file_size(iter->path(), ec);
if (ec) {
- LOG4CXX_WARN_WITH_ERRNO(logger_,
- "Failed to get file_size: '"
- << path << "', reason: " << ec.message());
+ SDL_LOG_WARN_WITH_ERRNO("Failed to get file_size: '"
+ << path << "', reason: " << ec.message());
} else {
// No error means we can add the file
dir_size += fsize;
- LOG4CXX_DEBUG(logger_, "Adding: " << fsize << ", total: " << dir_size);
+ SDL_LOG_DEBUG("Adding: " << fsize << ", total: " << dir_size);
}
}
// Increment the iterator to point to next entry in recursive iteration
iter.increment(ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Failed to increment iterator for path '"
- << path << "', reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to increment iterator for path '"
+ << path << "', reason: " << ec.message());
return dir_size;
}
}
@@ -135,11 +130,11 @@ size_t file_system::DirectorySize(const std::string& path) {
// NOTE that boost makes 0777 permissions by default
bool file_system::CreateDirectory(const std::string& name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
const bool success = fs::create_directory(name, ec);
if (!success || ec) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "Unable to create directory: " << name);
+ SDL_LOG_WARN_WITH_ERRNO("Unable to create directory: " << name);
} else {
// Set 0700 permissions to maintain previous API
fs::permissions(name, fs::perms::owner_all, ec);
@@ -148,15 +143,14 @@ bool file_system::CreateDirectory(const std::string& name) {
}
bool file_system::CreateDirectoryRecursively(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
// Create directory and all parents
fs::create_directories(path, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to create directory recursively: '"
- << path << "', reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to create directory recursively: '"
+ << path << "', reason: " << ec.message());
return false;
}
@@ -165,13 +159,12 @@ bool file_system::CreateDirectoryRecursively(const std::string& path) {
}
bool file_system::IsDirectory(const std::string& name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
const bool is_directory = fs::is_directory(name, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to check if it is directory: "
- << name << " reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to check if it is directory: "
+ << name << " reason: " << ec.message());
}
return is_directory;
}
@@ -179,22 +172,21 @@ bool file_system::IsDirectory(const std::string& name) {
// NOTE this may be a duplicate of IsDirectory since it already checks
// existence
bool file_system::DirectoryExists(const std::string& name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const bool exists = FileExists(name) && IsDirectory(name);
- LOG4CXX_DEBUG(
- logger_,
+ SDL_LOG_DEBUG(
+
"Directory '" << name << "' " << (exists ? "exists" : "NOT exists"));
return exists;
}
bool file_system::FileExists(const std::string& name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
const bool exists = fs::exists(name, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to check that file exists: "
- << name << " reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to check that file exists: "
+ << name << " reason: " << ec.message());
}
return exists;
}
@@ -202,7 +194,7 @@ bool file_system::FileExists(const std::string& name) {
bool file_system::Write(const std::string& file_name,
const std::vector<uint8_t>& data,
std::ios_base::openmode mode) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::ofstream file(file_name.c_str(), std::ios_base::binary | mode);
if (file.is_open()) {
for (uint32_t i = 0; i < data.size(); ++i) {
@@ -216,7 +208,7 @@ bool file_system::Write(const std::string& file_name,
std::ofstream* file_system::Open(const std::string& file_name,
std::ios_base::openmode mode) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::ofstream* file = new std::ofstream();
file->open(file_name.c_str(), std::ios_base::binary | mode);
if (file->is_open()) {
@@ -230,7 +222,7 @@ std::ofstream* file_system::Open(const std::string& file_name,
bool file_system::Write(std::ofstream* const file_stream,
const uint8_t* data,
uint32_t data_size) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
bool result = false;
if (file_stream) {
for (size_t i = 0; i < data_size; ++i) {
@@ -242,73 +234,67 @@ bool file_system::Write(std::ofstream* const file_stream,
}
void file_system::Close(std::ofstream* file_stream) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (file_stream) {
file_stream->close();
}
}
std::string file_system::CurrentWorkingDirectory() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
const fs::path currpath = fs::current_path(ec);
if (ec) {
- LOG4CXX_WARN_WITH_ERRNO(logger_,
- "Unable to get current working directory: '"
- << currpath << "' reason: " << ec.message());
+ SDL_LOG_WARN_WITH_ERRNO("Unable to get current working directory: '"
+ << currpath << "' reason: " << ec.message());
}
return currpath.string();
}
std::string file_system::GetAbsolutePath(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
const fs::path absolute = fs::canonical(path, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to get absolute path: '"
- << path << "', reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to get absolute path: '"
+ << path << "', reason: " << ec.message());
return std::string(); // invalid path
}
return absolute.string();
}
bool file_system::IsFileNameValid(const std::string& file_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return file_name.end() == std::find(file_name.begin(), file_name.end(), '/');
}
// Does not remove if file is write-protected
bool file_system::DeleteFile(const std::string& name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (FileExists(name) && IsAccessible(name, W_OK)) {
error_code ec;
const bool success = fs::remove(name.c_str(), ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to delete file: '"
- << name << "', reason: " << ec.message()
- << "success: " << success);
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to delete file: '"
+ << name << "', reason: " << ec.message()
+ << "success: " << success);
}
return success && !ec;
}
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
"Unable to delete file either doesn't exist or is not accessible");
return false;
}
void file_system::remove_directory_content(const std::string& directory_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
fs::directory_iterator dir_iter(directory_name, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_,
- "Unable to remove directory contents: " << directory_name
- << " reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to remove directory contents: "
+ << directory_name << " reason: " << ec.message());
}
// According to Boost's documentation, removing shouldn't invalidate the
@@ -319,15 +305,15 @@ void file_system::remove_directory_content(const std::string& directory_name) {
while (dir_iter != end) {
fs::remove_all(dir_iter->path(), ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_,
+ SDL_LOG_ERROR_WITH_ERRNO(
+
"Unable to remove file: " << dir_iter->path().string() << " reason "
<< ec.message());
}
dir_iter.increment(ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_, "Unable to increment dir_iter: reason " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to increment dir_iter: reason "
+ << ec.message());
break;
}
}
@@ -335,11 +321,11 @@ void file_system::remove_directory_content(const std::string& directory_name) {
bool file_system::RemoveDirectory(const std::string& directory_name,
const bool is_recursively) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
// Make sure the directory exists
if (!DirectoryExists(directory_name) && IsAccessible(directory_name, W_OK)) {
- LOG4CXX_WARN(
- logger_,
+ SDL_LOG_WARN(
+
"Unable to remove directory either doesn't exist or is not accessible");
return false;
}
@@ -349,8 +335,7 @@ bool file_system::RemoveDirectory(const std::string& directory_name,
if (is_recursively) {
success = (fs::remove_all(directory_name, ec) != 0);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to remove all: '" << directory_name
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to remove all: '" << directory_name
<< "', reason "
<< ec.message());
}
@@ -358,8 +343,7 @@ bool file_system::RemoveDirectory(const std::string& directory_name,
// Otherwise try to remove
success = fs::remove(directory_name, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to remove: '" << directory_name
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to remove: '" << directory_name
<< "', reason "
<< ec.message());
}
@@ -368,31 +352,29 @@ bool file_system::RemoveDirectory(const std::string& directory_name,
}
bool file_system::IsAccessible(const std::string& name, const int32_t how) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return !access(name.c_str(), how);
}
bool file_system::IsWritingAllowed(const std::string& name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return IsAccessible(name, W_OK);
}
bool file_system::IsReadingAllowed(const std::string& name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return IsAccessible(name, R_OK);
}
std::vector<std::string> file_system::ListFiles(
const std::string& directory_name) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
fs::directory_iterator iter(directory_name, ec), end;
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_,
- "Unable to get directory_iterator: " << directory_name << " reason "
- << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to get directory_iterator: "
+ << directory_name << " reason " << ec.message());
return std::vector<std::string>();
}
@@ -401,10 +383,9 @@ std::vector<std::string> file_system::ListFiles(
list_files.push_back(iter->path().filename().string());
iter.increment(ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Failed to increment iterator for path '"
- << directory_name
- << "', reason: " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Failed to increment iterator for path '"
+ << directory_name
+ << "', reason: " << ec.message());
return list_files;
}
}
@@ -422,10 +403,10 @@ bool file_system::WriteBinaryFile(const std::string& name,
bool file_system::ReadBinaryFile(const std::string& name,
std::vector<uint8_t>& result) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Filename: " << name);
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Filename: " << name);
if (!FileExists(name) || !IsAccessible(name, R_OK)) {
- LOG4CXX_ERROR(logger_, "Not able to read binary file: " << name);
+ SDL_LOG_ERROR("Not able to read binary file: " << name);
return false;
}
@@ -446,7 +427,7 @@ bool file_system::ReadBinaryFile(const std::string& name,
uint32_t offset,
uint32_t length) {
if (!FileExists(name) || !IsAccessible(name, R_OK)) {
- LOG4CXX_ERROR(logger_, "Not able to read binary file: " << name);
+ SDL_LOG_ERROR("Not able to read binary file: " << name);
return false;
}
@@ -466,14 +447,14 @@ bool file_system::ReadBinaryFile(const std::string& name,
}
bool file_system::ReadFile(const std::string& name, std::string& result) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!FileExists(name) || !IsAccessible(name, R_OK)) {
- LOG4CXX_ERROR(logger_, "Not able to read file: " << name);
+ SDL_LOG_ERROR("Not able to read file: " << name);
return false;
}
std::ifstream file(name.c_str());
if (!file) {
- LOG4CXX_ERROR(logger_, "Not able to open binary file: " << name);
+ SDL_LOG_ERROR("Not able to open binary file: " << name);
return false;
}
std::ostringstream ss;
@@ -483,7 +464,7 @@ bool file_system::ReadFile(const std::string& name, std::string& result) {
}
const std::string file_system::ConvertPathForURL(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const std::string reserved_symbols = "!#$&'()*+,:;=?@[] ";
size_t pos = std::string::npos;
std::string converted_path;
@@ -503,11 +484,11 @@ const std::string file_system::ConvertPathForURL(const std::string& path) {
}
bool file_system::CreateFile(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
std::ofstream file(path);
if (!(file.is_open())) {
- LOG4CXX_WARN(logger_, "failed to create file: " << path);
+ SDL_LOG_WARN("failed to create file: " << path);
return false;
}
file.close();
@@ -515,14 +496,13 @@ bool file_system::CreateFile(const std::string& path) {
}
time_t file_system::GetFileModificationTime(const std::string& path) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
error_code ec;
std::time_t time = fs::last_write_time(path, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Unable to get file modification time: "
- << path << " reason " << ec.message());
+ SDL_LOG_ERROR_WITH_ERRNO("Unable to get file modification time: "
+ << path << " reason " << ec.message());
return 0;
}
@@ -530,18 +510,17 @@ time_t file_system::GetFileModificationTime(const std::string& path) {
}
bool file_system::CopyFile(const std::string& src, const std::string& dst) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (!FileExists(src) || FileExists(dst) || !CreateFile(dst)) {
- LOG4CXX_WARN(
- logger_,
- "Failed to copy file from: '" << src << "', to: '" << dst << "'");
+ SDL_LOG_WARN("Failed to copy file from: '" << src << "', to: '" << dst
+ << "'");
return false;
}
error_code ec;
fs::copy_file(src, dst, ec);
if (ec) {
- LOG4CXX_ERROR_WITH_ERRNO(
- logger_,
+ SDL_LOG_ERROR_WITH_ERRNO(
+
"Unable to copy file: '" << src << "', reason: " << ec.message());
// something failed
return false;
@@ -550,7 +529,7 @@ bool file_system::CopyFile(const std::string& src, const std::string& dst) {
}
bool file_system::MoveFile(const std::string& src, const std::string& dst) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
if (std::rename(src.c_str(), dst.c_str()) == 0) {
return true;
@@ -560,15 +539,19 @@ bool file_system::MoveFile(const std::string& src, const std::string& dst) {
// Instead, copy the file over and delete the old one
bool success = CopyFile(src, dst);
if (!success) {
- LOG4CXX_ERROR(
- logger_,
- "Failed to copy file from: '" << src << "', to: '" << dst << "'");
+ SDL_LOG_ERROR("Failed to copy file from: '" << src << "', to: '" << dst
+ << "'");
return false;
}
success = DeleteFile(src);
if (!success) {
- LOG4CXX_ERROR(logger_, "Failed to delete file '" << src << "'");
+ SDL_LOG_ERROR("Failed to delete file '" << src << "'");
return false;
}
return true;
}
+
+std::string file_system::GetFileName(const std::string& full_path) {
+ fs::path p(full_path);
+ return p.filename().string();
+}
diff --git a/src/components/utils/src/jsoncpp_reader_wrapper.cc b/src/components/utils/src/jsoncpp_reader_wrapper.cc
index 69da386eed..f347a3253d 100644
--- a/src/components/utils/src/jsoncpp_reader_wrapper.cc
+++ b/src/components/utils/src/jsoncpp_reader_wrapper.cc
@@ -35,14 +35,14 @@
namespace utils {
-CREATE_LOGGERPTR_GLOBAL(logger_, "JsoncppReaderWrapper")
+SDL_CREATE_LOG_VARIABLE("JsoncppReaderWrapper")
JsonReader::JsonReader() {
reader_ = std::unique_ptr<Json::CharReader>(reader_builder_.newCharReader());
}
bool JsonReader::parse(const std::string& json, Json::Value* root) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
JSONCPP_STRING err;
bool is_parsing_ok = false;
const size_t json_len = json.length();
@@ -50,12 +50,12 @@ bool JsonReader::parse(const std::string& json, Json::Value* root) {
is_parsing_ok =
reader_->parse(json.c_str(), json.c_str() + json_len, root, &err);
} catch (Json::RuntimeError& e) {
- LOG4CXX_DEBUG(logger_, "Exception caught during parse json: " << e.what());
+ SDL_LOG_DEBUG("Exception caught during parse json: " << e.what());
return false;
}
if (!is_parsing_ok) {
- LOG4CXX_ERROR(logger_, "Json parsing fails: " << err);
+ SDL_LOG_ERROR("Json parsing fails: " << err);
}
return is_parsing_ok;
}
diff --git a/src/components/utils/src/lock_boost.cc b/src/components/utils/src/lock_boost.cc
index 2299bcf77d..735b31d882 100644
--- a/src/components/utils/src/lock_boost.cc
+++ b/src/components/utils/src/lock_boost.cc
@@ -39,13 +39,13 @@
namespace sync_primitives {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
Lock::Lock() : lock_taken_(0) {}
Lock::~Lock() {
if (lock_taken_ > 0) {
- LOG4CXX_FATAL(logger_, "Destroying non-released regular mutex " << &mutex_);
+ SDL_LOG_FATAL("Destroying non-released regular mutex " << &mutex_);
}
}
@@ -69,7 +69,7 @@ bool Lock::Try() {
void Lock::AssertFreeAndMarkTaken() {
if (lock_taken_ != 0) {
- LOG4CXX_FATAL(logger_, "Locking already taken not recursive mutex");
+ SDL_LOG_FATAL("Locking already taken not recursive mutex");
NOTREACHED();
}
lock_taken_++;
@@ -77,7 +77,7 @@ void Lock::AssertFreeAndMarkTaken() {
void Lock::AssertTakenAndMarkFree() {
if (lock_taken_ == 0) {
- LOG4CXX_FATAL(logger_, "Unlocking a mutex that is not taken");
+ SDL_LOG_FATAL("Unlocking a mutex that is not taken");
NOTREACHED();
}
lock_taken_--;
@@ -89,8 +89,7 @@ RecursiveLock::RecursiveLock() : lock_taken_(0) {}
RecursiveLock::~RecursiveLock() {
if (lock_taken_ > 0) {
- LOG4CXX_FATAL(logger_,
- "Destroying non-released recursive mutex " << &mutex_);
+ SDL_LOG_FATAL("Destroying non-released recursive mutex " << &mutex_);
}
}
@@ -118,7 +117,7 @@ void RecursiveLock::AssertFreeAndMarkTaken() {
void RecursiveLock::AssertTakenAndMarkFree() {
if (lock_taken_ == 0) {
- LOG4CXX_FATAL(logger_, "Unlocking a recursive mutex that is not taken");
+ SDL_LOG_FATAL("Unlocking a recursive mutex that is not taken");
NOTREACHED();
}
lock_taken_--;
diff --git a/src/components/utils/src/log_message_loop_thread.cc b/src/components/utils/src/log_message_loop_thread.cc
deleted file mode 100644
index 182eb64534..0000000000
--- a/src/components/utils/src/log_message_loop_thread.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "utils/log_message_loop_thread.h"
-#include "utils/logger_status.h"
-
-namespace logger {
-
-void LogMessageLoopThread::Handle(const LogMessage message) {
- message.logger->forcedLog(message.level,
- message.entry,
- message.timeStamp,
- message.location,
- message.threadName);
-}
-
-LogMessageLoopThread::LogMessageLoopThread()
- : LogMessageLoopThreadTemplate("Logger", this) {}
-
-LogMessageLoopThread::~LogMessageLoopThread() {
- // we'll have to drop messages
- // while deleting logger thread
- logger_status = DeletingLoggerThread;
- LogMessageLoopThreadTemplate::Shutdown();
-}
-
-} // namespace logger
diff --git a/src/components/utils/src/logger.cc b/src/components/utils/src/logger.cc
deleted file mode 100644
index 5a7922afc4..0000000000
--- a/src/components/utils/src/logger.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "utils/logger.h"
-#include <apr_time.h>
-#include "utils/log_message_loop_thread.h"
-#include "utils/logger_status.h"
-
-void deinit_logger() {
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
- LOG4CXX_DEBUG(logger_, "Logger deinitialization");
- logger::set_logs_enabled(false);
- log4cxx::LoggerPtr rootLogger = log4cxx::Logger::getRootLogger();
- logger::delete_log_message_loop_thread(rootLogger);
- log4cxx::spi::LoggerRepositoryPtr repository =
- rootLogger->getLoggerRepository();
- log4cxx::LoggerList loggers = repository->getCurrentLoggers();
- for (log4cxx::LoggerList::iterator i = loggers.begin(); i != loggers.end();
- ++i) {
- log4cxx::LoggerPtr logger = *i;
- logger->removeAllAppenders();
- }
- rootLogger->removeAllAppenders();
- logger::logger_status = logger::LoggerThreadNotCreated;
-}
-
-log4cxx_time_t time_now() {
- return apr_time_now();
-}
diff --git a/src/components/utils/src/logger/log4cxxlogger.cc b/src/components/utils/src/logger/log4cxxlogger.cc
new file mode 100644
index 0000000000..7d43892073
--- /dev/null
+++ b/src/components/utils/src/logger/log4cxxlogger.cc
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/logger/log4cxxlogger.h"
+#include <apr_pools.h>
+#include <apr_thread_proc.h>
+#include <atomic>
+#include <sstream>
+#include "assert.h"
+#include "log4cxx/propertyconfigurator.h"
+
+namespace logger {
+
+Log4CXXLogger::Log4CXXLogger(const std::string& filename)
+ : filename_(filename) {}
+
+void Log4CXXLogger::Init() {
+ log4cxx::PropertyConfigurator::configure(filename_);
+}
+
+void Log4CXXLogger::DeInit() {
+ log4cxx::LoggerPtr rootLogger = log4cxx::Logger::getRootLogger();
+
+ if (LOG4CXX_UNLIKELY(rootLogger->isDebugEnabled())) {
+ ::log4cxx::helpers::MessageBuffer oss_;
+ rootLogger->forcedLog(::log4cxx::Level::getDebug(),
+ oss_.str(oss_ << "Logger loop thread deinitialized"),
+ LOG4CXX_LOCATION);
+ }
+
+ if (LOG4CXX_UNLIKELY(rootLogger->isDebugEnabled())) {
+ ::log4cxx::helpers::MessageBuffer oss_;
+ rootLogger->forcedLog(::log4cxx::Level::getDebug(),
+ oss_.str(oss_ << "Logger calling removeAllAppenders"),
+ LOG4CXX_LOCATION);
+ }
+
+ log4cxx::spi::LoggerRepositoryPtr repository =
+ rootLogger->getLoggerRepository();
+ log4cxx::LoggerList loggers = repository->getCurrentLoggers();
+ for (auto logger : loggers) {
+ logger->removeAllAppenders();
+ }
+
+ rootLogger->removeAllAppenders();
+}
+
+log4cxx::LevelPtr getLogLevel(LogLevel log_level) {
+ switch (log_level) {
+ case LogLevel::TRACE_LEVEL:
+ return log4cxx::Level::getTrace();
+ case LogLevel::DEBUG_LEVEL:
+ return log4cxx::Level::getDebug();
+ case LogLevel::INFO_LEVEL:
+ return log4cxx::Level::getInfo();
+ case LogLevel::WARNING_LEVEL:
+ return log4cxx::Level::getWarn();
+ case LogLevel::ERROR_LEVEL:
+ return log4cxx::Level::getError();
+ case LogLevel::FATAL_LEVEL:
+ return log4cxx::Level::getFatal();
+ default:
+ assert(false);
+ }
+}
+
+bool Log4CXXLogger::IsEnabledFor(const std::string& component,
+ LogLevel log_level) const {
+ log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(component);
+ return logger->isEnabledFor(getLogLevel(log_level));
+}
+
+void Log4CXXLogger::PushLog(const LogMessage& log_message) {
+ log4cxx::LoggerPtr logger =
+ log4cxx::Logger::getLogger(log_message.component_);
+
+ std::ostringstream ss;
+ ss << log_message.thread_id_;
+
+ auto time = std::chrono::duration_cast<std::chrono::microseconds>(
+ log_message.timestamp_.time_since_epoch())
+ .count();
+ auto location =
+ log4cxx::spi::LocationInfo(log_message.location_.file_name.c_str(),
+ log_message.location_.function_name.c_str(),
+ log_message.location_.line_number);
+ logger->forcedLog(getLogLevel(log_message.log_level_),
+ log_message.log_event_,
+ time,
+ location,
+ ss.str());
+}
+
+} // namespace logger
diff --git a/src/components/utils/src/logger/logger_impl.cc b/src/components/utils/src/logger/logger_impl.cc
new file mode 100644
index 0000000000..1439f7327a
--- /dev/null
+++ b/src/components/utils/src/logger/logger_impl.cc
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/logger/logger_impl.h"
+#include <assert.h>
+#include <iostream>
+
+namespace logger {
+
+LoggerImpl::LoggerImpl(bool use_message_loop_thread)
+ : impl_(nullptr), use_message_loop_thread_(use_message_loop_thread) {}
+
+void LoggerImpl::Init(std::unique_ptr<ThirdPartyLoggerInterface>&& impl) {
+ assert(impl_ == nullptr);
+ impl_ = std::move(impl);
+
+ impl_->Init();
+
+ if (use_message_loop_thread_) {
+ auto deinit_logger = [](LogMessageLoopThread* logMsgThread) {
+ delete logMsgThread;
+ };
+
+ if (!loop_thread_) {
+ loop_thread_ = LoopThreadPtr<LogMessageLoopThread>(
+ new LogMessageLoopThread(
+ [this](LogMessage message) { impl_->PushLog(message); }),
+ deinit_logger);
+ }
+ }
+}
+
+void LoggerImpl::DeInit() {
+ if (use_message_loop_thread_) {
+ Flush();
+ loop_thread_.reset();
+ }
+
+ if (impl_) {
+ impl_->DeInit();
+ }
+}
+
+void LoggerImpl::Flush() {
+ if (use_message_loop_thread_) {
+ if (loop_thread_) {
+ loop_thread_->WaitDumpQueue();
+ }
+ }
+}
+
+bool LoggerImpl::IsEnabledFor(const std::string& component,
+ LogLevel log_level) const {
+ return impl_ ? impl_->IsEnabledFor(component, log_level) : false;
+}
+
+void LoggerImpl::PushLog(const LogMessage& log_message) {
+ if (impl_) {
+ if (use_message_loop_thread_) {
+ if (loop_thread_) {
+ loop_thread_->Push(log_message);
+ }
+ } else {
+ impl_->PushLog(log_message);
+ }
+ }
+}
+
+Logger& Logger::instance(Logger* pre_init) {
+ static Logger* instance_;
+ if (pre_init) {
+ assert(instance_ == nullptr);
+ instance_ = pre_init;
+ }
+ return *instance_;
+}
+
+LogMessageLoopThread::LogMessageLoopThread(
+ std::function<void(LogMessage)> handler)
+ : LogMessageLoopThreadTemplate("Logger", this), force_log_(handler) {}
+
+void LogMessageLoopThread::Push(const LogMessage& message) {
+ PostMessage(message);
+}
+
+void LogMessageLoopThread::Handle(const LogMessage message) {
+ force_log_(message);
+}
+
+LogMessageLoopThread::~LogMessageLoopThread() {
+ // we'll have to drop messages
+ // while deleting logger thread
+ LogMessageLoopThreadTemplate::Shutdown();
+}
+
+} // namespace logger
diff --git a/src/components/utils/src/push_log.cc b/src/components/utils/src/push_log.cc
deleted file mode 100644
index f9d1cd738a..0000000000
--- a/src/components/utils/src/push_log.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "utils/push_log.h"
-#include "utils/log_message_loop_thread.h"
-#include "utils/logger_status.h"
-
-namespace logger {
-
-struct __attribute__((visibility("default"))) LogsEnabled {
- static std::atomic_bool logs_enabled_;
-};
-
-std::atomic_bool LogsEnabled::logs_enabled_(false);
-
-template <typename T>
-using logger_ptr = std::unique_ptr<T, std::function<void(T*)> >;
-
-static logger_ptr<LogMessageLoopThread> log_message_loop_thread;
-
-auto deinit_logger = [](LogMessageLoopThread* logMsgThread) {
- delete logMsgThread;
- logger::logger_status = logger::LoggerThreadNotCreated;
-};
-
-bool push_log(log4cxx::LoggerPtr logger,
- log4cxx::LevelPtr level,
- const std::string& entry,
- log4cxx_time_t timeStamp,
- const log4cxx::spi::LocationInfo& location,
- const log4cxx::LogString& threadName) {
- if (LoggerThreadCreated == logger_status) {
- LogMessage message = {
- logger, level, entry, timeStamp, location, threadName};
- if (log_message_loop_thread) {
- log_message_loop_thread->PostMessage(message);
- return true;
- }
- }
-
- if (LoggerThreadNotCreated == logger_status) {
- logger_status = CreatingLoggerThread;
- // we'll have to drop messages
- // while creating logger thread
- create_log_message_loop_thread();
- LogMessage message = {
- logger, level, entry, timeStamp, location, threadName};
- log_message_loop_thread->PostMessage(message);
- logger_status = LoggerThreadCreated;
- return true;
- }
-
- // also we drop messages
- // while deleting logger thread
-
- return false;
-}
-
-bool logs_enabled() {
- return LogsEnabled::logs_enabled_;
-}
-
-void set_logs_enabled(bool state) {
- LogsEnabled::logs_enabled_ = state;
-}
-
-void create_log_message_loop_thread() {
- if (!log_message_loop_thread) {
- log_message_loop_thread = logger_ptr<LogMessageLoopThread>(
- new LogMessageLoopThread, deinit_logger);
- }
-}
-
-void delete_log_message_loop_thread(log4cxx::LoggerPtr& logger) {
- if (logger::logger_status == logger::LoggerThreadCreated) {
- logger::flush_logger();
- }
-
- log_message_loop_thread.reset();
-
- if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {
- ::log4cxx::helpers::MessageBuffer oss_;
- logger->forcedLog(::log4cxx::Level::getDebug(),
- oss_.str(oss_ << "Logger loop thread deinitialized"),
- LOG4CXX_LOCATION);
- }
-
- if (logger->getRootLogger() == logger) {
- return;
- }
-
- if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {
- ::log4cxx::helpers::MessageBuffer oss_;
- logger->forcedLog(::log4cxx::Level::getDebug(),
- oss_.str(oss_ << "Logger calling removeAllAppenders"),
- LOG4CXX_LOCATION);
- }
-
- logger->removeAllAppenders();
-}
-
-void flush_logger() {
- logger::LoggerStatus old_status = logger::logger_status;
- // Stop pushing new messages to the log queue
- logger::logger_status = logger::DeletingLoggerThread;
- log_message_loop_thread->WaitDumpQueue();
- logger::logger_status = old_status;
-}
-
-} // namespace logger
diff --git a/src/components/utils/src/qdb_wrapper/sql_database.cc b/src/components/utils/src/qdb_wrapper/sql_database.cc
index e2a51753b2..a2063de19e 100644
--- a/src/components/utils/src/qdb_wrapper/sql_database.cc
+++ b/src/components/utils/src/qdb_wrapper/sql_database.cc
@@ -37,7 +37,7 @@
namespace utils {
namespace dbms {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
SQLDatabase::SQLDatabase(const std::string& db_name)
: conn_(NULL), db_name_(db_name), error_(Error::OK) {}
@@ -101,10 +101,10 @@ qdb_hdl_t* SQLDatabase::conn() const {
bool SQLDatabase::Backup() {
if (qdb_backup(conn_, QDB_ATTACH_DEFAULT) == -1) {
error_ = Error::ERROR;
- LOG4CXX_ERROR(logger_, "Backup returned error: " << std::strerror(errno));
+ SDL_LOG_ERROR("Backup returned error: " << std::strerror(errno));
return false;
}
- LOG4CXX_INFO(logger_, "Backup was successful.");
+ SDL_LOG_INFO("Backup was successful.");
return true;
}
diff --git a/src/components/utils/src/qdb_wrapper/sql_query.cc b/src/components/utils/src/qdb_wrapper/sql_query.cc
index d101e80718..ee774d89a2 100644
--- a/src/components/utils/src/qdb_wrapper/sql_query.cc
+++ b/src/components/utils/src/qdb_wrapper/sql_query.cc
@@ -41,7 +41,7 @@
namespace utils {
namespace dbms {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
class SetBindInteger {
public:
@@ -111,7 +111,7 @@ bool SQLQuery::Prepare(const std::string& query) {
query_ = query;
statement_ = qdb_stmt_init(db_->conn(), query.c_str(), query.length() + 1);
if (statement_ == -1) {
- LOG4CXX_DEBUG(logger_, "Prepare error: " << strerror(errno));
+ SDL_LOG_DEBUG("Prepare error: " << strerror(errno));
error_ = Error::ERROR;
return false;
}
diff --git a/src/components/utils/src/resource_usage.cc b/src/components/utils/src/resource_usage.cc
index 15a8c71e70..cf08be45ce 100644
--- a/src/components/utils/src/resource_usage.cc
+++ b/src/components/utils/src/resource_usage.cc
@@ -20,19 +20,19 @@
namespace utils {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
const char* Resources::proc = "/proc/";
ResourseUsage* Resources::getCurrentResourseUsage() {
PidStats pid_stats;
if (false == GetProcInfo(pid_stats)) {
- LOG4CXX_ERROR(logger_, "Failed to get cpu proc info");
+ SDL_LOG_ERROR("Failed to get cpu proc info");
return NULL;
}
MemInfo mem_info;
if (false == GetMemInfo(mem_info)) {
- LOG4CXX_ERROR(logger_, "Failed to get memory info");
+ SDL_LOG_ERROR("Failed to get memory info");
return NULL;
}
ResourseUsage* usage = new ResourseUsage();
@@ -149,16 +149,15 @@ bool Resources::GetProcInfo(Resources::PidStats& output) {
&(output.guest_time),
&(output.cguest_time));
if (num_succes != 43) { // 43 is number of iteams in Resources::PidStats
- LOG4CXX_ERROR(logger_, "Couldn't parse all iteams in /proc/PID/stat file");
+ SDL_LOG_ERROR("Couldn't parse all iteams in /proc/PID/stat file");
return false;
}
return true;
#elif defined(__QNXNTO__)
int fd = open(GetProcPath().c_str(), O_RDONLY);
if (0 >= fd) {
- LOG4CXX_ERROR(logger_,
- "Failed open process proc file : "
- << GetProcPath() << "; error no : " << strerror(errno));
+ SDL_LOG_ERROR("Failed open process proc file : "
+ << GetProcPath() << "; error no : " << strerror(errno));
close(fd);
return false;
@@ -174,7 +173,7 @@ bool Resources::GetMemInfo(Resources::MemInfo& output) {
#if defined(OS_LINUX)
Resources::PidStats pid_stat;
if (false == GetProcInfo(pid_stat)) {
- LOG4CXX_ERROR(logger_, "Failed to get proc info");
+ SDL_LOG_ERROR("Failed to get proc info");
result = false;
} else {
output = pid_stat.vsize;
@@ -186,19 +185,19 @@ bool Resources::GetMemInfo(Resources::MemInfo& output) {
struct stat st;
struct _dir* proc_dir = 0;
if (0 == (proc_dir = opendir(proc))) {
- LOG4CXX_ERROR(logger_, "Unable to access to " << proc);
+ SDL_LOG_ERROR("Unable to access to " << proc);
result = false;
return result;
}
if (0 == readdir(proc_dir)) {
- LOG4CXX_ERROR(logger_, "Unable to read : " << proc_dir);
+ SDL_LOG_ERROR("Unable to read : " << proc_dir);
closedir(proc_dir);
result = false;
return result;
}
closedir(proc_dir);
if (-1 == stat(as_path.c_str(), &st) || 0 == st.st_size) {
- LOG4CXX_ERROR(logger_, "Unable to stat : " << as_path.c_str());
+ SDL_LOG_ERROR("Unable to stat : " << as_path.c_str());
result = false;
return result;
}
diff --git a/src/components/utils/src/rwlock_posix.cc b/src/components/utils/src/rwlock_posix.cc
index 81bf5feee1..5509449fd1 100644
--- a/src/components/utils/src/rwlock_posix.cc
+++ b/src/components/utils/src/rwlock_posix.cc
@@ -35,23 +35,23 @@
namespace sync_primitives {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
RWLock::RWLock() {
if (pthread_rwlock_init(&rwlock_, 0) != 0) {
- LOG4CXX_ERROR(logger_, "Failed to initialize rwlock");
+ SDL_LOG_ERROR("Failed to initialize rwlock");
}
}
RWLock::~RWLock() {
if (pthread_rwlock_destroy(&rwlock_) != 0) {
- LOG4CXX_ERROR(logger_, "Failed to destroy rwlock");
+ SDL_LOG_ERROR("Failed to destroy rwlock");
}
}
bool RWLock::AcquireForReading() {
if (pthread_rwlock_rdlock(&rwlock_) != 0) {
- LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for reading");
+ SDL_LOG_ERROR("Failed to acquire rwlock for reading");
return false;
}
return true;
@@ -59,7 +59,7 @@ bool RWLock::AcquireForReading() {
bool RWLock::TryAcquireForReading() {
if (pthread_rwlock_tryrdlock(&rwlock_) != 0) {
- LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for reading");
+ SDL_LOG_ERROR("Failed to acquire rwlock for reading");
return false;
}
return true;
@@ -67,7 +67,7 @@ bool RWLock::TryAcquireForReading() {
bool RWLock::AcquireForWriting() {
if (pthread_rwlock_wrlock(&rwlock_) != 0) {
- LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for writing");
+ SDL_LOG_ERROR("Failed to acquire rwlock for writing");
return false;
}
return true;
@@ -75,7 +75,7 @@ bool RWLock::AcquireForWriting() {
bool RWLock::TryAcquireForWriting() {
if (pthread_rwlock_trywrlock(&rwlock_) != 0) {
- LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for writing");
+ SDL_LOG_ERROR("Failed to acquire rwlock for writing");
return false;
}
return true;
@@ -83,7 +83,7 @@ bool RWLock::TryAcquireForWriting() {
bool RWLock::Release() {
if (pthread_rwlock_unlock(&rwlock_) != 0) {
- LOG4CXX_ERROR(logger_, "Failed to release rwlock");
+ SDL_LOG_ERROR("Failed to release rwlock");
return false;
}
return true;
diff --git a/src/components/utils/src/system.cc b/src/components/utils/src/system.cc
index 2acc7acf92..d8bd034d4a 100644
--- a/src/components/utils/src/system.cc
+++ b/src/components/utils/src/system.cc
@@ -49,7 +49,7 @@
namespace utils {
-CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
struct GetCString {
char* operator()(const std::string& string) {
@@ -96,8 +96,7 @@ bool System::Execute(bool wait) {
delete[] argv;
if (ret == -1) {
- LOG4CXX_ERROR(logger_,
- "Can't execute command: " << command_ << " Errno is: "
+ SDL_LOG_ERROR("Can't execute command: " << command_ << " Errno is: "
<< std::strerror(errno));
return false;
}
@@ -117,13 +116,13 @@ bool System::Execute(bool wait) {
switch (pid_command) {
case -1: { // Error
- LOG4CXX_FATAL(logger_, "fork() failed!");
+ SDL_LOG_FATAL("fork() failed!");
return false;
}
case 0: { // Child process
int32_t fd_dev0 = open("/dev/null", O_RDWR, S_IWRITE);
if (0 > fd_dev0) {
- LOG4CXX_FATAL(logger_, "Open dev0 failed!");
+ SDL_LOG_FATAL("Open dev0 failed!");
return false;
}
// close input/output file descriptors.
@@ -143,7 +142,7 @@ bool System::Execute(bool wait) {
// Execute the program.
if (execvp(command_.c_str(), argv) == -1) {
- LOG4CXX_ERROR(logger_, "Can't execute command: " << command_);
+ SDL_LOG_ERROR("Can't execute command: " << command_);
_exit(EXIT_FAILURE);
}
delete[] argv;
@@ -151,14 +150,14 @@ bool System::Execute(bool wait) {
return true;
}
default: { /* Parent process */
- LOG4CXX_INFO(logger_, "Process created with pid " << pid_command);
+ SDL_LOG_INFO("Process created with pid " << pid_command);
if (wait) {
int status;
pid_t wait_pid;
do {
wait_pid = waitpid(pid_command, &status, WUNTRACED | WCONTINUED);
if (wait_pid == -1) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Can't wait");
+ SDL_LOG_ERROR_WITH_ERRNO("Can't wait");
_exit(EXIT_FAILURE);
return false;
}
diff --git a/src/components/utils/src/threads/async_runner.cc b/src/components/utils/src/threads/async_runner.cc
index 740db016be..3109339340 100644
--- a/src/components/utils/src/threads/async_runner.cc
+++ b/src/components/utils/src/threads/async_runner.cc
@@ -38,28 +38,28 @@
namespace threads {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
AsyncRunner::AsyncRunner(const std::string& thread_name)
: executor_(new AsyncRunnerDelegate) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
thread_ = threads::CreateThread(thread_name.c_str(), executor_);
- thread_->start();
+ thread_->Start();
}
void AsyncRunner::AsyncRun(ThreadDelegate* delegate) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
executor_->runDelegate(delegate);
}
void AsyncRunner::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
- thread_->join();
+ SDL_LOG_AUTO_TRACE();
+ thread_->Stop(threads::Thread::kThreadStopDelegate);
}
AsyncRunner::~AsyncRunner() {
- LOG4CXX_AUTO_TRACE(logger_);
- thread_->join();
+ SDL_LOG_AUTO_TRACE();
+ thread_->Stop(threads::Thread::kThreadSoftStop);
delete executor_;
threads::DeleteThread(thread_);
}
@@ -81,7 +81,7 @@ void AsyncRunner::AsyncRunnerDelegate::processDelegate() {
}
void AsyncRunner::AsyncRunnerDelegate::waitForDelegate() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(delegates_queue_lock_);
if (!stop_flag_ && delegates_queue_.empty()) {
delegate_notifier_.Wait(lock);
@@ -89,7 +89,7 @@ void AsyncRunner::AsyncRunnerDelegate::waitForDelegate() {
}
void AsyncRunner::AsyncRunnerDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
while (!stop_flag_) {
processDelegate();
waitForDelegate();
@@ -97,14 +97,14 @@ void AsyncRunner::AsyncRunnerDelegate::threadMain() {
}
void AsyncRunner::AsyncRunnerDelegate::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(delegates_queue_lock_);
stop_flag_ = true;
delegate_notifier_.NotifyOne();
}
void AsyncRunner::AsyncRunnerDelegate::runDelegate(ThreadDelegate* delegate) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(delegates_queue_lock_);
delegates_queue_.push(delegate);
delegate_notifier_.NotifyOne();
diff --git a/src/components/utils/src/threads/pulse_thread_delegate.cc b/src/components/utils/src/threads/pulse_thread_delegate.cc
index a76b17368a..79174ae693 100644
--- a/src/components/utils/src/threads/pulse_thread_delegate.cc
+++ b/src/components/utils/src/threads/pulse_thread_delegate.cc
@@ -37,32 +37,31 @@
namespace threads {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
PulseThreadDelegate::PulseThreadDelegate() : run_(false) {
- LOG4CXX_TRACE(logger_, "Creating QNX channel");
+ SDL_LOG_TRACE("Creating QNX channel");
chid_ = ChannelCreate(0);
if (chid_ == -1) {
- LOG4CXX_ERROR(logger_, "Failed to create QNX channel");
+ SDL_LOG_ERROR("Failed to create QNX channel");
return;
}
- LOG4CXX_DEBUG(logger_, "Created QNX channel " << chid_);
+ SDL_LOG_DEBUG("Created QNX channel " << chid_);
- LOG4CXX_TRACE(logger_, "Connecting to QNX channel " << chid_);
+ SDL_LOG_TRACE("Connecting to QNX channel " << chid_);
coid_ = ConnectAttach(ND_LOCAL_NODE, 0, chid_, _NTO_SIDE_CHANNEL, 0);
if (coid_ == -1) {
- LOG4CXX_ERROR(logger_, "Failed to connect to QNX channel " << chid_);
+ SDL_LOG_ERROR("Failed to connect to QNX channel " << chid_);
return;
}
- LOG4CXX_DEBUG(logger_, "Connected to QNX channel " << chid_);
+ SDL_LOG_DEBUG("Connected to QNX channel " << chid_);
run_ = true;
}
void PulseThreadDelegate::threadMain() {
if (!Init()) {
- LOG4CXX_ERROR(logger_,
- "Failed to initialize thread for QNX channel " << chid_);
+ SDL_LOG_ERROR("Failed to initialize thread for QNX channel " << chid_);
return;
}
while (run_) {
@@ -70,9 +69,9 @@ void PulseThreadDelegate::threadMain() {
SIGEV_PULSE_INIT(&event, coid_, SIGEV_PULSE_PRIO_INHERIT, PULSE_CODE, 0);
if (ArmEvent(&event)) {
struct _pulse pulse;
- LOG4CXX_INFO(logger_, "Waiting for pulse on QNX channel " << chid_);
+ SDL_LOG_INFO("Waiting for pulse on QNX channel " << chid_);
if (MsgReceivePulse(chid_, &pulse, sizeof(pulse), 0) != -1) {
- LOG4CXX_INFO(logger_, "Received pulse on QNX channel " << chid_);
+ SDL_LOG_INFO("Received pulse on QNX channel " << chid_);
switch (pulse.code) {
case PULSE_CODE:
OnPulse();
@@ -80,12 +79,10 @@ void PulseThreadDelegate::threadMain() {
}
} else {
if (run_) {
- LOG4CXX_WARN(logger_,
- "Error occurred while waiting for pulse on QNX channel "
- << chid_);
+ SDL_LOG_WARN("Error occurred while waiting for pulse on QNX channel "
+ << chid_);
} else {
- LOG4CXX_INFO(logger_,
- "QNX channel " << chid_ << " is apparently destroyed");
+ SDL_LOG_INFO("QNX channel " << chid_ << " is apparently destroyed");
}
}
}
@@ -96,18 +93,18 @@ void PulseThreadDelegate::threadMain() {
void PulseThreadDelegate::exitThreadMain() {
run_ = false;
- LOG4CXX_TRACE(logger_, "Disconnecting from QNX channel " << chid_);
+ SDL_LOG_TRACE("Disconnecting from QNX channel " << chid_);
if (ConnectDetach(coid_) != -1) {
- LOG4CXX_DEBUG(logger_, "Disconnected from QNX channel " << chid_);
+ SDL_LOG_DEBUG("Disconnected from QNX channel " << chid_);
} else {
- LOG4CXX_WARN(logger_, "Failed to disconnect from QNX channel " << chid_);
+ SDL_LOG_WARN("Failed to disconnect from QNX channel " << chid_);
}
- LOG4CXX_TRACE(logger_, "Destroying QNX channel " << chid_);
+ SDL_LOG_TRACE("Destroying QNX channel " << chid_);
if (ChannelDestroy(chid_) != -1) { // unblocks MsgReceivePulse()
- LOG4CXX_DEBUG(logger_, "QNX channel " << chid_ << " destroyed");
+ SDL_LOG_DEBUG("QNX channel " << chid_ << " destroyed");
} else {
- LOG4CXX_WARN(logger_, "Failed to destroy QNX channel " << chid_);
+ SDL_LOG_WARN("Failed to destroy QNX channel " << chid_);
}
}
diff --git a/src/components/utils/src/threads/thread_delegate.cc b/src/components/utils/src/threads/thread_delegate.cc
index e071959522..a23f1b051e 100644
--- a/src/components/utils/src/threads/thread_delegate.cc
+++ b/src/components/utils/src/threads/thread_delegate.cc
@@ -41,7 +41,7 @@ namespace threads {
ThreadDelegate::~ThreadDelegate() {
if (thread_) {
- thread_->set_delegate(NULL);
+ thread_->SetDelegate(NULL);
}
}
@@ -50,7 +50,7 @@ void ThreadDelegate::exitThreadMain() {
if (thread_->IsCurrentThread()) {
pthread_exit(NULL);
} else {
- pthread_cancel(thread_->thread_handle());
+ pthread_cancel(thread_->ThreadHandle());
}
thread_ = NULL;
}
diff --git a/src/components/utils/src/threads/thread_manager.cc b/src/components/utils/src/threads/thread_manager.cc
index 8825510d74..466bd98dc5 100644
--- a/src/components/utils/src/threads/thread_manager.cc
+++ b/src/components/utils/src/threads/thread_manager.cc
@@ -49,6 +49,6 @@
namespace threads {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
} // namespace threads
diff --git a/src/components/utils/src/threads/thread_posix.cc b/src/components/utils/src/threads/thread_posix.cc
index 35c1cd7084..23e3da4a8d 100644
--- a/src/components/utils/src/threads/thread_posix.cc
+++ b/src/components/utils/src/threads/thread_posix.cc
@@ -53,71 +53,82 @@ const size_t THREAD_NAME_SIZE = 15;
namespace threads {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
size_t Thread::kMinStackSize =
PTHREAD_STACK_MIN; /* Ubuntu : 16384 ; QNX : 256; */
void Thread::cleanup(void* arg) {
- LOG4CXX_AUTO_TRACE(logger_);
- Thread* thread = reinterpret_cast<Thread*>(arg);
+ SDL_LOG_AUTO_TRACE();
+ Thread* thread = static_cast<Thread*>(arg);
sync_primitives::AutoLock auto_lock(thread->state_lock_);
- thread->isThreadRunning_ = false;
+ thread->thread_state_ = kThreadStateCompleted;
+ thread->thread_command_ = kThreadCommandNone;
thread->state_cond_.Broadcast();
}
void* Thread::threadFunc(void* arg) {
- // 0 - state_lock unlocked
- // stopped = 0
- // running = 0
- // finalized = 0
- // 4 - state_lock unlocked
- // stopped = 1
- // running = 1
- // finalized = 0
- // 5 - state_lock unlocked
- // stopped = 1
- // running = 1
- // finalized = 1
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-
- threads::Thread* thread = reinterpret_cast<Thread*>(arg);
+ auto thread_procedure_execution = [](Thread* thread) {
+ thread->thread_state_ = kThreadStateRunning;
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+ pthread_testcancel();
+ thread->state_lock_.Release();
+ thread->delegate_->threadMain();
+ thread->state_lock_.Acquire();
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
+ };
+
+ threads::Thread* thread = static_cast<Thread*>(arg);
DCHECK(thread);
+ thread->state_lock_.Acquire();
+
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
pthread_cleanup_push(&cleanup, thread);
- thread->state_lock_.Acquire();
thread->state_cond_.Broadcast();
- while (!thread->finalized_) {
- LOG4CXX_DEBUG(logger_, "Thread #" << pthread_self() << " iteration");
- thread->run_cond_.Wait(thread->state_lock_);
- LOG4CXX_DEBUG(logger_,
- "Thread #" << pthread_self() << " execute. "
- << "stopped_ = " << thread->stopped_
- << "; finalized_ = " << thread->finalized_);
- if (!thread->stopped_ && !thread->finalized_) {
- thread->isThreadRunning_ = true;
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
- pthread_testcancel();
-
- thread->state_lock_.Release();
- thread->delegate_->threadMain();
- thread->state_lock_.Acquire();
-
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
- thread->isThreadRunning_ = false;
+ // We have special variable for controlling iterations/exiting thread
+ // in order to separate decision logic (continue iterations or exit?)
+ // from controlling while cycle
+ bool continueIterations = true;
+
+ while (continueIterations) {
+ thread->thread_state_ = kThreadStateIdle;
+ SDL_LOG_DEBUG("Thread #" << pthread_self() << " iteration");
+ thread->state_cond_.Wait(thread->state_lock_);
+ SDL_LOG_DEBUG("Thread #"
+ << pthread_self() << " execute. "
+ << "thread_command_ = " << thread->thread_command_);
+
+ switch (thread->thread_command_) {
+ case kThreadCommandRun:
+ thread_procedure_execution(thread);
+ break;
+
+ case kThreadCommandFinalize:
+ continueIterations = false;
+ break;
+
+ default:
+ SDL_LOG_ERROR("Incorrect thread command: " << thread->thread_command_);
+ break;
}
+
+ thread->thread_command_ = kThreadCommandNone; // consumed
thread->state_cond_.Broadcast();
- LOG4CXX_DEBUG(logger_,
- "Thread #" << pthread_self() << " finished iteration");
+ SDL_LOG_DEBUG("Thread #" << pthread_self() << " finished iteration");
}
thread->state_lock_.Release();
- pthread_cleanup_pop(1);
- LOG4CXX_DEBUG(logger_,
- "Thread #" << pthread_self() << " exited successfully");
+ const auto execute_cleanup = 1;
+ // The pthread_cleanup_pop() function shall remove the routine at the top of
+ // the calling thread's cancellation cleanup stack and optionally invoke it
+ // (if execute is non-zero).
+ pthread_cleanup_pop(execute_cleanup);
+
+ SDL_LOG_DEBUG("Thread #" << pthread_self() << " exited successfully");
return NULL;
}
@@ -127,8 +138,7 @@ void Thread::SetNameForId(const PlatformThreadHandle& thread_id,
name.erase(THREAD_NAME_SIZE);
const int rc = pthread_setname_np(thread_id, name.c_str());
if (rc != EOK) {
- LOG4CXX_WARN(logger_,
- "Couldn't set pthread name \"" << name << "\", error code "
+ SDL_LOG_WARN("Couldn't set pthread name \"" << name << "\", error code "
<< rc << " (" << strerror(rc)
<< ")");
}
@@ -139,13 +149,11 @@ Thread::Thread(const char* name, ThreadDelegate* delegate)
, delegate_(delegate)
, handle_(0)
, thread_options_()
- , isThreadRunning_(0)
- , stopped_(false)
- , finalized_(false)
- , thread_created_(false) {}
+ , thread_command_(kThreadCommandNone)
+ , thread_state_(kThreadStateNone) {}
-bool Thread::start() {
- return start(thread_options_);
+bool Thread::Start() {
+ return Start(thread_options_);
}
PlatformThreadHandle Thread::CurrentId() {
@@ -153,154 +161,295 @@ PlatformThreadHandle Thread::CurrentId() {
}
bool Thread::IsCurrentThread() const {
- return pthread_equal(CurrentId(), thread_handle());
+ return pthread_equal(CurrentId(), ThreadHandle());
}
-bool Thread::start(const ThreadOptions& options) {
- LOG4CXX_AUTO_TRACE(logger_);
+bool Thread::Start(const ThreadOptions& options) {
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(state_lock_);
- // 1 - state_lock locked
- // stopped = 0
- // running = 0
if (!delegate_) {
- LOG4CXX_ERROR(logger_,
- "Cannot start thread " << name_ << ": delegate is NULL");
- // 0 - state_lock unlocked
+ SDL_LOG_ERROR("Cannot start thread " << name_ << ": delegate is NULL");
+ return false;
+ }
+
+ if (kThreadStateCompleted == thread_state_) {
+ SDL_LOG_ERROR("Cannot start thread " << name_ << ": thread completed");
return false;
}
- if (isThreadRunning_) {
- LOG4CXX_TRACE(
- logger_,
- "EXIT thread " << name_ << " #" << handle_ << " is already running");
+ if (kThreadStateRunning == thread_state_) {
+ SDL_LOG_TRACE("EXIT thread " << name_ << " #" << handle_
+ << " is already running");
return true;
}
- thread_options_ = options;
+ if (!handle_) {
+ thread_options_ = options;
+ pthread_attr_t attributes = SetThreadCreationAttributes(&thread_options_);
+
+ int pthread_result =
+ pthread_create(&handle_, &attributes, threadFunc, this);
+ pthread_attr_destroy(&attributes);
+
+ if (EOK != pthread_result) {
+ SDL_LOG_ERROR("Couldn't create thread "
+ << name_ << ". Error code = " << pthread_result << " (\""
+ << strerror(pthread_result) << "\")");
+ handle_ = 0;
+ thread_state_ = kThreadStateError;
+ return false;
+ }
+
+ SDL_LOG_DEBUG("Created thread: " << name_);
+ SetNameForId(handle_, name_);
+ // state_lock 0
+ // possible concurrencies: stop and threadFunc
+ state_cond_.Wait(auto_lock);
+ }
+
+ if (kThreadCommandFinalize == thread_command_) {
+ SDL_LOG_DEBUG("Thread " << name_ << " #" << handle_
+ << " waiting finalize.");
+ return false;
+ }
+
+ thread_command_ = kThreadCommandRun;
+ state_cond_.NotifyOne();
+
+ SDL_LOG_DEBUG("Thread " << name_ << " #" << handle_ << " started."
+ << " pthread_result = " << EOK);
+ return true;
+}
+
+void Thread::SchedYield() {
+ sched_yield();
+}
+
+bool Thread::Stop(const ThreadStopOption stop_option) {
+ SDL_LOG_AUTO_TRACE();
+ DCHECK_OR_RETURN(
+ (kThreadStopDelegate <= stop_option) && (kThreadForceStop >= stop_option),
+ false);
+ sync_primitives::AutoLock auto_lock(state_lock_);
+ thread_command_ = kThreadCommandNone; // cancel all active commands
+
+ if (!handle_ && kThreadStateError != thread_state_) {
+ SDL_LOG_WARN(
+ "Thread " << name_ << ": can't stopped,thread is not run handle_: "
+ << handle_ << " thread_state_ is: " << thread_state_);
+ return false;
+ }
+
+ if (kThreadStateError == thread_state_ ||
+ kThreadStateCompleted == thread_state_) {
+ SDL_LOG_WARN("Thread " << name_ << ": can't stopped thread_state_ is: "
+ << thread_state_);
+ return false;
+ }
+
+ SDL_LOG_DEBUG("Stopping thread #" << handle_ << " \"" << name_ << "\"");
+
+ bool result = false;
+ switch (stop_option) {
+ case kThreadStopDelegate:
+ result = StopDelegate(auto_lock);
+ break;
+ case kThreadSoftStop:
+ result = StopSoft(auto_lock);
+ break;
+ case kThreadForceStop:
+ StopForce(auto_lock);
+ result = true;
+ break;
+ default:
+ SDL_LOG_ERROR("Incorrect thread stop option: " << stop_option);
+ break;
+ }
+
+ SDL_LOG_DEBUG("Is thread stopped #" << handle_ << " \"" << name_
+ << " \": " << result);
+ return result;
+}
+
+void Thread::Join(const ThreadJoinOption join_option) {
+ SDL_LOG_AUTO_TRACE();
+ DCHECK_OR_RETURN_VOID(!IsCurrentThread());
+ DCHECK_OR_RETURN_VOID((kThreadJoinDelegate <= join_option) &&
+ (kThreadJoinThread >= join_option));
+ if (!handle_ || kThreadStateError == thread_state_) {
+ SDL_LOG_WARN("Thread " << name_ << ": is not joinable handle_: " << handle_
+ << " thread_state_ is: " << thread_state_);
+ return;
+ }
+
+ {
+ sync_primitives::AutoLock auto_lock(state_lock_);
+ JoinDelegate(auto_lock);
+ }
+
+ if (kThreadJoinDelegate == join_option) {
+ return;
+ }
+
+ SDL_LOG_DEBUG("Waiting for #" << handle_ << " to finished thread #"
+ << pthread_self());
+
+ pthread_join(handle_, NULL);
+}
+
+Thread::~Thread() {
+ Stop(kThreadForceStop);
+ Join(kThreadJoinThread);
+}
+Thread* CreateThread(const char* name, ThreadDelegate* delegate) {
+ Thread* thread = new Thread(name, delegate);
+ delegate->set_thread(thread);
+ return thread;
+}
+
+void DeleteThread(Thread* thread) {
+ delete thread;
+}
+
+pthread_attr_t Thread::SetThreadCreationAttributes(
+ ThreadOptions* thread_options) {
pthread_attr_t attributes;
int pthread_result = pthread_attr_init(&attributes);
if (pthread_result != EOK) {
- LOG4CXX_WARN(logger_,
- "Couldn't init pthread attributes. Error code = "
- << pthread_result << " (\"" << strerror(pthread_result)
- << "\")");
+ SDL_LOG_WARN("Couldn't init pthread attributes. Error code = "
+ << pthread_result << " (\"" << strerror(pthread_result)
+ << "\")");
+ }
+
+ if (!thread_options) {
+ return attributes;
}
- if (!thread_options_.is_joinable()) {
+ if (!thread_options->is_joinable()) {
+ SDL_LOG_WARN(
+ "Set state detach attribute, undefined behavior possible with "
+ "this attribute");
pthread_result =
pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
if (pthread_result != EOK) {
- LOG4CXX_WARN(logger_,
- "Couldn't set detach state attribute. Error code = "
- << pthread_result << " (\"" << strerror(pthread_result)
- << "\")");
- thread_options_.is_joinable(false);
+ SDL_LOG_WARN("Couldn't set detach state attribute. Error code = "
+ << pthread_result << " (\"" << strerror(pthread_result)
+ << "\")");
+ thread_options->is_joinable(false);
}
}
- const size_t stack_size = thread_options_.stack_size();
+ const size_t stack_size = thread_options->stack_size();
if (stack_size >= Thread::kMinStackSize) {
pthread_result = pthread_attr_setstacksize(&attributes, stack_size);
if (pthread_result != EOK) {
- LOG4CXX_WARN(logger_,
- "Couldn't set stacksize = "
- << stack_size << ". Error code = " << pthread_result
- << " (\"" << strerror(pthread_result) << "\")");
+ SDL_LOG_WARN("Couldn't set stacksize = "
+ << stack_size << ". Error code = " << pthread_result
+ << " (\"" << strerror(pthread_result) << "\")");
}
} else {
ThreadOptions thread_options_temp(Thread::kMinStackSize,
- thread_options_.is_joinable());
- thread_options_ = thread_options_temp;
+ thread_options->is_joinable());
+ *thread_options = thread_options_temp;
}
- if (!thread_created_) {
- // state_lock 1
- pthread_result = pthread_create(&handle_, &attributes, threadFunc, this);
- if (pthread_result == EOK) {
- LOG4CXX_DEBUG(logger_, "Created thread: " << name_);
- SetNameForId(handle_, name_);
- // state_lock 0
- // possible concurrencies: stop and threadFunc
- state_cond_.Wait(auto_lock);
- thread_created_ = true;
- } else {
- LOG4CXX_ERROR(logger_,
- "Couldn't create thread "
- << name_ << ". Error code = " << pthread_result
- << " (\"" << strerror(pthread_result) << "\")");
- }
- }
- stopped_ = false;
- run_cond_.NotifyOne();
- LOG4CXX_DEBUG(logger_,
- "Thread " << name_ << " #" << handle_ << " started."
- << " pthread_result = " << pthread_result);
- pthread_attr_destroy(&attributes);
- return pthread_result == EOK;
+ return attributes;
}
-void Thread::yield() {
- sched_yield();
+bool Thread::StopDelegate(sync_primitives::AutoLock& auto_lock) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (kThreadStateRunning != thread_state_) {
+ SDL_LOG_WARN("Thread " << name_ << ": task can't stopped thread_state_ is: "
+ << thread_state_);
+ return false;
+ }
+
+ if (!delegate_) {
+ SDL_LOG_WARN("Thread " << name_ << ": task can't stopped delegate is NULL");
+ return false;
+ }
+
+ delegate_->exitThreadMain();
+
+ JoinDelegate(auto_lock);
+
+ return true;
}
-void Thread::stop() {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(state_lock_);
+bool Thread::StopSoft(sync_primitives::AutoLock& auto_lock) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (kThreadStateRunning == thread_state_) {
+ bool result = StopDelegate(auto_lock);
+ if (!result) {
+ return false;
+ }
+ }
- stopped_ = true;
+ if (kThreadStateIdle != thread_state_) {
+ SDL_LOG_WARN("Thread " << name_ << ": can't stopped thread_state_ is: "
+ << thread_state_);
+ return false;
+ }
- LOG4CXX_DEBUG(logger_,
- "Stopping thread #" << handle_ << " \"" << name_ << "\"");
+ thread_command_ = kThreadCommandFinalize;
+ state_cond_.NotifyOne();
- if (delegate_ && isThreadRunning_) {
- delegate_->exitThreadMain();
+ if (!pthread_equal(pthread_self(), handle_)) {
+ SDL_LOG_DEBUG("Waiting for #" << handle_ << " last iteration in thread #"
+ << pthread_self());
+ state_cond_.Wait(auto_lock);
}
- LOG4CXX_DEBUG(logger_,
- "Stopped thread #" << handle_ << " \"" << name_ << " \"");
+ return true;
}
-void Thread::join() {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(!IsCurrentThread());
-
- stop();
+void Thread::StopForce(sync_primitives::AutoLock& auto_lock) {
+ SDL_LOG_AUTO_TRACE();
- sync_primitives::AutoLock auto_lock(state_lock_);
- run_cond_.NotifyOne();
- if (isThreadRunning_) {
- if (!pthread_equal(pthread_self(), handle_)) {
- LOG4CXX_DEBUG(logger_,
- "Waiting for #" << handle_
- << " finished iteration in thread #"
- << pthread_self());
- state_cond_.Wait(auto_lock);
+ if (kThreadStateRunning == thread_state_ ||
+ kThreadStateIdle == thread_state_) {
+ bool result = StopSoft(auto_lock);
+ if (result) {
+ return;
}
}
-}
+ // Notify not to thread but to actor
+ // that may starting this thread in race condition.
+ thread_state_ = kThreadStateCompleted;
+ state_cond_.NotifyOne();
-Thread::~Thread() {
- finalized_ = true;
- stopped_ = true;
- join();
- // in some platforms pthread_join behaviour is undefined when thread is
- // not created(pthread_create) and call pthread_join.
- if (handle_) {
- pthread_join(handle_, NULL);
+ SDL_LOG_WARN("The thread was not soft stopped, the start of a forced stop");
+
+ if (!pthread_equal(pthread_self(), handle_)) {
+ SDL_LOG_DEBUG("Thread #" << handle_ << " cancel");
+ pthread_cancel(handle_);
+ } else {
+ SDL_LOG_DEBUG("Thread #" << handle_ << " exit");
+ pthread_exit(NULL);
+ NOTREACHED();
}
}
-Thread* CreateThread(const char* name, ThreadDelegate* delegate) {
- Thread* thread = new Thread(name, delegate);
- delegate->set_thread(thread);
- return thread;
-}
+void Thread::JoinDelegate(sync_primitives::AutoLock& auto_lock) {
+ SDL_LOG_AUTO_TRACE();
+ if (kThreadStateRunning != thread_state_) {
+ SDL_LOG_WARN("Thread " << name_
+ << ": delegate is not joinable thread_state_ is: "
+ << thread_state_);
+ return;
+ }
-void DeleteThread(Thread* thread) {
- delete thread;
+ if (!pthread_equal(pthread_self(), handle_)) {
+ SDL_LOG_DEBUG("Waiting for #" << handle_
+ << " finished iteration in thread #"
+ << pthread_self());
+ state_cond_.Wait(auto_lock);
+ }
}
} // namespace threads
diff --git a/src/components/utils/src/threads/thread_validator.cc b/src/components/utils/src/threads/thread_validator.cc
index 3b753e79b5..218137127b 100644
--- a/src/components/utils/src/threads/thread_validator.cc
+++ b/src/components/utils/src/threads/thread_validator.cc
@@ -36,7 +36,7 @@
namespace threads {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
SingleThreadSimpleValidator::SingleThreadSimpleValidator()
: creation_thread_id_(Thread::CurrentId()) {}
@@ -46,13 +46,13 @@ SingleThreadSimpleValidator::~SingleThreadSimpleValidator() {}
void SingleThreadSimpleValidator::AssertRunningOnCreationThread() const {
PlatformThreadHandle current_id = Thread::CurrentId();
if (creation_thread_id_ != current_id) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
+
"Single-threaded object created at thread "
- << creation_thread_id_ << " is accessed from thread " << current_id
+ << creation_thread_id_ << " is accessed from thread " << current_id
#ifdef BACKTRACE_SUPPORT
- << "\n"
- << utils::Backtrace()
+ << "\n"
+ << utils::Backtrace()
#endif
);
}
@@ -74,12 +74,11 @@ void SingleThreadValidator::PassToThread(PlatformThreadHandle thread_id) const {
void SingleThreadValidator::AssertRunningOnValidThread() const {
PlatformThreadHandle current_id = Thread::CurrentId();
if (owning_thread_id_ != current_id) {
- LOG4CXX_ERROR(logger_,
- "Single-threaded object owned by thread "
- << owning_thread_id_ << " is accessed from thread "
- << current_id << "\n"
+ SDL_LOG_ERROR("Single-threaded object owned by thread "
+ << owning_thread_id_ << " is accessed from thread "
+ << current_id << "\n"
#ifdef BACKTRACE_SUPPORT
- << utils::Backtrace()
+ << utils::Backtrace()
#endif
);
}
diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc
index 582458e5c4..ceade03afb 100644
--- a/src/components/utils/src/timer.cc
+++ b/src/components/utils/src/timer.cc
@@ -41,7 +41,7 @@
#include "utils/threads/thread_delegate.h"
#include "utils/timer_task.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+SDL_CREATE_LOG_VARIABLE("Utils")
timer::Timer::Timer(const std::string& name, TimerTask* task)
: name_(name)
@@ -51,15 +51,15 @@ timer::Timer::Timer(const std::string& name, TimerTask* task)
, thread_(threads::CreateThread(name_.c_str(), delegate_.get()))
, single_shot_(true)
, completed_flag_(false) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
DCHECK(!name_.empty());
DCHECK(task_);
DCHECK(thread_);
- LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been created");
+ SDL_LOG_DEBUG("Timer " << name_ << " has been created");
}
timer::Timer::~Timer() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(state_lock_);
StopThread();
StopDelegate();
@@ -69,12 +69,12 @@ timer::Timer::~Timer() {
DeleteThread(thread_);
DCHECK(task_);
delete task_;
- LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been destroyed");
+ SDL_LOG_DEBUG("Timer " << name_ << " has been destroyed");
}
void timer::Timer::Start(const Milliseconds timeout,
const TimerType timer_type) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(state_lock_);
StopThread();
completed_flag_ = false;
@@ -91,16 +91,16 @@ void timer::Timer::Start(const Milliseconds timeout,
};
StartDelegate(timeout);
StartThread();
- LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been started");
+ SDL_LOG_DEBUG("Timer " << name_ << " has been started");
}
void timer::Timer::Stop() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock auto_lock(state_lock_);
StopThread();
StopDelegate();
single_shot_ = true;
- LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been stopped");
+ SDL_LOG_DEBUG("Timer " << name_ << " has been stopped");
}
bool timer::Timer::is_running() const {
@@ -134,7 +134,7 @@ void timer::Timer::StartThread() {
DCHECK_OR_RETURN_VOID(thread_);
if (!thread_->IsCurrentThread()) {
- thread_->start();
+ thread_->Start();
}
}
@@ -148,7 +148,7 @@ void timer::Timer::StopThread() {
delegate_->set_finalized_flag(true);
{
sync_primitives::AutoUnlock auto_unlock(state_lock_);
- thread_->join();
+ thread_->Stop(threads::Thread::kThreadStopDelegate);
}
delegate_->set_finalized_flag(false);
}
@@ -206,17 +206,16 @@ bool timer::Timer::TimerDelegate::finalized_flag() const {
void timer::Timer::TimerDelegate::threadMain() {
sync_primitives::AutoLock auto_lock(state_lock_ref_);
while (!stop_flag_ && !finalized_flag_) {
- LOG4CXX_DEBUG(logger_, "Milliseconds left to wait: " << timeout_);
+ SDL_LOG_DEBUG("Milliseconds left to wait: " << timeout_);
if (sync_primitives::ConditionalVariable::kTimeout ==
state_condition_.WaitFor(auto_lock, timeout_)) {
- LOG4CXX_DEBUG(logger_,
- "Timer has finished counting. Timeout (ms): " << timeout_);
+ SDL_LOG_DEBUG("Timer has finished counting. Timeout (ms): " << timeout_);
if (timer_) {
sync_primitives::AutoUnlock auto_unlock(auto_lock);
timer_->OnTimeout();
}
} else {
- LOG4CXX_DEBUG(logger_, "Timer has been force reset");
+ SDL_LOG_DEBUG("Timer has been force reset");
}
}
}
diff --git a/src/components/utils/test/CMakeLists.txt b/src/components/utils/test/CMakeLists.txt
index b5127ccabc..2db7d72d84 100644
--- a/src/components/utils/test/CMakeLists.txt
+++ b/src/components/utils/test/CMakeLists.txt
@@ -78,7 +78,6 @@ endif()
# exclude some tests
list(APPEND EXCLUDE_PATHS
generated_code_with_sqlite_test.cc
- posix_thread_test.cc
resource_usage_test.cc
)
diff --git a/src/components/utils/test/auto_trace_test.cc b/src/components/utils/test/auto_trace_test.cc
deleted file mode 100644
index 41dc90cae4..0000000000
--- a/src/components/utils/test/auto_trace_test.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <ctime>
-#include <fstream>
-
-#include "gtest/gtest.h"
-#include "utils/auto_trace.h"
-#include "utils/date_time.h"
-#include "utils/file_system.h"
-#include "utils/helpers.h"
-#include "utils/log_message_loop_thread.h"
-#include "utils/logger.h"
-#include "utils/logger_status.h"
-#include "utils/threads/message_loop_thread.h"
-#include "utils/threads/thread.h"
-
-namespace test {
-namespace components {
-namespace utils_test {
-
-using namespace ::logger;
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog")
-
-namespace {
-const std::string kFileName =
- file_system::CurrentWorkingDirectory() + "/AutoTraceTestLogFile.log";
-} // namespace
-
-void Preconditions() {
- // Delete file with previous logs
- if (file_system::FileExists(kFileName)) {
- // If logger is active now deleting log file cause undefined befaviour.
- DEINIT_LOGGER();
- ASSERT_TRUE(file_system::DeleteFile(kFileName))
- << "Can't delete AutoTraceTestLogFile.log";
- }
-}
-
-void InitLogger() {
- // Set enabled logs
- INIT_LOGGER("log4cxx.properties", true);
- // DEINIT_LOGGER will be called in test_main.cc
-}
-
-void CreateDeleteAutoTrace(const std::string& testlog) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, testlog);
-}
-
-/**
- * @brief IsLogLineContains cheks if log line contains debug message with
- * specified debug message
- * @param log_line line to search in
- * @param debug_level expected debug level
- * @param debug_log_message expected debug message
- * @return true if debug_message exist in log_line with debug_level
- */
-bool IsLogLineContains(const std::string& log_line,
- const std::string& debug_level,
- const std::string& debug_message) {
- return log_line.find(debug_level) != std::string::npos &&
- log_line.find(debug_message) != std::string::npos;
-}
-
-/**
- * @brief CheckAutoTraceDebugInFile chacks if logfile contains autotrace and
- * debug for test AutoTrace_WriteToFile_ReadCorrectString
- * @param debug_message message that should be logged with DEBUG level
- * @return true if trace enter, trace exit, debug message exist in log file
- */
-bool CheckAutoTraceDebugInFile(const std::string& debug_message) {
- using namespace helpers;
- const std::string debug_log_level = "DEBUG";
- const std::string trace_log_level = "TRACE";
- const std::string enter_message = ": Enter";
- const std::string exit_message = ": Exit";
- std::ifstream file_log(kFileName);
- if (!file_log.is_open()) {
- return false;
- }
-
- bool debug_found = false;
- bool trace_enter = false;
- bool trace_exit = false;
- for (std::string line;
- Compare<bool, EQ, ONE>(false, debug_found, trace_enter, trace_exit) &&
- getline(file_log, line);) {
- debug_found = debug_found
- ? debug_found
- : IsLogLineContains(line, debug_log_level, debug_message);
- trace_enter = trace_enter
- ? trace_enter
- : IsLogLineContains(line, trace_log_level, enter_message);
- trace_exit = trace_exit
- ? trace_exit
- : IsLogLineContains(line, trace_log_level, exit_message);
- }
- file_log.close();
- return Compare<bool, EQ, ALL>(true, debug_found, trace_enter, trace_exit);
-}
-// TODO(DTrunov) : Enable after APPLINK-25006 will be resolved
-TEST(AutoTraceTest, DISABLED_AutoTrace_WriteToFile_ReadCorrectString) {
- const std::string testlog = "Test trace is working!";
- Preconditions();
- InitLogger();
- CreateDeleteAutoTrace(testlog);
-
- FLUSH_LOGGER();
- ASSERT_TRUE(CheckAutoTraceDebugInFile(testlog));
-}
-
-} // namespace utils_test
-} // namespace components
-} // namespace test
diff --git a/src/components/utils/test/posix_thread_test.cc b/src/components/utils/test/posix_thread_test.cc
index 4bf0c8c092..2ba4e764f6 100644
--- a/src/components/utils/test/posix_thread_test.cc
+++ b/src/components/utils/test/posix_thread_test.cc
@@ -34,296 +34,354 @@
#include "utils/lock.h"
#include "utils/threads/thread.h"
-namespace test {
-namespace components {
-namespace utils_test {
+namespace threads {
using namespace sync_primitives;
-using namespace threads;
-
-// TODO(AByzhynar): Change this to use Gtest class to create all variables for
-// every TEST_F
-// TODO(AByzhynar): Add multithreading tests
namespace {
-const uint32_t MAX_SIZE = 20;
-const size_t MyStackSize = 32768;
-const char* threadName("test thread");
-const std::string test_thread_name("THREAD");
-sync_primitives::ConditionalVariable cond_var_;
-sync_primitives::Lock test_mutex_;
+const uint32_t kMaxSize = 20;
+const size_t kStackSize = 32768;
+const char* kThreadName = "test thread";
+const std::string kRenamedThreadName("THREAD");
}; // namespace
// ThreadDelegate successor
-class TestThreadDelegate : public threads::ThreadDelegate {
+class TestThreadDelegate : public ThreadDelegate {
public:
- TestThreadDelegate() : check_value_(false) {}
- void threadMain() {
+ TestThreadDelegate(const bool idle = false)
+ : idle_(idle), check_value_(false) {}
+ void threadMain() override {
AutoLock test_lock(test_mutex_);
check_value_ = true;
cond_var_.NotifyOne();
+ if (idle_) {
+ cond_var_.WaitFor(test_lock, 5000);
+ cond_var_.NotifyOne();
+ }
+ }
+
+ void exitThreadMain() override {
+ NotifyOne();
}
- bool check_value() const {
+ bool IsChangedValue() const {
return check_value_;
}
+ bool WaitFor(AutoLock& auto_lock, const uint32_t& milliseconds) {
+ return cond_var_.WaitFor(auto_lock, milliseconds);
+ }
+
+ void NotifyOne() {
+ cond_var_.NotifyOne();
+ }
+
+ Lock& GetLock() {
+ return test_mutex_;
+ }
+
private:
+ bool idle_;
bool check_value_;
+ sync_primitives::Lock test_mutex_;
+ sync_primitives::ConditionalVariable cond_var_;
};
-TEST(PosixThreadTest, CreateThread_ExpectThreadCreated) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- EXPECT_TRUE(thread != NULL);
- EXPECT_EQ(thread, threadDelegate->thread());
- EXPECT_EQ(thread->delegate(), threadDelegate);
- DeleteThread(thread);
- delete threadDelegate;
+class PosixThreadTest : public ::testing::Test {
+ public:
+ PosixThreadTest() : thread_delegate_(new TestThreadDelegate()) {
+ thread_ = CreateThread(kThreadName, thread_delegate_);
+ }
+
+ ~PosixThreadTest() {
+ thread_->Stop(Thread::kThreadForceStop);
+ delete thread_delegate_;
+ DeleteThread(thread_);
+ };
+
+ void ReplaceThreadDelegate(TestThreadDelegate* thread_delegate) {
+ EXPECT_TRUE(nullptr != thread_);
+ delete thread_->GetDelegate();
+ EXPECT_EQ(nullptr, thread_->GetDelegate());
+
+ thread_->SetDelegate(thread_delegate);
+ EXPECT_EQ(thread_delegate, thread_->GetDelegate());
+ }
+
+ protected:
+ TestThreadDelegate* thread_delegate_;
+ Thread* thread_;
+};
+
+TEST_F(PosixThreadTest, CreateThread_ExpectThreadCreated) {
+ EXPECT_TRUE(NULL != thread_);
+ EXPECT_EQ(thread_, thread_delegate_->thread());
+ EXPECT_EQ(thread_delegate_, thread_->GetDelegate());
+
+ delete thread_delegate_;
+ thread_delegate_ = nullptr;
// Check Delegate Dtor worked successfully
- EXPECT_EQ(NULL, thread->delegate());
+ EXPECT_EQ(NULL, thread_->GetDelegate());
}
-TEST(PosixThreadTest, CheckCreatedThreadName_ExpectCorrectName) {
- // Arrange
- threads::Thread* thread = NULL;
- threads::ThreadDelegate* threadDelegate = new TestThreadDelegate();
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
+TEST_F(PosixThreadTest, CheckCreatedThreadName_ExpectCorrectName) {
+ EXPECT_TRUE(NULL != thread_);
+ EXPECT_EQ(thread_, thread_delegate_->thread());
+ EXPECT_EQ(thread_delegate_, thread_->GetDelegate());
// Check thread was created with correct name
- EXPECT_EQ(threadName, thread->name());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+ EXPECT_EQ(kThreadName, thread_->GetThreadName());
}
-TEST(PosixThreadTest,
- CheckCreatedThreadNameChangeToLongName_ExpectThreadNameReduced) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize));
- // Rename started thread. Name will be cut to 15 symbols + '\0'
- // This is the limit in current POSIX thread implementation
- thread->SetNameForId(thread->thread_handle(),
- std::string("new thread with changed name"));
- // Name must be large enough to keep 16 symbols. Read previous comment
- char name[MAX_SIZE];
- int result = pthread_getname_np(thread->thread_handle(), name, sizeof(name));
- if (!result)
- EXPECT_EQ(std::string("new thread with"), std::string(name));
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+TEST_F(PosixThreadTest,
+ CheckCreatedThreadNameChangeToLongName_ExpectThreadNameReduced) {
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ thread_->Start(ThreadOptions(Thread::kMinStackSize));
+ // Rename started thread. Name will be cut to 15 symbols + '\0'
+ // This is the limit in current POSIX thread implementation
+ thread_->SetNameForId(thread_->ThreadHandle(),
+ std::string("new thread with changed name"));
+ // Name must be large enough to keep 16 symbols. Read previous comment
+ char name[kMaxSize];
+ int result =
+ pthread_getname_np(thread_->ThreadHandle(), name, sizeof(name));
+ if (!result) {
+ EXPECT_EQ(std::string("new thread with"), std::string(name));
+ }
+
+ thread_delegate_->WaitFor(test_lock, 10000);
+ }
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(
+TEST_F(
PosixThreadTest,
- StartCreatedThreadWithOptionsJoinableAndMyStackSize_ExpectMyStackSizeStackAndJoinableThreadStarted) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start thread with following options (Stack size = 32768 & thread is
- // joinable)
- thread->start(threads::ThreadOptions(MyStackSize));
- // Check thread is joinable
- EXPECT_TRUE(thread->is_joinable());
- // Check thread stack size is 32768
- EXPECT_EQ(MyStackSize, thread->stack_size());
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+ StartCreatedThreadWithOptionsJoinableAndUserStackSize_ExpectUserStackSizeStackAndJoinableThreadStarted) {
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ // Start thread with following options (Stack size = 32768 & thread is
+ // joinable)
+ thread_->Start(ThreadOptions(kStackSize));
+ // Check thread is joinable
+ EXPECT_TRUE(thread_->IsJoinable());
+ // Check thread stack size is 32768
+ EXPECT_EQ(kStackSize, thread_->StackSize());
+ thread_delegate_->WaitFor(test_lock, 10000);
+ }
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(
+TEST_F(
PosixThreadTest,
StartCreatedThreadWithDefaultOptions_ExpectZeroStackAndJoinableThreadStarted) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start thread with default options (Stack size = 0 & thread is joinable)
- thread->start(threads::ThreadOptions());
- // Check thread is joinable
- EXPECT_TRUE(thread->is_joinable());
- // Check thread stack size is minimum value. Stack can not be 0
- EXPECT_EQ(Thread::kMinStackSize, thread->stack_size());
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ // Start thread with default options (Stack size = 0 & thread is joinable)
+ thread_->Start(ThreadOptions());
+ // Check thread is joinable
+ EXPECT_TRUE(thread_->IsJoinable());
+ // Check thread stack size is minimum value. Stack can not be 0
+ EXPECT_EQ(Thread::kMinStackSize, thread_->StackSize());
+ thread_delegate_->WaitFor(test_lock, 10000);
+ }
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(
+TEST_F(
PosixThreadTest,
StartThreadWithZeroStackAndDetached_ExpectMinimumStackAndDetachedThreadStarted) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start thread with default options (Stack size = 0 & thread is detached)
- thread->start(threads::ThreadOptions(0, false));
- // Check thread is detached
- EXPECT_FALSE(thread->is_joinable());
- // Check thread stack size is 0
- EXPECT_EQ(Thread::kMinStackSize, thread->stack_size());
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ // Start thread with default options (Stack size = 0 & thread is detached)
+ thread_->Start(ThreadOptions(0, false));
+ // Check thread is detached
+ EXPECT_FALSE(thread_->IsJoinable());
+ // Check thread stack size is 0
+ EXPECT_EQ(Thread::kMinStackSize, thread_->StackSize());
+ thread_delegate_->WaitFor(test_lock, 10000);
+ }
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(
- PosixThreadTest,
- DISABLED_CheckCreatedThreadNameChangeToEmpty_ExpectThreadNameChangedToEmpty) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize));
- // Rename started thread. Name will be cut to 15 symbols + '\0'
- // This is the limit in current POSIX thread implementation
- thread->SetNameForId(thread->thread_handle(), std::string(""));
- // Name must be large enough to keep 16 symbols. Read previous comment
- char name[MAX_SIZE];
- int result = pthread_getname_np(thread->thread_handle(), name, sizeof(name));
- if (!result) {
- EXPECT_EQ(std::string(""), std::string(name));
+TEST_F(PosixThreadTest,
+ CheckCreatedThreadNameChangeToEmpty_ExpectThreadNameChangedToEmpty) {
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ thread_->Start(ThreadOptions(Thread::kMinStackSize));
+ // Rename started thread. Name will be cut to 15 symbols + '\0'
+ // This is the limit in current POSIX thread implementation
+ thread_->SetNameForId(thread_->ThreadHandle(), std::string(""));
+ // Name must be large enough to keep 16 symbols. Read previous comment
+ char name[kMaxSize];
+ int result =
+ pthread_getname_np(thread_->ThreadHandle(), name, sizeof(name));
+ if (!result) {
+ EXPECT_TRUE(std::string(name).empty());
+ }
+ thread_delegate_->WaitFor(test_lock, 10000);
}
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(PosixThreadTest,
- CheckCreatedThreadNameChangeToShortName_ExpectThreadNameChangedToShort) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start created thread
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize));
- // Rename started thread. Name will be cut to 15 symbols + '\0'
- // This is the limit in current POSIX thread implementation
- thread->SetNameForId(thread->thread_handle(), test_thread_name);
- // Name must be large enough to keep 16 symbols. Read previous comment
- char name[MAX_SIZE];
- int result = pthread_getname_np(thread->thread_handle(), name, sizeof(name));
- if (!result) {
- EXPECT_EQ(test_thread_name, std::string(name));
+TEST_F(PosixThreadTest,
+ CheckCreatedThreadNameChangeToShortName_ExpectThreadNameChangedToShort) {
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ // Start created thread
+ thread_->Start(ThreadOptions(Thread::kMinStackSize));
+ // Rename started thread. Name will be cut to 15 symbols + '\0'
+ // This is the limit in current POSIX thread implementation
+ thread_->SetNameForId(thread_->ThreadHandle(), kRenamedThreadName);
+ // Name must be large enough to keep 16 symbols. Read previous comment
+ char name[kMaxSize];
+ int result =
+ pthread_getname_np(thread_->ThreadHandle(), name, sizeof(name));
+ if (!result) {
+ EXPECT_EQ(kRenamedThreadName, std::string(name));
+ }
+ thread_delegate_->WaitFor(test_lock, 10000);
}
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(PosixThreadTest, StartThread_ExpectThreadStarted) {
- // Arrange
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start created thread
- EXPECT_TRUE(
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+TEST_F(PosixThreadTest, StartThread_ExpectThreadStarted) {
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ // Start created thread
+ EXPECT_TRUE(thread_->Start(ThreadOptions(Thread::kMinStackSize)));
+ thread_delegate_->WaitFor(test_lock, 10000);
+ }
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(PosixThreadTest, StartOneThreadTwice_ExpectTheSameThreadStartedTwice) {
- // Arrange
- PlatformThreadHandle thread1_id;
- PlatformThreadHandle thread2_id;
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start created thread
- EXPECT_TRUE(
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
- thread1_id = thread->CurrentId();
- thread->stop();
- // Try to start thread again
- EXPECT_TRUE(
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
- thread2_id = thread->CurrentId();
- EXPECT_EQ(thread1_id, thread2_id);
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+TEST_F(PosixThreadTest, StartOneThreadTwice_ExpectTheSameThreadStartedTwice) {
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ // Start created thread
+ EXPECT_TRUE(thread_->Start(ThreadOptions(Thread::kMinStackSize)));
+ auto thread1_id = thread_->CurrentId();
+ thread_delegate_->WaitFor(test_lock, 10000);
+ thread_->Join(Thread::kThreadJoinDelegate);
+ // Try to start thread again
+ EXPECT_TRUE(thread_->Start(ThreadOptions(Thread::kMinStackSize)));
+ auto thread2_id = thread_->CurrentId();
+ EXPECT_EQ(thread1_id, thread2_id);
+ thread_delegate_->WaitFor(test_lock, 10000);
+ }
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
}
-TEST(PosixThreadTest,
- StartOneThreadAgainAfterRename_ExpectRenamedThreadStarted) {
- // Arrange
- PlatformThreadHandle thread1_id;
- PlatformThreadHandle thread2_id;
- threads::Thread* thread = NULL;
- TestThreadDelegate* threadDelegate = new TestThreadDelegate();
- AutoLock test_lock(test_mutex_);
- // Create thread
- ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start created thread
- EXPECT_TRUE(
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
- thread1_id = thread->CurrentId();
- // Rename started thread. Name will be cut to 15 symbols + '\0'
- // This is the limit in current POSIX thread implementation
- thread->SetNameForId(thread->thread_handle(), test_thread_name);
- // Name must be large enough to keep 16 symbols. Read previous comment
- char name[MAX_SIZE];
- int result = pthread_getname_np(thread->thread_handle(), name, sizeof(name));
- if (!result)
- EXPECT_EQ(test_thread_name, std::string(name));
- // Stop thread
- thread->stop();
- EXPECT_TRUE(
- thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
- thread2_id = thread->CurrentId();
- // Expect the same thread started with the the same name
- EXPECT_EQ(test_thread_name, std::string(name));
- EXPECT_EQ(thread1_id, thread2_id);
- cond_var_.WaitFor(test_lock, 10000);
- EXPECT_TRUE(threadDelegate->check_value());
- DeleteThread(thread);
- delete threadDelegate;
- EXPECT_EQ(NULL, thread->delegate());
+TEST_F(PosixThreadTest,
+ StartOneThreadAgainAfterRename_ExpectRenamedThreadStarted) {
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock test_lock(lock);
+ // Start created thread
+ EXPECT_TRUE(thread_->Start(ThreadOptions(Thread::kMinStackSize)));
+ auto thread1_id = thread_->CurrentId();
+ // Rename started thread. Name will be cut to 15 symbols + '\0'
+ // This is the limit in current POSIX thread implementation
+ thread_->SetNameForId(thread_->ThreadHandle(), kThreadName);
+ // Name must be large enough to keep 16 symbols. Read previous comment
+ char name[kMaxSize];
+ int result =
+ pthread_getname_np(thread_->ThreadHandle(), name, sizeof(name));
+ if (!result) {
+ EXPECT_EQ(kThreadName, std::string(name));
+ }
+ thread_delegate_->WaitFor(test_lock, 10000);
+ thread_->Join(Thread::kThreadJoinDelegate);
+ EXPECT_TRUE(thread_->Start(ThreadOptions(Thread::kMinStackSize)));
+ auto thread2_id = thread_->CurrentId();
+ // Expect the same thread started with the the same name
+ EXPECT_EQ(kThreadName, std::string(name));
+ EXPECT_EQ(thread1_id, thread2_id);
+ thread_delegate_->WaitFor(test_lock, 10000);
+ }
+
+ EXPECT_TRUE(thread_delegate_->IsChangedValue());
+}
+
+TEST_F(PosixThreadTest, StartThreadWithNullPtrDelegate_ExpectThreadStateNone) {
+ thread_->SetDelegate(nullptr);
+ EXPECT_TRUE(nullptr != thread_);
+ EXPECT_EQ(nullptr, thread_->GetDelegate());
+
+ EXPECT_FALSE(thread_->Start());
+ EXPECT_FALSE(thread_->IsRunning());
+ EXPECT_EQ(Thread::kThreadStateNone, thread_->thread_state_);
+}
+
+TEST_F(PosixThreadTest,
+ StartThreadExecutingThreadMain_ExpectThreadStateRunning) {
+ const bool cycled_thread_main = true;
+ thread_delegate_ = new TestThreadDelegate(cycled_thread_main);
+ ReplaceThreadDelegate(thread_delegate_);
+
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock auto_lock(lock);
+ EXPECT_TRUE(thread_->Start());
+ thread_delegate_->WaitFor(auto_lock, 5000);
+ }
+
+ EXPECT_TRUE(thread_->IsRunning());
+ EXPECT_EQ(Thread::kThreadStateRunning, thread_->thread_state_);
+}
+
+TEST_F(PosixThreadTest,
+ StartThreadExecutingThreadMainCallStopDelegate_ExpectThreadStateIdle) {
+ const bool cycled_thread_main = true;
+ thread_delegate_ = new TestThreadDelegate(cycled_thread_main);
+ ReplaceThreadDelegate(thread_delegate_);
+
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock auto_lock(lock);
+ EXPECT_TRUE(thread_->Start());
+ thread_delegate_->WaitFor(auto_lock, 5000);
+ }
+
+ thread_->Stop(Thread::kThreadStopDelegate);
+
+ EXPECT_FALSE(thread_->IsRunning());
+ EXPECT_EQ(Thread::kThreadStateIdle, thread_->thread_state_);
+}
+
+TEST_F(PosixThreadTest,
+ StartThreadExecutingThreadMainCallForceStop_ExpectThreadStateCompleted) {
+ const bool cycled_thread_main = true;
+ thread_delegate_ = new TestThreadDelegate(cycled_thread_main);
+ ReplaceThreadDelegate(thread_delegate_);
+
+ {
+ auto& lock = thread_delegate_->GetLock();
+ AutoLock auto_lock(lock);
+ EXPECT_TRUE(thread_->Start());
+ thread_delegate_->WaitFor(auto_lock, 5000);
+ }
+
+ thread_->Stop(Thread::kThreadForceStop);
+ thread_->Join(Thread::kThreadJoinThread);
+
+ EXPECT_FALSE(thread_->IsRunning());
+ EXPECT_EQ(Thread::kThreadStateCompleted, thread_->thread_state_);
}
-} // namespace utils_test
-} // namespace components
-} // namespace test
+} // namespace threads
diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
index de0067bba8..73ab03f205 100755
--- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
+++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
@@ -738,19 +738,18 @@ class CodeGenerator(object):
item.name += "_history_v" + str(len(history_list)-count)
result_array.append(self._gen_schema_item_decl(item))
count += 1
- result_array.append(self._gen_history_vector_decl(history_list, x.name))
+ result_array.append(self._gen_history_vector_decl(x.name))
result = u"\n\n".join(result_array)
return result
- def _gen_history_vector_decl(self, history_list, name):
+ def _gen_history_vector_decl(self, name):
"""Generate History Vector Declaration.
Generates the declaration and initialization
of a vector of schema items
Arguments:
- history_list -> list of history items
name -> name of parent parameter name
Returns:
@@ -759,9 +758,40 @@ class CodeGenerator(object):
result_array = []
result_array.append(self._impl_code_shared_ptr_vector_template.substitute(var_name = name))
result = u"\n".join(result_array)
+ if result is not "":
+ result += u"\n\n"
return result
+ def _gen_function_history_decl(self, member):
+ """Generate History Vector Declaration for function.
+ Generates the declaration and initialization
+ of a function
+
+ Arguments:
+ member -> function member
+
+ Returns:
+ String with history array code.
+ """
+ result_array = []
+ count = 0
+ if member.history is not None:
+ history_list = member.history
+ result_array.append(self._gen_history_vector_decl(member.name))
+ for item in history_list:
+ item.name += "_history_v" + str(len(history_list)-count)
+ result_array.append(self._impl_code_item_decl_template.substitute(
+ comment="",
+ var_name=self._gen_schema_item_var_name(item),
+ item_decl=self._impl_function_schema))
+ result_array.append(self._gen_function_history_vector_item_fill(item, member.name))
+ count += 1
+
+ result = u"\n\n".join(result_array)
+ if result is not "":
+ result += u"\n\n"
+ return result
def _gen_schema_item_decl(self, member):
"""Generate schema item declaration.
@@ -777,7 +807,7 @@ class CodeGenerator(object):
"""
- return self._impl_code_item_decl_temlate.substitute(
+ return self._impl_code_item_decl_template.substitute(
comment=self._gen_comment(member, False),
var_name=self._gen_schema_item_var_name(member),
item_decl=self._gen_schema_item_decl_code(
@@ -960,6 +990,40 @@ class CodeGenerator(object):
raise GenerateError("Unexpected call to the unimplemented function.")
+ def _gen_function_member(self, member):
+ """Generate function member fill code.
+
+ Generates source code that fills new schema with items.
+
+ Keyword arguments:
+ members -- list of struct members/function parameters to process.
+
+ Returns:
+ String with function member definition fill code.
+
+ """
+ self._check_member_history(member)
+
+ if (member.since is not None):
+ if member.history is not None:
+ return self._impl_function_member_fill_template_with_version_and_history_vector.substitute(
+ schema=self._impl_function_schema,
+ since=member.since if member.since is not None else "",
+ until=member.until if member.until is not None else "",
+ deprecated=member.deprecated if member.deprecated is not None else u"false",
+ removed=member.removed if member.removed is not None else u"false",
+ vector_name=member.name)
+ else:
+ return self._impl_function_member_fill_template_with_version.substitute(
+ schema=self._impl_function_schema,
+ since=member.since if member.since is not None else "",
+ until=member.until if member.until is not None else "",
+ deprecated=member.deprecated if member.deprecated is not None else u"false",
+ removed=member.removed if member.removed is not None else u"false")
+ else:
+ return self._impl_function_member_fill_template.substitute(
+ schema=self._impl_function_schema)
+
def _check_member_history(self, member):
"""
Checks set of rules that history items are valid
@@ -1056,6 +1120,34 @@ class CodeGenerator(object):
else:
print("Warning! History item does not have any version history. Omitting " + member.name)
+ def _gen_function_history_vector_item_fill(self, member, vector_name):
+ """Generate schema item fill code for function.
+
+ Generates source code that fills history vector with item.
+
+ Keyword arguments:
+ member -- struct member/function parameter to process.
+
+ Returns:
+ String with schema item fill code.
+
+ """
+
+ if (member.since is not None or
+ member.until is not None or
+ member.deprecated is not None or
+ member.removed is not None):
+ return self._impl_code_append_history_vector_template.substitute(
+ vector_name=vector_name,
+ name=member.name,
+ mandatory=u"true",
+ since=member.since if member.since is not None else "",
+ until=member.until if member.until is not None else "",
+ deprecated=member.deprecated if member.deprecated is not None else u"false",
+ removed=member.removed if member.removed is not None else u"false")
+ else:
+ print("Warning! History item does not have any version history. Omitting " + member.name)
+
@staticmethod
def _gen_schema_item_var_name(member):
"""Generate schema item variable name.
@@ -1158,7 +1250,11 @@ class CodeGenerator(object):
schema_item_fill=self._gen_schema_items_fill(
function.params.values(), function.since, function.until, function.deprecated, function.removed),
schema_params_fill=self._gen_schema_params_fill(
- function.message_type.name)),
+ function.message_type.name),
+ function_history_fill=self._gen_function_history_decl(
+ function),
+ function_member=self._gen_function_member(
+ function)),
1))
def _gen_enums(self, enums, structs):
@@ -1831,7 +1927,7 @@ class CodeGenerator(object):
_impl_gen_schema_enum_history_map_template = string.Template(
u'''${name}_element_signatures''')
- _impl_code_item_decl_temlate = string.Template(
+ _impl_code_item_decl_template = string.Template(
u'''${comment}'''
u'''std::shared_ptr<ISchemaItem> ${var_name} = ${item_decl};''')
@@ -1874,6 +1970,17 @@ class CodeGenerator(object):
_impl_code_item_fill_template_with_version_and_history_vector = string.Template(
u'''schema_members["${name}"] = SMember(${var_name}, ${is_mandatory}, "${since}", "${until}", ${deprecated}, ${removed}, ${vector_name}_history_vector);''')
+
+ _impl_function_schema = u'''CObjectSchemaItem::create(schema_members)'''
+
+ _impl_function_member_fill_template = string.Template(
+ u'''SMember(${schema}, true)''')
+
+ _impl_function_member_fill_template_with_version = string.Template(
+ u'''SMember(${schema}, true, "${since}", "${until}", ${deprecated}, ${removed})''')
+
+ _impl_function_member_fill_template_with_version_and_history_vector = string.Template(
+ u'''SMember(${schema}, true, "${since}", "${until}", ${deprecated}, ${removed}, ${vector_name}_history_vector)''')
_function_impl_template = string.Template(
u'''CSmartSchema $namespace::$class_name::'''
@@ -1894,12 +2001,12 @@ class CodeGenerator(object):
u'''params_members;\n'''
u'''${schema_params_fill}'''
u'''\n'''
+ u'''${function_history_fill}'''
u'''Members '''
u'''root_members_map;\n'''
u'''root_members_map[ns_smart_device_link::ns_json_handler::'''
u'''strings::S_MSG_PARAMS] = '''
- u'''SMember(CObjectSchemaItem::'''
- u'''create(schema_members), true);\n'''
+ u'''${function_member};\n'''
u'''root_members_map[ns_smart_device_link::ns_json_handler::'''
u'''strings::S_PARAMS] = '''
u'''SMember(CObjectSchemaItem::'''
diff --git a/tools/policy_table_validator/main.cpp b/tools/policy_table_validator/main.cpp
index 80c5e2eddc..7e099c7ae1 100644
--- a/tools/policy_table_validator/main.cpp
+++ b/tools/policy_table_validator/main.cpp
@@ -5,6 +5,13 @@
#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/file_system.h"
+#ifdef ENABLE_LOG
+#include "utils/logger/logger_impl.h"
+#include "utils/logger/log4cxxlogger.h"
+#endif // ENABLE_LOG
+
+#include "utils/logger.h"
+
namespace policy_table = rpc::policy_table_interface_base;
enum ResultCode {
@@ -43,6 +50,17 @@ int main(int argc, char** argv) {
help();
exit(MISSED_FILE_NAME);
}
+
+#ifdef ENABLE_LOG
+ // --------------------------------------------------------------------------
+ // Logger initialization
+ // Redefine for each paticular logger implementation
+ auto logger = std::unique_ptr<logger::Log4CXXLogger>(new logger::Log4CXXLogger("log4cxx.properties"));
+ auto logger_impl = std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl());
+ logger::Logger::instance(logger_impl.get());
+ logger_impl->Init(std::move(logger));
+#endif // ENABLE_LOG
+
std::string pt_type_str = argv[1];
std::string file_name = argv[2];
std::string json_string;
@@ -51,11 +69,13 @@ int main(int argc, char** argv) {
if (rpc::policy_table_interface_base::PolicyTableType::INVALID_PT_TYPE ==
pt_type) {
std::cout << "Invalid policy table type: " << pt_type_str << std::endl;
+ SDL_DEINIT_LOGGER()
exit(PT_TYPE_ERROR);
}
bool read_result = file_system::ReadFile(file_name, json_string);
if (false == read_result) {
std::cout << "Read file error: " << file_name << std::endl;
+ SDL_DEINIT_LOGGER()
exit(READ_ERROR);
}
@@ -64,6 +84,7 @@ int main(int argc, char** argv) {
bool parse_result = reader.parse(json_string, &value);
if (false == parse_result) {
+ SDL_DEINIT_LOGGER()
exit(PARSE_ERROR);
}
std::cout << "DEFAULT_POLICY" << std::endl;
@@ -72,6 +93,7 @@ int main(int argc, char** argv) {
bool is_valid = table.is_valid();
if (true == is_valid) {
std::cout << "Table is valid" << std::endl;
+ SDL_DEINIT_LOGGER()
exit(SUCCES);
}
@@ -81,5 +103,6 @@ int main(int argc, char** argv) {
std::cout << "Errors: " << std::endl
<< rpc::PrettyFormat(report) << std::endl;
+ SDL_DEINIT_LOGGER()
return SUCCES;
}
diff --git a/tools/rpc_spec b/tools/rpc_spec
-Subproject 45cd76866b1e6dfefe185e60f97ff61dec95c6a
+Subproject 0d7185781f4dd1a316137a052e1126cdb6e3f47