diff options
10 files changed, 1379 insertions, 3788 deletions
diff --git a/src/components/application_manager/include/application_manager/command_factory.h b/src/components/application_manager/include/application_manager/command_factory.h index 596ff11b2a..30bcc69a37 100644 --- a/src/components/application_manager/include/application_manager/command_factory.h +++ b/src/components/application_manager/include/application_manager/command_factory.h @@ -34,10 +34,14 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_FACTORY_H #include "application_manager/commands/command.h" +#include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" +#include "application_manager/policies/policy_handler_interface.h" #include "utils/macro.h" namespace application_manager { - +using rpc_service::RPCService; +using policy::PolicyHandlerInterface; typedef utils::SharedPtr<commands::Command> CommandSharedPtr; /** @@ -54,6 +58,145 @@ class CommandFactory { virtual CommandSharedPtr CreateCommand( const commands::MessageSharedPtr& message, commands::Command::CommandSource source) = 0; + /** + * @param int32_t command id + * @param CommandSource source + * @return return true if command can be create, else return false + **/ + virtual bool IsAbleToProcess( + const int32_t, + const application_manager::commands::Command::CommandSource) const = 0; +}; + +/** + * @brief Command creator interface for create commands + **/ +class CommandCreator { + public: + /** + * @brief ~CommandCreator destructor + **/ + virtual ~CommandCreator() {} + /** + * @return return true if command can be create, else return false + **/ + virtual bool CanBeCreated() const = 0; + /** + * @brief Create command object and return pointer to it + * @param smartObject SmartObject shared pointer. + * @return Pointer to created command object. + **/ + virtual CommandSharedPtr create( + const commands::MessageSharedPtr& message) const = 0; +}; + +/** + * @brief DefaultCommandCreator concrete command creator + **/ +template <typename CommandType> +class DefaultCommandCreator : public CommandCreator { + public: + /** + * @brief DefaultCommandCreator constructor + */ + DefaultCommandCreator(ApplicationManager& application_manager, + RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + PolicyHandlerInterface& policy_handler) + : application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) {} + + private: + /** + * @return return true + **/ + bool CanBeCreated() const override { + return true; + } + + /** + * @brief Create command object and return pointer to it + * @param smartObject SmartObject shared pointer. + * @return Pointer to created command object. + **/ + CommandSharedPtr create( + const commands::MessageSharedPtr& message) const override { + CommandSharedPtr command(new CommandType(message, + application_manager_, + rpc_service_, + hmi_capabilities_, + policy_handler_)); + return command; + } + + ApplicationManager& application_manager_; + RPCService& rpc_service_; + HMICapabilities& hmi_capabilities_; + PolicyHandlerInterface& policy_handler_; +}; + +struct InvalidCommand {}; + +/** + * @brief DefaultCommandCreator<InvalidCommand> creator for invalid commands + **/ +template <> +class DefaultCommandCreator<InvalidCommand> : public CommandCreator { + public: + /** + * @brief DefaultCommandCreator constructor + */ + DefaultCommandCreator(ApplicationManager& application_manager, + RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + PolicyHandlerInterface& policy_handler) { + UNUSED(application_manager); + UNUSED(rpc_service); + UNUSED(hmi_capabilities); + UNUSED(policy_handler); + } + + private: + /** + * @return return false + **/ + bool CanBeCreated() const override { + return false; + } + /** + * @brief Create command object and return pointer to it + * @param smartObject SmartObject shared pointer. + * @return Pointer to created empty command object. + **/ + CommandSharedPtr create( + const commands::MessageSharedPtr& message) const override { + UNUSED(message); + return CommandSharedPtr(); + } +}; + +struct CommandCreatorFactory { + CommandCreatorFactory(ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + PolicyHandlerInterface& policy_handler) + : application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) {} + + template <typename CommandType> + CommandCreator& GetCreator() { + static DefaultCommandCreator<CommandType> res( + application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); + return res; + } + ApplicationManager& application_manager_; + RPCService& rpc_service_; + HMICapabilities& hmi_capabilities_; + PolicyHandlerInterface& policy_handler_; }; } // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h index d9efb2f018..a0a8eecbbd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h @@ -52,7 +52,17 @@ class HMICommandFactory : public app_mngr::CommandFactory { const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) OVERRIDE; + bool IsAbleToProcess( + const int32_t, + const application_manager::commands::Command::CommandSource) + const OVERRIDE; + private: + app_mngr::CommandCreator& get_creator_factory( + hmi_apis::FunctionID::eType id, + hmi_apis::messageType::eType message_type, + app_mngr::commands::Command::CommandSource source) const; + app_mngr::ApplicationManager& application_manager_; app_mngr::rpc_service::RPCService& rpc_service_; app_mngr::HMICapabilities& hmi_capabilities_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h index 8fa01b6800..f4a1505269 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h @@ -52,7 +52,17 @@ class MobileCommandFactory : public app_mngr::CommandFactory { const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) OVERRIDE; + bool IsAbleToProcess( + const int32_t, + const application_manager::commands::Command::CommandSource) + const OVERRIDE; + private: + app_mngr::CommandCreator& get_creator_factory( + mobile_apis::FunctionID::eType id, + mobile_apis::messageType::eType message_type, + app_mngr::commands::Command::CommandSource source) const; + app_mngr::ApplicationManager& application_manager_; app_mngr::rpc_service::RPCService& rpc_service_; app_mngr::HMICapabilities& hmi_capabilities_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h index 5bb24ad62a..5b5f0ae49f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h @@ -56,6 +56,11 @@ class SDLCommandFactory : public app_mngr::CommandFactory { const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) OVERRIDE; + bool IsAbleToProcess( + const int32_t, + const application_manager::commands::Command::CommandSource) + const OVERRIDE; + private: app_mngr::ApplicationManager& app_manager_; app_mngr::rpc_service::RPCService& rpc_service_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index f5321ff08f..d0da49168b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -310,1645 +310,639 @@ HMICommandFactory::HMICommandFactory( CommandSharedPtr HMICommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - const int function_id = - (*message)[strings::params][strings::function_id].asInt(); + const hmi_apis::FunctionID::eType function_id = + static_cast<hmi_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asInt()); LOG4CXX_DEBUG( logger_, "HMICommandFactory::CreateCommand function_id: " << function_id); - CommandSharedPtr command( - new application_manager::commands::CommandImpl(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); + const hmi_apis::messageType::eType message_type = + static_cast<hmi_apis::messageType::eType>( + (*message)[strings::params][strings::message_type].asInt()); - bool is_response = false; - const int msg_type = - (*message)[strings::params][strings::message_type].asInt(); - if (msg_type == - static_cast<int>(application_manager::MessageType::kResponse)) { - is_response = true; + if (hmi_apis::messageType::response == message_type) { LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand response"); } else if ((*message)[strings::params][strings::message_type] == - static_cast<int>( - application_manager::MessageType::kErrorResponse)) { - is_response = true; + hmi_apis::messageType::error_response) { LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand error response"); } else { LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand request"); } - switch (function_id) { + return get_creator_factory(function_id, message_type, source).create(message); +} + +bool HMICommandFactory::IsAbleToProcess( + const int32_t function_id, + const application_manager::commands::Command::CommandSource message_source) + const { + using app_mngr::commands::Command; + return get_creator_factory( + static_cast<hmi_apis::FunctionID::eType>(function_id), + hmi_apis::messageType::INVALID_ENUM, + message_source).CanBeCreated(); +} + +CommandCreator& HMICommandFactory::get_creator_factory( + hmi_apis::FunctionID::eType id, + hmi_apis::messageType::eType message_type, + application_manager::commands::Command::CommandSource source) const { + CommandCreatorFactory factory( + application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); + + switch (static_cast<int32_t>(id)) { case hmi_apis::FunctionID::BasicCommunication_OnStartDeviceDiscovery: { - command.reset(new commands::OnStartDeviceDiscovery(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnStartDeviceDiscovery>(); } case hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList: { - if (is_response) { - command.reset( - new commands::UpdateDeviceListResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UpdateDeviceListRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UpdateDeviceListRequest>() + : factory.GetCreator<commands::UpdateDeviceListResponse>(); } case hmi_apis::FunctionID::BasicCommunication_ActivateApp: { - if (is_response) { - command.reset(new commands::ActivateAppResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::ActivateAppRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::ActivateAppRequest>() + : factory.GetCreator<commands::ActivateAppResponse>(); } #ifdef EXTERNAL_PROPRIETARY_MODE case hmi_apis::FunctionID::BasicCommunication_DecryptCertificate: { - if (is_response) { - command.reset( - new commands::DecryptCertificateResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::DecryptCertificateRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::DecryptCertificateRequest>() + : factory.GetCreator<commands::DecryptCertificateResponse>(); } #endif // EXTERNAL_PROPRIETARY_MODE case hmi_apis::FunctionID::BasicCommunication_GetSystemInfo: { - if (is_response) { - command.reset(new commands::GetSystemInfoResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::GetSystemInfoRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::GetSystemInfoRequest>() + : factory.GetCreator<commands::GetSystemInfoResponse>(); } case hmi_apis::FunctionID::SDL_ActivateApp: { - if (is_response) { - command.reset(new commands::SDLActivateAppResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SDLActivateAppRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::SDLActivateAppRequest>() + : factory.GetCreator<commands::SDLActivateAppResponse>(); } case hmi_apis::FunctionID::BasicCommunication_PolicyUpdate: { - if (is_response) { - command.reset( - new commands::SDLPolicyUpdateResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SDLPolicyUpdate(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::SDLPolicyUpdate>() + : factory.GetCreator<commands::SDLPolicyUpdateResponse>(); } case hmi_apis::FunctionID::SDL_GetURLS: { - if (is_response) { - command.reset(new commands::GetUrlsResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::GetUrls(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::GetUrls>() + : factory.GetCreator<commands::GetUrlsResponse>(); } case hmi_apis::FunctionID::SDL_OnAppPermissionChanged: { - command.reset( - new commands::OnAppPermissionChangedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAppPermissionChangedNotification>(); } case hmi_apis::FunctionID::SDL_GetListOfPermissions: { - if (is_response) { - command.reset( - new commands::SDLGetListOfPermissionsResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::SDLGetListOfPermissionsRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::SDLGetListOfPermissionsRequest>() + : factory + .GetCreator<commands::SDLGetListOfPermissionsResponse>(); } case hmi_apis::FunctionID::SDL_GetUserFriendlyMessage: { - if (is_response) { - command.reset(new commands::SDLGetUserFriendlyMessageResponse( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::SDLGetUserFriendlyMessageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::SDLGetUserFriendlyMessageRequest>() + : factory.GetCreator< + commands::SDLGetUserFriendlyMessageResponse>(); } case hmi_apis::FunctionID::SDL_GetStatusUpdate: { - if (is_response) { - command.reset( - new commands::SDLGetStatusUpdateResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::SDLGetStatusUpdateRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::SDLGetStatusUpdateRequest>() + : factory.GetCreator<commands::SDLGetStatusUpdateResponse>(); } case hmi_apis::FunctionID::SDL_OnStatusUpdate: { - command.reset( - new commands::OnStatusUpdateNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnStatusUpdateNotification>(); } case hmi_apis::FunctionID::SDL_OnAppPermissionConsent: { - command.reset( - new commands::OnAppPermissionConsentNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAppPermissionConsentNotification>(); } case hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported: { - if (is_response) { - command.reset( - new commands::MixingAudioSupportedResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::MixingAudioSupportedRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::MixingAudioSupportedRequest>() + : factory.GetCreator<commands::MixingAudioSupportedResponse>(); } case hmi_apis::FunctionID::BasicCommunication_OnExitAllApplications: { - command.reset( - new commands::OnExitAllApplicationsNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnExitAllApplicationsNotification>(); } case hmi_apis::FunctionID::UI_AddCommand: { - if (is_response) { - command.reset(new commands::UIAddCommandResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIAddCommandRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIAddCommandRequest>() + : factory.GetCreator<commands::UIAddCommandResponse>(); } case hmi_apis::FunctionID::UI_DeleteCommand: { - if (is_response) { - command.reset( - new commands::UIDeleteCommandResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIDeleteCommandRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIDeleteCommandRequest>() + : factory.GetCreator<commands::UIDeleteCommandResponse>(); } case hmi_apis::FunctionID::UI_AddSubMenu: { - if (is_response) { - command.reset(new commands::UIAddSubmenuResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIAddSubmenuRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIAddSubmenuRequest>() + : factory.GetCreator<commands::UIAddSubmenuResponse>(); } case hmi_apis::FunctionID::UI_DeleteSubMenu: { - if (is_response) { - command.reset( - new commands::UIDeleteSubmenuResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIDeleteSubmenuRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIDeleteSubmenuRequest>() + : factory.GetCreator<commands::UIDeleteSubmenuResponse>(); } case hmi_apis::FunctionID::UI_SetMediaClockTimer: { - if (is_response) { - command.reset( - new commands::UISetMediaClockTimerResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UISetMediaClockTimerRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UISetMediaClockTimerRequest>() + : factory.GetCreator<commands::UISetMediaClockTimerResponse>(); } case hmi_apis::FunctionID::UI_PerformInteraction: { - if (is_response) { - command.reset( - new commands::UIPerformInteractionResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UIPerformInteractionRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIPerformInteractionRequest>() + : factory.GetCreator<commands::UIPerformInteractionResponse>(); } case hmi_apis::FunctionID::UI_SetGlobalProperties: { - if (is_response) { - command.reset( - new commands::UISetGlobalPropertiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UISetGlobalPropertiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UISetGlobalPropertiesRequest>() + : factory + .GetCreator<commands::UISetGlobalPropertiesResponse>(); } case hmi_apis::FunctionID::UI_ScrollableMessage: { - if (is_response) { - command.reset( - new commands::UIScrollableMessageResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UIScrollableMessageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIScrollableMessageRequest>() + : factory.GetCreator<commands::UIScrollableMessageResponse>(); } case hmi_apis::FunctionID::UI_SetAppIcon: { - if (is_response) { - command.reset(new commands::UISetAppIconResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UISetAppIconRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UISetAppIconRequest>() + : factory.GetCreator<commands::UISetAppIconResponse>(); } case hmi_apis::FunctionID::UI_GetSupportedLanguages: { - if (is_response) { - command.reset( - new commands::UIGetSupportedLanguagesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UIGetSupportedLanguagesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::UIGetSupportedLanguagesRequest>() + : factory + .GetCreator<commands::UIGetSupportedLanguagesResponse>(); } case hmi_apis::FunctionID::UI_GetLanguage: { - if (is_response) { - command.reset(new commands::UIGetLanguageResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIGetLanguageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIGetLanguageRequest>() + : factory.GetCreator<commands::UIGetLanguageResponse>(); } case hmi_apis::FunctionID::UI_GetCapabilities: { - if (is_response) { - command.reset( - new commands::UIGetCapabilitiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UIGetCapabilitiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIGetCapabilitiesRequest>() + : factory.GetCreator<commands::UIGetCapabilitiesResponse>(); } case hmi_apis::FunctionID::UI_ChangeRegistration: { - if (is_response) { - command.reset( - new commands::UIChangeRegistratioResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UIChangeRegistrationRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIChangeRegistrationRequest>() + : factory.GetCreator<commands::UIChangeRegistratioResponse>(); } case hmi_apis::FunctionID::UI_PerformAudioPassThru: { - if (is_response) { - command.reset( - new commands::UIPerformAudioPassThruResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UIPerformAudioPassThruRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIPerformAudioPassThruRequest>() + : factory + .GetCreator<commands::UIPerformAudioPassThruResponse>(); } case hmi_apis::FunctionID::UI_EndAudioPassThru: { - if (is_response) { - command.reset( - new commands::UIEndAudioPassThruResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UIEndAudioPassThruRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIEndAudioPassThruRequest>() + : factory.GetCreator<commands::UIEndAudioPassThruResponse>(); } case hmi_apis::FunctionID::UI_Alert: { - if (is_response) { - command.reset(new commands::UIAlertResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIAlertRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIAlertRequest>() + : factory.GetCreator<commands::UIAlertResponse>(); } case hmi_apis::FunctionID::VR_IsReady: { - if (is_response) { - command.reset(new commands::VRIsReadyResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::VRIsReadyRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VRIsReadyRequest>() + : factory.GetCreator<commands::VRIsReadyResponse>(); } case hmi_apis::FunctionID::VR_AddCommand: { - if (is_response) { - command.reset(new commands::VRAddCommandResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::VRAddCommandRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VRAddCommandRequest>() + : factory.GetCreator<commands::VRAddCommandResponse>(); } case hmi_apis::FunctionID::VR_DeleteCommand: { - if (is_response) { - command.reset( - new commands::VRDeleteCommandResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::VRDeleteCommandRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VRDeleteCommandRequest>() + : factory.GetCreator<commands::VRDeleteCommandResponse>(); } case hmi_apis::FunctionID::VR_ChangeRegistration: { - if (is_response) { - command.reset( - new commands::VRChangeRegistrationResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VRChangeRegistrationRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VRChangeRegistrationRequest>() + : factory.GetCreator<commands::VRChangeRegistrationResponse>(); } case hmi_apis::FunctionID::VR_GetSupportedLanguages: { - if (is_response) { - command.reset( - new commands::VRGetSupportedLanguagesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VRGetSupportedLanguagesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::VRGetSupportedLanguagesRequest>() + : factory + .GetCreator<commands::VRGetSupportedLanguagesResponse>(); } case hmi_apis::FunctionID::VR_GetLanguage: { - if (is_response) { - command.reset(new commands::VRGetLanguageResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::VRGetLanguageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VRGetLanguageRequest>() + : factory.GetCreator<commands::VRGetLanguageResponse>(); } case hmi_apis::FunctionID::VR_GetCapabilities: { - if (is_response) { - command.reset( - new commands::VRGetCapabilitiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VRGetCapabilitiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VRGetCapabilitiesRequest>() + : factory.GetCreator<commands::VRGetCapabilitiesResponse>(); } case hmi_apis::FunctionID::TTS_IsReady: { - if (is_response) { - command.reset(new commands::TTSIsReadyResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::TTSIsReadyRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::TTSIsReadyRequest>() + : factory.GetCreator<commands::TTSIsReadyResponse>(); } case hmi_apis::FunctionID::TTS_ChangeRegistration: { - if (is_response) { - command.reset( - new commands::TTSChangeRegistratioResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::TTSChangeRegistrationRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::TTSChangeRegistrationRequest>() + : factory.GetCreator<commands::TTSChangeRegistratioResponse>(); } case hmi_apis::FunctionID::TTS_GetSupportedLanguages: { - if (is_response) { - command.reset( - new commands::TTSGetSupportedLanguagesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::TTSGetSupportedLanguagesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::TTSGetSupportedLanguagesRequest>() + : factory.GetCreator< + commands::TTSGetSupportedLanguagesResponse>(); } case hmi_apis::FunctionID::TTS_StopSpeaking: { - if (is_response) { - command.reset( - new commands::TTSStopSpeakingResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::TTSStopSpeakingRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::TTSStopSpeakingRequest>() + : factory.GetCreator<commands::TTSStopSpeakingResponse>(); } case hmi_apis::FunctionID::TTS_GetLanguage: { - if (is_response) { - command.reset(new commands::TTSGetLanguageResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::TTSGetLanguageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::TTSGetLanguageRequest>() + : factory.GetCreator<commands::TTSGetLanguageResponse>(); } case hmi_apis::FunctionID::TTS_Speak: { - if (is_response) { - command.reset(new commands::TTSSpeakResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::TTSSpeakRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::TTSSpeakRequest>() + : factory.GetCreator<commands::TTSSpeakResponse>(); } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - if (is_response) { - command.reset( - new commands::TTSSetGlobalPropertiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::TTSSetGlobalPropertiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::TTSSetGlobalPropertiesRequest>() + : factory + .GetCreator<commands::TTSSetGlobalPropertiesResponse>(); } case hmi_apis::FunctionID::TTS_GetCapabilities: { - if (is_response) { - command.reset( - new commands::TTSGetCapabilitiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::TTSGetCapabilitiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::TTSGetCapabilitiesRequest>() + : factory.GetCreator<commands::TTSGetCapabilitiesResponse>(); } case hmi_apis::FunctionID::TTS_Started: { - command.reset(new commands::OnTTSStartedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnTTSStartedNotification>(); } case hmi_apis::FunctionID::TTS_Stopped: { - command.reset(new commands::OnTTSStoppedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnTTSStoppedNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnAppActivated: { - command.reset( - new commands::OnAppActivatedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAppActivatedNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnAwakeSDL: { - command.reset(new commands::OnAwakeSDLNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAwakeSDLNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnExitApplication: { - command.reset( - new commands::OnExitApplicationNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnExitApplicationNotification>(); } case hmi_apis::FunctionID::UI_Show: { - if (is_response) { - command.reset(new commands::UIShowResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIShowRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIShowRequest>() + : factory.GetCreator<commands::UIShowResponse>(); } case hmi_apis::FunctionID::UI_Slider: { - if (is_response) { - command.reset(new commands::UISliderResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UISliderRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UISliderRequest>() + : factory.GetCreator<commands::UISliderResponse>(); } case hmi_apis::FunctionID::UI_ClosePopUp: { - if (is_response) { - command.reset(new commands::ClosePopupResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::ClosePopupRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::ClosePopupRequest>() + : factory.GetCreator<commands::ClosePopupResponse>(); } case hmi_apis::FunctionID::UI_IsReady: { - if (is_response) { - command.reset(new commands::UIIsReadyResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UIIsReadyRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UIIsReadyRequest>() + : factory.GetCreator<commands::UIIsReadyResponse>(); } case hmi_apis::FunctionID::VehicleInfo_IsReady: { - if (is_response) { - command.reset(new commands::VIIsReadyResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::VIIsReadyRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIIsReadyRequest>() + : factory.GetCreator<commands::VIIsReadyResponse>(); } case hmi_apis::FunctionID::VehicleInfo_ReadDID: { - if (is_response) { - command.reset(new commands::VIReadDIDResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::VIReadDIDRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIReadDIDRequest>() + : factory.GetCreator<commands::VIReadDIDResponse>(); } #ifdef HMI_DBUS_API case hmi_apis::FunctionID::VehicleInfo_GetGpsData: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetGpsData>(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetGpsData>(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetGpsData> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetGpsData> >(); } case hmi_apis::FunctionID::VehicleInfo_GetSpeed: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSpeed>(message, - application_manager_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSpeed>(message, - application_manager_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetSpeed> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetSpeed> >(); } case hmi_apis::FunctionID::VehicleInfo_GetRpm: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetRpm>(message, - application_manager_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetRpm>(message, - application_manager_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehitcleInfo_GetRpm> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetRpm> >(); } case hmi_apis::FunctionID::VehicleInfo_GetFuelLevel: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevel>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevel>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetFuelLevel> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetFuelLevel> >(); } case hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState> >(); + : factory.GetCreator< + commands::VIGetVehicleDataResponseTemplate<hmi_apis:: + FunctionID::VehicleInfo_GetFuelLevelState>> () } case hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetInstantFuelConsumption> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetInstantFuelConsumption> >(); } case hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetExternalTemperature> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetExternalTemperature> >(); } case hmi_apis::FunctionID::VehicleInfo_GetPrndl: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetPrndl>(message, - application_manager_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetPrndl>(message, - application_manager_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetPrndl> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetPrndl> >(); } case hmi_apis::FunctionID::VehicleInfo_GetVin: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetVin>(message, - application_manager_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetVin>(message, - application_manager_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetVin> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetVin> >(); } case hmi_apis::FunctionID::VehicleInfo_GetTirePressure: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetTirePressure>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetTirePressure>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetTirePressure> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetTirePressure> >(); } case hmi_apis::FunctionID::VehicleInfo_GetOdometer: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetOdometer>(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetOdometer>(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetOdometer> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetOdometer> >(); } case hmi_apis::FunctionID::VehicleInfo_GetBeltStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBeltStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBeltStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetBeltStatus> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetBeltStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_GetBodyInformation: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBodyInformation>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBodyInformation>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetBodyInformation> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetBodyInformation> >(); } case hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetDeviceStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_GetDriverBraking: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDriverBraking>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDriverBraking>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetDriverBraking> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetDriverBraking> >(); } case hmi_apis::FunctionID::VehicleInfo_GetWiperStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetWiperStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetWiperStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetWiperStatus> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetWiperStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetHeadLampStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_GetEngineTorque: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEngineTorque>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEngineTorque>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetEngineTorque> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetEngineTorque> >(); } case hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetAccPedalPosition> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetAccPedalPosition> >(); } case hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetSteeringWheelAngle> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetSteeringWheelAngle> >(); } case hmi_apis::FunctionID::VehicleInfo_GetECallInfo: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetECallInfo>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetECallInfo>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetECallInfo> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetECallInfo> >(); } case hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetAirbagStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetEmergencyEvent> >(); } case hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetClusterModeStatus> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_GetClusterModeStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_GetMyKey: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetMyKey>(message, - application_manager_)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetMyKey>(message, - application_manager_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_GetMyKey> >() + : factory + .GetCreator<commands::VIGetVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_GetMyKey> >(); } #else case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: { - if (is_response) { - command.reset( - new commands::VIGetVehicleDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VIGetVehicleDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleDataRequest>() + : factory.GetCreator<commands::VIGetVehicleDataResponse>(); } #endif // #ifdef HMI_DBUS_API case hmi_apis::FunctionID::VehicleInfo_GetDTCs: { - if (is_response) { - command.reset(new commands::VIGetDTCsResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::VIGetDTCsRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetDTCsRequest>() + : factory.GetCreator<commands::VIGetDTCsResponse>(); } case hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage: { - if (is_response) { - command.reset( - new commands::VIDiagnosticMessageResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VIDiagnosticMessageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIDiagnosticMessageRequest>() + : factory.GetCreator<commands::VIDiagnosticMessageResponse>(); } case hmi_apis::FunctionID::VehicleInfo_GetVehicleType: { - if (is_response) { - command.reset( - new commands::VIGetVehicleTypeResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VIGetVehicleTypeRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VIGetVehicleTypeRequest>() + : factory.GetCreator<commands::VIGetVehicleTypeResponse>(); } case hmi_apis::FunctionID::Navigation_IsReady: { - if (is_response) { - command.reset(new commands::NaviIsReadyResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::NaviIsReadyRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviIsReadyRequest>() + : factory.GetCreator<commands::NaviIsReadyResponse>(); } case hmi_apis::FunctionID::Navigation_AlertManeuver: { - if (is_response) { - command.reset( - new commands::NaviAlertManeuverResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviAlertManeuverRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviAlertManeuverRequest>() + : factory.GetCreator<commands::NaviAlertManeuverResponse>(); } case hmi_apis::FunctionID::Navigation_GetWayPoints: { - if (is_response) { - command.reset( - new commands::NaviGetWayPointsResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviGetWayPointsRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviGetWayPointsRequest>() + : factory.GetCreator<commands::NaviGetWayPointsResponse>(); } case hmi_apis::FunctionID::Navigation_UpdateTurnList: { - if (is_response) { - command.reset( - new commands::NaviUpdateTurnListResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviUpdateTurnListRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviUpdateTurnListRequest>() + : factory.GetCreator<commands::NaviUpdateTurnListResponse>(); } case hmi_apis::FunctionID::Navigation_ShowConstantTBT: { - if (is_response) { - command.reset( - new commands::NaviShowConstantTBTResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviShowConstantTBTRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviShowConstantTBTRequest>() + : factory.GetCreator<commands::NaviShowConstantTBTResponse>(); } case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: { - if (is_response) { - command.reset( - new commands::NaviSubscribeWayPointsResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviSubscribeWayPointsRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviSubscribeWayPointsRequest>() + : factory + .GetCreator<commands::NaviSubscribeWayPointsResponse>(); } case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { - if (is_response) { - command.reset( - new commands::NaviUnsubscribeWayPointsResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviUnSubscribeWayPointsRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::NaviUnSubscribeWayPointsRequest>() + : factory.GetCreator< + commands::NaviUnsubscribeWayPointsResponse>(); } case hmi_apis::FunctionID::Buttons_GetCapabilities: { - if (is_response) { - command.reset( - new commands::ButtonGetCapabilitiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::ButtonGetCapabilitiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::ButtonGetCapabilitiesRequest>() + : factory + .GetCreator<commands::ButtonGetCapabilitiesResponse>(); } case hmi_apis::FunctionID::SDL_OnAllowSDLFunctionality: { - command.reset(new commands::OnAllowSDLFunctionalityNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::OnAllowSDLFunctionalityNotification>(); } case hmi_apis::FunctionID::SDL_OnSDLConsentNeeded: { - command.reset( - new commands::OnSDLConsentNeededNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnSDLConsentNeededNotification>(); } case hmi_apis::FunctionID::SDL_UpdateSDL: { - if (is_response) { - command.reset(new commands::UpdateSDLResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UpdateSDLRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UpdateSDLRequest>() + : factory.GetCreator<commands::UpdateSDLResponse>(); } case hmi_apis::FunctionID::BasicCommunication_OnIgnitionCycleOver: { - command.reset( - new commands::OnIgnitionCycleOverNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnIgnitionCycleOverNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnSystemInfoChanged: { - command.reset( - new commands::OnSystemInfoChangedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnSystemInfoChangedNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnReady: { - command.reset(new commands::OnReadyNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnReadyNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnSystemTimeReady: { command.reset(new commands::OnSystemTimeReadyNotification( @@ -1956,1619 +950,774 @@ CommandSharedPtr HMICommandFactory::CreateCommand( break; } case hmi_apis::FunctionID::BasicCommunication_OnDeviceChosen: { - command.reset( - new commands::OnDeviceChosenNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnDeviceChosenNotification>(); } case hmi_apis::FunctionID::UI_OnSystemContext: { - command.reset( - new commands::OnSystemContextNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnSystemContextNotification>(); } case hmi_apis::FunctionID::UI_OnDriverDistraction: { - command.reset(new commands::hmi::OnDriverDistractionNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::hmi::OnDriverDistractionNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnUpdateDeviceList: { - command.reset(new commands::OnUpdateDeviceList(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnUpdateDeviceList>(); } case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered: { - command.reset( - new commands::OnAppRegisteredNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAppRegisteredNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered: { - command.reset( - new commands::OnAppUnregisteredNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAppUnregisteredNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnFindApplications: { - command.reset(new commands::OnFindApplications(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnFindApplications>(); } case hmi_apis::FunctionID::BasicCommunication_UpdateAppList: { - if (is_response) { - command.reset(new commands::UpdateAppListResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UpdateAppListRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UpdateAppListRequest>() + : factory.GetCreator<commands::UpdateAppListResponse>(); } case hmi_apis::FunctionID::VR_Started: { - command.reset(new commands::OnVRStartedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVRStartedNotification>(); } case hmi_apis::FunctionID::VR_Stopped: { - command.reset(new commands::OnVRStoppedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVRStoppedNotification>(); } case hmi_apis::FunctionID::VR_OnCommand: { - command.reset(new commands::OnVRCommandNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVRCommandNotification>(); } case hmi_apis::FunctionID::UI_OnCommand: { - command.reset(new commands::OnUICommandNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnUICommandNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated: { - command.reset( - new commands::OnAppDeactivatedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAppDeactivatedNotification>(); } case hmi_apis::FunctionID::UI_OnLanguageChange: { - command.reset( - new commands::OnUILanguageChangeNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnUILanguageChangeNotification>(); } case hmi_apis::FunctionID::VR_OnLanguageChange: { - command.reset( - new commands::OnVRLanguageChangeNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVRLanguageChangeNotification>(); } case hmi_apis::FunctionID::TTS_OnLanguageChange: { - command.reset( - new commands::OnTTSLanguageChangeNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnTTSLanguageChangeNotification>(); } case hmi_apis::FunctionID::Buttons_OnButtonEvent: { - command.reset( - new commands::hmi::OnButtonEventNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::hmi::OnButtonEventNotification>(); } case hmi_apis::FunctionID::Buttons_OnButtonPress: { - command.reset( - new commands::hmi::OnButtonPressNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::hmi::OnButtonPressNotification>(); } case hmi_apis::FunctionID::Buttons_OnButtonSubscription: { - command.reset(new commands::hmi::OnButtonSubscriptionNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::hmi::OnButtonSubscriptionNotification>(); } #ifdef HMI_DBUS_API case hmi_apis::FunctionID::VehicleInfo_SubscribeGps: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeGps>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeGps>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeGps> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeGps> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeSpeed> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeRpm: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeRpm>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeRpm>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeRpm> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeRpm> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeFuelLevel> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeFuelLevel> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeFuelLevel_State> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeFuelLevel_State> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeInstantFuelConsumption> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeInstantFuelConsumption> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeExternalTemperature> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeExternalTemperature> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribePrndl: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribePrndl>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribePrndl>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribePrndl> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribePrndl> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeVin: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeVin>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeVin>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeVin> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeVin> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeTirePressure> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeTirePressure> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeOdometer> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeOdometer> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeBeltStatus> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeBeltStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeBodyInformation> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeBodyInformation> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeDeviceStatus> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeDeviceStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeDriverBraking> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeDriverBraking> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeWiperStatus> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeWiperStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeHeadLampStatus> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeHeadLampStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeEngineTorque> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeEngineTorque> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeAccPedalPosition> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeAccPedalPosition> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeSteeringWheelAngle> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeSteeringWheelAngle> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeECallInfo> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeECallInfo> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeAirbagStatus> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeAirbagStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeEmergencyEvent> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeEmergencyEvent> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeClusterModeStatus> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeClusterModeStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VISubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey> >() + : factory.GetCreator< + commands::VISubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_SubscribeMyKey> >(); } #else case hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData: { - if (is_response) { - command.reset( - new commands::VISubscribeVehicleDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VISubscribeVehicleDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VISubscribeVehicleDataRequest>() + : factory + .GetCreator<commands::VISubscribeVehicleDataResponse>(); } #endif // #ifdef HMI_DBUS_API #ifdef HMI_DBUS_API case hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator < + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeGps> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeSpeed> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeSpeed> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeRpm> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeFuelLevel> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeFuelLevel> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeFuelLevel_State> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeFuelLevel_State> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID:: - VehicleInfo_UnsubscribeInstantFuelConsumption>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID:: - VehicleInfo_UnsubscribeInstantFuelConsumption>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeInstantFuelConsumption> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeInstantFuelConsumption> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeExternalTemperature> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeExternalTemperature> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribePrndl> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribePrndl> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeVin> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeTirePressure> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeTirePressure> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeOdometer> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeOdometer> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeBeltStatus> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeBeltStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeBodyInformation> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeBodyInformation> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeDeviceStatus> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeDeviceStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeDriverBraking> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeDriverBraking> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeWiperStatus> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeWiperStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeHeadLampStatus> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeHeadLampStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeEngineTorque> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeEngineTorque> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeAccPedalPosition> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeAccPedalPosition> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeSteeringWheelAngle> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeSteeringWheelAngle> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeECallInfo> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeECallInfo> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeAirbagStatus> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeAirbagStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeEmergencyEvent> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeEmergencyEvent> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeClusterModeStatus> >() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeClusterModeStatus> >(); } case hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::>( + VIUnsubscribeVehicleDataRequestTemplate< + hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>) + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponseTemplate< + hmi_apis::FunctionID:: + VehicleInfo_UnsubscribeMyKey> >(); } #else case hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData: { - if (is_response) { - command.reset( - new commands::VIUnsubscribeVehicleDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VIUnsubscribeVehicleDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::VIUnsubscribeVehicleDataRequest>() + : factory.GetCreator< + commands::VIUnsubscribeVehicleDataResponse>(); } #endif // #ifdef HMI_DBUS_API #ifdef HMI_DBUS_API case hmi_apis::FunctionID::VehicleInfo_OnGpsData: { - command.reset(new commands::OnVIGpsDataNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIGpsDataNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnSpeed: { - command.reset(new commands::OnVISpeedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVISpeedNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnRpm: { - command.reset(new commands::OnVIRpmNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIRpmNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnFuelLevel: { - command.reset( - new commands::OnVIFuelLevelNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVifuelLevelNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnFuelLevelState: { - command.reset( - new commands::OnVIFuelLevelStateNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVifuelLevelStateNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnInstantFuelConsumption: { - command.reset(new commands::OnVIInstantFuelConsumptionNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::OnVIInstantFuelConsumptionNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnExternalTemperature: { - command.reset(new commands::OnVIExternalTemperatureNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::OnVIExternalTemperatureNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnVin: { - command.reset(new commands::OnVIVinNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIVinNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnPrndl: { - command.reset(new commands::OnVIPrndlNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIPrndlNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnTirePressure: { - command.reset( - new commands::OnVITirePressureNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVITirePressureNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnOdometer: { - command.reset(new commands::OnVIOdometerNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIOdometerNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnBeltStatus: { - command.reset( - new commands::OnVIBeltStatusNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIBeltStatusNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnBodyInformation: { - command.reset( - new commands::OnVIBodyInformationNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIBodyInformationNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnDeviceStatus: { - command.reset( - new commands::OnVIDeviceStatusNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIDeviceStatusNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnDriverBraking: { - command.reset( - new commands::OnVIDriverBrakingNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIDriverBrakingNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnWiperStatus: { - command.reset( - new commands::OnVIWiperStatusNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIWiperStatusNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnHeadLampStatus: { - command.reset( - new commands::OnVIHeadLampStatusNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIHeadLampStatusNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnEngineTorque: { - command.reset( - new commands::OnVIEngineTorqueNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIEngineTorqueNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnAccPedalPosition: { - command.reset( - new commands::OnVIAccPedalPositionNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIAccPedalPositionNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnSteeringWheelAngle: { - command.reset( - new commands::OnVISteeringWheelAngleNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVISteeringWheelAngleNotification>(); } case hmi_apis::FunctionID::VehicleInfo_OnMyKey: { - command.reset(new commands::OnVIMyKeyNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIMyKeyNotification>(); } #else case hmi_apis::FunctionID::VehicleInfo_OnVehicleData: { - command.reset( - new commands::OnVIVehicleDataNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVIVehicleDataNotification>(); } #endif // #ifdef HMI_DBUS_API case hmi_apis::FunctionID::Navigation_OnTBTClientState: { - command.reset( - new commands::OnNaviTBTClientStateNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnNaviTBTClientStateNotification>(); } case hmi_apis::FunctionID::UI_OnKeyboardInput: { - command.reset( - new commands::hmi::OnUIKeyBoardInputNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::hmi::OnUIKeyBoardInputNotification>(); } case hmi_apis::FunctionID::UI_OnTouchEvent: { - command.reset( - new commands::hmi::OnUITouchEventNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::hmi::OnUITouchEventNotification>(); } case hmi_apis::FunctionID::UI_OnResetTimeout: { - command.reset( - new commands::hmi::OnUIResetTimeoutNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::hmi::OnUIResetTimeoutNotification>(); } case hmi_apis::FunctionID::Navigation_SetVideoConfig: { - if (is_response) { - command.reset( - new commands::NaviSetVideoConfigResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviSetVideoConfigRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviSetVideoConfigRequest>() + : factory.GetCreator<commands::NaviSetVideoConfigResponse>(); } case hmi_apis::FunctionID::Navigation_StartStream: { - if (is_response) { - command.reset( - new commands::NaviStartStreamResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::NaviStartStreamRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviStartStreamRequest>() + : factory.GetCreator<commands::NaviStartStreamResponse>(); } case hmi_apis::FunctionID::Navigation_StopStream: { - if (is_response) { - command.reset(new commands::NaviStopStreamResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::NaviStopStreamRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviStopStreamRequest>() + : factory.GetCreator<commands::NaviStopStreamResponse>(); } case hmi_apis::FunctionID::Navigation_StartAudioStream: { - if (is_response) { - command.reset( - new commands::AudioStartStreamResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::AudioStartStreamRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::AudioStartStreamRequest>() + : factory.GetCreator<commands::AudioStartStreamResponse>(); } case hmi_apis::FunctionID::Navigation_StopAudioStream: { - if (is_response) { - command.reset( - new commands::AudioStopStreamResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::AudioStopStreamRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::AudioStopStreamRequest>() + : factory.GetCreator<commands::AudioStopStreamResponse>(); } case hmi_apis::FunctionID::Navigation_OnAudioDataStreaming: { - command.reset( - new commands::OnAudioDataStreamingNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAudioDataStreamingNotification>(); } case hmi_apis::FunctionID::Navigation_OnVideoDataStreaming: { - command.reset( - new commands::OnVideoDataStreamingNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVideoDataStreamingNotification>(); } case hmi_apis::FunctionID::VR_PerformInteraction: { - if (is_response) { - command.reset( - new commands::VRPerformInteractionResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::VRPerformInteractionRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::VRPerformInteractionRequest>() + : factory.GetCreator<commands::VRPerformInteractionResponse>(); } case hmi_apis::FunctionID::BasicCommunication_OnSystemRequest: { - command.reset( - new commands::OnSystemRequestNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnSystemRequestNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnPutFile: { - command.reset(new commands::OnPutFileNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnPutFileNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource: { - command.reset( - new commands::OnResumeAudioSourceNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnResumeAudioSourceNotification>(); } case hmi_apis::FunctionID::UI_SetDisplayLayout: { - if (is_response) { - command.reset( - new commands::UiSetDisplayLayoutResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UiSetDisplayLayoutRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UiSetDisplayLayoutRequest>() + : factory.GetCreator<commands::UiSetDisplayLayoutResponse>(); } case hmi_apis::FunctionID::BasicCommunication_OnSDLClose: { - command.reset(new commands::OnSDLCloseNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnSDLCloseNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete: { - command.reset(new commands::OnSDLPersistenceCompleteNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::OnSDLPersistenceCompleteNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnFileRemoved: { - command.reset( - new commands::OnFileRemovedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnFileRemovedNotification>(); } case hmi_apis::FunctionID::UI_OnRecordStart: { - command.reset( - new commands::OnRecordStartdNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnRecordStartdNotification>(); } case hmi_apis::FunctionID::BasicCommunication_SystemRequest: { - if (is_response) { - command.reset( - new commands::BasicCommunicationSystemResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::BasicCommunicationSystemRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator<commands::BasicCommunicationSystemRequest>() + : factory.GetCreator< + commands::BasicCommunicationSystemResponse>(); } case hmi_apis::FunctionID::BasicCommunication_GetSystemTime: { if (is_response) { @@ -3581,164 +1730,56 @@ CommandSharedPtr HMICommandFactory::CreateCommand( break; } case hmi_apis::FunctionID::Navigation_SendLocation: { - if (is_response) { - command.reset( - new commands::NaviSendLocationResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::NaviSendLocationRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::NaviSendLocationRequest>() + : factory.GetCreator<commands::NaviSendLocationResponse>(); } case hmi_apis::FunctionID::SDL_AddStatisticsInfo: { - command.reset( - new commands::AddStatisticsInfoNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::AddStatisticsInfoNotification>(); } case hmi_apis::FunctionID::SDL_OnSystemError: { - command.reset( - new commands::OnSystemErrorNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnSystemErrorNotification>(); } case hmi_apis::FunctionID::SDL_OnReceivedPolicyUpdate: { - command.reset(new commands::OnReceivedPolicyUpdate(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnReceivedPolicyUpdate>(); } case hmi_apis::FunctionID::SDL_OnPolicyUpdate: { - command.reset(new commands::OnPolicyUpdate(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnPolicyUpdate>(); } case hmi_apis::FunctionID::SDL_OnDeviceStateChanged: { - command.reset( - new commands::OnDeviceStateChangedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnDeviceStateChangedNotification>(); } case hmi_apis::FunctionID::TTS_OnResetTimeout: { - command.reset( - new commands::hmi::OnTTSResetTimeoutNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::hmi::OnTTSResetTimeoutNotification>(); } case hmi_apis::FunctionID::BasicCommunication_OnEventChanged: { - command.reset( - new commands::OnEventChangedNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnEventChangedNotification>(); } case hmi_apis::FunctionID::BasicCommunication_DialNumber: { - if (is_response) { - command.reset( - new commands::hmi::DialNumberResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::hmi::DialNumberRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::hmi::DialNumberRequest>() + : factory.GetCreator<commands::hmi::DialNumberResponse>(); } case hmi_apis::FunctionID::Navigation_OnWayPointChange: { - command.reset( - new commands::OnNaviWayPointChangeNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnNaviWayPointChangeNotification>(); } case hmi_apis::FunctionID::RC_IsReady: { - if (is_response) { - command.reset(new commands::RCIsReadyResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::RCIsReadyRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::RCIsReadyRequest>() + : factory.GetCreator<commands::RCIsReadyResponse>(); } case hmi_apis::FunctionID::RC_GetCapabilities: { - if (is_response) { - command.reset( - new commands::RCGetCapabilitiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::RCGetCapabilitiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::RCGetCapabilitiesRequest>() + : factory.GetCreator<commands::RCGetCapabilitiesResponse>(); } case hmi_apis::FunctionID::UI_SendHapticData: { - if (is_response) { - command.reset( - new commands::UISendHapticDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UISendHapticDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return hmi_apis::messageType::request == message_type + ? factory.GetCreator<commands::UISendHapticDataRequest>() + : factory.GetCreator<commands::UISendHapticDataResponse>(); } + default: { return factory.GetCreator<InvalidCommand>(); } } - return command; } } // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index 9b986131b0..4640711147 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -147,982 +147,347 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") namespace sdl_rpc_plugin { using namespace application_manager; -MobileCommandFactory::MobileCommandFactory( - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler) - : application_manager_(application_manager) - , rpc_service_(rpc_service) - , hmi_capabilities_(hmi_capabilities) - , policy_handler_(policy_handler) {} - -CommandSharedPtr MobileCommandFactory::CreateCommand( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::commands::Command::CommandSource source) { - CommandSharedPtr command; - const int function_id = - (*message)[strings::params][strings::function_id].asInt(); - LOG4CXX_DEBUG( - logger_, - "MobileCommandFactory::CreateCommand function_id: " << function_id); +CommandCreator& MobileCommandFactory::get_creator_factory( + mobile_apis::FunctionID::eType id, + mobile_apis::messageType::eType message_type, + app_mngr::commands::Command::CommandSource source) const { + CommandCreatorFactory factory( + application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); - switch (function_id) { + switch (id) { case mobile_apis::FunctionID::RegisterAppInterfaceID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kRequest)) { - command.reset( - new commands::RegisterAppInterfaceRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - - } else { - command.reset( - new commands::RegisterAppInterfaceResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::RegisterAppInterfaceRequest>() + : factory.GetCreator<commands::RegisterAppInterfaceResponse>(); } case mobile_apis::FunctionID::UnregisterAppInterfaceID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kRequest)) { - command.reset( - new commands::UnregisterAppInterfaceRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UnregisterAppInterfaceResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::UnregisterAppInterfaceRequest>() + : factory + .GetCreator<commands::UnregisterAppInterfaceResponse>(); } case mobile_apis::FunctionID::SetGlobalPropertiesID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SetGlobalPropertiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::SetGlobalPropertiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SetGlobalPropertiesRequest>() + : factory.GetCreator<commands::SetGlobalPropertiesResponse>(); } case mobile_apis::FunctionID::ResetGlobalPropertiesID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::ResetGlobalPropertiesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::ResetGlobalPropertiesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ResetGlobalPropertiesRequest>() + : factory + .GetCreator<commands::ResetGlobalPropertiesResponse>(); } case mobile_apis::FunctionID::AddCommandID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::AddCommandResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::AddCommandRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::AddCommandRequest>() + : factory.GetCreator<commands::AddCommandResponse>(); } case mobile_apis::FunctionID::DeleteCommandID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::DeleteCommandResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::DeleteCommandRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::DeleteCommandRequest>() + : factory.GetCreator<commands::DeleteCommandResponse>(); } case mobile_apis::FunctionID::AddSubMenuID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::AddSubMenuResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::AddSubMenuRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::AddSubMenuRequest>() + : factory.GetCreator<commands::AddSubMenuResponse>(); } + case mobile_apis::FunctionID::DeleteSubMenuID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::DeleteSubMenuResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::DeleteSubMenuRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::DeleteSubMenuRequest>() + : factory.GetCreator<commands::DeleteSubMenuResponse>(); } case mobile_apis::FunctionID::DeleteInteractionChoiceSetID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::DeleteInteractionChoiceSetResponse( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::DeleteInteractionChoiceSetRequest( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator< + commands::DeleteInteractionChoiceSetRequest>() + : factory.GetCreator< + commands::DeleteInteractionChoiceSetResponse>(); } case mobile_apis::FunctionID::AlertID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::AlertResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::AlertRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::AlertRequest>() + : factory.GetCreator<commands::AlertResponse>(); } case mobile_apis::FunctionID::SpeakID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SpeakResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SpeakRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SpeakRequest>() + : factory.GetCreator<commands::SpeakResponse>(); } case mobile_apis::FunctionID::SliderID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SliderResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SliderRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SliderRequest>() + : factory.GetCreator<commands::SliderResponse>(); } case mobile_apis::FunctionID::PerformAudioPassThruID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::PerformAudioPassThruResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::PerformAudioPassThruRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::PerformAudioPassThruRequest>() + : factory.GetCreator<commands::PerformAudioPassThruResponse>(); } + case mobile_apis::FunctionID::CreateInteractionChoiceSetID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::CreateInteractionChoiceSetResponse( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::CreateInteractionChoiceSetRequest( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator< + commands::CreateInteractionChoiceSetRequest>() + : factory.GetCreator< + commands::CreateInteractionChoiceSetResponse>(); } case mobile_apis::FunctionID::PerformInteractionID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::PerformInteractionResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::PerformInteractionRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::PerformInteractionRequest>() + : factory.GetCreator<commands::PerformInteractionResponse>(); } case mobile_apis::FunctionID::EndAudioPassThruID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::EndAudioPassThruResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::EndAudioPassThruRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::EndAudioPassThruRequest>() + : factory.GetCreator<commands::EndAudioPassThruResponse>(); } case mobile_apis::FunctionID::PutFileID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::PutFileResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::PutFileRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::PutFileRequest>() + : factory.GetCreator<commands::PutFileResponse>(); } case mobile_apis::FunctionID::DeleteFileID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::DeleteFileResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::DeleteFileRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::DeleteFileRequest>() + : factory.GetCreator<commands::DeleteFileResponse>(); } case mobile_apis::FunctionID::ListFilesID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ListFilesResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::ListFilesRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ListFilesRequest>() + : factory.GetCreator<commands::ListFilesResponse>(); } case mobile_apis::FunctionID::SubscribeButtonID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SubscribeButtonResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SubscribeButtonRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SubscribeButtonRequest>() + : factory.GetCreator<commands::SubscribeButtonResponse>(); } case mobile_apis::FunctionID::UnsubscribeButtonID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::UnsubscribeButtonResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UnsubscribeButtonRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::UnsubscribeButtonRequest>() + : factory.GetCreator<commands::UnsubscribeButtonResponse>(); } case mobile_apis::FunctionID::ShowConstantTBTID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::ShowConstantTBTResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::ShowConstantTBTRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ShowConstantTBTRequest>() + : factory.GetCreator<commands::ShowConstantTBTResponse>(); } case mobile_apis::FunctionID::ShowID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ShowResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::ShowRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ShowRequest>() + : factory.GetCreator<commands::ShowResponse>(); } case mobile_apis::FunctionID::GetWayPointsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command = utils::MakeShared<commands::GetWayPointsResponse>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_); - } else { - command = utils::MakeShared<commands::GetWayPointsRequest>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ShowConstantTBTRequest>() + : factory.GetCreator<commands::GetWayPointsResponse>(); } case mobile_apis::FunctionID::SubscribeVehicleDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SubscribeVehicleDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::SubscribeVehicleDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SubscribeVehicleDataRequest>() + : factory.GetCreator<commands::SubscribeVehicleDataResponse>(); } case mobile_apis::FunctionID::UnsubscribeVehicleDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::UnsubscribeVehicleDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::UnsubscribeVehicleDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::UnsubscribeVehicleDataRequest>() + : factory + .GetCreator<commands::UnsubscribeVehicleDataResponse>(); } case mobile_apis::FunctionID::SubscribeWayPointsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command = utils::MakeShared<commands::SubscribeWayPointsResponse>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_); - } else { - command = utils::MakeShared<commands::SubscribeWayPointsRequest>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SubscribeWayPointsRequest>() + : factory.GetCreator<commands::SubscribeWayPointsResponse>(); } case mobile_apis::FunctionID::UnsubscribeWayPointsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command = utils::MakeShared<commands::UnsubscribeWayPointsResponse>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_); - } else { - command = utils::MakeShared<commands::UnSubscribeWayPointsRequest>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ShowConstantTBTRequest>() + : factory.GetCreator<commands::ShowConstantTBTResponse>(); } case mobile_apis::FunctionID::GetSystemCapabilityID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::GetSystemCapabilityResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::GetSystemCapabilityRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::GetSystemCapabilityRequest>() + : factory.GetCreator<commands::GetSystemCapabilityResponse>(); } case mobile_apis::FunctionID::ReadDIDID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ReadDIDResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::ReadDIDResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ReadDIDRequest>() + : factory.GetCreator<commands::ReadDIDResponse>(); } case mobile_apis::FunctionID::GetVehicleDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::GetVehicleDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::GetVehicleDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::GetVehicleDataRequest>() + : factory.GetCreator<commands::GetVehicleDataResponse>(); } case mobile_apis::FunctionID::ScrollableMessageID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::ScrollableMessageResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::ScrollableMessageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ScrollableMessageRequest>() + : factory.GetCreator<commands::ScrollableMessageResponse>(); } + case mobile_apis::FunctionID::AlertManeuverID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::AlertManeuverResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::AlertManeuverRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::AlertManeuverRequest>() + : factory.GetCreator<commands::AlertManeuverResponse>(); } case mobile_apis::FunctionID::SetAppIconID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SetAppIconResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SetAppIconRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SetAppIconRequest>() + : factory.GetCreator<commands::SetAppIconResponse>(); } case mobile_apis::FunctionID::SetDisplayLayoutID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SetDisplayLayoutResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::SetDisplayLayoutRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SetDisplayLayoutRequest>() + : factory.GetCreator<commands::SetDisplayLayoutResponse>(); } case mobile_apis::FunctionID::UpdateTurnListID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::UpdateTurnListResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::UpdateTurnListRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::UpdateTurnListRequest>() + : factory.GetCreator<commands::UpdateTurnListResponse>(); } case mobile_apis::FunctionID::ChangeRegistrationID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::ChangeRegistrationResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::ChangeRegistrationRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::ChangeRegistrationRequest>() + : factory.GetCreator<commands::ChangeRegistrationResponse>(); } case mobile_apis::FunctionID::GetDTCsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::GetDTCsResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::GetDTCsRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::GetDTCsRequest>() + : factory.GetCreator<commands::GetDTCsResponse>(); } case mobile_apis::FunctionID::DiagnosticMessageID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::DiagnosticMessageResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset( - new commands::DiagnosticMessageRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::DiagnosticMessageRequest>() + : factory.GetCreator<commands::DiagnosticMessageResponse>(); } case mobile_apis::FunctionID::SetMediaClockTimerID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SetMediaClockTimerResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SetMediaClockRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SetMediaClockRequest>() + : factory.GetCreator<commands::SetMediaClockTimerResponse>(); } case mobile_apis::FunctionID::SystemRequestID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SystemResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SystemRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SystemRequest>() + : factory.GetCreator<commands::SystemResponse>(); } case mobile_apis::FunctionID::SendLocationID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SendLocationResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SendLocationRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SendLocationRequest>() + : factory.GetCreator<commands::SendLocationResponse>(); } case mobile_apis::FunctionID::DialNumberID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::DialNumberResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::DialNumberRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::DialNumberRequest>() + : factory.GetCreator<commands::DialNumberResponse>(); } case mobile_apis::FunctionID::SendHapticDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SendHapticDataResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::SendHapticDataRequest(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + return mobile_api::messageType::request == message_type + ? factory.GetCreator<commands::SendHapticDataRequest>() + : factory.GetCreator<commands::SendHapticDataResponse>(); } case mobile_apis::FunctionID::OnButtonEventID: { - command.reset( - new commands::mobile::OnButtonEventNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::mobile::OnButtonEventNotification>(); } case mobile_apis::FunctionID::OnButtonPressID: { - command.reset( - new commands::mobile::OnButtonPressNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::mobile::OnButtonPressNotification>(); } case mobile_apis::FunctionID::OnAudioPassThruID: { - command.reset( - new commands::OnAudioPassThruNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnAudioPassThruNotification>(); } case mobile_apis::FunctionID::OnVehicleDataID: { - command.reset( - new commands::OnVehicleDataNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnVehicleDataNotification>(); } case mobile_apis::FunctionID::OnAppInterfaceUnregisteredID: { - command.reset(new commands::OnAppInterfaceUnregisteredNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::OnAppInterfaceUnregisteredNotification>(); } case mobile_apis::FunctionID::OnCommandID: { - command.reset(new commands::OnCommandNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnCommandNotification>(); } case mobile_apis::FunctionID::OnTBTClientStateID: { - command.reset( - new commands::OnTBTClientStateNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnTBTClientStateNotification>(); } case mobile_apis::FunctionID::OnDriverDistractionID: { - command.reset(new commands::mobile::OnDriverDistractionNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::mobile::OnDriverDistractionNotification>(); } case mobile_apis::FunctionID::OnLanguageChangeID: { - command.reset( - new commands::OnLanguageChangeNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnLanguageChangeNotification>(); } case mobile_apis::FunctionID::OnPermissionsChangeID: { - command.reset( - new commands::OnPermissionsChangeNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::OnPermissionsChangeNotification>(); } case mobile_apis::FunctionID::OnHMIStatusID: { - if (app_mngr::commands::Command::SOURCE_SDL == source) { - command.reset( - new commands::OnHMIStatusNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } else { - command.reset(new commands::OnHMIStatusNotificationFromMobile( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - } - break; + using app_mngr::commands::Command; + return Command::CommandSource::SOURCE_MOBILE == source + ? factory.GetCreator< + commands::OnHMIStatusNotificationFromMobile>() + : factory.GetCreator<commands::OnHMIStatusNotification>(); } case mobile_apis::FunctionID::OnKeyboardInputID: { - command.reset(new commands::mobile::OnKeyBoardInputNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::mobile::OnKeyBoardInputNotification>(); } case mobile_apis::FunctionID::OnTouchEventID: { - command.reset( - new commands::mobile::OnTouchEventNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory.GetCreator<commands::mobile::OnTouchEventNotification>(); } case mobile_apis::FunctionID::OnSystemRequestID: { - command.reset(new commands::mobile::OnSystemRequestNotification( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + return factory + .GetCreator<commands::mobile::OnSystemRequestNotification>(); } case mobile_apis::FunctionID::OnHashChangeID: { - command.reset( - new commands::mobile::OnHashChangeNotification(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); - break; + using app_mngr::commands::Command; + return factory.GetCreator<commands::mobile::OnHashChangeNotification>(); } case mobile_apis::FunctionID::OnWayPointChangeID: { - command = utils::MakeShared<commands::OnWayPointChangeNotification>( - message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_); - break; + using app_mngr::commands::Command; + return factory.GetCreator<commands::OnWayPointChangeNotification>(); } - default: { - (*message)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::GenericResponseID); - command.reset(new commands::GenericResponse(message, - application_manager_, - rpc_service_, - hmi_capabilities_, - policy_handler_)); + case mobile_apis::FunctionID::GenericResponseID: { + using app_mngr::commands::Command; + return factory.GetCreator<commands::GenericResponse>(); } + default: { return factory.GetCreator<InvalidCommand>(); } } - return command; +} + +MobileCommandFactory::MobileCommandFactory( + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) {} + +bool MobileCommandFactory::IsAbleToProcess( + const int32_t function_id, + const application_manager::commands::Command::CommandSource message_source) + const { + using app_mngr::commands::Command; + return get_creator_factory( + static_cast<mobile_apis::FunctionID::eType>(function_id), + mobile_apis::messageType::INVALID_ENUM, + message_source).CanBeCreated(); +} + +CommandSharedPtr MobileCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + mobile_apis::messageType::eType message_type = + static_cast<mobile_apis::messageType::eType>( + (*message)[strings::params][strings::message_type].asInt()); + + mobile_apis::FunctionID::eType function_id = + static_cast<mobile_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asInt()); + + LOG4CXX_DEBUG( + logger_, + "MobileCommandFactory::CreateCommand function_id: " << function_id); + + return get_creator_factory(function_id, message_type, source).create(message); } } // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc index 7b5d64b770..38ad70951e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc @@ -65,4 +65,17 @@ app_mngr::CommandSharedPtr SDLCommandFactory::CreateCommand( } } +bool SDLCommandFactory::IsAbleToProcess( + const int32_t FunctionID, + const application_manager::commands::Command::CommandSource source) const { + bool is_hmi_command_factory_able_to_process = + hmi_command_factory_->IsAbleToProcess(FunctionID, source); + bool is_mobile_command_factory_able_to_process = + mobile_command_factory_->IsAbleToProcess(FunctionID, source); + + return app_mngr::commands::Command::SOURCE_HMI == source + ? is_hmi_command_factory_able_to_process + : is_mobile_command_factory_able_to_process; +} + } // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc index 2db776abcc..22b818f5e0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc @@ -50,7 +50,7 @@ bool SDLRPCPlugin::IsAbleToProcess( const int32_t function_id, const application_manager::commands::Command::CommandSource message_source) { - return true; + return command_factory_->IsAbleToProcess(function_id, message_source); } std::string SDLRPCPlugin::PluginName() { diff --git a/src/components/application_manager/test/include/application_manager/mock_command_factory.h b/src/components/application_manager/test/include/application_manager/mock_command_factory.h index ca4616cbd2..a55183e341 100644 --- a/src/components/application_manager/test/include/application_manager/mock_command_factory.h +++ b/src/components/application_manager/test/include/application_manager/mock_command_factory.h @@ -49,6 +49,10 @@ class MockCommandFactory : public application_manager::CommandFactory { application_manager::CommandSharedPtr( const application_manager::commands::MessageSharedPtr&, application_manager::commands::Command::CommandSource)); + MOCK_CONST_METHOD2( + IsAbleToProcess, + bool(const int32_t, + const application_manager::commands::Command::CommandSource)); // const commands::MessageSharedPtr& message, // application_manager::commands::Command::CommandSource)); diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index da227c7b60..be806288b5 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -122,7 +122,7 @@ class MockApplicationManager : public application_manager::ApplicationManager { SendHMIStatusNotification, void(const utils::SharedPtr<application_manager::Application> app)); MOCK_METHOD1(RemoveHMIFakeParameters, - void(application_manager::MessagePtr& message)); + void(smart_objects::SmartObjectSPtr& message)); MOCK_CONST_METHOD1( GetDefaultHmiLevel, mobile_apis::HMILevel::eType( |