diff options
author | Alexander Kutsan <akutsan@luxoft.com> | 2017-11-27 18:32:42 +0200 |
---|---|---|
committer | Alexander Kutsan <akutsan@luxoft.com> | 2017-11-27 20:25:56 +0200 |
commit | 12b00172b4e287c4196f4db296bb8cbc62765cfe (patch) | |
tree | 7e21bc2deb2872e27bb1752a2044a9da6dafef27 | |
parent | 9ee67118478f2b3ad8ac3504762ad70400ce109f (diff) | |
download | sdl_core-12b00172b4e287c4196f4db296bb8cbc62765cfe.tar.gz |
Create correct structure of SubscriveVehicleData Response
Convert to string keys of already subscribed vehicle data
Add data type of already subscribed vehicle data
-rw-r--r-- | src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc index f529e271b4..28cf4c754c 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -286,20 +286,33 @@ void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( smart_objects::SmartObject& msg_params) const { LOG4CXX_AUTO_TRACE(logger_); using namespace mobile_apis; + auto vi_to_string = + [](const mobile_apis::VehicleDataType::eType vehicle_data) { + for (auto& vi_str_to_int_pair : MessageHelper::vehicle_data()) { + if (vehicle_data == vi_str_to_int_pair.second) { + return vi_str_to_int_pair.first; + } + } + return std::string(); + }; + VehicleInfoSubscriptions::const_iterator it_same_app = vi_already_subscribed_by_this_app_.begin(); for (; vi_already_subscribed_by_this_app_.end() != it_same_app; ++it_same_app) { - msg_params[*it_same_app][strings::result_code] = + msg_params[vi_to_string(*it_same_app)][strings::result_code] = VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED; + msg_params[vi_to_string(*it_same_app)][strings::data_type] = *it_same_app; } VehicleInfoSubscriptions::const_iterator it_another_app = vi_already_subscribed_by_another_apps_.begin(); for (; vi_already_subscribed_by_another_apps_.end() != it_another_app; ++it_another_app) { - msg_params[*it_another_app][strings::result_code] = + msg_params[vi_to_string(*it_another_app)][strings::result_code] = VehicleDataResultCode::VDRC_SUCCESS; + msg_params[vi_to_string(*it_another_app)][strings::data_type] = + *it_another_app; } } |