diff options
author | jacobkeeler <jacob.keeler@livioradio.com> | 2018-10-12 10:11:45 -0400 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2018-10-12 10:11:45 -0400 |
commit | 1413bed7877486516ccec4d8cc5e6122849325a3 (patch) | |
tree | b643a6dc311c7101b47457d04bba35791772e9fb | |
parent | c9697970a6ad6300936fe893efe7f3acae92a7c0 (diff) | |
download | sdl_core-1413bed7877486516ccec4d8cc5e6122849325a3.tar.gz |
Cut off unrelated module data parameters in SIVDfix/omit_unrelated_module_data
-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; |