All of lore.kernel.org
 help / color / mirror / Atom feed
* Non-consecutive handle values in GATT
@ 2015-03-04 18:45 Andrejs Hanins
  2015-03-04 21:39 ` Arman Uguray
  0 siblings, 1 reply; 15+ messages in thread
From: Andrejs Hanins @ 2015-03-04 18:45 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org, marcin.kraglak, szymon.janc

Hello,

     I'm experimenting with an LE peripheral device which provides GATT 
services described by attributes with non-consecutive handle values, 
i.e. there are "gaps" between handle values. According to the Bluetooth 
Core specification 4.0 (Volume 3, Part G, "2.5.1 Overview") it is allowed:

      Although the Attribute Handle values are in increasing order, 
following Attribute Handle values may differ by more than one.

     Based on my experiments, BlueZ 5.28 and also git-master as of today 
does not support non-consecutive handle values GATT table. As a result, 
I can't connect to my device because gatt-client fails to initialize 
properly. The failing place is in discover_descs():

       if (gatt_db_attribute_get_handle(attr) !=
                             chrc_data->value_handle)
             goto failed;

     The value of chrc_data->value_handle is correct and matches GATT 
table one the device, but the attr->handle has the value of previous 
attribute (Primary Service UUID in my case) +2. This handle value 
calculation happens in gatt_db_service_add_characteristic() which has 
strange code:

     /* We set handle of characteristic value, which will be added next */
     put_le16(get_handle_at_index(service, i - 1) + 2, &value[1]);

     Before trying to fix the problem by myself it would be great to 
hear some comments about this issue. Does it seem like a bug or I missed 
something?

     As a note, I can successfully connect to my LE peripheral from an 
iPhone LightBlue app, which does not posses any issues during GATT 
discovery and can read/write the characteristic on the device.


BR, Andrey

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-03-18 13:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-04 18:45 Non-consecutive handle values in GATT Andrejs Hanins
2015-03-04 21:39 ` Arman Uguray
2015-03-04 22:21   ` Lukasz Rymanowski
2015-03-04 22:34     ` Andrejs Hanins
2015-03-05  8:39       ` Luiz Augusto von Dentz
2015-03-16 11:05         ` Luiz Augusto von Dentz
2015-03-16 13:20           ` Andrejs Hanins
2015-03-16 13:54             ` Andrejs Hanins
2015-03-16 14:13               ` Luiz Augusto von Dentz
2015-03-16 14:22                 ` Andrejs Hanins
2015-03-17 13:07                   ` Luiz Augusto von Dentz
2015-03-17 13:33                     ` Andrejs Hanins
2015-03-17 15:01                       ` Luiz Augusto von Dentz
2015-03-18 13:27                         ` Luiz Augusto von Dentz
2015-03-18 13:54                           ` Andrejs Hanins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.