summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Lytvynenko (GitHub) <ILytvynenko@luxoft.com>2018-05-24 18:06:50 +0300
committerIra Lytvynenko (GitHub) <ILytvynenko@luxoft.com>2018-06-26 12:01:46 +0300
commitb98ab7d634926ee904612a2f5725caf9121755a0 (patch)
tree52ab3f25d93ea9a1f13df8b5305e7fba35b8707c
parent7a9f54e29be2e4090689c3da4ee144f8d6e73744 (diff)
downloadsdl_core-b98ab7d634926ee904612a2f5725caf9121755a0.tar.gz
Fix release of resources
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
index e17ad50233..4f968dd2d8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
@@ -116,7 +116,6 @@ void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) {
return;
}
LOG4CXX_ERROR(logger_, info);
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false, mobile_apis::Result::DISALLOWED, info.c_str());
}
@@ -127,7 +126,6 @@ void RCCommandRequest::Run() {
if (!IsInterfaceAvailable(app_mngr::HmiInterfaces::HMI_INTERFACE_RC)) {
LOG4CXX_WARN(logger_, "HMI interface RC is not available");
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
"Remote control is not supported by system");
@@ -139,7 +137,6 @@ void RCCommandRequest::Run() {
mobile_apis::AppHMIType::eType::REMOTE_CONTROL,
app->app_types())) {
LOG4CXX_WARN(logger_, "Application has no remote control functions");
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false, mobile_apis::Result::DISALLOWED, "");
return;
}
@@ -160,7 +157,6 @@ bool RCCommandRequest::AcquireResources() {
if (!IsResourceFree(module_type)) {
LOG4CXX_WARN(logger_, "Resource is busy.");
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false, mobile_apis::Result::IN_USE, "");
return false;
}
@@ -172,17 +168,14 @@ bool RCCommandRequest::AcquireResources() {
return true;
}
case AcquireResult::IN_USE: {
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false, mobile_apis::Result::IN_USE, "");
return false;
}
case AcquireResult::ASK_DRIVER: {
- SetResourceState(module_type, ResourceState::BUSY);
SendGetUserConsent(module_type);
return false;
}
case AcquireResult::REJECTED: {
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false, mobile_apis::Result::REJECTED, "");
return false;
}
@@ -209,7 +202,6 @@ void RCCommandRequest::ProcessAccessResponse(
const std::string module_type = ModuleType();
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer.");
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
return;
}
@@ -238,11 +230,11 @@ void RCCommandRequest::ProcessAccessResponse(
if (is_allowed) {
resource_allocation_manager_.ForceAcquireResource(module_type,
app->app_id());
+ SetResourceState(module_type, ResourceState::BUSY);
Execute(); // run child's logic
} else {
resource_allocation_manager_.OnDriverDisallowed(module_type,
app->app_id());
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(
false,
mobile_apis::Result::REJECTED,
@@ -252,7 +244,6 @@ void RCCommandRequest::ProcessAccessResponse(
} else {
std::string response_info;
GetInfo(message, response_info);
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false, result_code, response_info.c_str());
}
}