summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegwon <segwon.han@samsung.com>2017-01-06 16:36:08 +0900
committerSegwon <segwon.han@samsung.com>2017-01-06 16:36:38 +0900
commited98ca768a2bd8c8a63bc8c950189644d68f9fd7 (patch)
tree5f2c78221e18d8b25c5452fe89f4874e016ba4bc
parentb2c6dc58784c113f5402c908197d271ff89692a3 (diff)
downloadd2d-conv-setting-ed98ca768a2bd8c8a63bc8c950189644d68f9fd7.tar.gz
d2d-conv-setting-ed98ca768a2bd8c8a63bc8c950189644d68f9fd7.tar.bz2
d2d-conv-setting-ed98ca768a2bd8c8a63bc8c950189644d68f9fd7.zip
Block device duplicate detection.
Signed-off-by: Segwon <segwon.han@samsung.com> Change-Id: I0d44e2ac3e8f2b335ba24d329bc4694ee0211ea6
-rw-r--r--src/ui/setting_item_discovery.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ui/setting_item_discovery.c b/src/ui/setting_item_discovery.c
index fe8d1a2..24c7946 100644
--- a/src/ui/setting_item_discovery.c
+++ b/src/ui/setting_item_discovery.c
@@ -165,17 +165,23 @@ static void discovery_foreach_cb(conv_device_h device_h, int result, void *data)
conv_device_get_property_string(device_h, CONV_DEVICE_NAME, &device_name);
conv_device_get_property_string(device_h, CONV_DEVICE_TYPE, &device_type);
- int index = ++devices_index;
+ int index;
+ for (index = 0; index <= devices_index; index++) {
+ if (!strcmp(devices_info[index]->mac_address, device_id)) {
+ return;
+ }
+ }
+
+ index = ++devices_index;
devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
devices_info[index]->index = index;
devices_info[index]->name = device_name;
devices_info[index]->type = device_type;
devices_info[index]->mac_address = device_id;
- //elm_genlist_item_append(discovered_list, item_builder, devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_discovery_deivce_selected_menu, devices_info[index]);
elm_genlist_item_insert_after(genlist, device_list_item_builder, devices_info[index], NULL, title_item, ELM_GENLIST_ITEM_NONE, show_acl_menu, devices_info[index]);
- break;
+ return;
case CONV_DISCOVERY_RESULT_FINISHED :
conv_destroy(conv_handle);