diff options
Diffstat (limited to 'src/components/application_manager/src/commands/command_request_impl.cc')
-rw-r--r-- | src/components/application_manager/src/commands/command_request_impl.cc | 42 |
1 files changed, 26 insertions, 16 deletions
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 515d8a998c..491fc72de4 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -37,8 +37,10 @@ #include "utils/make_shared.h" #include "application_manager/commands/command_request_impl.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" #include "application_manager/message_helper.h" #include "smart_objects/smart_object.h" + namespace application_manager { namespace commands { @@ -193,9 +195,17 @@ ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; } -CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandImpl(message, application_manager) +CommandRequestImpl::CommandRequestImpl( + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , EventObserver(application_manager.event_dispatcher()) , current_state_(kAwaitingHMIResponse) , hash_update_mode_(kSkipHashUpdate) @@ -241,7 +251,7 @@ void CommandRequestImpl::onTimeOut() { correlation_id(), mobile_api::Result::GENERIC_ERROR); AddTimeOutComponentInfoToMessage(*response); - application_manager_.ManageMobileCommand(response, ORIGIN_SDL); + rpc_service_.ManageMobileCommand(response, SOURCE_SDL); } void CommandRequestImpl::on_event(const event_engine::Event& event) {} @@ -304,7 +314,7 @@ void CommandRequestImpl::SendResponse( is_success_result_ = success; - application_manager_.ManageMobileCommand(result, ORIGIN_SDL); + rpc_service_.ManageMobileCommand(result, SOURCE_SDL); } bool CommandRequestImpl::CheckSyntax(const std::string& str, @@ -432,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_.ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send request"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); } @@ -461,7 +471,7 @@ void CommandRequestImpl::CreateHMINotification( notify[strings::params][strings::function_id] = function_id; notify[strings::msg_params] = msg_params; - if (!application_manager_.ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send HMI notification"); } } @@ -570,6 +580,10 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( mobile_result = mobile_apis::Result::SAVED; break; } + case hmi_apis::Common_Result::READ_ONLY: { + mobile_result = mobile_apis::Result::READ_ONLY; + break; + } default: { LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code); break; @@ -605,10 +619,8 @@ bool CommandRequestImpl::CheckAllowedParameters() { smart_objects::SmartMap::const_iterator iter_end = s_map.map_end(); for (; iter != iter_end; ++iter) { - if (iter->second.asBool()) { - LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first); - params.insert(iter->first); - } + LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first); + params.insert(iter->first); } mobile_apis::Result::eType check_result = @@ -628,7 +640,7 @@ bool CommandRequestImpl::CheckAllowedParameters() { correlation_id(), app->app_id()); - application_manager_.SendMessageToMobile(response); + rpc_service_.SendMessageToMobile(response); return false; } @@ -652,15 +664,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; |