diff options
author | Kozoriz <kozorizandriy@gmail.com> | 2016-04-11 16:21:12 +0300 |
---|---|---|
committer | Kozoriz <kozorizandriy@gmail.com> | 2016-04-25 12:05:00 +0300 |
commit | 2c7dc612ce41461bebc3416917d2607f24002285 (patch) | |
tree | 3dfce6575c040c3469e17ec1eab07d02c3dee92f /src | |
parent | 8b1699d3829ad4e2384788652a2102f7cd8a8bff (diff) | |
download | sdl_core-2c7dc612ce41461bebc3416917d2607f24002285.tar.gz |
Mobile commands update after removing all singletones
Diffstat (limited to 'src')
209 files changed, 1365 insertions, 1145 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h index 2c36d8425e..2b7ea2f400 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h @@ -52,7 +52,7 @@ class AddCommandRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AddCommandRequest(const MessageSharedPtr& message); + explicit AddCommandRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AddCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h index 67a49a8e17..39a10f80c7 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h @@ -51,7 +51,7 @@ class AddCommandResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AddCommandResponse(const MessageSharedPtr& message); + explicit AddCommandResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AddCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h index befeb76d9f..13b0331687 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h @@ -51,7 +51,7 @@ class AddSubMenuRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AddSubMenuRequest(const MessageSharedPtr& message); + explicit AddSubMenuRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AddSubMenuRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h index 62c404951a..da76b98a24 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h @@ -51,7 +51,7 @@ class AddSubMenuResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AddSubMenuResponse(const MessageSharedPtr& message); + explicit AddSubMenuResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AddSubMenuResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h index 02423f0630..8427509522 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h @@ -53,7 +53,7 @@ class AlertManeuverRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AlertManeuverRequest(const MessageSharedPtr& message); + explicit AlertManeuverRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AlertManeuverRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h index 5f0827699b..083519dc10 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h @@ -51,7 +51,7 @@ class AlertManeuverResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AlertManeuverResponse(const MessageSharedPtr& message); + explicit AlertManeuverResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AlertManeuverResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h index dea6790a60..49e602e9ac 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h @@ -52,7 +52,7 @@ class AlertRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AlertRequest(const MessageSharedPtr& message); + explicit AlertRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AlertRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h index 59b38933a7..3e60a879b2 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h @@ -51,7 +51,7 @@ class AlertResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AlertResponse(const MessageSharedPtr& message); + explicit AlertResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief AlertResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h index 5e12b1f08d..bb7c3a1d57 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h @@ -57,7 +57,7 @@ class ChangeRegistrationRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ChangeRegistrationRequest(const MessageSharedPtr& message); + explicit ChangeRegistrationRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ChangeRegistrationRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h index 2cac5f2d58..7bccec9502 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h @@ -51,7 +51,7 @@ class ChangeRegistrationResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ChangeRegistrationResponse(const MessageSharedPtr& message); + explicit ChangeRegistrationResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ChangeRegistrationResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h index 615416fac5..dc95581113 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h @@ -58,7 +58,7 @@ class CreateInteractionChoiceSetRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit CreateInteractionChoiceSetRequest(const MessageSharedPtr& message); + explicit CreateInteractionChoiceSetRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief CreateInteractionChoiceSetRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h index 965573f4a4..706769f982 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h @@ -51,7 +51,7 @@ class CreateInteractionChoiceSetResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit CreateInteractionChoiceSetResponse(const MessageSharedPtr& message); + explicit CreateInteractionChoiceSetResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief CreateInteractionChoiceSetResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h index bae0fedd54..6732094f2c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h @@ -51,7 +51,7 @@ class DeleteCommandRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteCommandRequest(const MessageSharedPtr& message); + explicit DeleteCommandRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h index 0fe0f0959b..52a6d8820e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h @@ -51,7 +51,7 @@ class DeleteCommandResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteCommandResponse(const MessageSharedPtr& message); + explicit DeleteCommandResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h index 4927227465..dfcc1d67ce 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h @@ -53,7 +53,7 @@ class DeleteFileRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteFileRequest(const MessageSharedPtr& message); + explicit DeleteFileRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteFileRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h index cfe6aaa4fa..b5eba3609e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h @@ -51,7 +51,7 @@ class DeleteFileResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteFileResponse(const MessageSharedPtr& message); + explicit DeleteFileResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteFileResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h index 283b882fad..861fdcee2c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h @@ -52,7 +52,7 @@ class DeleteInteractionChoiceSetRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteInteractionChoiceSetRequest(const MessageSharedPtr& message); + explicit DeleteInteractionChoiceSetRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteInteractionChoiceSetRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h index 1f641e15b3..e150a8bc9d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h @@ -51,7 +51,7 @@ class DeleteInteractionChoiceSetResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteInteractionChoiceSetResponse(const MessageSharedPtr& message); + explicit DeleteInteractionChoiceSetResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteInteractionChoiceSetResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h index 6687218051..8217a5c954 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h @@ -52,7 +52,7 @@ class DeleteSubMenuRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteSubMenuRequest(const MessageSharedPtr& message); + explicit DeleteSubMenuRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteSubMenuRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h index 0bb080e93e..83ea7452e9 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h @@ -51,7 +51,7 @@ class DeleteSubMenuResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteSubMenuResponse(const MessageSharedPtr& message); + explicit DeleteSubMenuResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DeleteSubMenuResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h index 4cda040b42..0d86fc677f 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h @@ -51,7 +51,7 @@ class DiagnosticMessageRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DiagnosticMessageRequest(const MessageSharedPtr& message); + explicit DiagnosticMessageRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DiagnosticMessageRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h index 1b6a6024f4..55fd8e3885 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h @@ -51,7 +51,7 @@ class DiagnosticMessageResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DiagnosticMessageResponse(const MessageSharedPtr& message); + explicit DiagnosticMessageResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DiagnosticMessageResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h index b628b4b85b..6fa0a8424f 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h @@ -48,7 +48,7 @@ class DialNumberRequest : public CommandRequestImpl { /** * \brief DialNumberRequest class constructor **/ - explicit DialNumberRequest(const MessageSharedPtr& message); + explicit DialNumberRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief DialNumberRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h index 6d85c14dd5..d8cca02e52 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h @@ -51,7 +51,7 @@ class DialNumberResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DialNumberResponse(const MessageSharedPtr& message); + explicit DialNumberResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief DialNumberResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h index f291f7a748..fc6776a632 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h @@ -51,7 +51,7 @@ class EndAudioPassThruRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit EndAudioPassThruRequest(const MessageSharedPtr& message); + explicit EndAudioPassThruRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief EndAudioPassThruRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h index 5ad5f85e6e..c174d4a339 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h @@ -51,7 +51,7 @@ class EndAudioPassThruResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit EndAudioPassThruResponse(const MessageSharedPtr& message); + explicit EndAudioPassThruResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief EndAudioPassThruResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h b/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h index 1fb931d508..c9b6940a86 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h @@ -45,8 +45,8 @@ class GenericResponse : public CommandResponseImpl { /** * \brief GenericResponse class constructor **/ - explicit GenericResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { + explicit GenericResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } /** diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h index d76ac253bc..d7ad6c6550 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h @@ -51,7 +51,7 @@ class GetDTCsRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit GetDTCsRequest(const MessageSharedPtr& message); + explicit GetDTCsRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief GetDTCsRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h index 69ff1fca59..6b847904aa 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h @@ -51,7 +51,7 @@ class GetDTCsResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit GetDTCsResponse(const MessageSharedPtr& message); + explicit GetDTCsResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief GetDTCsResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h index db9db7b0a7..1bcbbcf8df 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h @@ -53,7 +53,7 @@ class GetVehicleDataRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit GetVehicleDataRequest(const MessageSharedPtr& message); + explicit GetVehicleDataRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief GetVehicleDataRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h index f0306df6aa..352b43086b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h @@ -51,7 +51,7 @@ class GetVehicleDataResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit GetVehicleDataResponse(const MessageSharedPtr& message); + explicit GetVehicleDataResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief GetVehicleDataResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h index 559e92c597..5d77949352 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h @@ -47,7 +47,8 @@ public: /** * \brief GetWayPointsRequest class constructor **/ - explicit GetWayPointsRequest(const MessageSharedPtr& message); + GetWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief GetWayPointsRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h index e0e795059f..51bfdb5f83 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h @@ -48,7 +48,8 @@ public: /** * \brief GetWayPointsResponse class constructor **/ - explicit GetWayPointsResponse(const MessageSharedPtr& message); + GetWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief GetWayPointsResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h b/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h index 86171f1ff8..6c7e7ec385 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h @@ -51,7 +51,7 @@ class ListFilesRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ListFilesRequest(const MessageSharedPtr& message); + explicit ListFilesRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ListFilesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h b/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h index 6f8e80bae2..57f17cdc15 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h @@ -51,7 +51,7 @@ class ListFilesResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ListFilesResponse(const MessageSharedPtr& message); + explicit ListFilesResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ListFilesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h index 8753660470..1f101f6f0c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h @@ -52,7 +52,7 @@ class OnAppInterfaceUnregisteredNotification : public CommandNotificationImpl { * @param message Incoming SmartObject message **/ explicit OnAppInterfaceUnregisteredNotification( - const MessageSharedPtr& message); + const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnAppInterfaceUnregisteredNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h index 67bc319771..e3fc1e3b05 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h @@ -52,7 +52,7 @@ class OnAudioPassThruNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnAudioPassThruNotification(const MessageSharedPtr& message); + explicit OnAudioPassThruNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnAudioPassThruNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h index d1297ba980..ef4a543278 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h @@ -55,7 +55,7 @@ class OnButtonEventNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnButtonEventNotification(const MessageSharedPtr& message); + explicit OnButtonEventNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnButtonEventNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h index 0ebdb6d7c6..951b98400b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h @@ -55,7 +55,7 @@ class OnButtonPressNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnButtonPressNotification(const MessageSharedPtr& message); + explicit OnButtonPressNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnButtonEventCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h index 751b1e7dd2..a45c924035 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h @@ -54,7 +54,7 @@ class OnCommandNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnCommandNotification(const MessageSharedPtr& message); + explicit OnCommandNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnCommandNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h index 2f2a3c81fc..ab9231ca85 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h @@ -53,7 +53,7 @@ class OnDriverDistractionNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnDriverDistractionNotification(const MessageSharedPtr& message); + explicit OnDriverDistractionNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnDriverDistractionNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h index be83047863..334436dacd 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h @@ -52,7 +52,7 @@ class OnHashChangeNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnHashChangeNotification(const MessageSharedPtr& message); + explicit OnHashChangeNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnHashChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h index 11d82925ec..40d8f1539a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h @@ -51,7 +51,7 @@ class OnHMIStatusNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnHMIStatusNotification(const MessageSharedPtr& message); + explicit OnHMIStatusNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnHMIStatusNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h index 70a8bf745b..be5ff3a5ca 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_HMI_STATUS_NOTIFICATION_FROM_MOBILE_H_ #include "application_manager/commands/command_notification_from_mobile_impl.h" +#include "application_manager/application_manager.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -53,7 +54,8 @@ class OnHMIStatusNotificationFromMobile : * * @param message Incoming SmartObject message **/ - explicit OnHMIStatusNotificationFromMobile(const MessageSharedPtr& message); + explicit OnHMIStatusNotificationFromMobile(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnHMIStatusNotificationFromMobile class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h index e0d6a258e9..e604e57d7d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h @@ -53,7 +53,7 @@ class OnKeyBoardInputNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnKeyBoardInputNotification(const MessageSharedPtr& message); + explicit OnKeyBoardInputNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnKeyBoardInputNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h index d163114890..4cf07c9775 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h @@ -51,7 +51,7 @@ class OnLanguageChangeNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnLanguageChangeNotification(const MessageSharedPtr& message); + explicit OnLanguageChangeNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnLanguageChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h index 3cffe8ff49..35eae6cc9b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h @@ -51,7 +51,7 @@ class OnPermissionsChangeNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnPermissionsChangeNotification(const MessageSharedPtr& message); + explicit OnPermissionsChangeNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnPermissionsChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h index 7eee611700..72a098d071 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h @@ -53,7 +53,7 @@ class OnSystemRequestNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnSystemRequestNotification(const MessageSharedPtr& message); + explicit OnSystemRequestNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnSystemRequestNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h index 5c34caba36..0848de7fe3 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h @@ -51,7 +51,7 @@ class OnTBTClientStateNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnTBTClientStateNotification(const MessageSharedPtr& message); + explicit OnTBTClientStateNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnTBTClientStateNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h index 1aba3087dd..4d8d3bc627 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h @@ -53,7 +53,7 @@ class OnTouchEventNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnTouchEventNotification(const MessageSharedPtr& message); + explicit OnTouchEventNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnTouchEventNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h index 7e64f19639..6d7da7089d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h @@ -53,7 +53,7 @@ class OnVehicleDataNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnVehicleDataNotification(const MessageSharedPtr& message); + explicit OnVehicleDataNotification(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnVehicleDataNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h index 16131621ea..c48458b8bc 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h @@ -47,7 +47,8 @@ class OnWayPointChangeNotification: public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnWayPointChangeNotification(const MessageSharedPtr& message); + OnWayPointChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnWayPointChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h index 8aea1e07a0..92b051d145 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h @@ -52,7 +52,7 @@ class PerformAudioPassThruRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit PerformAudioPassThruRequest(const MessageSharedPtr& message); + explicit PerformAudioPassThruRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief PerformAudioPassThruRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h index d659e59be0..f83e7783f4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h @@ -51,7 +51,7 @@ class PerformAudioPassThruResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit PerformAudioPassThruResponse(const MessageSharedPtr& message); + explicit PerformAudioPassThruResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief PerformAudioPassThruResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h index 591a28dc01..bbb4ecf1c4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h @@ -55,7 +55,7 @@ class PerformInteractionRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit PerformInteractionRequest(const MessageSharedPtr& message); + explicit PerformInteractionRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief PerformInteractionRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h index 4ecc149fb4..1dd737afb6 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h @@ -51,7 +51,7 @@ class PerformInteractionResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit PerformInteractionResponse(const MessageSharedPtr& message); + explicit PerformInteractionResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief PerformInteractionResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h b/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h index 8a94a708a1..8c4a565016 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h @@ -36,7 +36,7 @@ #include "application_manager/commands/command_request_impl.h" #include "utils/macro.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -52,7 +52,7 @@ class PutFileRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit PutFileRequest(const MessageSharedPtr& message); + explicit PutFileRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief PutFileRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h b/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h index 89ff6ad08f..caf3fb476c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h @@ -51,7 +51,7 @@ class PutFileResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit PutFileResponse(const MessageSharedPtr& message); + explicit PutFileResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief PutFileResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h b/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h index e2e5dbf3da..a22e016eba 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h @@ -51,7 +51,7 @@ class ReadDIDRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ReadDIDRequest(const MessageSharedPtr& message); + explicit ReadDIDRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ReadDIDRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h b/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h index 80b9b5ea48..cb89595924 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h @@ -51,7 +51,7 @@ class ReadDIDResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ReadDIDResponse(const MessageSharedPtr& message); + explicit ReadDIDResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ReadDIDResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h index a3e9d89cb9..e3226434cb 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h @@ -59,7 +59,8 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { /** * \brief RegisterAppInterfaceRequest class constructor **/ - explicit RegisterAppInterfaceRequest(const MessageSharedPtr& message); + explicit RegisterAppInterfaceRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief RegisterAppInterfaceRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h index 1244cb65f8..c98a3004ba 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h @@ -47,9 +47,9 @@ class RegisterAppInterfaceResponse : public CommandResponseImpl { /** * \brief RegisterAppInterfaceResponse class constructor **/ - explicit RegisterAppInterfaceResponse(const MessageSharedPtr& response) - : CommandResponseImpl(response) { - } + explicit RegisterAppInterfaceResponse(const MessageSharedPtr& response, + ApplicationManager& application_manager) + : CommandResponseImpl(response, application_manager) {} /** * \brief RegisterAppInterfaceResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h index d7abe38c11..4e08e23edf 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h @@ -52,7 +52,7 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ResetGlobalPropertiesRequest(const MessageSharedPtr& message); + explicit ResetGlobalPropertiesRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ResetGlobalPropertiesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h index 7c0b8eb00b..ad508e9f94 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h @@ -51,7 +51,7 @@ class ResetGlobalPropertiesResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ResetGlobalPropertiesResponse(const MessageSharedPtr& message); + explicit ResetGlobalPropertiesResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ResetGlobalPropertiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h index a810f4eb2d..e8e360fa47 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h @@ -50,7 +50,7 @@ class ScrollableMessageRequest : public CommandRequestImpl { /** * @brief ScrollableMessageRequest class constructor **/ - explicit ScrollableMessageRequest(const MessageSharedPtr& message); + explicit ScrollableMessageRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SliderCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h index f0c0ea8f7a..7184574d13 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h @@ -45,7 +45,7 @@ class ScrollableMessageResponse : public CommandResponseImpl { /** * \brief ScrollableMessageResponse class constructor **/ - explicit ScrollableMessageResponse(const MessageSharedPtr& message); + explicit ScrollableMessageResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief SpeakResponseCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h b/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h index 7178514bfe..156318e1e0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h @@ -49,7 +49,7 @@ class SendLocationRequest : public CommandRequestImpl { /** * @brief SendLocationRquest class constructor */ - explicit SendLocationRequest(const MessageSharedPtr& message); + explicit SendLocationRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SendLocationRquest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h b/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h index fe88a2af29..666bbdfab2 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h @@ -45,7 +45,7 @@ class SendLocationResponse : public CommandResponseImpl { /** * @brief SendLocationResponse class constructor */ - explicit SendLocationResponse(const MessageSharedPtr& message); + explicit SendLocationResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SendLocationResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h index da21decd81..ec973a86e0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h @@ -59,7 +59,7 @@ class SetAppIconRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SetAppIconRequest(const MessageSharedPtr& message); + explicit SetAppIconRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SetIconRequest class destructor @@ -105,7 +105,7 @@ private: /** * @brief Checks, if icons saving to configured folder is enabled */ - static int8_t is_icons_saving_enabled_; + bool is_icons_saving_enabled_; }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h index 02be7fe37e..d8a768d89c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h @@ -51,7 +51,7 @@ class SetAppIconResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetAppIconResponse(const MessageSharedPtr& message); + explicit SetAppIconResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SetIconResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h index 925a1cd67f..3dabfeb794 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h @@ -51,7 +51,7 @@ class SetDisplayLayoutRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SetDisplayLayoutRequest(const MessageSharedPtr& message); + explicit SetDisplayLayoutRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SetDisplayLayoutRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h index dbf3de8d88..cb1070c5a3 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h @@ -51,7 +51,7 @@ class SetDisplayLayoutResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetDisplayLayoutResponse(const MessageSharedPtr& message); + explicit SetDisplayLayoutResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SetDisplayLayoutResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h index c9f8399cfc..71c329a862 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h @@ -51,7 +51,7 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SetGlobalPropertiesRequest(const MessageSharedPtr& message); + explicit SetGlobalPropertiesRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SetGlobalPropertiesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h index dd80e738e3..c3c8f4a2fd 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h @@ -51,7 +51,7 @@ class SetGlobalPropertiesResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetGlobalPropertiesResponse(const MessageSharedPtr& message); + explicit SetGlobalPropertiesResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SetGlobalPropertiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h index d46094032a..e4fb7a5373 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SET_ICON_REQUEST_H_ #include "application_manager/commands/command_request_impl.h" +#include "application_manager/application_manager.h" #include "utils/macro.h" namespace application_manager { @@ -59,7 +60,7 @@ class SetIconRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SetIconRequest(const MessageSharedPtr& message); + explicit SetIconRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SetIconRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h index 88dceaf5a2..4be45c8c00 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_ #include "application_manager/commands/command_response_impl.h" +#include "application_manager/application_manager.h" #include "utils/macro.h" namespace application_manager { @@ -51,7 +52,8 @@ class SetIconResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetIconResponse(const MessageSharedPtr& message); + explicit SetIconResponse(const MessageSharedPtr& message, + ApplicationManager& app_man); /** * @brief SetIconResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h index e4fae5c0b3..e23d53c60c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h @@ -49,7 +49,7 @@ class SetMediaClockRequest : public CommandRequestImpl { /** * \brief SetMediaClockRequest class constructor **/ - explicit SetMediaClockRequest(const MessageSharedPtr& message); + explicit SetMediaClockRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief ShowCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h index 46844bd2f3..95c29497f4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h @@ -45,7 +45,7 @@ class SetMediaClockTimerResponse : public CommandResponseImpl { /** * \brief SetMediaClockTimerResponse class constructor **/ - explicit SetMediaClockTimerResponse(const MessageSharedPtr& message); + explicit SetMediaClockTimerResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief SetMediaClockTimerResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h index a22ee9852a..e2da357c01 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h @@ -52,7 +52,7 @@ class ShowConstantTBTRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ShowConstantTBTRequest(const MessageSharedPtr& message); + explicit ShowConstantTBTRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ShowConstantTBTRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h index 6a102b1984..4834b93af4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h @@ -51,7 +51,7 @@ class ShowConstantTBTResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ShowConstantTBTResponse(const MessageSharedPtr& message); + explicit ShowConstantTBTResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief ShowConstantTBTResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h index 091cab3bfd..98bcf3e576 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h @@ -50,7 +50,7 @@ class ShowRequest : public CommandRequestImpl { /** * \brief ShowRequest class constructor **/ - explicit ShowRequest(const MessageSharedPtr& message); + explicit ShowRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief ShowRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_response.h b/src/components/application_manager/include/application_manager/commands/mobile/show_response.h index c327bc3b3a..a38a0990aa 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_response.h @@ -45,7 +45,7 @@ class ShowResponse : public CommandResponseImpl { /** * \brief ShowResponse class constructor **/ - explicit ShowResponse(const MessageSharedPtr& message); + explicit ShowResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief ShowResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h b/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h index de24438ddd..0c011d07b8 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h @@ -49,7 +49,7 @@ class SliderRequest : public CommandRequestImpl { /** * \brief SliderRequest class constructor **/ - explicit SliderRequest(const MessageSharedPtr& message); + explicit SliderRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief SliderRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h b/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h index 1888388e7c..0de13c6999 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h @@ -45,7 +45,7 @@ class SliderResponse : public CommandResponseImpl { /** * \brief SliderResponse class constructor **/ - explicit SliderResponse(const MessageSharedPtr& message); + explicit SliderResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief SpeakResponseCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h index 7d3b2096af..226a2f7152 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h @@ -49,7 +49,7 @@ class SpeakRequest : public CommandRequestImpl { /** * \brief SpeakRequest class constructor **/ - explicit SpeakRequest(const MessageSharedPtr& message); + explicit SpeakRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief SpeakRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h b/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h index cbf1ec40de..7b26dc585a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h @@ -45,7 +45,7 @@ class SpeakResponse : public CommandResponseImpl { /** * \brief SpeakResponse class constructor **/ - explicit SpeakResponse(const MessageSharedPtr& message); + explicit SpeakResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * \brief SpeakResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h index 12168e2473..6ea4b8fca2 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h @@ -52,7 +52,7 @@ class SubscribeButtonRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeButtonRequest(const MessageSharedPtr& message); + explicit SubscribeButtonRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SubscribeButtonRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h index 8366884540..3c9565fda7 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h @@ -51,7 +51,7 @@ class SubscribeButtonResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeButtonResponse(const MessageSharedPtr& message); + explicit SubscribeButtonResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SubscribeButtonResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h index cd3d1ff3ee..3fbd85795c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h @@ -52,7 +52,7 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeVehicleDataRequest(const MessageSharedPtr& message); + explicit SubscribeVehicleDataRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SubscribeButtonCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h index d2771c0712..3913a209d4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h @@ -51,7 +51,7 @@ class SubscribeVehicleDataResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeVehicleDataResponse(const MessageSharedPtr& message); + explicit SubscribeVehicleDataResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief UnsubscribeVehicleDataCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h index 5cc77e5bf5..166835c1ce 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h @@ -47,7 +47,8 @@ public: /** * \brief SubscribeWayPointsRequest class constructor **/ - explicit SubscribeWayPointsRequest(const MessageSharedPtr& message); + SubscribeWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SubscribeWayPointsRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h index 25acf7262b..fc2a06ea69 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h @@ -48,7 +48,8 @@ public: /** * \brief SubscribeWayPointsResponse class constructor **/ - explicit SubscribeWayPointsResponse(const MessageSharedPtr& message); + SubscribeWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SubscribeWayPointsResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/system_request.h b/src/components/application_manager/include/application_manager/commands/mobile/system_request.h index 25accb1db2..23a003bd39 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/system_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/system_request.h @@ -36,6 +36,9 @@ #include <string> #include "application_manager/commands/command_request_impl.h" +#include "application_manager/application_manager.h" +#include "application_manager/event_engine/event.h" +#include "smart_objects/smart_object.h" namespace NsSmartDeviceLink { namespace NsSmartObjects { @@ -57,7 +60,7 @@ class SystemRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SystemRequest(const MessageSharedPtr& message); + explicit SystemRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SystemRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/system_response.h b/src/components/application_manager/include/application_manager/commands/mobile/system_response.h index ca2fb99970..c126254a1f 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/system_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/system_response.h @@ -51,7 +51,7 @@ class SystemResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SystemResponse(const MessageSharedPtr& message); + explicit SystemResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief SystemResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h index a5a53736e2..c9182f739a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h @@ -49,8 +49,8 @@ class UnregisterAppInterfaceRequest : public CommandRequestImpl { /** * \brief UnregisterAppInterfaceRequest class constructor **/ - explicit UnregisterAppInterfaceRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { + explicit UnregisterAppInterfaceRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } /** diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h index 5c8928a6c8..3193e62988 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h @@ -47,9 +47,9 @@ class UnregisterAppInterfaceResponse : public CommandResponseImpl { /** * \brief UnregisterAppInterfaceResponse class constructor **/ - explicit UnregisterAppInterfaceResponse(const MessageSharedPtr& response) - : CommandResponseImpl(response) { - } + explicit UnregisterAppInterfaceResponse( + const MessageSharedPtr& response, ApplicationManager& application_manager) + : CommandResponseImpl(response, application_manager) {} /** * \brief UnregisterAppInterfaceResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h index 58c9dc8de9..d183a59a7a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h @@ -51,7 +51,7 @@ class UnsubscribeButtonRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeButtonRequest(const MessageSharedPtr& message); + explicit UnsubscribeButtonRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief UnsubscribeButtonRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h index 972da48065..7ea149bb0d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h @@ -51,7 +51,7 @@ class UnsubscribeButtonResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeButtonResponse(const MessageSharedPtr& message); + explicit UnsubscribeButtonResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief UnsubscribeButtonResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h index b560665c06..bd1d495d8a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h @@ -52,7 +52,7 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeVehicleDataRequest(const MessageSharedPtr& message); + explicit UnsubscribeVehicleDataRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief UnsubscribeVehicleDataRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h index 3fb932ecf3..00c65112af 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h @@ -51,7 +51,7 @@ class UnsubscribeVehicleDataResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeVehicleDataResponse(const MessageSharedPtr& message); + explicit UnsubscribeVehicleDataResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief UnsubscribeVehicleDataResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h index c92c55e90d..fc0cc7a982 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h @@ -44,7 +44,8 @@ public: /** * \brief UnSubscribeWayPointsRequest class constructor **/ - explicit UnSubscribeWayPointsRequest(const MessageSharedPtr& message); + UnSubscribeWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief UnSubscribeWayPointsRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h index c5a32327a1..d8b46e4dda 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h @@ -48,7 +48,8 @@ public: /** * \brief UnsubscribeWayPointsResponse class constructor **/ - explicit UnsubscribeWayPointsResponse(const MessageSharedPtr& message); + UnsubscribeWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief UnsubscribeWayPointsResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h index c65c2bc534..bf17d7ab9b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h @@ -52,7 +52,7 @@ class UpdateTurnListRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit UpdateTurnListRequest(const MessageSharedPtr& message); + explicit UpdateTurnListRequest(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief UpdateTurnListRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h index fdbf64826c..f8f41d93d0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h @@ -51,7 +51,7 @@ class UpdateTurnListResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit UpdateTurnListResponse(const MessageSharedPtr& message); + explicit UpdateTurnListResponse(const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief UpdateTurnListResponse class destructor diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc index 9079f34488..6f45826d5a 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc @@ -33,7 +33,7 @@ #include <string> #include "application_manager/commands/mobile/add_command_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application.h" #include "application_manager/message_helper.h" #include "utils/file_system.h" @@ -46,16 +46,18 @@ namespace commands { namespace custom_str = utils::custom_string; -AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) - , send_ui_(false) - , send_vr_(false) - , is_ui_received_(false) - , is_vr_received_(false) - , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} +AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), + send_ui_(false), + send_vr_(false), + is_ui_received_(false), + is_vr_received_(false), + ui_result_(hmi_apis::Common_Result::INVALID_ENUM), + vr_result_(hmi_apis::Common_Result::INVALID_ENUM) { +} -AddCommandRequest::~AddCommandRequest() {} +AddCommandRequest::~AddCommandRequest() { +} void AddCommandRequest::onTimeOut() { LOG4CXX_AUTO_TRACE(logger_); @@ -66,7 +68,7 @@ void AddCommandRequest::onTimeOut() { void AddCommandRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { @@ -76,12 +78,14 @@ void AddCommandRequest::Run() { } if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) { - mobile_apis::Result::eType verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::cmd_icon], app); + mobile_apis::Result::eType verification_result = + MessageHelper::VerifyImage((*message_)[strings::msg_params] + [strings::cmd_icon], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR( - logger_, "MessageHelper::VerifyImage return " << verification_result); + logger_, + "MessageHelper::VerifyImage return " << verification_result); SendResponse(false, verification_result); return; } @@ -94,13 +98,13 @@ void AddCommandRequest::Run() { } if (app->FindCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt())) { + (*message_)[strings::msg_params][strings::cmd_id].asUInt())) { LOG4CXX_ERROR(logger_, "INVALID_ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } - bool data_exist = false; + bool data_exist = false; if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { if (!CheckCommandName(app)) { @@ -108,22 +112,21 @@ void AddCommandRequest::Run() { return; } if (((*message_)[strings::msg_params][strings::menu_params].keyExists( - hmi_request::parent_id)) && - (0 != - (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id] - .asUInt())) { + hmi_request::parent_id)) && (0 != (*message_)[strings::msg_params] + [strings::menu_params][hmi_request::parent_id].asUInt())) { if (!CheckCommandParentId(app)) { - SendResponse( - false, mobile_apis::Result::INVALID_ID, "Parent ID doesn't exist"); + SendResponse(false, mobile_apis::Result::INVALID_ID, + "Parent ID doesn't exist"); return; } } data_exist = true; } - if (((*message_)[strings::msg_params].keyExists(strings::vr_commands)) && - ((*message_)[strings::msg_params][strings::vr_commands].length() > 0)) { + if (((*message_)[strings::msg_params].keyExists(strings::vr_commands)) + && ((*message_)[strings::msg_params] + [strings::vr_commands].length() > 0)) { + if (!CheckCommandVRSynonym(app)) { SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); return; @@ -139,16 +142,18 @@ void AddCommandRequest::Run() { } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Incoming add command has contains \t\n \\t \\n"); + LOG4CXX_ERROR(logger_, + "Incoming add command has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } - app->AddCommand((*message_)[strings::msg_params][strings::cmd_id].asUInt(), - (*message_)[strings::msg_params]); + app->AddCommand((*message_)[strings::msg_params] + [strings::cmd_id].asUInt(), + (*message_)[strings::msg_params]); - smart_objects::SmartObject ui_msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject( + smart_objects::SmartType_Map); if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { ui_msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; @@ -157,11 +162,10 @@ void AddCommandRequest::Run() { ui_msg_params[strings::app_id] = app->app_id(); - if (((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) && - ((*message_)[strings::msg_params][strings::cmd_icon].keyExists( - strings::value)) && - (0 < (*message_)[strings::msg_params][strings::cmd_icon][strings::value] - .length())) { + if ( ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) + && ((*message_)[strings::msg_params][strings::cmd_icon].keyExists(strings::value)) + && (0 < (*message_)[strings::msg_params][strings::cmd_icon] + [strings::value].length())) { ui_msg_params[strings::cmd_icon] = (*message_)[strings::msg_params][strings::cmd_icon]; } @@ -169,8 +173,8 @@ void AddCommandRequest::Run() { send_ui_ = true; } - smart_objects::SmartObject vr_msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject vr_msg_params = smart_objects::SmartObject( + smart_objects::SmartType_Map); if ((*message_)[strings::msg_params].keyExists(strings::vr_commands)) { vr_msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; @@ -203,11 +207,10 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { CommandsMap::const_iterator i = commands.begin(); uint32_t saved_parent_id = 0; uint32_t parent_id = 0; - if ((*message_)[strings::msg_params][strings::menu_params].keyExists( - hmi_request::parent_id)) { - parent_id = (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id] - .asUInt(); + if ((*message_)[strings::msg_params] + [strings::menu_params].keyExists(hmi_request::parent_id)) { + parent_id = (*message_)[strings::msg_params] + [strings::menu_params][hmi_request::parent_id].asUInt(); } for (; commands.end() != i; ++i) { @@ -217,16 +220,13 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { saved_parent_id = 0; if ((*i->second)[strings::menu_params].keyExists(hmi_request::parent_id)) { - saved_parent_id = - (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt(); + saved_parent_id = (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt(); } - if (((*i->second)[strings::menu_params][strings::menu_name].asString() == - (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name] - .asString()) && + if (((*i->second)[strings::menu_params][strings::menu_name].asString() + == (*message_)[strings::msg_params][strings::menu_params] + [strings::menu_name].asString()) && (saved_parent_id == parent_id)) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandName received" + LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandName received" " command name already exist in same level menu"); return false; } @@ -244,23 +244,23 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) { CommandsMap::const_iterator it = commands.begin(); for (; commands.end() != it; ++it) { - if (!(*it->second).keyExists(strings::vr_commands)) { + + if(!(*it->second).keyExists(strings::vr_commands)) { continue; } for (size_t i = 0; i < (*it->second)[strings::vr_commands].length(); ++i) { for (size_t j = 0; - j < (*message_)[strings::msg_params][strings::vr_commands].length(); - ++j) { + j < (*message_)[strings::msg_params][strings::vr_commands].length(); + ++j) { const custom_str::CustomString& vr_cmd_i = (*it->second)[strings::vr_commands][i].asCustomString(); const custom_str::CustomString& vr_cmd_j = - (*message_)[strings::msg_params][strings::vr_commands][j] - .asCustomString(); + (*message_)[strings::msg_params] + [strings::vr_commands][j].asCustomString(); if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandVRSynonym" + LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandVRSynonym" " received command vr synonym already exist"); return false; } @@ -277,13 +277,11 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { const int32_t parent_id = (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id] - .asInt(); + [hmi_request::parent_id].asInt(); smart_objects::SmartObject* parent = app->FindSubMenu(parent_id); if (!parent) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandParentId received" + LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandParentId received" " submenu doesn't exist"); return false; } @@ -297,7 +295,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -305,8 +303,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { } smart_objects::SmartObject msg_param(smart_objects::SmartType_Map); - msg_param[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; + msg_param[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; msg_param[strings::app_id] = application->app_id(); switch (event.id()) { @@ -333,7 +330,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); return; } } @@ -347,83 +344,93 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { } smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; + msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; msg_params[strings::app_id] = application->app_id(); mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; const bool is_vr_invalid_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::INVALID_ENUM, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + vr_result_, + hmi_apis::Common_Result::INVALID_ENUM, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); const bool is_ui_ivalid_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::INVALID_ENUM, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + ui_result_, + hmi_apis::Common_Result::INVALID_ENUM, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - const bool is_no_ui_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); + const bool is_no_ui_error = + Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + ui_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); - const bool is_no_vr_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); + const bool is_no_vr_error = + Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + vr_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); - bool result = (is_no_ui_error && is_no_vr_error) || - (is_no_ui_error && is_vr_invalid_unsupported) || - (is_no_vr_error && is_ui_ivalid_unsupported); + bool result = + (is_no_ui_error && is_no_vr_error) || + (is_no_ui_error && is_vr_invalid_unsupported) || + (is_no_vr_error && is_ui_ivalid_unsupported); const bool is_vr_or_ui_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_); + hmi_apis::Common_Result::WARNINGS, + ui_result_, + vr_result_); - if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) { + if (!result && + hmi_apis::Common_Result::REJECTED == ui_result_) { result_code = MessageHelper::HMIToMobileResult(ui_result_); } else if (is_vr_or_ui_warning) { result_code = mobile_apis::Result::WARNINGS; } else { - result_code = - MessageHelper::HMIToMobileResult(std::max(ui_result_, vr_result_)); + result_code = MessageHelper::HMIToMobileResult( + std::max(ui_result_, vr_result_)); } if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) { - const bool is_ui_not_ok = Compare<hmi_apis::Common_Result::eType, NEQ, ALL>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + const bool is_ui_not_ok = + Compare<hmi_apis::Common_Result::eType, NEQ, ALL>( + ui_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); if (is_ui_not_ok) { - result_code = ui_result_ == hmi_apis::Common_Result::REJECTED - ? mobile_apis::Result::REJECTED - : mobile_apis::Result::GENERIC_ERROR; + result_code = + ui_result_ == hmi_apis::Common_Result::REJECTED + ? mobile_apis::Result::REJECTED + : mobile_apis::Result::GENERIC_ERROR; msg_params[strings::grammar_id] = application->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - application->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); + application->RemoveCommand((*message_)[strings::msg_params] + [strings::cmd_id].asUInt()); result = false; } } - if (BothSend() && hmi_apis::Common_Result::SUCCESS == ui_result_ && - !is_no_vr_error) { - result_code = vr_result_ == hmi_apis::Common_Result::REJECTED - ? mobile_apis::Result::REJECTED - : mobile_apis::Result::GENERIC_ERROR; + if(BothSend() && + hmi_apis::Common_Result::SUCCESS == ui_result_ && + !is_no_vr_error) { + + result_code = + vr_result_ == hmi_apis::Common_Result::REJECTED + ? mobile_apis::Result::REJECTED : + mobile_apis::Result::GENERIC_ERROR; SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - application->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); + application->RemoveCommand((*message_)[strings::msg_params] + [strings::cmd_id].asUInt()); result = false; } @@ -444,8 +451,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { str = (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name] - .asCharArray(); + [strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed."); return true; @@ -457,8 +463,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() { (*message_)[strings::msg_params][strings::vr_commands].length(); for (size_t i = 0; i < len; ++i) { - str = (*message_)[strings::msg_params][strings::vr_commands][i] - .asCharArray(); + str = (*message_)[strings::msg_params] + [strings::vr_commands][i].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); return true; @@ -467,8 +473,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() { } if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) { - str = (*message_)[strings::msg_params][strings::cmd_icon][strings::value] - .asCharArray(); + str = (*message_)[strings::msg_params] + [strings::cmd_icon][strings::value].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid cmd_icon value syntax check failed"); return true; @@ -483,20 +489,19 @@ bool AddCommandRequest::BothSend() const { void AddCommandRequest::RemoveCommand() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + ApplicationSharedPtr app = application_manager_.application( + connection_key()); if (!app.valid()) { LOG4CXX_ERROR(logger_, "No application associated with session key"); return; } smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; + msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; msg_params[strings::app_id] = app->app_id(); - app->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); + app->RemoveCommand((*message_)[strings::msg_params] + [strings::cmd_id].asUInt()); if (BothSend() && !(is_vr_received_ || is_ui_received_)) { // in case we have send bth UI and VR and no one respond diff --git a/src/components/application_manager/src/commands/mobile/add_command_response.cc b/src/components/application_manager/src/commands/mobile/add_command_response.cc index 51684c065b..21f881a574 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_response.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/add_command_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } AddCommandResponse::~AddCommandResponse() { @@ -48,7 +48,7 @@ AddCommandResponse::~AddCommandResponse() { void AddCommandResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc index 6f2529bfee..c1d364b6cd 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/add_sub_menu_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application.h" #include "utils/helpers.h" @@ -40,16 +40,18 @@ namespace application_manager { namespace commands { -AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) {} +AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { +} -AddSubMenuRequest::~AddSubMenuRequest() {} +AddSubMenuRequest::~AddSubMenuRequest() { +} void AddSubMenuRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + ApplicationSharedPtr app = application_manager_.application( + connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -80,14 +82,14 @@ void AddSubMenuRequest::Run() { return; } - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = smart_objects::SmartObject( + smart_objects::SmartType_Map); msg_params[strings::menu_id] = (*message_)[strings::msg_params][strings::menu_id]; if ((*message_)[strings::msg_params].keyExists(strings::position)) { - msg_params[strings::menu_params][strings::position] = - (*message_)[strings::msg_params][strings::position]; + msg_params[strings::menu_params][strings::position] = + (*message_)[strings::msg_params][strings::position]; } msg_params[strings::menu_params][strings::menu_name] = (*message_)[strings::msg_params][strings::menu_name]; @@ -107,13 +109,14 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = + Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -121,10 +124,10 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { } if (result) { - application->AddSubMenu( - (*message_)[strings::msg_params][strings::menu_id].asInt(), - (*message_)[strings::msg_params]); - } + application->AddSubMenu((*message_)[strings::msg_params] + [strings::menu_id].asInt(), + (*message_)[strings::msg_params]); + } SendResponse(result, result_code, NULL, &(message[strings::msg_params])); if (result) { application->UpdateHash(); diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc index ff37a6a998..02672edadd 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/add_sub_menu_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { namespace commands { -AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } AddSubMenuResponse::~AddSubMenuResponse() { @@ -49,7 +49,7 @@ AddSubMenuResponse::~AddSubMenuResponse() { void AddSubMenuResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc index 5cfefd06f5..7c0c557b62 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc @@ -33,8 +33,9 @@ #include <cstring> #include <string> #include "application_manager/commands/mobile/alert_maneuver_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" +#include "application_manager/policies/policy_handler.h" #include "application_manager/message_helper.h" #include "utils/helpers.h" @@ -42,8 +43,8 @@ namespace application_manager { namespace commands { -AlertManeuverRequest::AlertManeuverRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message), +AlertManeuverRequest::AlertManeuverRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), tts_speak_result_code_(mobile_apis::Result::INVALID_ENUM), navi_alert_maneuver_result_code_(mobile_apis::Result::INVALID_ENUM) { subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); @@ -62,7 +63,7 @@ void AlertManeuverRequest::Run() { return; } - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (NULL == app.get()) { @@ -83,7 +84,7 @@ void AlertManeuverRequest::Run() { mobile_apis::Result::eType processing_result = MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager::ApplicationManagerImpl::instance()->GetPolicyHandler()); + application_manager_.GetPolicyHandler(), application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); @@ -163,7 +164,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_OnResetTimeout: { LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); - ApplicationManagerImpl::instance()->updateRequestTimeout( + application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc index 8f9c73267f..c1c2cdafc0 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/alert_maneuver_response.h" -#include "application_manager/application_manager_impl.h" + #include "interfaces/HMI_API.h" namespace application_manager { namespace commands { -AlertManeuverResponse::AlertManeuverResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +AlertManeuverResponse::AlertManeuverResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } AlertManeuverResponse::~AlertManeuverResponse() { @@ -49,7 +49,7 @@ AlertManeuverResponse::~AlertManeuverResponse() { void AlertManeuverResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc index 0ef778a128..66ce432a95 100644 --- a/src/components/application_manager/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_request.cc @@ -37,7 +37,8 @@ #include "application_manager/message_helper.h" #include "application_manager/application_impl.h" -#include "application_manager/application_manager_impl.h" + +#include "application_manager/policies/policy_handler.h" #include "utils/helpers.h" namespace application_manager { @@ -46,8 +47,8 @@ namespace commands { namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; -AlertRequest::AlertRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message), +AlertRequest::AlertRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), awaiting_ui_alert_response_(false), awaiting_tts_speak_response_(false), awaiting_tts_stop_speaking_response_(false), @@ -136,7 +137,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { << awaiting_tts_speak_response_ << " " << awaiting_tts_stop_speaking_response_ << " " << awaiting_ui_alert_response_); - ApplicationManagerImpl::instance()->updateRequestTimeout( + application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } @@ -250,7 +251,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { bool AlertRequest::Validate(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(app_id); + application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "No application associated with session key"); @@ -276,7 +277,7 @@ bool AlertRequest::Validate(uint32_t app_id) { mobile_apis::Result::eType processing_result = MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager::ApplicationManagerImpl::instance()->GetPolicyHandler()); + application_manager_.GetPolicyHandler(), application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "INVALID_DATA!"); @@ -302,7 +303,7 @@ bool AlertRequest::Validate(uint32_t app_id) { void AlertRequest::SendAlertRequest(int32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(app_id); + application_manager_.application(app_id); smart_objects::SmartObject msg_params = smart_objects::SmartObject( smart_objects::SmartType_Map); diff --git a/src/components/application_manager/src/commands/mobile/alert_response.cc b/src/components/application_manager/src/commands/mobile/alert_response.cc index dac086a8b1..5c7918731c 100644 --- a/src/components/application_manager/src/commands/mobile/alert_response.cc +++ b/src/components/application_manager/src/commands/mobile/alert_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/alert_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { -AlertResponse::AlertResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +AlertResponse::AlertResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } AlertResponse::~AlertResponse() { @@ -51,7 +51,7 @@ AlertResponse::~AlertResponse() { void AlertResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/src/commands/mobile/change_registration_request.cc index 9bee80aa7d..84ce79611a 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_request.cc @@ -34,7 +34,7 @@ #include <string.h> #include <algorithm> #include "application_manager/commands/mobile/change_registration_request.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -42,14 +42,16 @@ namespace { namespace custom_str = utils::custom_string; struct IsSameNickname { - IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {} - bool operator()(const policy::StringArray::value_type& nickname) const { - return app_id_.CompareIgnoreCase(nickname.c_str()); - } + IsSameNickname(const custom_str::CustomString& app_id): + app_id_(app_id) { + } + bool operator()(const policy::StringArray::value_type& nickname) const { + return app_id_.CompareIgnoreCase(nickname.c_str()); + } - private: - const custom_str::CustomString& app_id_; -}; + private: + const custom_str::CustomString& app_id_; + }; } namespace application_manager { @@ -57,22 +59,23 @@ namespace application_manager { namespace commands { ChangeRegistrationRequest::ChangeRegistrationRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) - , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), + ui_result_(hmi_apis::Common_Result::INVALID_ENUM), + vr_result_(hmi_apis::Common_Result::INVALID_ENUM), + tts_result_(hmi_apis::Common_Result::INVALID_ENUM) { +} -ChangeRegistrationRequest::~ChangeRegistrationRequest() {} +ChangeRegistrationRequest::~ChangeRegistrationRequest() { +} void ChangeRegistrationRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace smart_objects; - ApplicationManagerImpl* instance = ApplicationManagerImpl::instance(); - const HMICapabilities& hmi_capabilities = instance->hmi_capabilities(); + const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - ApplicationSharedPtr app = instance->application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); @@ -110,9 +113,10 @@ void ChangeRegistrationRequest::Run() { const int32_t language = msg_params[strings::language].asInt(); - if (false == (IsLanguageSupportedByUI(hmi_language) && - IsLanguageSupportedByVR(language) && - IsLanguageSupportedByTTS(language))) { + if (false == + (IsLanguageSupportedByUI(hmi_language) && + IsLanguageSupportedByVR(language) && + IsLanguageSupportedByTTS(language))) { LOG4CXX_ERROR(logger_, "Language is not supported"); SendResponse(false, mobile_apis::Result::REJECTED); return; @@ -142,10 +146,11 @@ void ChangeRegistrationRequest::Run() { ui_params[strings::ngn_media_screen_app_name] = msg_params[strings::ngn_media_screen_app_name]; app->set_ngn_media_screen_name( - msg_params[strings::ngn_media_screen_app_name]); + msg_params[strings::ngn_media_screen_app_name]); } - SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration, &ui_params, true); + SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration, + &ui_params, true); // VR processing SmartObject vr_params = SmartObject(SmartType_Map); @@ -155,9 +160,10 @@ void ChangeRegistrationRequest::Run() { vr_params[strings::app_id] = app->app_id(); if (msg_params.keyExists(strings::vr_synonyms)) { vr_params[strings::vr_synonyms] = msg_params[strings::vr_synonyms]; - app->set_vr_synonyms(msg_params[strings::vr_synonyms]); + app -> set_vr_synonyms(msg_params[strings::vr_synonyms]); } - SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration, &vr_params, true); + SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration, + &vr_params, true); // TTS processing SmartObject tts_params = SmartObject(SmartType_Map); @@ -170,17 +176,19 @@ void ChangeRegistrationRequest::Run() { app->set_tts_name(msg_params[strings::tts_name]); } - SendHMIRequest( - hmi_apis::FunctionID::TTS_ChangeRegistration, &tts_params, true); + SendHMIRequest(hmi_apis::FunctionID::TTS_ChangeRegistration, + &tts_params, true); } bool ChangeRegistrationRequest::AllHmiResponsesSuccess( - const hmi_apis::Common_Result::eType ui, - const hmi_apis::Common_Result::eType vr, - const hmi_apis::Common_Result::eType tts) { - return hmi_apis::Common_Result::SUCCESS == ui && - hmi_apis::Common_Result::SUCCESS == vr && - hmi_apis::Common_Result::SUCCESS == tts; + const hmi_apis::Common_Result::eType ui, + const hmi_apis::Common_Result::eType vr, + const hmi_apis::Common_Result::eType tts) { + + return + hmi_apis::Common_Result::SUCCESS == ui && + hmi_apis::Common_Result::SUCCESS == vr && + hmi_apis::Common_Result::SUCCESS == tts; } void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { @@ -219,7 +227,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { if (pending_requests_.IsFinal(event_id)) { ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -228,37 +236,35 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { if (hmi_apis::Common_Result::SUCCESS == ui_result_) { application->set_ui_language(static_cast<mobile_api::Language::eType>( - (*message_)[strings::msg_params][strings::hmi_display_language] - .asInt())); + (*message_)[strings::msg_params][strings::hmi_display_language].asInt())); } - if (hmi_apis::Common_Result::SUCCESS == vr_result_ || - hmi_apis::Common_Result::SUCCESS == tts_result_) { + if (hmi_apis::Common_Result::SUCCESS == vr_result_ + || hmi_apis::Common_Result::SUCCESS == tts_result_) { application->set_language(static_cast<mobile_api::Language::eType>( (*message_)[strings::msg_params][strings::language].asInt())); } - int32_t greates_result_code = - std::max(std::max(ui_result_, vr_result_), tts_result_); + int32_t greates_result_code = std::max(std::max(ui_result_, vr_result_), + tts_result_); (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::eType::ChangeRegistrationID; + mobile_apis::FunctionID::eType::ChangeRegistrationID; SendResponse(AllHmiResponsesSuccess(ui_result_, vr_result_, tts_result_), static_cast<mobile_apis::Result::eType>(greates_result_code), - NULL, - &(message[strings::msg_params])); + NULL, &(message[strings::msg_params])); } else { LOG4CXX_INFO(logger_, - "There are some pending responses from HMI." - "ChangeRegistrationRequest still waiting."); + "There are some pending responses from HMI." + "ChangeRegistrationRequest still waiting."); } } bool ChangeRegistrationRequest::IsLanguageSupportedByUI( const int32_t& hmi_display_lang) { const HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); const smart_objects::SmartObject* ui_languages = hmi_capabilities.ui_supported_languages(); @@ -281,7 +287,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI( bool ChangeRegistrationRequest::IsLanguageSupportedByVR( const int32_t& hmi_display_lang) { const HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); const smart_objects::SmartObject* vr_languages = hmi_capabilities.vr_supported_languages(); @@ -304,7 +310,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR( bool ChangeRegistrationRequest::IsLanguageSupportedByTTS( const int32_t& hmi_display_lang) { const HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); const smart_objects::SmartObject* tts_languages = hmi_capabilities.tts_supported_languages(); @@ -351,10 +357,10 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { } } - if ((*message_)[strings::msg_params].keyExists( - strings::ngn_media_screen_app_name)) { - str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] - .asCharArray(); + if ((*message_)[strings::msg_params]. + keyExists(strings::ngn_media_screen_app_name)) { + str = (*message_)[strings::msg_params] + [strings::ngn_media_screen_app_name].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid ngn_media_screen_app_name syntax check failed"); @@ -386,7 +392,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - ApplicationManagerImpl::ApplicationListAccessor accessor; + ApplicationSet accessor = application_manager_.applications().GetData(); custom_str::CustomString app_name; uint32_t app_id = connection_key(); if (msg_params.keyExists(strings::app_name)) { @@ -430,53 +436,48 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { return mobile_apis::Result::DUPLICATE_NAME; } } // end vr check - } // application for end + } // application for end return mobile_apis::Result::SUCCESS; } bool ChangeRegistrationRequest::IsNicknameAllowed( const custom_str::CustomString& app_name) const { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( - connection_key()); + ApplicationSharedPtr app = + application_manager_. + application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "Can't find appication with connection key " - << connection_key()); + LOG4CXX_ERROR(logger_, "Can't find appication with connection key " + << connection_key()); return false; } - const std::string policy_app_id = app->mobile_app_id(); + const std::string policy_app_id = app->policy_app_id(); policy::StringArray app_nicknames; policy::StringArray app_hmi_types; - const bool init_result = - application_manager::ApplicationManagerImpl::instance() - ->GetPolicyHandler() + bool init_result = application_manager_.GetPolicyHandler() .GetInitialAppData(policy_app_id, &app_nicknames, &app_hmi_types); if (!init_result) { LOG4CXX_ERROR(logger_, "Error during getting of nickname list for application " - << policy_app_id); + << policy_app_id); return false; } if (!app_nicknames.empty()) { IsSameNickname compare(app_name); - policy::StringArray::const_iterator it = - std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); + policy::StringArray::const_iterator it = std::find_if( + app_nicknames.begin(), app_nicknames.end(), compare); if (app_nicknames.end() == it) { LOG4CXX_WARN(logger_, "Application name was not found in nicknames list."); usage_statistics::AppCounter count_of_rejections_nickname_mismatch( - application_manager::ApplicationManagerImpl::instance() - ->GetPolicyHandler() - .GetStatisticManager(), + application_manager_.GetPolicyHandler().GetStatisticManager(), policy_app_id, usage_statistics::REJECTIONS_NICKNAME_MISMATCH); ++count_of_rejections_nickname_mismatch; diff --git a/src/components/application_manager/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/src/commands/mobile/change_registration_response.cc index 557614f173..0c41534e73 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_response.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/change_registration_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { ChangeRegistrationResponse::ChangeRegistrationResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } ChangeRegistrationResponse::~ChangeRegistrationResponse() { @@ -49,7 +49,7 @@ ChangeRegistrationResponse::~ChangeRegistrationResponse() { void ChangeRegistrationResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc index 9f2f0ba3a1..8f2d531032 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2016, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -31,12 +31,11 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <string.h> #include <string> #include <algorithm> #include <vector> #include "application_manager/commands/mobile/create_interaction_choice_set_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "utils/gen_hash.h" @@ -47,8 +46,8 @@ namespace application_manager { namespace commands { CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message), + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), expected_chs_count_(0), received_chs_count_(0), error_from_hmi_(false) { @@ -61,7 +60,7 @@ CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { void CreateInteractionChoiceSetRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace mobile_apis; - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( connection_key()); if (!app) { @@ -78,13 +77,13 @@ void CreateInteractionChoiceSetRequest::Run() { [strings::choice_set][i].keyExists(strings::image)) { verification_result_image = MessageHelper::VerifyImage( (*message_)[strings::msg_params][strings::choice_set] - [i][strings::image], app); + [i][strings::image], app, application_manager_); } if ((*message_)[strings::msg_params] [strings::choice_set][i].keyExists(strings::secondary_image)) { verification_result_secondary_image = MessageHelper::VerifyImage( (*message_)[strings::msg_params][strings::choice_set] - [i][strings::secondary_image], app); + [i][strings::secondary_image], app, application_manager_); } if (verification_result_image == Result::INVALID_DATA || verification_result_secondary_image == Result::INVALID_DATA) { @@ -109,7 +108,7 @@ void CreateInteractionChoiceSetRequest::Run() { SendResponse(false, result); return; } - uint32_t grammar_id = ApplicationManagerImpl::instance()->GenerateGrammarID(); + uint32_t grammar_id = application_manager_.GenerateGrammarID(); (*message_)[strings::msg_params][strings::grammar_id] = grammar_id; app->AddChoiceSet(choice_set_id_, (*message_)[strings::msg_params]); SendVRAddCommandRequests(app); @@ -304,7 +303,6 @@ void CreateInteractionChoiceSetRequest::on_event( return; } - Common_Result::eType vr_result = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -326,10 +324,9 @@ void CreateInteractionChoiceSetRequest::on_event( } } } - if (received_chs_count_ < expected_chs_count_) { - ApplicationManagerImpl::instance()->updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); LOG4CXX_DEBUG(logger_, "Timeout for request was updated"); return; } @@ -340,7 +337,6 @@ void CreateInteractionChoiceSetRequest::on_event( void CreateInteractionChoiceSetRequest::onTimeOut() { LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock error_lock(error_from_hmi_lock_); if (!error_from_hmi_) { SendResponse(false, mobile_apis::Result::GENERIC_ERROR); } @@ -350,7 +346,7 @@ void CreateInteractionChoiceSetRequest::onTimeOut() { // according to SDLAQ-CRS-2976 sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_); is_timed_out_ = true; - ApplicationManagerImpl::instance()->TerminateRequest( + application_manager_.TerminateRequest( connection_key(), correlation_id()); } @@ -358,7 +354,7 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; @@ -391,7 +387,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { SendResponse(true, mobile_apis::Result::SUCCESS); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; @@ -400,8 +396,9 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { } else { DeleteChoices(); } - ApplicationManagerImpl::instance()->TerminateRequest(connection_key(), - correlation_id()); + + application_manager_.TerminateRequest( + connection_key(), correlation_id()); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc index bc81206088..cac23a4bc9 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/create_interaction_choice_set_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() { diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc index 58fd06532a..baebbe26cd 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc @@ -32,8 +32,9 @@ */ #include "application_manager/commands/mobile/delete_command_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "utils/helpers.h" @@ -42,8 +43,8 @@ namespace application_manager { namespace commands { -DeleteCommandRequest::DeleteCommandRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message), +DeleteCommandRequest::DeleteCommandRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), is_ui_send_(false), is_vr_send_(false), is_ui_received_(false), @@ -58,7 +59,7 @@ DeleteCommandRequest::~DeleteCommandRequest() { void DeleteCommandRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr application = ApplicationManagerImpl::instance()-> + ApplicationSharedPtr application = application_manager_. application(connection_key()); if (!application) { @@ -146,7 +147,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { } ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "Application is not registered"); diff --git a/src/components/application_manager/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/src/commands/mobile/delete_command_response.cc index 75178bcb4d..c1ab1926e2 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/delete_command_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -DeleteCommandResponse::DeleteCommandResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +DeleteCommandResponse::DeleteCommandResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } DeleteCommandResponse::~DeleteCommandResponse() { @@ -48,7 +48,7 @@ DeleteCommandResponse::~DeleteCommandResponse() { void DeleteCommandResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/src/commands/mobile/delete_file_request.cc index 4c753871ce..adc4dbb776 100644 --- a/src/components/application_manager/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_file_request.cc @@ -32,17 +32,17 @@ */ #include "application_manager/commands/mobile/delete_file_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" -#include "config_profile/profile.h" + #include "utils/file_system.h" namespace application_manager { namespace commands { -DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } DeleteFileRequest::~DeleteFileRequest() { @@ -52,7 +52,7 @@ void DeleteFileRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); @@ -61,7 +61,7 @@ void DeleteFileRequest::Run() { } if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && - (profile::Profile::instance()->delete_file_in_none() <= + (application_manager_.get_settings().delete_file_in_none() <= application->delete_file_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed // DeleteFile request is limited by the configuration profile @@ -74,7 +74,7 @@ void DeleteFileRequest::Run() { (*message_)[strings::msg_params][strings::sync_file_name].asString(); std::string full_file_path = - profile::Profile::instance()->app_storage_folder() + "/"; + application_manager_.get_settings().app_storage_folder() + "/"; full_file_path += application->folder_name(); full_file_path += "/"; full_file_path += sync_file_name; diff --git a/src/components/application_manager/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/src/commands/mobile/delete_file_response.cc index 401b0ea719..f9fbd93fa2 100644 --- a/src/components/application_manager/src/commands/mobile/delete_file_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_file_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/delete_file_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { namespace commands { -DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } DeleteFileResponse::~DeleteFileResponse() { @@ -51,7 +51,7 @@ void DeleteFileResponse::Run() { uint32_t app_id = (*message_)[strings::params][strings::connection_key] .asUInt(); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(app_id); + application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "Application not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); @@ -59,9 +59,7 @@ void DeleteFileResponse::Run() { } (*message_)[strings::msg_params][strings::space_available] = - static_cast<uint32_t>( - ApplicationManagerImpl::instance()-> - GetAvailableSpaceForApp(app->folder_name())); + static_cast<uint32_t>(app->GetAvailableDiskSpace()); SendResponse((*message_)[strings::msg_params][strings::success].asBool()); } diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc index a29350b649..1a5aa490bb 100644 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/delete_interaction_choice_set_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -43,8 +43,8 @@ namespace application_manager { namespace commands { DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() { @@ -54,7 +54,7 @@ void DeleteInteractionChoiceSetRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "No application associated with connection key " diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc index f9ee513b94..1281cddf6a 100644 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/delete_interaction_choice_set_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -42,8 +42,8 @@ namespace application_manager { namespace commands { DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() { diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc index 31387ded7d..ea19cb3389 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/delete_sub_menu_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/HMI_API.h" #include "utils/helpers.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { -DeleteSubMenuRequest::DeleteSubMenuRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +DeleteSubMenuRequest::DeleteSubMenuRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } DeleteSubMenuRequest::~DeleteSubMenuRequest() { @@ -52,7 +52,7 @@ void DeleteSubMenuRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); @@ -159,7 +159,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { mobile_api::Result::WARNINGS); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc index 0c897e138c..cea087024c 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/delete_sub_menu_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -DeleteSubMenuResponse::DeleteSubMenuResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +DeleteSubMenuResponse::DeleteSubMenuResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } DeleteSubMenuResponse::~DeleteSubMenuResponse() { @@ -48,7 +48,7 @@ DeleteSubMenuResponse::~DeleteSubMenuResponse() { void DeleteSubMenuResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc index ff87779116..448c006793 100644 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc @@ -33,17 +33,17 @@ #include <algorithm> #include "application_manager/commands/mobile/diagnostic_message_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" -#include "config_profile/profile.h" + #include "interfaces/HMI_API.h" namespace application_manager { namespace commands { -DiagnosticMessageRequest::DiagnosticMessageRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +DiagnosticMessageRequest::DiagnosticMessageRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } DiagnosticMessageRequest::~DiagnosticMessageRequest() { @@ -53,7 +53,7 @@ void DiagnosticMessageRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered."); @@ -62,7 +62,7 @@ void DiagnosticMessageRequest::Run() { } const std::vector<uint32_t>& supported_diag_modes = - profile::Profile::instance()->supported_diag_modes(); + application_manager_.get_settings().supported_diag_modes(); smart_objects::SmartObject& msg_data = (*message_)[strings::msg_params][strings::message_data]; diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc index 9c399a00c8..ce987c9592 100644 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc +++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/diagnostic_message_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -DiagnosticMessageResponse::DiagnosticMessageResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +DiagnosticMessageResponse::DiagnosticMessageResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } DiagnosticMessageResponse::~DiagnosticMessageResponse() { @@ -48,7 +48,7 @@ DiagnosticMessageResponse::~DiagnosticMessageResponse() { void DiagnosticMessageResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/src/commands/mobile/dial_number_request.cc index 6e8f5e15ad..52b6b7aaeb 100644 --- a/src/components/application_manager/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/src/commands/mobile/dial_number_request.cc @@ -33,17 +33,19 @@ #include <algorithm> #include <string> #include "application_manager/commands/mobile/dial_number_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { namespace commands { -DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) {} +DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { +} -DialNumberRequest::~DialNumberRequest() {} +DialNumberRequest::~DialNumberRequest() { +} bool DialNumberRequest::Init() { LOG4CXX_AUTO_TRACE(logger_); @@ -57,13 +59,14 @@ void DialNumberRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } + std::string number = (*message_)[strings::msg_params][strings::number].asString(); if (!CheckSyntax(number)) { @@ -71,10 +74,10 @@ void DialNumberRequest::Run() { SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } + StripNumberParam(number); if (number.empty()) { - LOG4CXX_WARN(logger_, - "After strip number param is empty. Invalid incoming data"); + LOG4CXX_ERROR(logger_, "After strip number param is empty. Invalid incoming data"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -84,13 +87,14 @@ void DialNumberRequest::Run() { (*message_)[strings::msg_params][strings::number].asString(); msg_params[strings::app_id] = application->hmi_app_id(); - SendHMIRequest( - hmi_apis::FunctionID::BasicCommunication_DialNumber, &msg_params, true); + SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_DialNumber, + &msg_params, true); } void DialNumberRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -102,9 +106,9 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_DialNumber: { LOG4CXX_INFO(logger_, "Received DialNumber event"); - result_code = CommandRequestImpl::GetMobileResultCode( - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt())); + result_code = CommandRequestImpl::GetMobileResultCode( + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt())); break; } default: { @@ -129,8 +133,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { void DialNumberRequest::StripNumberParam(std::string& number) { std::size_t found = 0; - while (std::string::npos != - (found = number.find_first_not_of("+*#,;0123456789"))) { + while (std::string::npos != (found = number.find_first_not_of("0123456789*#,;+"))) { number.erase(number.begin() + found); } (*message_)[strings::msg_params][strings::number] = number; diff --git a/src/components/application_manager/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/src/commands/mobile/dial_number_response.cc index 1daab5a4e1..ae44597607 100644 --- a/src/components/application_manager/src/commands/mobile/dial_number_response.cc +++ b/src/components/application_manager/src/commands/mobile/dial_number_response.cc @@ -31,21 +31,23 @@ */ #include "application_manager/commands/mobile/dial_number_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } DialNumberResponse::~DialNumberResponse() { } void DialNumberResponse::Run() { - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + LOG4CXX_AUTO_TRACE(logger_); + + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc index 78a867a6d8..827eb25526 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/end_audio_pass_thru_request.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { EndAudioPassThruRequest::EndAudioPassThruRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } EndAudioPassThruRequest::~EndAudioPassThruRequest() { @@ -66,9 +66,9 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { if (result) { bool ended_successfully = - ApplicationManagerImpl::instance()->end_audio_pass_thru(); + application_manager_.EndAudioPassThrough(); if (ended_successfully) { - ApplicationManagerImpl::instance()->StopAudioPassThru( + application_manager_.StopAudioPassThru( connection_key()); } } diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc index 0ac1a00bd4..2f66b6e70c 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/end_audio_pass_thru_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { EndAudioPassThruResponse::EndAudioPassThruResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } EndAudioPassThruResponse::~EndAudioPassThruResponse() { @@ -49,7 +49,7 @@ EndAudioPassThruResponse::~EndAudioPassThruResponse() { void EndAudioPassThruResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/generic_response.cc b/src/components/application_manager/src/commands/mobile/generic_response.cc index 69c841b2f1..cab1779940 100644 --- a/src/components/application_manager/src/commands/mobile/generic_response.cc +++ b/src/components/application_manager/src/commands/mobile/generic_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/generic_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc index f6791759a4..4d2a3ba7a7 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/get_dtcs_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/HMI_API.h" @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { -GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } GetDTCsRequest::~GetDTCsRequest() { @@ -50,7 +50,7 @@ GetDTCsRequest::~GetDTCsRequest() { void GetDTCsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc index 523711c975..3ba11f560f 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/get_dtcs_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } GetDTCsResponse::~GetDTCsResponse() { @@ -48,7 +48,7 @@ GetDTCsResponse::~GetDTCsResponse() { void GetDTCsResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc index 6413e9d7d4..7f13fa0316 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc @@ -33,7 +33,7 @@ #include <string> #include "application_manager/commands/mobile/get_vehicle_data_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" @@ -46,10 +46,12 @@ namespace commands { namespace str = strings; #ifdef HMI_DBUS_API -GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) {} +GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { +} -GetVehicleDataRequest::~GetVehicleDataRequest() {} +GetVehicleDataRequest::~GetVehicleDataRequest() { +} void GetVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -57,7 +59,7 @@ void GetVehicleDataRequest::Run() { int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(app_id); + appplication_manager.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -69,8 +71,8 @@ void GetVehicleDataRequest::Run() { VehicleData::const_iterator it = vehicle_data.begin(); for (; vehicle_data.end() != it; ++it) { - if (true == (*message_)[str::msg_params].keyExists(it->first) && - true == (*message_)[str::msg_params][it->first].asBool()) { + if (true == (*message_)[str::msg_params].keyExists(it->first) + && true == (*message_)[str::msg_params][it->first].asBool()) { SendRequestsToHmi(app->app_id()); return; } @@ -80,44 +82,37 @@ void GetVehicleDataRequest::Run() { } namespace { -struct Subrequest { - hmi_apis::FunctionID::eType func_id; - const char* str; -}; -Subrequest subrequests[] = { - {hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps}, - {hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed}, - {hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm}, - {hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level}, - {hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState, - str::fuel_level_state}, - {hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption, - str::instant_fuel_consumption}, - {hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature, - str::external_temp}, - {hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin}, - {hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl}, - {hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure}, - {hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer}, - {hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status}, - {hmi_apis::FunctionID::VehicleInfo_GetBodyInformation, - str::body_information}, - {hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status}, - {hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking}, - {hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status}, - {hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus, - str::head_lamp_status}, - {hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque}, - {hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos}, - {hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle, - str::steering_wheel_angle}, - {hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info}, - {hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status}, - {hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event}, - {hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus, - str::cluster_mode_status}, - {hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key}, -}; + struct Subrequest { + hmi_apis::FunctionID::eType func_id; + const char* str; + }; + Subrequest subrequests[] = { + { hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps}, + { hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed}, + { hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm}, + { hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level}, + { hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState, str::fuel_level_state}, + { hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption, str::instant_fuel_consumption}, + { hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature, str::external_temp}, + { hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin}, + { hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl}, + { hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure}, + { hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer}, + { hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status}, + { hmi_apis::FunctionID::VehicleInfo_GetBodyInformation, str::body_information}, + { hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status}, + { hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking}, + { hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status}, + { hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus, str::head_lamp_status}, + { hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque}, + { hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos}, + { hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle, str::steering_wheel_angle}, + { hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info}, + { hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status}, + { hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event}, + { hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus, str::cluster_mode_status}, + { hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key}, + }; } void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { @@ -126,8 +121,8 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) { const Subrequest& sr = subrequests[i]; - if (true == (*message_)[str::msg_params].keyExists(sr.str) && - true == (*message_)[str::msg_params][sr.str].asBool()) { + if (true == (*message_)[str::msg_params].keyExists(sr.str) + && true == (*message_)[str::msg_params][sr.str].asBool()) { HmiRequest hmi_request; hmi_request.str = sr.str; hmi_request.func_id = sr.func_id; @@ -140,8 +135,7 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { hmi_requests_.size() << " requests are going to be sent to HMI"); for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { + it != hmi_requests_.end(); ++it) { SendHMIRequest(it->func_id, &msg_params, true); } } @@ -156,8 +150,9 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { ++it) { HmiRequest& hmi_request = *it; if (hmi_request.func_id == event.id()) { - hmi_request.status = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + hmi_request.status = + static_cast<hmi_apis::Common_Result::eType>(message[strings::params][hmi_response::code] + .asInt()); if (hmi_apis::Common_Result::SUCCESS == hmi_request.status) hmi_request.value = message[str::msg_params][hmi_request.str]; hmi_request.complete = true; @@ -211,18 +206,17 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { } } #else -GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) {} +GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { +} GetVehicleDataRequest::~GetVehicleDataRequest() {} void GetVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - int32_t app_id = - (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(app_id); + int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); + ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -296,8 +290,8 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { } } -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API -} // namespace commands +} // namespace commands -} // namespace application_manager +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc index 5491e9b1aa..138016832a 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/get_vehicle_data_response.h" -#include "application_manager/application_manager_impl.h" + #include "interfaces/HMI_API.h" namespace application_manager { namespace commands { -GetVehicleDataResponse::GetVehicleDataResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +GetVehicleDataResponse::GetVehicleDataResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } GetVehicleDataResponse::~GetVehicleDataResponse() { @@ -49,7 +49,7 @@ GetVehicleDataResponse::~GetVehicleDataResponse() { void GetVehicleDataResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc index 3c927959ca..c7d73288cc 100644 --- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc @@ -1,12 +1,13 @@ -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/commands/mobile/get_way_points_request.h" namespace application_manager { namespace commands { -GetWayPointsRequest::GetWayPointsRequest(const MessageSharedPtr& message) - :CommandRequestImpl(message){ +GetWayPointsRequest::GetWayPointsRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + :CommandRequestImpl(message, application_manager){ } GetWayPointsRequest::~GetWayPointsRequest() {} @@ -15,7 +16,7 @@ void GetWayPointsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( connection_key()); if (!app) { @@ -31,7 +32,7 @@ void GetWayPointsRequest::Run() { void GetWayPointsRequest::on_event(const event_engine::Event& event) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( connection_key()); const smart_objects::SmartObject &message = event.smart_object(); switch(event.id()) { diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc index a8cc574ca1..615a0996a5 100644 --- a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc @@ -1,4 +1,4 @@ -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/commands/mobile/get_way_points_response.h" namespace application_manager { @@ -6,8 +6,8 @@ namespace application_manager { namespace commands { GetWayPointsResponse::GetWayPointsResponse( - const MessageSharedPtr &message) - : CommandResponseImpl(message) { + const MessageSharedPtr &message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } GetWayPointsResponse::~GetWayPointsResponse() { @@ -16,7 +16,7 @@ GetWayPointsResponse::~GetWayPointsResponse() { void GetWayPointsResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/list_files_request.cc b/src/components/application_manager/src/commands/mobile/list_files_request.cc index 49cb936d3a..7410c12a05 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_request.cc @@ -33,9 +33,9 @@ #include <string> #include "application_manager/commands/mobile/list_files_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" -#include "config_profile/profile.h" + #include "application_manager/mobile_command_factory.h" #include "utils/file_system.h" @@ -43,8 +43,8 @@ namespace application_manager { namespace commands { -ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } ListFilesRequest::~ListFilesRequest() { @@ -54,7 +54,7 @@ void ListFilesRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); @@ -63,7 +63,7 @@ void ListFilesRequest::Run() { } if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && - (profile::Profile::instance()->list_files_in_none() <= + (application_manager_.get_settings().list_files_in_none() <= application->list_files_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed // DeleteFile request is limited by the configuration profile @@ -75,8 +75,7 @@ void ListFilesRequest::Run() { application->increment_list_files_in_none_count(); (*message_)[strings::msg_params][strings::space_available] = - static_cast<int32_t>(ApplicationManagerImpl::instance()-> - GetAvailableSpaceForApp(application->folder_name())); + static_cast<int32_t>(application->GetAvailableDiskSpace()); uint32_t i = 0; const AppFilesMap& app_files = application->getAppFiles(); for (AppFilesMap::const_iterator it = app_files.begin(); @@ -85,7 +84,7 @@ void ListFilesRequest::Run() { // In AppFile to application stored full path to file. In message required // to write only name file. // Plus one required for move to next letter after '/'. - if (i < ::profile::Profile::instance()->list_files_response_size()) { + if (i < application_manager_.get_settings().list_files_response_size()) { LOG4CXX_DEBUG(logger_, "File " + filename + " added to ListFiles response"); (*message_)[strings::msg_params][strings::filenames][i++] = filename; } else { diff --git a/src/components/application_manager/src/commands/mobile/list_files_response.cc b/src/components/application_manager/src/commands/mobile/list_files_response.cc index 42bd1e6f07..8517d37b0d 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_response.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/list_files_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { namespace commands { -ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } ListFilesResponse::~ListFilesResponse() { @@ -49,7 +49,7 @@ ListFilesResponse::~ListFilesResponse() { void ListFilesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc index e3e51faa6e..b7a26df478 100644 --- a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc @@ -39,8 +39,8 @@ namespace application_manager { namespace commands { OnAppInterfaceUnregisteredNotification::OnAppInterfaceUnregisteredNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnAppInterfaceUnregisteredNotification::~OnAppInterfaceUnregisteredNotification() { diff --git a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc index d1329bf8ea..9b10cd08ad 100644 --- a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc @@ -37,8 +37,8 @@ namespace application_manager { namespace commands { OnAudioPassThruNotification::OnAudioPassThruNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnAudioPassThruNotification::~OnAudioPassThruNotification() { diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc index 52aeebfe85..d045dadbe9 100644 --- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_button_event_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" @@ -43,8 +43,8 @@ namespace commands { namespace mobile { OnButtonEventNotification::OnButtonEventNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnButtonEventNotification::~OnButtonEventNotification() { @@ -73,7 +73,7 @@ void OnButtonEventNotification::Run() { return; } - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::msg_params][strings::app_id].asUInt()); if (false == app.valid()) { @@ -96,7 +96,7 @@ void OnButtonEventNotification::Run() { } const std::vector<ApplicationSharedPtr>& subscribedApps = - ApplicationManagerImpl::instance()->applications_by_button(btn_id); + application_manager_.applications_by_button(btn_id); std::vector<ApplicationSharedPtr>::const_iterator it = subscribedApps.begin(); for (; subscribedApps.end() != it; ++it) { diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc index c919c36c3f..84a59f22e7 100644 --- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_button_press_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" @@ -43,8 +43,8 @@ namespace commands { namespace mobile { OnButtonPressNotification::OnButtonPressNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnButtonPressNotification::~OnButtonPressNotification() { @@ -73,7 +73,7 @@ void OnButtonPressNotification::Run() { return; } - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::msg_params][strings::app_id].asUInt()); if (false == app.valid()) { @@ -96,7 +96,7 @@ void OnButtonPressNotification::Run() { } const std::vector<ApplicationSharedPtr>& subscribedApps = - ApplicationManagerImpl::instance()->applications_by_button(btn_id); + application_manager_.applications_by_button(btn_id); std::vector<ApplicationSharedPtr>::const_iterator it = subscribedApps.begin(); for (; subscribedApps.end() != it; ++it) { diff --git a/src/components/application_manager/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/src/commands/mobile/on_command_notification.cc index 922fcad525..5a9070d1af 100644 --- a/src/components/application_manager/src/commands/mobile/on_command_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_command_notification.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/on_command_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { namespace commands { -OnCommandNotification::OnCommandNotification(const MessageSharedPtr& message) - : CommandNotificationImpl(message) { +OnCommandNotification::OnCommandNotification(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnCommandNotification::~OnCommandNotification() { @@ -49,7 +49,7 @@ OnCommandNotification::~OnCommandNotification() { void OnCommandNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::msg_params][strings::app_id].asInt()); if (!app) { diff --git a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc index e9145520f4..f55527736c 100644 --- a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_driver_distraction_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" @@ -43,8 +43,8 @@ namespace commands { namespace mobile { OnDriverDistractionNotification::OnDriverDistractionNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnDriverDistractionNotification::~OnDriverDistractionNotification() { diff --git a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc index 10f3eb1ab6..c8df30d451 100644 --- a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc @@ -33,7 +33,7 @@ */ #include "application_manager/commands/mobile/on_hash_change_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" #include <string> @@ -45,8 +45,8 @@ namespace commands { namespace mobile { OnHashChangeNotification::OnHashChangeNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnHashChangeNotification::~OnHashChangeNotification() { @@ -60,7 +60,7 @@ void OnHashChangeNotification::Run() { int32_t app_id; app_id = (*message_)[strings::params][strings::connection_key].asInt(); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id); + ApplicationSharedPtr app = application_manager_.application(app_id); if (app) { (*message_)[strings::msg_params][strings::hash_id] = app->curHash(); SendNotification(); diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc index e4a2d7c340..7c267f06e1 100644 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_hmi_status_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/message_helper.h" #include "application_manager/message.h" #include "interfaces/MOBILE_API.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { OnHMIStatusNotification::OnHMIStatusNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnHMIStatusNotification::~OnHMIStatusNotification() { @@ -53,7 +53,7 @@ void OnHMIStatusNotification::Run() { (*message_)[strings::params][strings::message_type] = static_cast<int32_t> ( application_manager::MessageType::kNotification); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( connection_key()); if (!app.valid()) { LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist"); @@ -69,7 +69,7 @@ void OnHMIStatusNotification::Run() { app->set_tts_properties_in_none(true); LOG4CXX_INFO(logger_, "OnHMIStatusNotification::Send TTS GlobalProperties" " with empty array to HMI"); - MessageHelper::SendTTSGlobalProperties(app, false); + MessageHelper::SendTTSGlobalProperties(app, false, application_manager_); } } else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) || (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { @@ -77,7 +77,7 @@ void OnHMIStatusNotification::Run() { app->set_tts_properties_in_full(true); LOG4CXX_INFO(logger_, "OnHMIStatusNotification AddAppToTTSGlobalPropertiesList"); - ApplicationManagerImpl::instance()->AddAppToTTSGlobalPropertiesList( + application_manager_.AddAppToTTSGlobalPropertiesList( app->app_id()); } } diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc index 3df1fbccb4..c729882ae4 100644 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc @@ -32,7 +32,6 @@ */ #include "application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h" -#include "application_manager/application_manager_impl.h" #include "application_manager/message_helper.h" #include "application_manager/message.h" @@ -40,8 +39,9 @@ namespace application_manager { namespace commands { OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile( - const MessageSharedPtr& message) - : CommandNotificationFromMobileImpl(message) {} + const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandNotificationFromMobileImpl(message, application_manager) {} OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {} @@ -51,7 +51,7 @@ void OnHMIStatusNotificationFromMobile::Run() { (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app.valid()) { LOG4CXX_ERROR( @@ -70,8 +70,7 @@ void OnHMIStatusNotificationFromMobile::Run() { connection_handler::DeviceHandle handle = app->device(); bool is_apps_requested_before = - application_manager::ApplicationManagerImpl::instance() - ->IsAppsQueriedFrom(handle); + application_manager_.IsAppsQueriedFrom(handle); LOG4CXX_DEBUG( logger_, @@ -84,7 +83,7 @@ void OnHMIStatusNotificationFromMobile::Run() { // In case this notification will be received from mobile side with // foreground level for app on mobile, this should trigger remote // apps list query for SDL 4.0 app - MessageHelper::SendQueryApps(connection_key()); + MessageHelper::SendQueryApps(connection_key(), application_manager_); return; } @@ -95,7 +94,8 @@ void OnHMIStatusNotificationFromMobile::Run() { << handle); if (ProtocolVersion::kV4 == app->protocol_version()) { - ApplicationManagerImpl::ApplicationListAccessor accessor; + const ApplicationSet& accessor = + application_manager_.applications().GetData(); bool is_another_foreground_sdl4_app = false; ApplicationSetConstIt it = accessor.begin(); @@ -109,10 +109,8 @@ void OnHMIStatusNotificationFromMobile::Run() { } if (!is_another_foreground_sdl4_app) { - application_manager::ApplicationManagerImpl::instance() - ->MarkAppsGreyOut(handle, !is_current_state_foreground); - application_manager::ApplicationManagerImpl::instance() - ->SendUpdateAppList(); + application_manager_.MarkAppsGreyOut(handle, !is_current_state_foreground); + application_manager_.SendUpdateAppList(); } } return; diff --git a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc index ed80335069..851e9f3059 100644 --- a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_keyboard_input_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" @@ -43,8 +43,8 @@ namespace commands { namespace mobile { OnKeyBoardInputNotification::OnKeyBoardInputNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) {} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) {} OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {} @@ -53,9 +53,9 @@ void OnKeyBoardInputNotification::Run() { ApplicationSharedPtr app_to_notify; - ApplicationManagerImpl::ApplicationListAccessor accessor; - ApplicationSetConstIt it = accessor.begin(); - for (; accessor.end() != it; ++it) { + DataAccessor<ApplicationSet> accessor = application_manager_.applications(); + ApplicationSetIt it = accessor.GetData().begin(); + for (; accessor.GetData().end() != it; ++it) { // if there is app with active perform interaction use it for notification ApplicationSharedPtr app = *it; if (app->is_perform_interaction_active()) { diff --git a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc index 43b1b5b921..f94cda91b2 100644 --- a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc @@ -38,8 +38,8 @@ namespace application_manager { namespace commands { OnLanguageChangeNotification::OnLanguageChangeNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnLanguageChangeNotification::~OnLanguageChangeNotification() { diff --git a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc index 62ea1af1fc..4d2f66075c 100644 --- a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { OnPermissionsChangeNotification::OnPermissionsChangeNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnPermissionsChangeNotification::~OnPermissionsChangeNotification() { diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc index dd938a44a5..14cbff8d28 100644 --- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc @@ -34,7 +34,7 @@ #include "application_manager/commands/mobile/on_system_request_notification.h" #include "interfaces/MOBILE_API.h" #include "utils/file_system.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/policies/policy_handler_interface.h" namespace application_manager { @@ -44,8 +44,8 @@ namespace commands { namespace mobile { OnSystemRequestNotification::OnSystemRequestNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnSystemRequestNotification::~OnSystemRequestNotification() { @@ -56,7 +56,7 @@ void OnSystemRequestNotification::Run() { using namespace application_manager; using namespace mobile_apis; - ApplicationSharedPtr app = ApplicationManagerImpl::instance()-> + ApplicationSharedPtr app = application_manager_. application(connection_key()); if (!app.valid()) { @@ -68,8 +68,8 @@ void OnSystemRequestNotification::Run() { RequestType::eType request_type = static_cast<RequestType::eType> ((*message_)[strings::msg_params][strings::request_type].asInt()); const policy::PolicyHandlerInterface& policy_handler = - application_manager::ApplicationManagerImpl::instance()->GetPolicyHandler(); - if (!policy_handler.IsRequestTypeAllowed(app->mobile_app_id(), + application_manager_.GetPolicyHandler(); + if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(), request_type)) { LOG4CXX_WARN(logger_, "Request type " << request_type <<" is not allowed by policies"); diff --git a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc index 99a5d665db..aae32c4115 100644 --- a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_tbt_client_state_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { OnTBTClientStateNotification::OnTBTClientStateNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnTBTClientStateNotification::~OnTBTClientStateNotification() { @@ -55,7 +55,7 @@ void OnTBTClientStateNotification::Run() { static_cast<int32_t>(application_manager::MessageType::kNotification); const std::vector<ApplicationSharedPtr>& applications = - ApplicationManagerImpl::instance()->applications_with_navi(); + application_manager_.applications_with_navi(); std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin(); for (; applications.end() != it; ++it) { diff --git a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc index 8780ab1b6a..3c0b0a5657 100644 --- a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_touch_event_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { @@ -42,8 +42,8 @@ namespace commands { namespace mobile { OnTouchEventNotification::OnTouchEventNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnTouchEventNotification::~OnTouchEventNotification() { @@ -53,7 +53,7 @@ void OnTouchEventNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); const std::vector<ApplicationSharedPtr>& applications = - ApplicationManagerImpl::instance()->applications_with_navi(); + application_manager_.applications_with_navi(); std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin(); for (; applications.end() != it; ++it) { diff --git a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc index 9c60b90be5..ec74c1c621 100644 --- a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/on_vehicle_data_notification.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" @@ -42,8 +42,8 @@ namespace application_manager { namespace commands { OnVehicleDataNotification::OnVehicleDataNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) { } OnVehicleDataNotification::~OnVehicleDataNotification() { @@ -63,7 +63,7 @@ void OnVehicleDataNotification::Run() { for (; vehicle_data.end() != it; ++it) { if (true == (*message_)[strings::msg_params].keyExists(it->first)) { const std::vector<ApplicationSharedPtr>& applications = - ApplicationManagerImpl::instance()->IviInfoUpdated(it->second, + application_manager_.IviInfoUpdated(it->second, (*message_)[strings::msg_params][it->first].asInt()); std::vector<ApplicationSharedPtr>::const_iterator app_it = diff --git a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc index 1df1ca80ce..3a0cf0143c 100644 --- a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc @@ -32,15 +32,14 @@ */ #include "application_manager/commands/mobile/on_way_point_change_notification.h" -#include "application_manager/application_impl.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { OnWayPointChangeNotification::OnWayPointChangeNotification( - const MessageSharedPtr& message) - : CommandNotificationImpl(message) {} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) {} OnWayPointChangeNotification::~OnWayPointChangeNotification() {} @@ -48,8 +47,7 @@ void OnWayPointChangeNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); std::set<int32_t> subscribed_for_way_points = - application_manager::ApplicationManagerImpl::instance() - ->GetAppsSubscribedForWayPoints(); + application_manager_.GetAppsSubscribedForWayPoints(); for (std::set<int32_t>::const_iterator app_id = subscribed_for_way_points.begin(); diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc index a3a869a85a..55619bc318 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -33,10 +33,9 @@ #include <cstring> #include "application_manager/commands/mobile/perform_audio_pass_thru_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "config_profile/profile.h" #include "utils/helpers.h" namespace application_manager { @@ -46,8 +45,8 @@ namespace commands { namespace str = strings; PerformAudioPassThruRequest::PerformAudioPassThruRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message), + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), is_active_tts_speak_(false), result_tts_speak_(mobile_apis::Result::SUCCESS) { subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); @@ -73,7 +72,7 @@ void PerformAudioPassThruRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); @@ -156,7 +155,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { return_info = "Unsupported phoneme type sent in a prompt"; } - SendResponse(result, mobile_code, return_info.c_str(), + SendResponse(result, mobile_code, return_info.empty() ? NULL : return_info.c_str(), &(message[strings::msg_params])); break; } @@ -171,7 +170,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { StartMicrophoneRecording(); // update request timeout to get time for perform audio recording - ApplicationManagerImpl::instance()-> + application_manager_. updateRequestTimeout(connection_key(), correlation_id(), default_timeout()); @@ -181,7 +180,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_OnResetTimeout: { LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); - ApplicationManagerImpl::instance()->updateRequestTimeout( + application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } @@ -275,9 +274,9 @@ void PerformAudioPassThruRequest::SendRecordStartNotification() { void PerformAudioPassThruRequest::StartMicrophoneRecording() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->begin_audio_pass_thru(); + application_manager_.BeginAudioPassThrough(); - ApplicationManagerImpl::instance()->StartAudioPassThruThread( + application_manager_.StartAudioPassThruThread( connection_key(), correlation_id(), (*message_)[str::msg_params][str::max_duration].asInt(), (*message_)[str::msg_params][str::sampling_rate].asInt(), @@ -331,12 +330,11 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { return false; } -void PerformAudioPassThruRequest::FinishTTSSpeak() { +void PerformAudioPassThruRequest::FinishTTSSpeak(){ LOG4CXX_AUTO_TRACE(logger_); - if (ApplicationManagerImpl::instance()->end_audio_pass_thru()) { + if (application_manager_.EndAudioPassThrough()) { LOG4CXX_DEBUG(logger_, "Stop AudioPassThru."); - ApplicationManagerImpl::instance()-> - StopAudioPassThru(connection_key()); + application_manager_.StopAudioPassThru(connection_key()); } if (!is_active_tts_speak_) { LOG4CXX_WARN(logger_, "TTS Speak is inactive."); @@ -349,7 +347,7 @@ void PerformAudioPassThruRequest::FinishTTSSpeak() { bool PerformAudioPassThruRequest::WaitTTSSpeak() { LOG4CXX_AUTO_TRACE(logger_); uint64_t default_timeout_msec = - profile::Profile::instance()->default_timeout(); + application_manager_.get_settings().default_timeout(); const TimevalStruct start_time = date_time::DateTime::getCurrentTime(); // Waiting for TTS_Speak diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc index 585383889d..411a0a41ae 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/perform_audio_pass_thru_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { PerformAudioPassThruResponse::PerformAudioPassThruResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } PerformAudioPassThruResponse::~PerformAudioPassThruResponse() { @@ -50,7 +50,7 @@ PerformAudioPassThruResponse::~PerformAudioPassThruResponse() { void PerformAudioPassThruResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc index 141cb44a09..4c0fe88f46 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc @@ -34,15 +34,18 @@ #include <string.h> #include <string> #include "application_manager/commands/mobile/perform_interaction_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "config_profile/profile.h" + #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "utils/file_system.h" #include "utils/helpers.h" #include "utils/custom_string.h" +#include "utils/gen_hash.h" + + namespace application_manager { @@ -53,22 +56,23 @@ namespace custom_str = utils::custom_string; uint32_t PerformInteractionRequest::pi_requests_count_ = 0; PerformInteractionRequest::PerformInteractionRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message), - interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM), - ui_response_recived_(false), - vr_response_recived_(false), - ui_result_(false), - vr_result_(false), - app_pi_was_active_before_(false), - vr_resultCode_(mobile_apis::Result::INVALID_ENUM), - ui_resultCode_(mobile_apis::Result::INVALID_ENUM) { + const MessageSharedPtr& message, ApplicationManager& application_manager) +: CommandRequestImpl(message, application_manager), + interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM), + ui_response_recived_(false), + vr_response_recived_(false), + ui_result_(false), + vr_result_(false), + app_pi_was_active_before_(false), + vr_resultCode_(mobile_apis::Result::INVALID_ENUM), + ui_resultCode_(mobile_apis::Result::INVALID_ENUM) { subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand); subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress); } -PerformInteractionRequest::~PerformInteractionRequest() {} +PerformInteractionRequest::~PerformInteractionRequest() { +} bool PerformInteractionRequest::Init() { /* Timeout in milliseconds. @@ -92,7 +96,7 @@ void PerformInteractionRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -116,9 +120,8 @@ 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"); + LOG4CXX_ERROR(logger_, "PerformInteraction contains InteractionMode" + "=VR_ONLY and interactionLayout=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -129,17 +132,15 @@ 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"); + LOG4CXX_ERROR(logger_,"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"); + LOG4CXX_ERROR(logger_,"interactionChoiceSetIDList is empty" + " and interactionLayout!=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -157,11 +158,10 @@ void PerformInteractionRequest::Run() { } if (msg_params.keyExists(strings::vr_help)) { - if (mobile_apis::Result::SUCCESS != - MessageHelper::VerifyImageVrHelpItems(msg_params[strings::vr_help], - app)) { - LOG4CXX_ERROR(logger_, - "Verification of " << strings::vr_help << " failed."); + if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems( + msg_params[strings::vr_help], app, application_manager_)) { + LOG4CXX_ERROR(logger_, "Verification of " << strings::vr_help + << " failed."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -177,7 +177,8 @@ void PerformInteractionRequest::Run() { switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH"); - if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || + if (!CheckChoiceSetVRSynonyms(app) || + !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app)) { return; } @@ -185,7 +186,8 @@ void PerformInteractionRequest::Run() { } case mobile_apis::InteractionMode::MANUAL_ONLY: { LOG4CXX_DEBUG(logger_, "Interaction Mode: MANUAL_ONLY"); - if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || + if (!CheckChoiceSetVRSynonyms(app) || + !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app)) { return; } @@ -193,7 +195,8 @@ void PerformInteractionRequest::Run() { } case mobile_apis::InteractionMode::VR_ONLY: { LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY"); - if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app)) { + if (!CheckChoiceSetVRSynonyms(app) || + !CheckVrHelpItemPositions(app)) { return; } break; @@ -221,8 +224,8 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { LOG4CXX_DEBUG(logger_, "Received UI_OnResetTimeout event"); - ApplicationManagerImpl::instance()->updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_PerformInteraction: { @@ -266,14 +269,14 @@ void PerformInteractionRequest::onTimeOut() { DisablePerformInteraction(); CommandRequestImpl::onTimeOut(); } else { - ApplicationManagerImpl::instance()->updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); } break; } case mobile_apis::InteractionMode::VR_ONLY: { - ApplicationManagerImpl::instance()->updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); break; } case mobile_apis::InteractionMode::MANUAL_ONLY: { @@ -289,6 +292,7 @@ void PerformInteractionRequest::onTimeOut() { }; } + void PerformInteractionRequest::ProcessVRResponse( const smart_objects::SmartObject& message, smart_objects::SmartObject& msg_params) { @@ -299,7 +303,7 @@ void PerformInteractionRequest::ProcessVRResponse( using namespace helpers; ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -324,16 +328,17 @@ void PerformInteractionRequest::ProcessVRResponse( return; } LOG4CXX_DEBUG(logger_, "Update timeout for UI"); - ApplicationManagerImpl::instance()->updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + application_manager_. + updateRequestTimeout(connection_key(), + correlation_id(), + default_timeout()); return; } if (SUCCESS == vr_resultCode_ && InteractionMode::MANUAL_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, - "VR response SUCCESS in MANUAL_ONLY mode " - << "Wait for UI response"); + LOG4CXX_DEBUG(logger_, "VR response SUCCESS in MANUAL_ONLY mode " << + "Wait for UI response"); // in case MANUAL_ONLY mode VR.PI SUCCESS just return return; } @@ -344,8 +349,7 @@ void PerformInteractionRequest::ProcessVRResponse( if (!CheckChoiceIDFromResponse(app, choise_id)) { LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI"); TerminatePerformInteraction(); - SendResponse( - false, GENERIC_ERROR, "Wrong choiceID was received from HMI"); + SendResponse(false, GENERIC_ERROR,"Wrong choiceID was received from HMI"); return; } msg_params[strings::choice_id] = choise_id; @@ -372,7 +376,7 @@ void PerformInteractionRequest::ProcessPerformInteractionResponse( using namespace smart_objects; ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; @@ -430,6 +434,8 @@ void PerformInteractionRequest::ProcessPerformInteractionResponse( } } + DisablePerformInteraction(); + const SmartObject* response_params = msg_params.empty() ? NULL @@ -521,8 +527,8 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest( (*message_)[strings::msg_params][hmi_request::interaction_layout] .asInt(); } - SendHMIRequest( - hmi_apis::FunctionID::UI_PerformInteraction, &msg_params, true); + SendHMIRequest(hmi_apis::FunctionID::UI_PerformInteraction, + &msg_params, true); } void PerformInteractionRequest::SendVRPerformInteractionRequest( @@ -533,7 +539,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject& choice_list = - (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; + (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; if (mobile_apis::InteractionMode::MANUAL_ONLY != interaction_mode_) { msg_params[strings::grammar_id] = @@ -547,7 +553,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( LOG4CXX_WARN(logger_, "Couldn't found choiset"); continue; } - msg_params[strings::grammar_id][grammar_id_index++] = + msg_params[strings::grammar_id][grammar_id_index++]= (*choice_set)[strings::grammar_id].asUInt(); } } @@ -577,7 +583,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( // construct prompt and append delimiter to each item item[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; item[strings::text] = vr_commands[0].asString() + - profile::Profile::instance()->tts_delimiter(); + application_manager_.get_settings().tts_delimiter(); msg_params[strings::help_prompt][index++] = item; } } @@ -589,7 +595,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( if ((*message_)[strings::msg_params].keyExists(strings::timeout_prompt)) { msg_params[strings::timeout_prompt] = - (*message_)[strings::msg_params][strings::timeout_prompt]; + (*message_)[strings::msg_params][strings::timeout_prompt]; } else { if (msg_params.keyExists(strings::help_prompt)) { msg_params[strings::timeout_prompt] = msg_params[strings::help_prompt]; @@ -597,8 +603,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( } if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { - msg_params[strings::initial_prompt] = - (*message_)[strings::msg_params][strings::initial_prompt]; + msg_params[strings::initial_prompt] = + (*message_)[strings::msg_params][strings::initial_prompt]; } mobile_apis::InteractionMode::eType mode = @@ -612,8 +618,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( msg_params[strings::timeout] = default_timeout_; } msg_params[strings::app_id] = app->app_id(); - SendHMIRequest( - hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, true); + SendHMIRequest(hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, + true); } bool PerformInteractionRequest::CheckChoiceSetMenuNames( @@ -625,12 +631,12 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( for (size_t i = 0; i < choice_list.length(); ++i) { // choice_set contains SmartObject msg_params - smart_objects::SmartObject* i_choice_set = - app->FindChoiceSet(choice_list[i].asInt()); + smart_objects::SmartObject* i_choice_set = app->FindChoiceSet( + choice_list[i].asInt()); for (size_t j = 0; j < choice_list.length(); ++j) { - smart_objects::SmartObject* j_choice_set = - app->FindChoiceSet(choice_list[j].asInt()); + smart_objects::SmartObject* j_choice_set = app->FindChoiceSet( + choice_list[j].asInt()); if (i == j) { // skip check the same element @@ -656,8 +662,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( if (ii_menu_name == jj_menu_name) { LOG4CXX_ERROR(logger_, "Choice set has duplicated menu name"); - SendResponse(false, - mobile_apis::Result::DUPLICATE_NAME, + SendResponse(false, mobile_apis::Result::DUPLICATE_NAME, "Choice set has duplicated menu name"); return false; } @@ -672,6 +677,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( application_manager::ApplicationSharedPtr const app) { LOG4CXX_AUTO_TRACE(logger_); + std::set<uint32_t> vr_command_set; smart_objects::SmartObject& choice_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -726,7 +732,6 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( } } } - return true; } @@ -746,8 +751,7 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions( for (size_t i = 0; i < vr_help.length(); ++i) { if (position != vr_help[i][strings::position].asInt()) { LOG4CXX_ERROR(logger_, "Non-sequential vrHelp item position"); - SendResponse(false, - mobile_apis::Result::REJECTED, + SendResponse(false, mobile_apis::Result::REJECTED, "Non-sequential vrHelp item position"); return false; } @@ -759,8 +763,7 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions( void PerformInteractionRequest::DisablePerformInteraction() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; @@ -787,6 +790,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { return true; } + if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { const smart_objects::SmartArray* ip_array = (*message_)[strings::msg_params][strings::initial_prompt].asArray(); @@ -865,8 +869,8 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { void PerformInteractionRequest::TerminatePerformInteraction() { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = smart_objects::SmartObject( + smart_objects::SmartType_Map); msg_params[hmi_request::method_name] = "UI.PerformInteraction"; SendHMIRequest(hmi_apis::FunctionID::UI_ClosePopUp, &msg_params); DisablePerformInteraction(); @@ -885,8 +889,8 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse( const PerformChoice& choice = choice_set_map_it->second; PerformChoice::const_iterator it = choice.begin(); for (; choice.end() != it; ++it) { - const smart_objects::SmartObject& choice_set = - (*it->second).getElement(strings::choice_set); + const smart_objects::SmartObject& choice_set = (*it->second).getElement( + strings::choice_set); for (size_t j = 0; j < choice_set.length(); ++j) { if (choice_id == choice_set.getElement(j).getElement(strings::choice_id).asInt()) { @@ -976,10 +980,10 @@ void PerformInteractionRequest::SendBothModeResponse( result = false; } - const bool is_error_code = (SUCCESS != perform_interaction_result_code || + const bool is_success_code = (SUCCESS != perform_interaction_result_code || WARNINGS != perform_interaction_result_code); - if (vr_resultCode_ == ui_resultCode_ && is_error_code) { + if (vr_resultCode_ == ui_resultCode_ && is_success_code) { result = false; } diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc index 59d706926d..16a8e9616c 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/perform_interaction_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { PerformInteractionResponse::PerformInteractionResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } PerformInteractionResponse::~PerformInteractionResponse() { @@ -49,7 +49,7 @@ PerformInteractionResponse::~PerformInteractionResponse() { void PerformInteractionResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/put_file_request.cc b/src/components/application_manager/src/commands/mobile/put_file_request.cc index 44df989fe7..9ff52da8f4 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_request.cc @@ -31,19 +31,20 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include <algorithm> #include "application_manager/commands/mobile/put_file_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/policies/policy_handler.h" #include "application_manager/application_impl.h" -#include "config_profile/profile.h" + #include "utils/file_system.h" namespace application_manager { namespace commands { -PutFileRequest::PutFileRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) +PutFileRequest::PutFileRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) , offset_(0) , sync_file_name_() , length_(0) @@ -58,7 +59,7 @@ void PutFileRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); smart_objects::SmartObject response_params = smart_objects::SmartObject( smart_objects::SmartType_Map); @@ -69,7 +70,7 @@ void PutFileRequest::Run() { } if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() && - profile::Profile::instance()->put_file_in_none() <= + application_manager_.get_settings().put_file_in_none() <= application->put_file_in_none_count()) { // If application is in the HMI_NONE level the quantity of allowed // PutFile request is limited by the configuration profile @@ -115,8 +116,7 @@ void PutFileRequest::Run() { // Policy table update in json format is currently to be received via PutFile // TODO(PV): after latest discussion has to be changed if (mobile_apis::FileType::JSON == file_type_) { - application_manager::ApplicationManagerImpl::instance() - ->GetPolicyHandler() + application_manager_.GetPolicyHandler() .ReceiveMessageFromSDK(sync_file_name_, binary_data); } @@ -147,13 +147,12 @@ void PutFileRequest::Run() { if (is_system_file) { response_params[strings::space_available] = 0; - file_path = profile::Profile::instance()->system_files_path(); + file_path = application_manager_.get_settings().system_files_path(); } else { - file_path = profile::Profile::instance()->app_storage_folder(); + file_path = application_manager_.get_settings().app_storage_folder(); file_path += "/" + application->folder_name(); - uint32_t space_available = ApplicationManagerImpl::instance()-> - GetAvailableSpaceForApp(application->folder_name()); + uint32_t space_available = application->GetAvailableDiskSpace(); if (binary_data.size() > space_available) { @@ -168,20 +167,27 @@ void PutFileRequest::Run() { } if (!file_system::CreateDirectoryRecursively(file_path)) { - LOG4CXX_ERROR(logger_, "Cann't create folder"); + LOG4CXX_ERROR(logger_, "Can't create folder"); SendResponse(false, mobile_apis::Result::GENERIC_ERROR, - "Cann't create folder.", &response_params); + "Can't create folder.", &response_params); return; } - + const std::string full_path = file_path + "/" + sync_file_name_; + UNUSED(full_path); + LOG4CXX_DEBUG(logger_, "Wrtiting " << binary_data.size() << "bytes to " + << full_path << " (current size is" + << file_system::FileSize(full_path) << ")"); + mobile_apis::Result::eType save_result = - ApplicationManagerImpl::instance()->SaveBinary(binary_data, file_path, + application_manager_.SaveBinary(binary_data, file_path, sync_file_name_, offset_); + LOG4CXX_DEBUG(logger_, "New size of " + << full_path << " is " + << file_system::FileSize(full_path) << " bytes"); if (!is_system_file) { response_params[strings::space_available] = static_cast<uint32_t>( - ApplicationManagerImpl::instance()->GetAvailableSpaceForApp( - application->folder_name())); + application->GetAvailableDiskSpace()); } sync_file_name_ = file_path + "/" + sync_file_name_; @@ -252,7 +258,7 @@ void PutFileRequest::SendOnPutFileNotification() { message[strings::msg_params][strings::length] = length_; message[strings::msg_params][strings::persistent_file] = is_persistent_file_; message[strings::msg_params][strings::file_type] = file_type_; - ApplicationManagerImpl::instance()->ManageHMICommand(notification); + application_manager_.ManageHMICommand(notification); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/put_file_response.cc b/src/components/application_manager/src/commands/mobile/put_file_response.cc index 52598fda16..08d936863a 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_response.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_response.cc @@ -34,14 +34,14 @@ #include "application_manager/commands/mobile/put_file_response.h" #include "utils/file_system.h" #include "application_manager/application_impl.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -PutFileResponse::PutFileResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +PutFileResponse::PutFileResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } PutFileResponse::~PutFileResponse() { @@ -51,7 +51,7 @@ void PutFileResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); uint32_t app_id = (*message_)[strings::params][strings::connection_key] .asUInt(); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id); + ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "Application not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc index 8ee06d0b7a..f37e02bc7d 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc @@ -32,7 +32,7 @@ #include <string> #include "application_manager/commands/mobile/read_did_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { -ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } ReadDIDRequest::~ReadDIDRequest() { @@ -54,7 +54,7 @@ void ReadDIDRequest::Run() { uint32_t app_id = (*message_)[strings::params][strings::connection_key] .asUInt(); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id); + ApplicationSharedPtr app = application_manager_.application(app_id); LOG4CXX_INFO(logger_, "Correlation_id :" << (*message_)[strings::params][strings::correlation_id] .asUInt()); diff --git a/src/components/application_manager/src/commands/mobile/read_did_response.cc b/src/components/application_manager/src/commands/mobile/read_did_response.cc index 1133fe89ed..1637f3e9bc 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_response.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/read_did_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } ReadDIDResponse::~ReadDIDResponse() { @@ -48,7 +48,7 @@ ReadDIDResponse::~ReadDIDResponse() { void ReadDIDResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index e2d60be754..23fba2edcc 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -37,13 +37,13 @@ #include <algorithm> #include <string.h> -#include "application_manager/application_manager_impl.h" +#include <utils/make_shared.h> +#include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "config_profile/profile.h" +#include "application_manager/resumption/resume_ctrl.h" #include "interfaces/MOBILE_API.h" -#include "application_manager/policies/policy_handler_interface.h" -#include "utils/make_shared.h" #include "interfaces/generated_msg_version.h" namespace { @@ -132,8 +132,8 @@ namespace application_manager { namespace commands { RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) , result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) {} RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {} @@ -155,33 +155,27 @@ void RegisterAppInterfaceRequest::Run() { // FIXME(EZamakhov): on shutdown - get freez // wait till HMI started - while (ApplicationManagerImpl::exists() && - !ApplicationManagerImpl::instance()->IsStopping() && - !ApplicationManagerImpl::instance()->IsHMICooperating()) { + 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()); - ApplicationManagerImpl::instance()->updateRequestTimeout( + "Waiting for the HMI... conn_key=" + << connection_key() + << ", correlation_id=" << correlation_id() + << ", default_timeout=" << default_timeout() + << ", thread=" << pthread_self()); + application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); sleep(1); // TODO(DK): timer_->StartWait(1); } - if (!ApplicationManagerImpl::exists()) { - LOG4CXX_WARN(logger_, "The ApplicationManager doesn't exist!"); - return; - } else if (ApplicationManagerImpl::instance()->IsStopping()) { + if (application_manager_.IsStopping()) { LOG4CXX_WARN(logger_, "The ApplicationManager is stopping!"); return; } ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (application) { SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); @@ -189,12 +183,12 @@ void RegisterAppInterfaceRequest::Run() { } const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; + (*message_)[strings::msg_params]; const std::string& policy_app_id = msg_params[strings::app_id].asString(); - if (ApplicationManagerImpl::instance()->IsApplicationForbidden( - connection_key(), policy_app_id)) { + if (application_manager_.IsApplicationForbidden( + connection_key(), policy_app_id)) { SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); return; } @@ -205,10 +199,11 @@ void RegisterAppInterfaceRequest::Run() { } mobile_apis::Result::eType policy_result = CheckWithPolicyData(); + if (Compare<mobile_apis::Result::eType, NEQ, ALL>( - policy_result, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::WARNINGS)) { + policy_result, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::WARNINGS)) { SendResponse(false, policy_result); return; } @@ -236,7 +231,7 @@ void RegisterAppInterfaceRequest::Run() { } application = - ApplicationManagerImpl::instance()->RegisterApplication(message_); + application_manager_.RegisterApplication(message_); if (!application) { LOG4CXX_ERROR(logger_, "Application hasn't been registered!"); @@ -244,21 +239,20 @@ void RegisterAppInterfaceRequest::Run() { } // For resuming application need to restore hmi_app_id from resumeCtrl resumption::ResumeCtrl& resumer = - ApplicationManagerImpl::instance()->resume_controller(); - + application_manager_.resume_controller(); const std::string& device_mac = application->mac_address(); // there is side affect with 2 mobile app with the same mobile app_id if (resumer.IsApplicationSaved(policy_app_id, device_mac)) { application->set_hmi_application_id( - resumer.GetHMIApplicationID(policy_app_id, device_mac)); + resumer.GetHMIApplicationID(policy_app_id, device_mac)); } else { application->set_hmi_application_id( - ApplicationManagerImpl::instance()->GenerateNewHMIAppID()); + application_manager_.GenerateNewHMIAppID()); } application->set_is_media_application( - msg_params[strings::is_media_application].asBool()); + msg_params[strings::is_media_application].asBool()); if (msg_params.keyExists(strings::vr_synonyms)) { application->set_vr_synonyms(msg_params[strings::vr_synonyms]); @@ -266,7 +260,7 @@ void RegisterAppInterfaceRequest::Run() { if (msg_params.keyExists(strings::ngn_media_screen_app_name)) { application->set_ngn_media_screen_name( - msg_params[strings::ngn_media_screen_app_name]); + msg_params[strings::ngn_media_screen_app_name]); } if (msg_params.keyExists(strings::tts_name)) { @@ -283,12 +277,12 @@ void RegisterAppInterfaceRequest::Run() { for (size_t i = 0; i < app_type.length(); ++i) { if (mobile_apis::AppHMIType::NAVIGATION == static_cast<mobile_apis::AppHMIType::eType>( - app_type.getElement(i).asUInt())) { + app_type.getElement(i).asUInt())) { application->set_is_navi(true); } if (mobile_apis::AppHMIType::COMMUNICATION == static_cast<mobile_apis::AppHMIType::eType>( - app_type.getElement(i).asUInt())) { + app_type.getElement(i).asUInt())) { application->set_voice_communication_supported(true); } } @@ -297,8 +291,7 @@ void RegisterAppInterfaceRequest::Run() { // Add device to policy table and set device info, if any policy::DeviceParams dev_params; if (-1 == - ApplicationManagerImpl::instance() - ->connection_handler() + application_manager_.connection_handler() .get_session_observer() .GetDataOnDeviceID(application->device(), &dev_params.device_name, @@ -309,7 +302,6 @@ void RegisterAppInterfaceRequest::Run() { "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)) { @@ -328,15 +320,18 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; const HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); const uint32_t key = connection_key(); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(key); + application_manager_.application(key); + + resumption::ResumeCtrl& resumer = + application_manager_.resume_controller(); - resumption::ResumeCtrl& resumer = ApplicationManagerImpl::instance()->resume_controller(); if (!application) { - LOG4CXX_ERROR(logger_, "There is no application for such connection key" << key); + LOG4CXX_ERROR(logger_, + "There is no application for such connection key" << key); LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer"); resumer.OnAppRegistrationEnd(); return; @@ -363,15 +358,14 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { << 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()); + 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; } @@ -484,7 +478,7 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { } const std::vector<uint32_t>& diag_modes = - profile::Profile::instance()->supported_diag_modes(); + application_manager_.get_settings().supported_diag_modes(); if (!diag_modes.empty()) { std::vector<uint32_t>::const_iterator it = diag_modes.begin(); uint32_t index = 0; @@ -501,20 +495,20 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { response_params[strings::hmi_capabilities][strings::phone_call] = hmi_capabilities.phone_call_supported(); response_params[strings::sdl_version] = - profile::Profile::instance()->sdl_version(); - const std::string ccpu_version = hmi_capabilities.ccpu_version(); - + application_manager_.get_settings().sdl_version(); + const std::string ccpu_version = + application_manager_.hmi_capabilities().ccpu_version(); if (!ccpu_version.empty()) { response_params[strings::system_software_version] = ccpu_version; } - bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id); + bool resumption = + (*message_)[strings::msg_params].keyExists(strings::hash_id); bool need_restore_vr = resumption; std::string hash_id; std::string add_info; - if (resumption) { hash_id = (*message_)[strings::msg_params][strings::hash_id].asString(); if (!resumer.CheckApplicationHash(application, hash_id)) { @@ -538,10 +532,10 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { result_code = result_checking_app_hmi_type_; } - // In case application exist in resumption we need to send resumeVrgrammars + // in case application exist in resumption we need to send resumeVrgrammars if (false == resumption) { resumption = resumer.IsApplicationSaved( - application->mobile_app_id(), + application->policy_app_id(), application->mac_address()); } @@ -557,7 +551,7 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { // By default app subscribed to CUSTOM_BUTTON SendSubscribeCustomButtonNotification(); - MessageHelper::SendChangeRegistrationRequestToHMI(application); + MessageHelper::SendChangeRegistrationRequestToHMI(application, application_manager_); } void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( @@ -596,7 +590,8 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( } std::string priority; - GetPolicyHandler().GetPriority(application_impl.mobile_app_id(), &priority); + GetPolicyHandler().GetPriority(application_impl.policy_app_id(), &priority); + if (!priority.empty()) { msg_params[strings::priority] = MessageHelper::GetPriorityCode(priority); } @@ -605,7 +600,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( smart_objects::SmartObject& application = msg_params[strings::application]; application[strings::app_name] = application_impl.name(); application[strings::app_id] = application_impl.app_id(); - application[hmi_response::policy_app_id] = application_impl.mobile_app_id(); + application[hmi_response::policy_app_id] = application_impl.policy_app_id(); application[strings::icon] = application_impl.app_icon_path(); const smart_objects::SmartObject* ngn_media_screen_name = @@ -626,9 +621,8 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( } std::vector<std::string> request_types = - GetPolicyHandler().GetAppRequestTypes( - application_impl.mobile_app_id()); + application_impl.policy_app_id()); application[strings::request_type] = SmartObject(SmartType_Array); smart_objects::SmartObject& request_array = @@ -644,8 +638,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( application[strings::device_info] = SmartObject(SmartType_Map); smart_objects::SmartObject& device_info = application[strings::device_info]; const protocol_handler::SessionObserver& session_observer = - application_manager::ApplicationManagerImpl::instance() - ->connection_handler() + application_manager_.connection_handler() .get_session_observer(); std::string device_name; std::string mac_address; @@ -667,10 +660,10 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( policy::DeviceConsent::kDeviceAllowed == device_consent; device_info[strings::transport_type] = - ApplicationManagerImpl::instance()->GetDeviceTransportType( + application_manager_.GetDeviceTransportType( transport_type); - DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(notification)); + DCHECK(application_manager_.ManageHMICommand(notification)); } mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { @@ -678,15 +671,16 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - ApplicationManagerImpl::ApplicationListAccessor accessor; + ApplicationSet accessor = application_manager_.applications().GetData(); ApplicationSetConstIt it = accessor.begin(); - const custom_str::CustomString app_name = msg_params[strings::app_name].asCustomString(); + const custom_str::CustomString& app_name = + msg_params[strings::app_name].asCustomString(); for (; accessor.end() != it; ++it) { // name check const custom_str::CustomString& cur_name = (*it)->name(); - if (!strcasecmp(app_name.c_str(), cur_name.c_str())) { + if (app_name.CompareIgnoreCase(cur_name)) { LOG4CXX_ERROR(logger_, "Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } @@ -733,7 +727,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { policy::StringArray app_nicknames; policy::StringArray app_hmi_types; - std::string mobile_app_id = + const std::string mobile_app_id = message[strings::msg_params][strings::app_id].asString(); const bool init_result = GetPolicyHandler().GetInitialAppData( mobile_app_id, &app_nicknames, &app_hmi_types); @@ -836,21 +830,19 @@ void RegisterAppInterfaceRequest::FillDeviceInfo( } bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { - LOG4CXX_INFO(logger_, - "RegisterAppInterfaceRequest::" - "IsApplicationWithSameAppIdRegistered"); + LOG4CXX_AUTO_TRACE(logger_); const custom_string::CustomString mobile_app_id = (*message_)[strings::msg_params][strings::app_id].asCustomString(); - ApplicationManagerImpl::ApplicationListAccessor accessor; - const ApplicationSet applications = accessor.applications(); + const ApplicationSet& applications = + application_manager_.applications().GetData(); ApplicationSetConstIt it = applications.begin(); ApplicationSetConstIt it_end = applications.end(); for (; it != it_end; ++it) { - if (mobile_app_id.CompareIgnoreCase((*it)->mobile_app_id().c_str())) { + if (mobile_app_id.CompareIgnoreCase((*it)->policy_app_id().c_str())) { return true; } } @@ -923,8 +915,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::hardware)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::hardware] - .asCharArray(); + [strings::hardware].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info hardware syntax check failed"); @@ -935,8 +926,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::firmware_rev)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::firmware_rev] - .asCharArray(); + [strings::firmware_rev].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info firmware_rev syntax check failed"); @@ -957,8 +947,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::os_version)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::os_version] - .asCharArray(); + [strings::os_version].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info os_version syntax check failed"); @@ -969,8 +958,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params][strings::device_info].keyExists( strings::carrier)) { str = (*message_)[strings::msg_params][strings::device_info] - [strings::carrier] - .asCharArray(); + [strings::carrier].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid device_info carrier syntax check failed"); @@ -1019,8 +1007,7 @@ void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { } policy::PolicyHandlerInterface& RegisterAppInterfaceRequest::GetPolicyHandler() { - return application_manager::ApplicationManagerImpl::instance() - ->GetPolicyHandler(); + return application_manager_.GetPolicyHandler(); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc index 8674a62b15..576f842bf7 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc @@ -33,7 +33,8 @@ #include "application_manager/commands/mobile/register_app_interface_response.h" #include "interfaces/MOBILE_API.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" +#include "application_manager/policies/policy_handler_interface.h" #include "connection_handler/connection_handler.h" #include "application_manager/policies/policy_handler_interface.h" @@ -47,11 +48,13 @@ void RegisterAppInterfaceResponse::Run() { mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; bool success = (*message_)[strings::msg_params][strings::success].asBool(); bool last_message = !success; - // Do not close connection in case of APPLICATION_NOT_REGISTERED despite it is an error - if (!success && (*message_)[strings::msg_params].keyExists(strings::result_code)) { + // Do not close connection in case of APPLICATION_NOT_REGISTERED despite it is + // an error + if (!success && + (*message_)[strings::msg_params].keyExists(strings::result_code)) { result_code = static_cast<mobile_apis::Result::eType>( (*message_)[strings::msg_params][strings::result_code].asInt()); - if (result_code == mobile_apis::Result::APPLICATION_REGISTERED_ALREADY) { + if (result_code == mobile_apis::Result::APPLICATION_REGISTERED_ALREADY) { last_message = false; } } @@ -63,36 +66,36 @@ 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 application_manager::ApplicationSharedPtr application = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "Application with connection key " - << connection_key() << " is not registered."); + LOG4CXX_ERROR(logger_, + "Application with connection key " << connection_key() + << " is not registered."); return; } - SetHeartBeatTimeout(connection_key(), application->mobile_app_id()); + SetHeartBeatTimeout(connection_key(), application->policy_app_id()); // Default HMI level should be set before any permissions validation, since it // relies on HMI level. - ApplicationManagerImpl::instance()->OnApplicationRegistered(application); + application_manager_.OnApplicationRegistered(application); // Sends OnPermissionChange notification to mobile right after RAI response // and HMI level set-up - application_manager::ApplicationManagerImpl::instance() - ->GetPolicyHandler().OnAppRegisteredOnMobile(application->mobile_app_id()); + application_manager_.GetPolicyHandler().OnAppRegisteredOnMobile(application->policy_app_id()); } void RegisterAppInterfaceResponse::SetHeartBeatTimeout( uint32_t connection_key, const std::string& mobile_app_id) { LOG4CXX_AUTO_TRACE(logger_); - const policy::PolicyHandlerInterface& policy_handler = - application_manager::ApplicationManagerImpl::instance()->GetPolicyHandler(); + policy::PolicyHandlerInterface& policy_handler = + application_manager_.GetPolicyHandler(); if (policy_handler.PolicyEnabled()) { const uint32_t timeout = policy_handler.HeartBeatTimeout(mobile_app_id); if (timeout > 0) { - application_manager::ApplicationManagerImpl::instance()-> - connection_handler().SetHeartBeatTimeout(connection_key, timeout); + application_manager_.connection_handler() + .SetHeartBeatTimeout(connection_key, timeout); } } else { LOG4CXX_INFO(logger_, "Policy is turn off"); diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc index 4118114822..d394370658 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc @@ -32,10 +32,10 @@ */ #include "application_manager/commands/mobile/reset_global_properties_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" -#include "config_profile/profile.h" + #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -44,8 +44,8 @@ namespace application_manager { namespace commands { ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message), + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), is_ui_send_(false), is_tts_send_(false), is_ui_received_(false), @@ -61,7 +61,7 @@ void ResetGlobalPropertiesRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id); + ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "No application associated with session key"); @@ -74,7 +74,7 @@ void ResetGlobalPropertiesRequest::Run() { //if application waits for sending ttsGlobalProperties need to remove this //application from tts_global_properties_app_list_ LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList"); - ApplicationManagerImpl::instance()->RemoveAppFromTTSGlobalPropertiesList( + application_manager_.RemoveAppFromTTSGlobalPropertiesList( app_id); bool helpt_promt = false; @@ -203,8 +203,8 @@ bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( return false; } - const std::vector<std::string>& time_out_promt = profile::Profile::instance() - ->time_out_promt(); + const std::vector<std::string>& time_out_promt = + application_manager_.get_settings().time_out_promt(); smart_objects::SmartObject so_time_out_promt = smart_objects::SmartObject( smart_objects::SmartType_Array); @@ -240,7 +240,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc index 8e562956ae..6892543d78 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/reset_global_properties_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() { @@ -49,7 +49,7 @@ ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() { void ResetGlobalPropertiesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc index 72055add18..6366ccefdc 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc @@ -33,8 +33,9 @@ #include <string.h> #include "application_manager/commands/mobile/scrollable_message_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" +#include "application_manager/policies/policy_handler.h" #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -45,8 +46,8 @@ namespace application_manager { namespace commands { ScrollableMessageRequest::ScrollableMessageRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); } @@ -71,9 +72,7 @@ bool ScrollableMessageRequest::Init() { void ScrollableMessageRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance() - ->application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -85,7 +84,7 @@ void ScrollableMessageRequest::Run() { mobile_apis::Result::eType processing_result = MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager::ApplicationManagerImpl::instance()->GetPolicyHandler()); + application_manager_.GetPolicyHandler(), application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); @@ -121,7 +120,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); - ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(), + application_manager_.updateRequestTimeout(connection_key(), correlation_id(), default_timeout()); break; @@ -134,7 +133,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { (message[strings::params][hmi_response::code].asInt()); HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); bool result = Compare<mobile_api::Result::eType, EQ, ONE>( diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc index 212a3ba912..ccc8bafbb0 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/scrollable_message_response.h" -#include "application_manager/application_manager_impl.h" + #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { ScrollableMessageResponse::ScrollableMessageResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } void ScrollableMessageResponse::Run() { @@ -50,13 +50,13 @@ void ScrollableMessageResponse::Run() { mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( (*message_)[strings::msg_params][strings::result_code].asInt()); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application( + application_manager_.application( (*message_)[strings::params][strings::connection_key].asInt()); if ((mobile_apis::Result::REJECTED != result_code) && application) { application->UnsubscribeFromSoftButtons( (*message_)[strings::params][strings::function_id].asInt()); } - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/send_location_request.cc b/src/components/application_manager/src/commands/mobile/send_location_request.cc index 9b91653984..9237b59ee9 100644 --- a/src/components/application_manager/src/commands/mobile/send_location_request.cc +++ b/src/components/application_manager/src/commands/mobile/send_location_request.cc @@ -31,16 +31,17 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "application_manager/commands/mobile/send_location_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/message_helper.h" #include "utils/helpers.h" +#include "utils/custom_string.h" namespace application_manager { namespace commands { -SendLocationRequest::SendLocationRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +SendLocationRequest::SendLocationRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } SendLocationRequest::~SendLocationRequest() { @@ -51,8 +52,7 @@ void SendLocationRequest::Run() { using smart_objects::SmartObject; LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance() - ->application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, @@ -91,7 +91,7 @@ void SendLocationRequest::Run() { } if (msg_params.keyExists(strings::address)) { - const custom_string::CustomString& address = + const utils::custom_string::CustomString& address = msg_params[strings::address].asCustomString(); if (address.empty()) { msg_params.erase(strings::address); @@ -108,7 +108,7 @@ void SendLocationRequest::Run() { mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; verification_result = MessageHelper::VerifyImage( - msg_params[strings::location_image], app); + (*message_)[strings::msg_params][strings::location_image], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); @@ -169,7 +169,7 @@ bool SendLocationRequest::CheckFieldsCompatibility() { } void insert_if_contains(const smart_objects::SmartObject& msg_params, const std::string& param_key, - std::vector<custom_string::CustomString>& output_vector) { + std::vector<utils::custom_string::CustomString>& output_vector) { if (msg_params.keyExists(param_key)) { output_vector.push_back(msg_params[param_key].asCustomString()); } @@ -177,7 +177,7 @@ void insert_if_contains(const smart_objects::SmartObject& msg_params, bool SendLocationRequest::IsWhiteSpaceExist() { LOG4CXX_AUTO_TRACE(logger_); - std::vector<custom_string::CustomString> fields_to_check; + std::vector<utils::custom_string::CustomString> fields_to_check; const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; insert_if_contains(msg_params, strings::location_name, fields_to_check); @@ -191,7 +191,7 @@ bool SendLocationRequest::IsWhiteSpaceExist() { smart_objects::SmartArray::const_iterator it_al = al_array->begin(); smart_objects::SmartArray::const_iterator it_al_end = al_array->end(); for (; it_al != it_al_end; ++it_al) { - const custom_string::CustomString& val = (*it_al).asCustomString(); + const utils::custom_string::CustomString& val = (*it_al).asCustomString(); fields_to_check.push_back(val); } } @@ -209,7 +209,7 @@ bool SendLocationRequest::IsWhiteSpaceExist() { insert_if_contains(address_so, strings::sub_thoroughfare, fields_to_check); } - std::vector<custom_string::CustomString>::iterator it = + std::vector<utils::custom_string::CustomString>::iterator it = fields_to_check.begin(); for (; it != fields_to_check.end(); ++it) { const std::string& str = it->AsMBString(); @@ -223,15 +223,14 @@ bool SendLocationRequest::IsWhiteSpaceExist() { } bool SendLocationRequest::CheckHMICapabilities(std::list<hmi_apis::Common_TextFieldName::eType>& fields_names) { + LOG4CXX_AUTO_TRACE(logger_); using namespace smart_objects; using namespace hmi_apis; - if (fields_names.empty()) { return true; } - ApplicationManagerImpl* instance = ApplicationManagerImpl::instance(); - const HMICapabilities& hmi_capabilities = instance->hmi_capabilities(); + const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); if (!hmi_capabilities.is_ui_cooperating()) { LOG4CXX_ERROR(logger_, "UI is not supported."); return false; diff --git a/src/components/application_manager/src/commands/mobile/send_location_response.cc b/src/components/application_manager/src/commands/mobile/send_location_response.cc index 32756c999d..756dfc16db 100644 --- a/src/components/application_manager/src/commands/mobile/send_location_response.cc +++ b/src/components/application_manager/src/commands/mobile/send_location_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/send_location_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/HMI_API.h" @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { -SendLocationResponse::SendLocationResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +SendLocationResponse::SendLocationResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SendLocationResponse::~SendLocationResponse() { @@ -50,7 +50,7 @@ SendLocationResponse::~SendLocationResponse() { void SendLocationResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc index 5c9a4f80e7..b0f4f73216 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc @@ -31,10 +31,10 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include <algorithm> #include "application_manager/commands/mobile/set_app_icon_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" -#include "config_profile/profile.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "utils/file_system.h" @@ -44,15 +44,12 @@ namespace application_manager { namespace commands { -int8_t SetAppIconRequest::is_icons_saving_enabled_ = -1; - -SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { - if (-1 == is_icons_saving_enabled_) { - const std::string path = profile::Profile::instance()->app_icons_folder(); +SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , is_icons_saving_enabled_(false){ + const std::string path = application_manager_.get_settings().app_icons_folder(); is_icons_saving_enabled_ = file_system::IsWritingAllowed(path) && file_system::IsReadingAllowed(path); - } } SetAppIconRequest::~SetAppIconRequest() {} @@ -61,7 +58,7 @@ void SetAppIconRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -73,7 +70,7 @@ void SetAppIconRequest::Run() { (*message_)[strings::msg_params][strings::sync_file_name].asString(); std::string full_file_path = - profile::Profile::instance()->app_storage_folder() + "/"; + application_manager_.get_settings().app_storage_folder() + "/"; full_file_path += app->folder_name(); full_file_path += "/"; full_file_path += sync_file_name; @@ -114,7 +111,7 @@ void SetAppIconRequest::Run() { void SetAppIconRequest::CopyToIconStorage( const std::string& path_to_file) const { - if (!profile::Profile::instance()->enable_protocol_4()) { + if (!application_manager_.protocol_handler().get_settings().enable_protocol_4()) { LOG4CXX_WARN(logger_, "Icon copying skipped, since protocol ver. 4 is not enabled."); return; @@ -127,9 +124,9 @@ void SetAppIconRequest::CopyToIconStorage( } const std::string icon_storage = - profile::Profile::instance()->app_icons_folder(); + application_manager_.get_settings().app_icons_folder(); const uint64_t storage_max_size = static_cast<uint64_t>( - profile::Profile::instance()->app_icons_folder_max_size()); + application_manager_.get_settings().app_icons_folder_max_size()); const uint64_t file_size = file_system::FileSize(path_to_file); if (storage_max_size < file_size) { @@ -146,7 +143,7 @@ void SetAppIconRequest::CopyToIconStorage( static_cast<uint64_t>(file_system::DirectorySize(icon_storage)); if (storage_max_size < (file_size + storage_size)) { const uint32_t icons_amount = - profile::Profile::instance()->app_icons_amount_to_remove(); + application_manager_.get_settings().app_icons_amount_to_remove(); if (!icons_amount) { LOG4CXX_DEBUG(logger_, @@ -160,8 +157,7 @@ void SetAppIconRequest::CopyToIconStorage( } } ApplicationConstSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( - connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR( @@ -170,7 +166,7 @@ void SetAppIconRequest::CopyToIconStorage( return; } - const std::string icon_path = icon_storage + "/" + app->mobile_app_id(); + const std::string icon_path = icon_storage + "/" + app->policy_app_id(); if (!file_system::CreateFile(icon_path)) { LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path); return; @@ -221,9 +217,9 @@ void SetAppIconRequest::RemoveOldestIcons(const std::string& storage, bool SetAppIconRequest::IsEnoughSpaceForIcon(const uint64_t icon_size) const { const std::string icon_storage = - profile::Profile::instance()->app_icons_folder(); + application_manager_.get_settings().app_icons_folder(); const uint64_t storage_max_size = static_cast<uint64_t>( - profile::Profile::instance()->app_icons_folder_max_size()); + application_manager_.get_settings().app_icons_folder_max_size()); const uint64_t storage_size = static_cast<uint64_t>(file_system::DirectorySize(icon_storage)); return storage_max_size >= (icon_size + storage_size); @@ -240,24 +236,24 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = + Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); if (result) { ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!message_.valid() || !app.valid()) { - LOG4CXX_ERROR(logger_, "NULL pointer."); - return; + LOG4CXX_ERROR(logger_, "NULL pointer."); + return; } - const std::string& path = - (*message_)[strings::msg_params][strings::sync_file_name] - [strings::value] - .asString(); + const std::string& path = (*message_)[strings::msg_params] + [strings::sync_file_name] + [strings::value].asString(); app->set_app_icon_path(path); LOG4CXX_INFO(logger_, diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc index 563490bd46..53d9fd9ea6 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/set_app_icon_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SetAppIconResponse::~SetAppIconResponse() { @@ -48,7 +48,7 @@ SetAppIconResponse::~SetAppIconResponse() { void SetAppIconResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc index f3d9e28c04..dfca103b35 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/set_display_layout_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { SetDisplayLayoutRequest::SetDisplayLayoutRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } SetDisplayLayoutRequest::~SetDisplayLayoutRequest() { @@ -51,7 +51,7 @@ SetDisplayLayoutRequest::~SetDisplayLayoutRequest() { void SetDisplayLayoutRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationConstSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -82,7 +82,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { if (response_success) { HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); // in case templates_available is empty copy from hmi capabilities if (msg_params.keyExists(hmi_response::display_capabilities)) { diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc index 3844b3bf05..02a03b7b07 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc @@ -33,15 +33,15 @@ #include "application_manager/commands/mobile/set_display_layout_response.h" #include "application_manager/application_impl.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { SetDisplayLayoutResponse::SetDisplayLayoutResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SetDisplayLayoutResponse::~SetDisplayLayoutResponse() { @@ -50,7 +50,7 @@ SetDisplayLayoutResponse::~SetDisplayLayoutResponse() { void SetDisplayLayoutResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc index ef4e18eef3..f74e8a923c 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc @@ -33,7 +33,7 @@ #include <string.h> #include <algorithm> #include "application_manager/commands/mobile/set_global_properties_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -44,8 +44,8 @@ namespace application_manager { namespace commands { SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message), + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager), is_ui_send_(false), is_tts_send_(false), is_ui_received_(false), @@ -64,7 +64,7 @@ void SetGlobalPropertiesRequest::Run() { (*message_)[strings::msg_params]; ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "No application associated with connection key " @@ -84,7 +84,7 @@ void SetGlobalPropertiesRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) { verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::menu_icon], app); + (*message_)[strings::msg_params][strings::menu_icon], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return " << verification_result); @@ -95,7 +95,7 @@ void SetGlobalPropertiesRequest::Run() { // Check for image file(s) in vrHelpItem if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) { if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems( - (*message_)[strings::msg_params][strings::vr_help], app)) { + (*message_)[strings::msg_params][strings::vr_help], app, application_manager_)) { LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; @@ -110,7 +110,7 @@ void SetGlobalPropertiesRequest::Run() { //if application waits for sending ttsGlobalProperties need to remove this //application from tts_global_properties_app_list_ - ApplicationManagerImpl::instance()->RemoveAppFromTTSGlobalPropertiesList( + application_manager_.RemoveAppFromTTSGlobalPropertiesList( connection_key()); bool is_help_prompt_present = msg_params.keyExists(strings::help_prompt); bool is_timeout_prompt_present = msg_params.keyExists( @@ -290,14 +290,12 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { } //TODO{ALeshin} APPLINK-15858. connection_key removed during SendResponse - const uint32_t stashedConnectionKey = connection_key(); + ApplicationSharedPtr application = + application_manager_.application(connection_key()); SendResponse(result, result_code, return_info, &(message[strings::msg_params])); - ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(stashedConnectionKey); - if (!application) { LOG4CXX_DEBUG(logger_, "NULL pointer."); return; diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc index 759333385d..9e4880e53d 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/set_global_properties_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { SetGlobalPropertiesResponse::SetGlobalPropertiesResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() { @@ -50,7 +50,7 @@ SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() { void SetGlobalPropertiesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_icon_request.cc index c9875475d7..0aa6e34488 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/set_icon_request.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/application_impl.h" #include "config_profile/profile.h" #include "interfaces/MOBILE_API.h" @@ -43,8 +43,8 @@ namespace application_manager { namespace commands { -SetIconRequest::SetIconRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +SetIconRequest::SetIconRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } SetIconRequest::~SetIconRequest() { @@ -54,7 +54,7 @@ void SetIconRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -66,7 +66,7 @@ void SetIconRequest::Run() { (*message_)[strings::msg_params][strings::sync_file_name].asString(); std::string full_file_path = - profile::Profile::instance()->app_storage_folder() + "/"; + application_manager_.get_settings().app_storage_folder() + "/"; full_file_path += app->folder_name(); full_file_path += "/"; full_file_path += sync_file_name; @@ -115,7 +115,7 @@ void SetIconRequest::on_event(const event_engine::Event& event) { if (result) { ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); const std::string path = (*message_)[strings::msg_params] [strings::sync_file_name] diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc.autosave b/src/components/application_manager/src/commands/mobile/set_icon_request.cc.autosave new file mode 100644 index 0000000000..93912ea156 --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/set_icon_request.cc.autosave @@ -0,0 +1,140 @@ +/* + + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/mobile/set_icon_request.h" +#include "application_manager/application_impl.h" +#include "config_profile/profile.h" +#include "interfaces/MOBILE_API.h" +#include "interfaces/HMI_API.h" +#include "utils/file_system.h" + +namespace application_manager { + +namespace commands { + +SetIconRequest::SetIconRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { +} + +SetIconRequest::~SetIconRequest() { +} + +void SetIconRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + ApplicationSharedPtr app = + application_manager_.application(connection_key()); + + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + const std::string& sync_file_name = + (*message_)[strings::msg_params][strings::sync_file_name].asString(); + + std::string full_file_path = + application_manager_.get_settings().app_storage_folder() + "/"; + full_file_path += app->folder_name(); + full_file_path += "/"; + full_file_path += sync_file_name; + + if (!file_system::FileExists(full_file_path)) { + LOG4CXX_ERROR(logger_, "No such file " << full_file_path); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + + smart_objects::SmartObject msg_params = smart_objects::SmartObject( + smart_objects::SmartType_Map); + + msg_params[strings::app_id] = app->app_id(); + msg_params[strings::sync_file_name] = smart_objects::SmartObject( + smart_objects::SmartType_Map); + +// Panasonic requres unchanged path value without encoded special characters + const std::string full_file_path_for_hmi = file_system::ConvertPathForURL( + full_file_path); + + msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi; + + // TODO(VS): research why is image_type hardcoded + msg_params[strings::sync_file_name][strings::image_type] = + static_cast<int32_t> (SetIconRequest::ImageType::DYNAMIC); + + // for further use in on_event function + (*message_)[strings::msg_params][strings::sync_file_name] = + msg_params[strings::sync_file_name]; + + SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true); +} + +void SetIconRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + const smart_objects::SmartObject& message = event.smart_object(); + + switch (event.id()) { + case hmi_apis::FunctionID::UI_SetAppIcon: { + mobile_apis::Result::eType result_code = + static_cast<mobile_apis::Result::eType>( + message[strings::params][hmi_response::code].asInt()); + + bool result = mobile_apis::Result::SUCCESS == result_code; + + if (result) { + ApplicationSharedPtr app = + application_manager_.application(connection_key()); + + const std::string path = (*message_)[strings::msg_params] + [strings::sync_file_name] + [strings::value].asString(); + app->set_app_icon_path(path); + + LOG4CXX_INFO(logger_, + "Icon path was set to '" << app->app_icon_path() << "'"); + } + + SendResponse(result, result_code, NULL, &(message[strings::msg_params])); + break; + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } + } +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_icon_response.cc index 632677a4fc..92c0a666c9 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_response.cc @@ -32,14 +32,15 @@ */ #include "application_manager/commands/mobile/set_icon_response.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { -SetIconResponse::SetIconResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +SetIconResponse::SetIconResponse(const MessageSharedPtr& message, + ApplicationManager& app_man) + : CommandResponseImpl(message, app_man) { } SetIconResponse::~SetIconResponse() { @@ -48,7 +49,7 @@ SetIconResponse::~SetIconResponse() { void SetIconResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/set_icon_response.cc.autosave b/src/components/application_manager/src/commands/mobile/set_icon_response.cc.autosave new file mode 100644 index 0000000000..7b4c848fc1 --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/set_icon_response.cc.autosave @@ -0,0 +1,56 @@ +/* + + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/mobile/set_icon_response.h" + +namespace application_manager { + +namespace commands { + +SetIconResponse::SetIconResponse(const MessageSharedPtr& message, + ApplicationManager& app_man) + : CommandResponseImpl(message, app_man) { +} + +SetIconResponse::~SetIconResponse() { +} + +void SetIconResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + application_manager_.SendMessageToMobile(message_); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc index 536bb755ed..444efdce86 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/set_media_clock_timer_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { -SetMediaClockRequest::SetMediaClockRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +SetMediaClockRequest::SetMediaClockRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } SetMediaClockRequest::~SetMediaClockRequest() { @@ -52,7 +52,7 @@ void SetMediaClockRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc index da6f204da4..e1d3259a23 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/set_media_clock_timer_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { SetMediaClockTimerResponse::SetMediaClockTimerResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SetMediaClockTimerResponse::~SetMediaClockTimerResponse() { @@ -49,7 +49,7 @@ SetMediaClockTimerResponse::~SetMediaClockTimerResponse() { void SetMediaClockTimerResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc index 20d58d13a1..6d2deddc46 100644 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc @@ -33,7 +33,8 @@ #include <cstring> #include "application_manager/commands/mobile/show_constant_tbt_request.h" -#include "application_manager/application_manager_impl.h" + +#include "application_manager/policies/policy_handler.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/policies/policy_handler_interface.h" @@ -44,8 +45,8 @@ namespace application_manager { namespace commands { -ShowConstantTBTRequest::ShowConstantTBTRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +ShowConstantTBTRequest::ShowConstantTBTRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } ShowConstantTBTRequest::~ShowConstantTBTRequest() { @@ -54,7 +55,7 @@ ShowConstantTBTRequest::~ShowConstantTBTRequest() { void ShowConstantTBTRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { @@ -85,9 +86,7 @@ void ShowConstantTBTRequest::Run() { mobile_apis::Result::eType processing_result = MessageHelper::ProcessSoftButtons( msg_params, - app, - application_manager::ApplicationManagerImpl::instance() - ->GetPolicyHandler()); + app, application_manager_.GetPolicyHandler() , application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "INVALID_DATA!"); @@ -100,7 +99,7 @@ void ShowConstantTBTRequest::Run() { mobile_apis::Result::SUCCESS; if (msg_params.keyExists(strings::turn_icon)) { verification_result = MessageHelper::VerifyImage( - msg_params[strings::turn_icon], app); + msg_params[strings::turn_icon], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); @@ -110,7 +109,7 @@ void ShowConstantTBTRequest::Run() { if (msg_params.keyExists(strings::next_turn_icon)) { verification_result = MessageHelper::VerifyImage( - msg_params[strings::next_turn_icon], app); + msg_params[strings::next_turn_icon], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); @@ -192,7 +191,7 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt())); HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); bool result = false; if (mobile_apis::Result::SUCCESS == result_code) { result = true; diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc index e45cd760df..3669159fb5 100644 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc +++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/show_constant_tbt_response.h" -#include "application_manager/application_manager_impl.h" + #include "interfaces/HMI_API.h" namespace application_manager { @@ -40,8 +40,9 @@ namespace application_manager { namespace commands { ShowConstantTBTResponse::ShowConstantTBTResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + + : CommandResponseImpl(message, application_manager) { } ShowConstantTBTResponse::~ShowConstantTBTResponse() { @@ -50,7 +51,7 @@ ShowConstantTBTResponse::~ShowConstantTBTResponse() { void ShowConstantTBTResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc index 8335feeb83..2684417a62 100644 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_request.cc @@ -32,7 +32,8 @@ */ #include <string.h> #include "application_manager/commands/mobile/show_request.h" -#include "application_manager/application_manager_impl.h" + +#include "application_manager/policies/policy_handler.h" #include "application_manager/application.h" #include "application_manager/message_helper.h" #include "utils/file_system.h" @@ -42,8 +43,8 @@ namespace application_manager { namespace commands { -ShowRequest::ShowRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +ShowRequest::ShowRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } ShowRequest::~ShowRequest() { @@ -53,7 +54,7 @@ void ShowRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( connection_key()); if (!app) { @@ -81,9 +82,7 @@ void ShowRequest::Run() { ((*message_)[strings::msg_params][strings::soft_buttons].length() > 0)) { processing_result = MessageHelper::ProcessSoftButtons( (*message_)[strings::msg_params], - app, - application_manager::ApplicationManagerImpl::instance() - ->GetPolicyHandler()); + app, application_manager_.GetPolicyHandler(),application_manager_); } if (mobile_apis::Result::SUCCESS != processing_result) { @@ -98,7 +97,7 @@ void ShowRequest::Run() { ((*message_)[strings::msg_params] [strings::graphic][strings::value].asString()).length()) { verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::graphic], app); + (*message_)[strings::msg_params][strings::graphic], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "Image verification failed."); SendResponse(false, verification_result); @@ -108,7 +107,7 @@ void ShowRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::secondary_graphic], app); + (*message_)[strings::msg_params][strings::secondary_graphic], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "Image verification failed."); SendResponse(false, verification_result); diff --git a/src/components/application_manager/src/commands/mobile/show_response.cc b/src/components/application_manager/src/commands/mobile/show_response.cc index 0c46cdd83c..764f37d42c 100644 --- a/src/components/application_manager/src/commands/mobile/show_response.cc +++ b/src/components/application_manager/src/commands/mobile/show_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/show_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/HMI_API.h" @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { -ShowResponse::ShowResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +ShowResponse::ShowResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } ShowResponse::~ShowResponse() { @@ -50,7 +50,7 @@ ShowResponse::~ShowResponse() { void ShowResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc index 80eb6336ce..0c4b177d44 100644 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/src/commands/mobile/slider_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/slider_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "utils/helpers.h" @@ -42,8 +42,8 @@ namespace application_manager { namespace commands { -SliderRequest::SliderRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +SliderRequest::SliderRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); } @@ -55,7 +55,8 @@ bool SliderRequest::Init() { /* Timeout in milliseconds. If omitted a standard value of 10000 milliseconds is used.*/ if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = profile::Profile::instance()->default_timeout() + + default_timeout_ = + application_manager_.get_settings().default_timeout() + (*message_)[strings::msg_params][strings::timeout].asUInt(); } @@ -66,7 +67,7 @@ void SliderRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!application) { @@ -123,7 +124,7 @@ 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"); - ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(), + application_manager_.updateRequestTimeout(connection_key(), correlation_id(), default_timeout()); return; diff --git a/src/components/application_manager/src/commands/mobile/slider_response.cc b/src/components/application_manager/src/commands/mobile/slider_response.cc index 7f0c10b068..dd9837ba7f 100644 --- a/src/components/application_manager/src/commands/mobile/slider_response.cc +++ b/src/components/application_manager/src/commands/mobile/slider_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/slider_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -SliderResponse::SliderResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +SliderResponse::SliderResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SliderResponse::~SliderResponse() { @@ -48,7 +48,7 @@ SliderResponse::~SliderResponse() { void SliderResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc index 7b0bc785e1..da65c8b57b 100644 --- a/src/components/application_manager/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/src/commands/mobile/speak_request.cc @@ -33,16 +33,17 @@ #include <string.h> #include "application_manager/commands/mobile/speak_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "utils/helpers.h" namespace application_manager { namespace commands { -SpeakRequest::SpeakRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +SpeakRequest::SpeakRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); } @@ -53,7 +54,7 @@ void SpeakRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( connection_key()); if (!app) { @@ -89,7 +90,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_OnResetTimeout: { LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); - ApplicationManagerImpl::instance()->updateRequestTimeout( + application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } @@ -106,7 +107,7 @@ void SpeakRequest::ProcessTTSSpeakResponse( using namespace helpers; ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); diff --git a/src/components/application_manager/src/commands/mobile/speak_response.cc b/src/components/application_manager/src/commands/mobile/speak_response.cc index d99b1d0952..1deae79990 100644 --- a/src/components/application_manager/src/commands/mobile/speak_response.cc +++ b/src/components/application_manager/src/commands/mobile/speak_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/speak_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/HMI_API.h" @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { -SpeakResponse::SpeakResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +SpeakResponse::SpeakResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SpeakResponse::~SpeakResponse() { @@ -50,7 +50,7 @@ SpeakResponse::~SpeakResponse() { void SpeakResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc index 9be2251a67..98d66d9311 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/subscribe_button_request.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { @@ -40,8 +40,8 @@ namespace commands { namespace str = strings; -SubscribeButtonRequest::SubscribeButtonRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { +SubscribeButtonRequest::SubscribeButtonRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } SubscribeButtonRequest::~SubscribeButtonRequest() { @@ -51,7 +51,7 @@ void SubscribeButtonRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); @@ -114,10 +114,7 @@ bool SubscribeButtonRequest::CheckHMICapabilities( using namespace mobile_apis; LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance(); - DCHECK_OR_RETURN(app_mgr, false); - - const HMICapabilities& hmi_caps = app_mgr->hmi_capabilities(); + const HMICapabilities& hmi_caps = application_manager_.hmi_capabilities(); if (!hmi_caps.is_ui_cooperating()) { LOG4CXX_ERROR(logger_, "UI is not supported by HMI."); return false; diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc index a3452ef19f..390a6811a4 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc @@ -38,8 +38,8 @@ namespace application_manager { namespace commands { SubscribeButtonResponse::SubscribeButtonResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SubscribeButtonResponse::~SubscribeButtonResponse() { diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc index 0e6e726f75..eab1ccbf26 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/subscribe_vehicle_data_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "utils/helpers.h" @@ -41,8 +41,8 @@ namespace application_manager { namespace commands { SubscribeVehicleDataRequest::SubscribeVehicleDataRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() { @@ -87,7 +87,7 @@ namespace { void SubscribeVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( connection_key()); if (!app) { @@ -239,7 +239,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { return; } - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( CommandRequestImpl::connection_key()); if (!app) { @@ -387,12 +387,23 @@ void SubscribeVehicleDataRequest::UnsubscribeFailedSubscriptions( } } +struct SubscribedToIVIPredicate { + int32_t vehicle_info_; + SubscribedToIVIPredicate(int32_t vehicle_info) + : vehicle_info_(vehicle_info) {} + bool operator()(const ApplicationSharedPtr app) const { + return app ? app->IsSubscribedToIVI(vehicle_info_) : false; + } +}; + bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor( const uint32_t param_id) const { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::SubscribedToIVIPredicate finder(param_id); - ApplicationManagerImpl::ApplicationListAccessor accessor; - return !accessor.FindAll(finder).empty(); + SubscribedToIVIPredicate finder(param_id); + DataAccessor<ApplicationSet> accessor = application_manager_.applications(); + ApplicationSetConstIt it = std::find_if( + accessor.GetData().begin(), accessor.GetData().end(), finder); + return it != accessor.GetData().end(); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc index c0554c62eb..454c7ad9f6 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/subscribe_vehicle_data_response.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "interfaces/MOBILE_API.h" @@ -40,8 +40,8 @@ namespace application_manager { namespace commands { SubscribeVehicleDataResponse::SubscribeVehicleDataResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() { @@ -49,7 +49,7 @@ SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() { void SubscribeVehicleDataResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc index 913f97ddcf..9b71b71aaa 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc @@ -1,4 +1,4 @@ -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/commands/mobile/subscribe_way_points_request.h" namespace application_manager { @@ -6,8 +6,8 @@ namespace application_manager { namespace commands { SubscribeWayPointsRequest::SubscribeWayPointsRequest( - const MessageSharedPtr &message) - : CommandRequestImpl(message) {} + const MessageSharedPtr &message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} @@ -15,7 +15,7 @@ void SubscribeWayPointsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( connection_key()); if (!app) { @@ -25,16 +25,13 @@ void SubscribeWayPointsRequest::Run() { return; } - if (application_manager::ApplicationManagerImpl::instance() - ->IsAppSubscribedForWayPoints(app->app_id())) { + if (application_manager_.IsAppSubscribedForWayPoints(app->app_id())) { SendResponse(false, mobile_apis::Result::IGNORED); return; } - if (application_manager::ApplicationManagerImpl::instance() - ->IsAnyAppSubscribedForWayPoints()) { - application_manager::ApplicationManagerImpl::instance() - ->SubscribeAppForWayPoints(app->app_id()); + if (application_manager_.IsAnyAppSubscribedForWayPoints()) { + application_manager_.SubscribeAppForWayPoints(app->app_id()); SendResponse(true, mobile_apis::Result::SUCCESS); return; } @@ -46,7 +43,7 @@ void SubscribeWayPointsRequest::Run() { void SubscribeWayPointsRequest::on_event(const event_engine::Event &event) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( + application_manager_.application( connection_key()); const smart_objects::SmartObject &message = event.smart_object(); switch (event.id()) { @@ -57,8 +54,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event &event) { message[strings::params][hmi_response::code].asUInt())); bool result = mobile_apis::Result::SUCCESS == result_code; if (result) { - application_manager::ApplicationManagerImpl::instance() - ->SubscribeAppForWayPoints(app->app_id()); + application_manager_.SubscribeAppForWayPoints(app->app_id()); } SendResponse(result, result_code, NULL, &(message[strings::msg_params])); break; diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc index bb0fc77c82..51b213444d 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc @@ -1,4 +1,4 @@ -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/commands/mobile/subscribe_way_points_response.h" namespace application_manager { @@ -6,8 +6,8 @@ namespace application_manager { namespace commands { SubscribeWayPointsResponse::SubscribeWayPointsResponse( - const MessageSharedPtr &message) - : CommandResponseImpl(message) { + const MessageSharedPtr &message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SubscribeWayPointsResponse::~SubscribeWayPointsResponse() { @@ -16,7 +16,7 @@ SubscribeWayPointsResponse::~SubscribeWayPointsResponse() { void SubscribeWayPointsResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc index dc399c8bc3..5c1231684e 100644 --- a/src/components/application_manager/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/src/commands/mobile/system_request.cc @@ -31,20 +31,20 @@ Copyright (c) 2013, Ford Motor Company POSSIBILITY OF SUCH DAMAGE. */ +#include "application_manager/commands/mobile/system_request.h" + #include <vector> #include <string> -#include <map> -#include <set> -#include "application_manager/commands/mobile/system_request.h" -#include "application_manager/application_manager_impl.h" -#include "application_manager/application_impl.h" +#include <stdio.h> +#include <algorithm> +#include <sstream> #include "application_manager/policies/policy_handler_interface.h" #include "interfaces/MOBILE_API.h" -#include "config_profile/profile.h" #include "utils/file_system.h" #include "formatters/CFormatterJsonBase.h" #include "json/json.h" #include "utils/helpers.h" +#include "utils/custom_string.h" namespace application_manager { @@ -71,7 +71,7 @@ class QueryAppsDataValidator { typedef std::map<std::string, SynonymsSet> SynonymsMap; QueryAppsDataValidator(const smart_objects::SmartObject& object, - const ApplicationManagerImpl& manager) + const ApplicationManager& manager) : data_(object), manager_(manager) {} bool Validate() const { @@ -403,7 +403,7 @@ class QueryAppsDataValidator { } const smart_objects::SmartObject& data_; - const ApplicationManagerImpl& manager_; + const ApplicationManager& manager_; DISALLOW_COPY_AND_ASSIGN(QueryAppsDataValidator); }; @@ -411,13 +411,16 @@ class QueryAppsDataValidator { namespace commands { +namespace custom_str = utils::custom_string; + uint32_t SystemRequest::index = 0; const std::string kSYNC = "SYNC"; const std::string kIVSU = "IVSU"; -SystemRequest::SystemRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) {} +SystemRequest::SystemRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { +} SystemRequest::~SystemRequest() {} @@ -425,7 +428,7 @@ void SystemRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!(application.valid())) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -438,9 +441,9 @@ void SystemRequest::Run() { (*message_)[strings::msg_params][strings::request_type].asInt()); const policy::PolicyHandlerInterface& policy_handler = - application_manager::ApplicationManagerImpl::instance()->GetPolicyHandler(); + application_manager_.GetPolicyHandler(); if (!policy_handler.IsRequestTypeAllowed( - application->mobile_app_id(), request_type)) { + application->policy_app_id(), request_type)) { SendResponse(false, mobile_apis::Result::DISALLOWED); return; } @@ -467,15 +470,15 @@ void SystemRequest::Run() { std::string binary_data_folder; if ((*message_)[strings::params].keyExists(strings::binary_data)) { binary_data = (*message_)[strings::params][strings::binary_data].asBinary(); - binary_data_folder = profile::Profile::instance()->system_files_path(); + binary_data_folder = application_manager_.get_settings().system_files_path(); } else { - binary_data_folder = profile::Profile::instance()->app_storage_folder(); + binary_data_folder = application_manager_.get_settings().app_storage_folder(); binary_data_folder += "/"; binary_data_folder += application->folder_name(); binary_data_folder += "/"; } - std::string file_dst_path = profile::Profile::instance()->system_files_path(); + std::string file_dst_path = application_manager_.get_settings().system_files_path(); file_dst_path += "/"; file_dst_path += file_name; @@ -484,7 +487,7 @@ void SystemRequest::Run() { logger_, "Binary data is present. Trying to save it to: " << binary_data_folder); if (mobile_apis::Result::SUCCESS != - (ApplicationManagerImpl::instance()->SaveBinary( + (application_manager_.SaveBinary( binary_data, binary_data_folder, file_name, 0))) { LOG4CXX_DEBUG(logger_, "Binary data can't be saved."); SendResponse(false, mobile_apis::Result::GENERIC_ERROR); @@ -541,8 +544,7 @@ void SystemRequest::Run() { return; } - ApplicationManagerImpl::instance()->ProcessQueryApp(sm_object, - connection_key()); + application_manager_.ProcessQueryApp(sm_object, connection_key()); SendResponse(true, mobile_apis::Result::SUCCESS); return; } @@ -556,7 +558,7 @@ void SystemRequest::Run() { } if (mobile_apis::RequestType::PROPRIETARY != request_type) { - msg_params[strings::app_id] = (application->mobile_app_id()); + msg_params[strings::app_id] = (application->policy_app_id()); } msg_params[strings::request_type] = (*message_)[strings::msg_params][strings::request_type]; @@ -577,13 +579,14 @@ void SystemRequest::on_event(const event_engine::Event& event) { GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); - const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = + Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!(application.valid())) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -594,6 +597,7 @@ void SystemRequest::on_event(const event_engine::Event& event) { file_system::DeleteFile(processing_file_); processing_file_.clear(); } + SendResponse(result, result_code, NULL, &(message[strings::msg_params])); break; } @@ -619,10 +623,8 @@ bool SystemRequest::ValidateQueryAppData( << json::response << "' parameter."); return false; } - ApplicationManagerImpl* manager = ApplicationManagerImpl::instance(); - DCHECK(manager); - QueryAppsDataValidator validator(data, *manager); + QueryAppsDataValidator validator(data, application_manager_); return validator.Validate(); } diff --git a/src/components/application_manager/src/commands/mobile/system_response.cc b/src/components/application_manager/src/commands/mobile/system_response.cc index 8b4fdafd1b..35b4d72ee2 100644 --- a/src/components/application_manager/src/commands/mobile/system_response.cc +++ b/src/components/application_manager/src/commands/mobile/system_response.cc @@ -32,14 +32,14 @@ */ #include "application_manager/commands/mobile/system_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { -SystemResponse::SystemResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +SystemResponse::SystemResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } SystemResponse::~SystemResponse() { @@ -48,7 +48,7 @@ SystemResponse::~SystemResponse() { void SystemResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc index dc63a11941..3363eb854b 100644 --- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/unregister_app_interface_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/message_helper.h" namespace application_manager { @@ -42,18 +42,16 @@ namespace commands { void UnregisterAppInterfaceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl* app_manager = ApplicationManagerImpl::instance(); - - if (!app_manager->application(connection_key())) { + if (!application_manager_.application(connection_key())) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); LOG4CXX_ERROR(logger_, "Application is not registered"); return; } - MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile( + application_manager_.ManageMobileCommand(MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( connection_key(), - mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM); - app_manager->UnregisterApplication(connection_key(), + mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM), commands::Command::ORIGIN_SDL); + application_manager_.UnregisterApplication(connection_key(), mobile_apis::Result::SUCCESS); SendResponse(true, mobile_apis::Result::SUCCESS); } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc index ef0b9a9a73..478cc7881f 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc @@ -32,7 +32,7 @@ */ #include "application_manager/commands/mobile/unsubscribe_button_request.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" namespace application_manager { @@ -42,8 +42,8 @@ namespace commands { namespace str = strings; UnsubscribeButtonRequest::UnsubscribeButtonRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } UnsubscribeButtonRequest::~UnsubscribeButtonRequest() { @@ -53,7 +53,7 @@ void UnsubscribeButtonRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc index 8bece66157..f7999181a1 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/unsubscribe_button_response.h" -#include "application_manager/application_manager_impl.h" + namespace application_manager { namespace commands { UnsubscribeButtonResponse::UnsubscribeButtonResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } UnsubscribeButtonResponse::~UnsubscribeButtonResponse() { diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 1c4f3ff280..5e33edc226 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -33,7 +33,7 @@ #include "application_manager/commands/mobile/unsubscribe_vehicle_data_request.h" #include "application_manager/commands/command_impl.h" -#include "application_manager/application_manager_impl.h" + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" @@ -45,8 +45,8 @@ namespace application_manager { namespace commands { UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest( - const MessageSharedPtr& message) - : CommandRequestImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { } UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() { @@ -91,7 +91,7 @@ namespace { void UnsubscribeVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( connection_key()); if (!app) { @@ -327,12 +327,23 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { #endif // #ifdef HMI_DBUS_API } +struct SubscribedToIVIPredicate { + int32_t vehicle_info_; + SubscribedToIVIPredicate(int32_t vehicle_info) + : vehicle_info_(vehicle_info) {} + bool operator()(const ApplicationSharedPtr app) const { + return app ? app->IsSubscribedToIVI(vehicle_info_) : false; + } +}; + bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor( const uint32_t param_id) const { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::SubscribedToIVIPredicate finder(param_id); - ApplicationManagerImpl::ApplicationListAccessor accessor; - return !accessor.FindAll(finder).empty(); + SubscribedToIVIPredicate finder(param_id); + DataAccessor<ApplicationSet> accessor = application_manager_.applications(); + ApplicationSetConstIt it = std::find_if( + accessor.GetData().begin(), accessor.GetData().end(), finder); + return it != accessor.GetData().end(); } void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( @@ -359,14 +370,14 @@ void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( void UnsubscribeVehicleDataRequest::UpdateHash() const { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - ApplicationManagerImpl::instance()->application(connection_key()); + application_manager_.application(connection_key()); if (application) { application->UpdateHash(); } else { LOG4CXX_ERROR(logger_, "Application with connection_key = " << connection_key() <<" doesn't exist."); } - ApplicationManagerImpl::instance()->TerminateRequest(connection_key(), + application_manager_.TerminateRequest(connection_key(), correlation_id()); } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc index 87b2e6e5e1..843a53682e 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc @@ -37,8 +37,8 @@ namespace application_manager { namespace commands { UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse( - const MessageSharedPtr& message) - : CommandResponseImpl(message) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() { diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc index c5c6f688b6..215d6dadc2 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc @@ -1,4 +1,4 @@ -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/commands/mobile/unsubscribe_way_points_request.h" namespace application_manager { @@ -6,8 +6,8 @@ namespace application_manager { namespace commands { UnSubscribeWayPointsRequest::UnSubscribeWayPointsRequest( - const MessageSharedPtr &message) - : CommandRequestImpl(message) {} + const MessageSharedPtr &message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} UnSubscribeWayPointsRequest::~UnSubscribeWayPointsRequest() {} @@ -15,8 +15,7 @@ void UnSubscribeWayPointsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( - connection_key()); + application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "An application with connection key " @@ -25,8 +24,7 @@ void UnSubscribeWayPointsRequest::Run() { return; } - if (!application_manager::ApplicationManagerImpl::instance() - ->IsAppSubscribedForWayPoints(app->app_id())) { + if (!application_manager_.IsAppSubscribedForWayPoints(app->app_id())) { SendResponse(false, mobile_apis::Result::IGNORED); return; } @@ -38,8 +36,7 @@ void UnSubscribeWayPointsRequest::Run() { void UnSubscribeWayPointsRequest::on_event(const event_engine::Event &event) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = - application_manager::ApplicationManagerImpl::instance()->application( - connection_key()); + application_manager_.application(connection_key()); const smart_objects::SmartObject &message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { @@ -49,8 +46,7 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event &event) { message[strings::params][hmi_response::code].asUInt())); bool result = mobile_apis::Result::SUCCESS == result_code; if (result) { - application_manager::ApplicationManagerImpl::instance() - ->UnsubscribeAppFromWayPoints(app->app_id()); + application_manager_.UnsubscribeAppFromWayPoints(app->app_id()); } SendResponse(result, result_code, NULL, &(message[strings::msg_params])); break; diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc index 0d8250f0b6..0e57fe410a 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc @@ -1,4 +1,4 @@ -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/commands/mobile/unsubscribe_way_points_response.h" namespace application_manager { @@ -6,15 +6,15 @@ namespace application_manager { namespace commands { UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse( - const MessageSharedPtr &message) - : CommandResponseImpl(message) {} + const MessageSharedPtr &message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} UnsubscribeWayPointsResponse::~UnsubscribeWayPointsResponse() {} void UnsubscribeWayPointsResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc index 8ed5886e01..02c9e479b7 100644 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc @@ -33,7 +33,8 @@ #include <string> #include "application_manager/commands/mobile/update_turn_list_request.h" -#include "application_manager/application_manager_impl.h" + +#include "application_manager/policies/policy_handler.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" @@ -46,15 +47,16 @@ namespace commands { namespace custom_str = utils::custom_string; -UpdateTurnListRequest::UpdateTurnListRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) {} +UpdateTurnListRequest::UpdateTurnListRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { +} UpdateTurnListRequest::~UpdateTurnListRequest() {} void UpdateTurnListRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application( + ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { @@ -74,7 +76,7 @@ void UpdateTurnListRequest::Run() { mobile_apis::Result::eType processing_result = MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager::ApplicationManagerImpl::instance()->GetPolicyHandler()); + application_manager_.GetPolicyHandler(), application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "INVALID_DATA!"); @@ -89,7 +91,7 @@ void UpdateTurnListRequest::Run() { if ((turn_list_array[i].keyExists(strings::turn_icon)) && (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon], - app))) { + app, application_manager_))) { LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -154,7 +156,7 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); HMICapabilities& hmi_capabilities = - ApplicationManagerImpl::instance()->hmi_capabilities(); + application_manager_.hmi_capabilities(); bool result = (mobile_apis::Result::SUCCESS == result_code) || @@ -219,6 +221,7 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() { return true; } } + } } return false; diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc index 26e5c460d3..005e0ad261 100644 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc +++ b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc @@ -32,15 +32,15 @@ */ #include "application_manager/commands/mobile/update_turn_list_response.h" -#include "application_manager/application_manager_impl.h" + #include "interfaces/HMI_API.h" namespace application_manager { namespace commands { -UpdateTurnListResponse::UpdateTurnListResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { +UpdateTurnListResponse::UpdateTurnListResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) { } UpdateTurnListResponse::~UpdateTurnListResponse() { @@ -49,7 +49,7 @@ UpdateTurnListResponse::~UpdateTurnListResponse() { void UpdateTurnListResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationManagerImpl::instance()->SendMessageToMobile(message_); + application_manager_.SendMessageToMobile(message_); } } // namespace commands |