diff options
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 | 19 |
1 files changed, 14 insertions, 5 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 0473dd1791..edc45670ce 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 @@ -394,16 +394,25 @@ ModuleCapability GetModuleDataCapabilities( return module_data_capabilities; } -bool isModuleTypeAndDataMatch(const std::string& module_type, - const smart_objects::SmartObject& module_data) { +/** + * @brief Clears unrelated module data parameters + * @param module type in request + * @param smart object of module_data + * @return true if the correct module parameter is present, false otherwise + */ +bool ClearUnrelatedModuleData(const std::string& module_type, + smart_objects::SmartObject& module_data) { LOG4CXX_AUTO_TRACE(logger_); const auto& all_module_types = RCHelpers::GetModulesList(); const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping(); bool module_type_and_data_match = false; for (const auto& type : all_module_types) { + const std::string module_key = data_mapping(type); if (type == module_type) { - module_type_and_data_match = module_data.keyExists(data_mapping(type)); - break; + module_type_and_data_match = module_data.keyExists(module_key); + } else if (module_data.keyExists(module_key)) { + // Cutting unrelated module data + module_data.erase(module_key); } } return module_type_and_data_match; @@ -445,7 +454,7 @@ void SetInteriorVehicleDataRequest::Execute() { (*message_)[app_mngr::strings::msg_params][message_params::kModuleData]; const std::string module_type = ModuleType(); - if (isModuleTypeAndDataMatch(module_type, module_data)) { + if (ClearUnrelatedModuleData(module_type, module_data)) { const smart_objects::SmartObject* rc_capabilities = hmi_capabilities_.rc_capability(); ModuleCapability module_data_capabilities; |