summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Levchenko (GitHub) <slevchenko.work@gmail.com>2017-03-29 10:27:44 +0300
committerIra Lytvynenko <ILytvynenko@luxoft.com>2017-06-21 14:24:32 +0300
commitae2ed9ce91e90de876290b5aba00bc404d8a2169 (patch)
tree938194be9a48762276da4b96f5fe8963f1f8d941
parent22a014b3746b28d2b8a3a4049c60bb76db6a0861 (diff)
downloadsdl_core-ae2ed9ce91e90de876290b5aba00bc404d8a2169.tar.gz
Add limitation of size for deviceList in BC.UpdateDeviceList RPC
According to requirements, SDL should send info about 100 devices at maximum, even if SDL has more devices connected.
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 19bb658bca..efed06e313 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -637,9 +637,12 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& list_so = (*device_list_so)[strings::device_list];
- int32_t index = 0;
+ uint32_t index = 0;
+ // According to requirements, SDL should send info about 100 devices at
+ // maximum, even if SDL has more devices connected.
+ const uint32_t max_device_count = 100;
for (connection_handler::DeviceMap::const_iterator it = devices.begin();
- devices.end() != it;
+ devices.end() != it && index < max_device_count;
++it) {
const connection_handler::Device& d =
static_cast<connection_handler::Device>(it->second);