From a081e0a57f8d0b840c9e44b060182508956a9f71 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 24 Nov 2016 17:31:45 +0100 Subject: [PATCH] Bluetooth: GATT: Fix primary service discovery response Applications expect service end handle as attribute value in userdata on discovery response callback. Jira: ZEP-1354 Change-Id: I664da4a7e054a531ad1c2c8cbc74367cb679ff03 Signed-off-by: Szymon Janc --- subsys/bluetooth/host/gatt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 01dc7a28612..b7e45829712 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -838,6 +838,7 @@ static void gatt_find_type_rsp(struct bt_conn *conn, uint8_t err, for (i = 0; length >= sizeof(rsp->list[i]); i++, length -= sizeof(rsp->list[i])) { struct bt_gatt_attr attr = {}; + struct bt_gatt_service value; start_handle = sys_le16_to_cpu(rsp->list[i].start_handle); end_handle = sys_le16_to_cpu(rsp->list[i].end_handle); @@ -851,7 +852,11 @@ static void gatt_find_type_rsp(struct bt_conn *conn, uint8_t err, attr.uuid = BT_UUID_GATT_SECONDARY; } + value.end_handle = end_handle; + value.uuid = params->uuid; + attr.handle = start_handle; + attr.user_data = &value; if (params->func(conn, &attr, params) == BT_GATT_ITER_STOP) { return;