diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc')
-rw-r--r-- | src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc index e2c1ed4e3a..eded6c685b 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc @@ -31,6 +31,7 @@ */ #include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h" +#include "application_manager/message_helper.h" namespace vehicle_info_plugin { using namespace application_manager; @@ -39,24 +40,39 @@ namespace commands { VIGetVehicleDataRequest::VIGetVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) + const VehicleInfoCommandParams& params) : RequestToHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) + , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {} VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {} void VIGetVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); + const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data(); + auto& msg_params = (*message_)[strings::msg_params]; + + smart_objects::SmartObject custom_data; + for (const auto& name : msg_params.enumerate()) { + const auto& found_it = rpc_spec_vehicle_data.find(name); + if (rpc_spec_vehicle_data.end() == found_it) { + custom_data[name] = msg_params[name]; + msg_params.erase(name); + } + } + + auto hmi_custom_msg_params = + custom_vehicle_data_manager_.CreateHMIMessageParams( + custom_data.enumerate()); + for (const auto& param : hmi_custom_msg_params.enumerate()) { + msg_params[param] = hmi_custom_msg_params[param]; + } SendRequest(); } } // namespace commands - } // namespace vehicle_info_plugin |