From 221fd83c2c9e9d773fcc9d01d04ba9a745fb8754 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 20 Aug 2012 14:32:21 -0300 Subject: [PATCH] gatt: Return not found if characteritics is empty This patch changes the behaviour of Discover All Characteristics and Discover Characteristics by UUID returning <> when Characteristic list that matches the defined criteria is empty. This scenario can happen when the GATT client avoids extra iteraction with the remote attribute server if the last received handle(or handle + 1) is equal to the end handle of the primary service. --- attrib/gatt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/attrib/gatt.c b/attrib/gatt.c index 9ab283f0e..aea59ec1b 100644 --- a/attrib/gatt.c +++ b/attrib/gatt.c @@ -302,7 +302,6 @@ static void char_discovered_cb(guint8 status, const guint8 *ipdu, guint16 iplen, } att_data_list_free(list); - err = 0; if (last != 0 && (last + 1 < dc->end)) { buf = g_attrib_get_buffer(dc->attrib, &buflen); @@ -321,6 +320,8 @@ static void char_discovered_cb(guint8 status, const guint8 *ipdu, guint16 iplen, return; } + err = (dc->characteristics ? 0 : ATT_ECODE_ATTR_NOT_FOUND); + done: dc->cb(dc->characteristics, err, dc->user_data); discover_char_free(dc); -- 2.47.3