diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc')
-rw-r--r-- | src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc index a26cf71448..0c513cb01e 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc @@ -488,6 +488,28 @@ bool ResourceAllocationManagerImpl::IsResourceFree( return ResourceState::FREE == resource->second; } +bool ResourceAllocationManagerImpl::IsResourceAllocated( + const std::string& module_type, + const std::string& module_id, + const uint32_t app_id) { + ModuleUid module(module_type, module_id); + sync_primitives::AutoLock lock(allocated_resources_lock_); + const auto allocation = allocated_resources_.find(module); + if (allocated_resources_.end() == allocation) { + SDL_LOG_DEBUG("Resource " << module_type << " is not allocated."); + return false; + } + + if (app_id != allocation->second) { + SDL_LOG_DEBUG("Resource " << module_type + << " is allocated by different application " + << allocation->second); + return true; + } + + return false; +} + void ResourceAllocationManagerImpl::SetAccessMode( const hmi_apis::Common_RCAccessMode::eType access_mode) { if (hmi_apis::Common_RCAccessMode::ASK_DRIVER != access_mode) { |