From 4fae9bdfdbda853f39dcd339e4bc14d037d64d30 Mon Sep 17 00:00:00 2001 From: Amit Purwar Date: Thu, 21 Jun 2018 16:09:48 +0530 Subject: [PATCH] Fixed gatt characteristic property This change fix the issue that Gatt characteristic property was not sent when descriptor is not present. Change-Id: I8dc6ec159ed049a3d550c2b8660506c5193a2a0c Signed-off-by: Amit Purwar --- bt-service-adaptation/services/gatt/bt-service-gatt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bt-service-adaptation/services/gatt/bt-service-gatt.c b/bt-service-adaptation/services/gatt/bt-service-gatt.c index 61c4987..e5c306c 100644 --- a/bt-service-adaptation/services/gatt/bt-service-gatt.c +++ b/bt-service-adaptation/services/gatt/bt-service-gatt.c @@ -2691,14 +2691,17 @@ static void __bt_build_descriptor_browse_info(int conn_id, memcpy(&info->char_uuid, char_info->uuid, BLUETOOTH_UUID_HEX_MAX_LEN); info->char_inst_id = char_info->inst_id; + /* Fill property of the parent characteristic of this descriptor */ + info->char_props_map = char_info->props; + + info->count = g_slist_length(char_info->descs); + BT_INFO("Total count of Descriptors [%d]", info->count); + if (!char_info->descs) { BT_ERR("No Descriptors browsed for address [%s]", conn_info->addr); return; } - info->count = g_slist_length(char_info->descs); - BT_INFO("Total count of Descriptors [%d]", info->count); - for (l = char_info->descs; l != NULL; l = g_slist_next(l)) { desc_info = (bt_gatt_descriptor_info_t*)l->data; if (desc_info == NULL) @@ -2714,8 +2717,6 @@ static void __bt_build_descriptor_browse_info(int conn_id, /* Fill instance ID of Descriptor */ info->inst_id[count] = desc_info->inst_id; - /* Fill property of the parent characteristic of this descriptor */ - info->char_props_map = char_info->props; /* Increment count of Descriptor browsed */ count++; -- 2.7.4