diff options
author | BSolonenko <BSolonenko@luxoft.com> | 2018-02-12 16:42:25 +0200 |
---|---|---|
committer | Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2018-06-26 12:01:44 +0300 |
commit | 2294f0ba776c8dbb9a903ff567d53e91a059b906 (patch) | |
tree | fc062da8ecdc881754746e5108f014b100c06e5d /src/components/application_manager/src | |
parent | 085c51581ec4f0683db480c0de4be01bc7e88d6d (diff) | |
download | sdl_core-2294f0ba776c8dbb9a903ff567d53e91a059b906.tar.gz |
Replaced all usages of passed parameters in implementation.
Replaced all usages of passed parameters in implementation from
application manager proxy to indirect call
Add missed factories
Remove commands includes
Diffstat (limited to 'src/components/application_manager/src')
7 files changed, 64 insertions, 46 deletions
diff --git a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc index 4dd77c2b1f..4e9a2556de 100644 --- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc @@ -72,7 +72,7 @@ void CommandNotificationFromMobileImpl::SendNotification() { LOG4CXX_INFO(logger_, "SendNotification"); MessageHelper::PrintSmartObject(*message_); - application_manager_.GetRPCService().SendMessageToMobile(message_); + rpc_service_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/command_notification_impl.cc b/src/components/application_manager/src/commands/command_notification_impl.cc index 0eed2d5fa6..70df95986b 100644 --- a/src/components/application_manager/src/commands/command_notification_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_impl.cc @@ -72,7 +72,7 @@ void CommandNotificationImpl::SendNotification() { LOG4CXX_INFO(logger_, "SendNotification"); MessageHelper::PrintSmartObject(*message_); - application_manager_.GetRPCService().SendMessageToMobile(message_); + rpc_service_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 15aa7df682..b531f6fa8a 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -251,8 +251,7 @@ void CommandRequestImpl::onTimeOut() { correlation_id(), mobile_api::Result::GENERIC_ERROR); AddTimeOutComponentInfoToMessage(*response); - application_manager_.GetRPCService().ManageMobileCommand(response, - SOURCE_SDL); + rpc_service_.ManageMobileCommand(response, SOURCE_SDL); } void CommandRequestImpl::on_event(const event_engine::Event& event) {} @@ -315,7 +314,7 @@ void CommandRequestImpl::SendResponse( is_success_result_ = success; - application_manager_.GetRPCService().ManageMobileCommand(result, SOURCE_SDL); + rpc_service_.ManageMobileCommand(result, SOURCE_SDL); } bool CommandRequestImpl::CheckSyntax(const std::string& str, @@ -443,7 +442,7 @@ uint32_t CommandRequestImpl::SendHMIRequest( subscribe_on_event(function_id, hmi_correlation_id); } if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { - if (!application_manager_.GetRPCService().ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send request"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); } @@ -472,7 +471,7 @@ void CommandRequestImpl::CreateHMINotification( notify[strings::params][strings::function_id] = function_id; notify[strings::msg_params] = msg_params; - if (!application_manager_.GetRPCService().ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send HMI notification"); } } @@ -637,7 +636,7 @@ bool CommandRequestImpl::CheckAllowedParameters() { correlation_id(), app->app_id()); - application_manager_.GetRPCService().SendMessageToMobile(response); + rpc_service_.SendMessageToMobile(response); return false; } @@ -661,15 +660,13 @@ bool CommandRequestImpl::CheckHMICapabilities( using namespace smart_objects; using namespace mobile_apis; - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - if (!hmi_capabilities.is_ui_cooperating()) { + if (!hmi_capabilities_.is_ui_cooperating()) { LOG4CXX_ERROR(logger_, "UI is not supported by HMI"); return false; } const SmartObject* button_capabilities_so = - hmi_capabilities.button_capabilities(); + hmi_capabilities_.button_capabilities(); if (!button_capabilities_so) { LOG4CXX_ERROR(logger_, "Invalid button capabilities object"); return false; diff --git a/src/components/application_manager/src/commands/command_response_impl.cc b/src/components/application_manager/src/commands/command_response_impl.cc index 8a39bc6bed..b956a4c7a5 100644 --- a/src/components/application_manager/src/commands/command_response_impl.cc +++ b/src/components/application_manager/src/commands/command_response_impl.cc @@ -89,8 +89,7 @@ void CommandResponseImpl::SendResponse( } } - application_manager_.GetRPCService().SendMessageToMobile(message_, - final_message); + rpc_service_.SendMessageToMobile(message_, final_message); } } // namespace commands diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index bf5e6501a8..f77495ac31 100644 --- a/src/components/application_manager/src/commands/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -82,7 +82,7 @@ void RequestFromHMI::SendResponse( (*message)[strings::msg_params][strings::success] = success; (*message)[strings::msg_params][strings::result_code] = result_code; - application_manager_.GetRPCService().ManageHMICommand(message); + rpc_service_.ManageHMICommand(message); } void RequestFromHMI::SendErrorResponse( @@ -99,7 +99,7 @@ void RequestFromHMI::SendErrorResponse( (*message)[strings::params][hmi_response::code] = result_code; (*message)[strings::params][strings::error_msg] = error_message; - application_manager_.GetRPCService().ManageHMICommand(message); + rpc_service_.ManageHMICommand(message); } void RequestFromHMI::FillCommonParametersOfSO( diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc index b000e7feb1..1acbc9ace7 100644 --- a/src/components/application_manager/src/commands/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/request_to_hmi.cc @@ -89,7 +89,7 @@ void RequestToHMI::Run() { void RequestToHMI::SendRequest() { (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; - application_manager_.GetRPCService().SendMessageToHMI(message_); + rpc_service_.SendMessageToHMI(message_); } } // namespace commands diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index fad844aaa3..62e7f5775f 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -126,7 +126,11 @@ bool RPCServiceImpl::ManageMobileCommand( LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error()); return false; } +<<<<<<< 7ee50284ab58ece63d8b7fdc3eb48b0effa11858 application_manager::CommandFactory& factory = (*plugin).GetCommandFactory(); +======= + auto factory = plugin->GetCommandFactory(); +>>>>>>> Remove commands includes auto command = factory.CreateCommand(message, source); if (!command) { @@ -259,6 +263,7 @@ bool RPCServiceImpl::ManageHMICommand( MessageHelper::PrintSmartObject(*message); const int32_t function_id = (*(message.get()))[strings::params][strings::function_id].asInt(); +<<<<<<< 7ee50284ab58ece63d8b7fdc3eb48b0effa11858 auto plugin = app_manager_.GetPluginManager().FindPluginToProcess( function_id, commands::Command::SOURCE_HMI); if (!plugin) { @@ -271,42 +276,59 @@ bool RPCServiceImpl::ManageHMICommand( if (!command) { LOG4CXX_WARN(logger_, "Failed to create command from smart object"); +======= + auto plugin = + app_manager_.GetPluginManager().FindPluginToProcess(function_id, source); + if (!plugin) { + LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error()); +>>>>>>> Remove commands includes return false; } - if ((*message).keyExists(strings::msg_params) && - (*message)[strings::msg_params].keyExists(strings::app_id)) { - const auto connection_key = - (*message)[strings::msg_params][strings::app_id].asUInt(); + auto factory = plugin->GetCommandFactory(); + auto command = factory.CreateCommand(message, source); - auto app = app_manager_.application(static_cast<uint32_t>(connection_key)); - if (app && app_manager_.IsAppInReconnectMode(app->policy_app_id())) { - commands_holder_.Suspend( - app, CommandHolder::CommandType::kHmiCommand, message); - return true; - } - } + message, commands::Command::SOURCE_HMI); + if (!command) { + LOG4CXX_WARN(logger_, "Failed to create command from smart object"); + return false; + } - int32_t message_type = - (*(message.get()))[strings::params][strings::message_type].asInt(); + if ((*message).keyExists(strings::msg_params) && + (*message)[strings::msg_params].keyExists(strings::app_id)) { + const auto connection_key = + (*message)[strings::msg_params][strings::app_id].asUInt(); + + auto app = + app_manager_.application(static_cast<uint32_t>(connection_key)); + if (app && app_manager_.IsAppInReconnectMode(app->policy_app_id())) { + commands_holder_.Suspend( + app, CommandHolder::CommandType::kHmiCommand, message); + return true; + } + } - if (kRequest == message_type) { - LOG4CXX_DEBUG(logger_, "ManageHMICommand"); - request_ctrl_.addHMIRequest(command); - } + int32_t message_type = + (*(message.get()))[strings::params][strings::message_type].asInt(); - if (command->Init()) { - command->Run(); - if (kResponse == message_type) { - const uint32_t correlation_id = - (*(message.get()))[strings::params][strings::correlation_id].asUInt(); - const int32_t function_id = - (*(message.get()))[strings::params][strings::function_id].asInt(); - request_ctrl_.OnHMIResponse(correlation_id, function_id); - } - return true; - } - return false; + if (kRequest == message_type) { + LOG4CXX_DEBUG(logger_, "ManageHMICommand"); + request_ctrl_.addHMIRequest(command); + } + + if (command->Init()) { + command->Run(); + if (kResponse == message_type) { + const uint32_t correlation_id = + (*(message.get()))[strings::params][strings::correlation_id] + .asUInt(); + const int32_t function_id = + (*(message.get()))[strings::params][strings::function_id].asInt(); + request_ctrl_.OnHMIResponse(correlation_id, function_id); + } + return true; + } + return false; } void RPCServiceImpl::Handle(const impl::MessageToHmi message) { |