summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2018-10-15 13:26:33 -0400
committerGitHub <noreply@github.com>2018-10-15 13:26:33 -0400
commit96aa5668f36e96c2cd5d93b2b29a4e2d601f8426 (patch)
tree98218cc107f6a3f1ad661ea041525b9f3c9ef7e1
parent7b4196493323b37ce43b810f6de30f4726f3fc3b (diff)
parent1413bed7877486516ccec4d8cc5e6122849325a3 (diff)
downloadsdl_core-96aa5668f36e96c2cd5d93b2b29a4e2d601f8426.tar.gz
Merge pull request #2675 from smartdevicelink/fix/omit_unrelated_module_data
Cut off unrelated module data parameters in SIVD
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc19
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;