summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2017-11-02 10:58:45 -0400
committerGitHub <noreply@github.com>2017-11-02 10:58:45 -0400
commit23456fdda12e2baee09aa404badbb5936a3d8d6a (patch)
tree9c292e7b287a2ed24b7afeaca74c5ad811b43ef5
parent989bb347ed778edb4d3474171d6e01a01462878a (diff)
parent14a1b722bb1103c328ea6935e9642ee80e2a68fc (diff)
downloadsdl_core-23456fdda12e2baee09aa404badbb5936a3d8d6a.tar.gz
Merge pull request #1611 from AKalinich-Luxoft/fix/fix_subscribevehicledata_subscriptions
Fix SubscribeVehicleData request subscriptions
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h5
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc14
2 files changed, 17 insertions, 2 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
index eb360b50d8..f556f81764 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
@@ -148,6 +148,11 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl {
*/
VehicleInfoSubscriptions vi_already_subscribed_by_this_app_;
+ /**
+ * @brief VI parameters which wait for subscribe after HMI respond
+ */
+ VehicleInfoSubscriptions vi_waiting_for_subscribe_;
+
DISALLOW_COPY_AND_ASSIGN(SubscribeVehicleDataRequest);
};
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 fc839a43f4..28651cded4 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
@@ -250,6 +250,15 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
result_code = mobile_apis::Result::IGNORED;
response_info = "Already subscribed on some provided VehicleData.";
}
+
+ if (!vi_waiting_for_subscribe_.empty()) {
+ LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData");
+ VehicleInfoSubscriptions::const_iterator key =
+ vi_waiting_for_subscribe_.begin();
+ for (; key != vi_waiting_for_subscribe_.end(); ++key) {
+ app->SubscribeToIVI(*key);
+ }
+ }
}
UnsubscribeFailedSubscriptions(app, message[strings::msg_params]);
@@ -407,12 +416,13 @@ void SubscribeVehicleDataRequest::CheckVISubscribtions(
out_request_params[key_name] = is_key_enabled;
- if (app->SubscribeToIVI(static_cast<uint32_t>(key_type))) {
+ if (is_key_enabled) {
+ vi_waiting_for_subscribe_.insert(key_type);
LOG4CXX_DEBUG(
logger_,
"App with connection key "
<< connection_key()
- << " have been subscribed for VehicleDataType: " << key_type);
+ << " will be subscribed for VehicleDataType: " << key_type);
++subscribed_items;
}
}