diff options
author | Shobhit Adlakha <ShobhitAd@users.noreply.github.com> | 2022-10-26 11:34:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 11:34:13 -0400 |
commit | 7343fc72c12edc8ac42a62556c9e4b29c9408bc3 (patch) | |
tree | 32e910f5440c10b384bb26b5555ac7adb77540ee /src/components/application_manager/rpc_plugins/rc_rpc_plugin/src | |
parent | 65947fd1eb30a392948d67003df0fe803c070c6b (diff) | |
parent | fb05c085b449b2149f85338fd4d00951205ab969 (diff) | |
download | sdl_core-master.tar.gz |
Release 8.2.0
Diffstat (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/src')
-rw-r--r-- | src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc index 75ccd46e4d..875455f545 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc @@ -371,23 +371,24 @@ bool RCCapabilitiesManagerImpl::CheckButtonName( SDL_LOG_AUTO_TRACE(); auto rc_capabilities = hmi_capabilities_.rc_capability(); if (!rc_capabilities) { - SDL_LOG_ERROR("No remote controll capabilities available"); + SDL_LOG_ERROR("No remote control capabilities available"); return false; } - if (enums_value::kRadio == module_type) { - if (!helpers::in_range(RCHelpers::buttons_radio(), button_name)) { - SDL_LOG_WARN("Trying to acceess climate button with module type radio"); - return false; - } - } + auto module_type_mismatch = [&button_name, &module_type]( + const std::string& type, + const std::vector<std::string>&& buttons) { + return (helpers::in_range(buttons, button_name) && type != module_type); + }; - if (enums_value::kClimate == module_type) { - if (!helpers::in_range(RCHelpers::buttons_climate(), button_name)) { - SDL_LOG_WARN("Trying to acceess radio button with module type climate"); - return false; - } + if (module_type_mismatch(enums_value::kRadio, RCHelpers::buttons_radio()) || + module_type_mismatch(enums_value::kClimate, + RCHelpers::buttons_climate())) { + SDL_LOG_WARN("Trying to access incompatible button: " + << button_name << " with module type: " << module_type); + return false; } + return true; } |