diff options
Diffstat (limited to 'src/components/application_manager/src/rpc_service_impl.cc')
-rw-r--r-- | src/components/application_manager/src/rpc_service_impl.cc | 80 |
1 files changed, 51 insertions, 29 deletions
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) { |