summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegwon <segwon.han@samsung.com>2017-01-06 16:33:11 +0900
committerSegwon <segwon.han@samsung.com>2017-01-06 16:33:49 +0900
commite59b5825cb3865d4f8bc312eb1f07a8066f9e5eb (patch)
treeeab7425018d35b09466d698bdcd3d742612965de
parenta4be778cba50391d607402d02edffa155338ecee (diff)
downloadd2d-conv-setting-e59b5825cb3865d4f8bc312eb1f07a8066f9e5eb.tar.gz
d2d-conv-setting-e59b5825cb3865d4f8bc312eb1f07a8066f9e5eb.tar.bz2
d2d-conv-setting-e59b5825cb3865d4f8bc312eb1f07a8066f9e5eb.zip
Block device duplicate detection.
Signed-off-by: Segwon <segwon.han@samsung.com> Change-Id: Ia80fe0d82787920fe5db6d530819563bef317402
-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);