diff options
author | JackLivio <jack@livio.io> | 2018-10-15 14:20:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-15 14:20:23 -0400 |
commit | 1ef06f5ad10ab978358a68153075748b8c78062c (patch) | |
tree | 2e7789d343fb593884745b2f67a9de12b224d369 | |
parent | 96aa5668f36e96c2cd5d93b2b29a4e2d601f8426 (diff) | |
parent | 386633b6f4381d036cc425e1e42aa5ed6ef320a8 (diff) | |
download | sdl_core-1ef06f5ad10ab978358a68153075748b8c78062c.tar.gz |
Merge pull request #2677 from smartdevicelink/fix/interior_data_caching_on_radio_disable
Add radio module filtering if radioEnable or hdRadioEnable are false
3 files changed, 27 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h index 4624d79b56..01588cc6b7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h @@ -94,6 +94,7 @@ class GetInteriorVehicleDataRequest : public RCCommandRequest { bool CheckRateLimits(); bool AppShouldBeUnsubscribed(); bool TheLastAppShouldBeUnsubscribed(app_mngr::ApplicationSharedPtr app); + void FilterDisabledModuleData(smart_objects::SmartObject& module_data); }; } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h index 1951af1a24..18014e6270 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h @@ -150,6 +150,7 @@ const char kFrequencyInteger[] = "frequencyInteger"; const char kFrequencyFraction[] = "frequencyFraction"; const char kBand[] = "band"; const char kRdsData[] = "rdsData"; +const char kHdRadioEnable[] = "hdRadioEnable"; const char kAvailableHDs[] = "availableHDs"; const char kHdChannel[] = "hdChannel"; const char kSignalStrength[] = "signalStrength"; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc index 93e37b95a7..4d12b4f375 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc @@ -89,11 +89,36 @@ bool GetInteriorVehicleDataRequest::ProcessCapabilities() { return true; } +void GetInteriorVehicleDataRequest::FilterDisabledModuleData( + smart_objects::SmartObject& module_data) { + // If radioEnable is false, remove all other radio parameters from the + // message. + if (module_data.keyExists(message_params::kRadioEnable) && + module_data[message_params::kRadioEnable].asBool() == false) { + for (auto data = module_data.map_begin(); data != module_data.map_end();) { + auto key = data->first; + ++data; + if (key != message_params::kRadioEnable) { + module_data.erase(key); + } + } + } + // If hdRadioEnable is false, find and remove the HDChannel if parameter is + // present. + if (module_data.keyExists(message_params::kHdRadioEnable) && + module_data[message_params::kHdRadioEnable].asBool() == false) { + module_data.erase(message_params::kHdChannel); + module_data.erase(message_params::kAvailableHDs); + module_data.erase(message_params::kSisData); + } +} + void GetInteriorVehicleDataRequest::ProcessResponseToMobileFromCache( app_mngr::ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping(); auto data = interior_data_cache_.Retrieve(ModuleType()); + FilterDisabledModuleData(data); auto response_msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); response_msg_params[message_params::kModuleData][data_mapping(ModuleType())] = |