From 096951609edb5ddd0b35f537f0f1c63c8af0116b Mon Sep 17 00:00:00 2001 From: JackLivio Date: Fri, 12 Oct 2018 14:46:21 -0400 Subject: Remove filtering from onInteriorVehicle data. Add to GetInteriorVehicleData. --- .../mobile/get_interior_vehicle_data_request.h | 1 + .../mobile/on_interior_vehicle_data_notification.h | 1 - .../mobile/get_interior_vehicle_data_request.cc | 22 +++++++++++++++++ .../on_interior_vehicle_data_notification.cc | 28 ---------------------- 4 files changed, 23 insertions(+), 29 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/commands/mobile/on_interior_vehicle_data_notification.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h index ec764d37cd..931e79366c 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h @@ -60,7 +60,6 @@ class OnInteriorVehicleDataNotification private: InteriorDataCache& interior_data_cache_; void AddDataToCache(const std::string& module_type); - void FilterDisabledModuleData(const std::string& module_type); }; } // namespace commands } // namespace rc_rpc_plugin 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..3550a72e23 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,33 @@ 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] == false) { + for (auto data = module_data.map_begin(); data != module_data.map_end(); + ++data) { + if (data->first != message_params::kRadioEnable) { + module_data.erase(data->first); + } + } + } + + // 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] == false) { + module_data.erase(message_params::kHdChannel); + } +} + 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())] = diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc index 7393c4f70e..37890b7979 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc @@ -63,33 +63,6 @@ void OnInteriorVehicleDataNotification::AddDataToCache( interior_data_cache_.Add(module_type, module_data); } -void OnInteriorVehicleDataNotification::FilterDisabledModuleData( - const std::string& module_type) { - const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping(); - auto& module_data = - (*message_)[app_mngr::strings::msg_params][message_params::kModuleData] - [data_mapping(module_type)]; - - // If radioEnable is false, remove all other radio parameters from the - // message. - if (module_data.keyExists(message_params::kRadioEnable) && - module_data[message_params::kRadioEnable] == false) { - for (auto data = module_data.map_begin(); data != module_data.map_end(); - ++data) { - if (data->first != message_params::kRadioEnable) { - module_data.erase(data->first); - } - } - } - - // 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] == false) { - module_data.erase(message_params::kHdChannel); - } -} - void OnInteriorVehicleDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -98,7 +71,6 @@ void OnInteriorVehicleDataNotification::Run() { RCHelpers::AppsSubscribedToModuleType(application_manager_, module_type); if (!apps_subscribed.empty()) { AddDataToCache(module_type); - FilterDisabledModuleData(module_type); } typedef std::vector AppPtrs; AppPtrs apps = RCRPCPlugin::GetRCApplications(application_manager_); -- cgit v1.2.1