From ed98ca768a2bd8c8a63bc8c950189644d68f9fd7 Mon Sep 17 00:00:00 2001 From: Segwon Date: Fri, 6 Jan 2017 16:36:08 +0900 Subject: Block device duplicate detection. Signed-off-by: Segwon Change-Id: I0d44e2ac3e8f2b335ba24d329bc4694ee0211ea6 --- src/ui/setting_item_discovery.c | 12 +++++++++--- 1 file 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); -- cgit v1.2.3