diff options
author | Ira Lytvynenko <ilytvynenko@luxoft.com> | 2018-08-13 11:12:11 -0400 |
---|---|---|
committer | Alexander <akutsan@luxoft.com> | 2018-08-16 16:16:59 +0300 |
commit | 7d531ebc8d74e980d1d9b2ecfa1db7bd2a0f0bfc (patch) | |
tree | 4226cf8f93097f2525205e851b0b8de6207f0532 /src/components/application_manager/rpc_plugins/rc_rpc_plugin/src | |
parent | d13628920cb48507ad98a7e0ef2494f0034b0542 (diff) | |
download | sdl_core-7d531ebc8d74e980d1d9b2ecfa1db7bd2a0f0bfc.tar.gz |
Fix capabilities validation
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/commands/mobile/set_interior_vehicle_data_request.cc | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc index 8745f5a0b5..3e34350711 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc @@ -219,12 +219,11 @@ bool CheckLightNameByCapabilities( } bool CheckControlDataByCapabilities( - const smart_objects::SmartObject& module_caps, + const smart_objects::SmartObject& capabilities_status, const smart_objects::SmartObject& control_data) { LOG4CXX_AUTO_TRACE(logger_); std::map<std::string, std::string> mapping = GetModuleDataToCapabilitiesMapping(); - const smart_objects::SmartObject& capabilities_status = module_caps[0]; auto it = control_data.map_begin(); for (; it != control_data.map_end(); ++it) { const std::string& request_parameter = it->first; @@ -233,7 +232,7 @@ bool CheckControlDataByCapabilities( for (; light_data != control_data[request_parameter].asArray()->end(); ++light_data) { if (!CheckLightNameByCapabilities( - module_caps[strings::kSupportedLights], *light_data)) { + capabilities_status[strings::kSupportedLights], *light_data)) { return false; } } @@ -263,39 +262,6 @@ bool CheckControlDataByCapabilities( return true; } -bool CheckHmiControlDataByCapabilities( - const smart_objects::SmartObject& module_caps, - const smart_objects::SmartObject& control_data) { - LOG4CXX_AUTO_TRACE(logger_); - std::map<std::string, std::string> mapping = - GetModuleDataToCapabilitiesMapping(); - const smart_objects::SmartObject& capabilities_status = module_caps; - auto it = control_data.map_begin(); - for (; it != control_data.map_end(); ++it) { - const std::string& request_parameter = it->first; - const std::string& caps_key = mapping[request_parameter]; - LOG4CXX_DEBUG(logger_, - "Checking request parameter " - << request_parameter - << " with capabilities. Appropriate key is " << caps_key); - if (!capabilities_status.keyExists(caps_key)) { - LOG4CXX_DEBUG(logger_, - "Capability " - << caps_key - << " is missed in RemoteControl capabilities"); - return false; - } - if (!capabilities_status[caps_key].asBool()) { - LOG4CXX_DEBUG(logger_, - "Capability " - << caps_key - << " is switched off in RemoteControl capabilities"); - return false; - } - } - return true; -} - bool CheckIfModuleDataExistInCapabilities( const smart_objects::SmartObject& rc_capabilities, const smart_objects::SmartObject& module_data) { @@ -317,12 +283,13 @@ bool CheckIfModuleDataExistInCapabilities( return false; } const smart_objects::SmartObject& caps = rc_capabilities[param.second]; - if (message_params::kHmiSettingsControlData == param.first) { + if (message_params::kHmiSettingsControlData == param.first || + message_params::kLightControlData == param.first) { is_module_data_valid = - CheckHmiControlDataByCapabilities(caps, module_data[param.first]); + CheckControlDataByCapabilities(caps, module_data[param.first]); } else { is_module_data_valid = - CheckControlDataByCapabilities(caps, module_data[param.first]); + CheckControlDataByCapabilities(caps[0], module_data[param.first]); } } } |