Thread (14 messages) 14 messages, 2 authors, 2012-01-24

Re: [PATCH 3/8] gatt-service: Provide service uuid in attrib_db_find_avail function

From: Anderson Lizardo <hidden>
Date: 2012-01-24 12:18:27

Hi Santiago,

On Tue, Jan 24, 2012 at 7:06 AM, Santiago Carot-Nemesio
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
We need to provide the service uuid because of GATT server should group
16-bit uuid services together and 128-bit uuid services together,
(Bluetooth 4.0, Vol 3, Part G, 3.1).
---
 attrib/gatt-service.c  |    2 +-
 plugins/gatt-example.c |   16 ++++++++++------
 proximity/reporter.c   |    9 ++++++---
 src/attrib-server.c    |    3 ++-
 src/attrib-server.h    |    3 ++-
 5 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/attrib/gatt-service.c b/attrib/gatt-service.c
index d00adb0..b27e525 100644
--- a/attrib/gatt-service.c
+++ b/attrib/gatt-service.c
@@ -436,8 +440,8 @@ static void register_weight_service(struct gatt_example_adapter *adapter,
       int len;

       btoh128(&char_weight_uuid_btorder, &char_weight_uuid);
-
-       start_handle = attrib_db_find_avail(adapter->adapter, svc_size);
+       bt_uuid128_create(&uuid, char_weight_uuid_btorder);
+       start_handle = attrib_db_find_avail(adapter->adapter, &uuid, svc_size);
       if (start_handle == 0) {
               error("Not enough free handles to register service");
               return;
This is wrong. You are using a *characteristic* UUID as a service
UUID. This example weight service is 16-bit, but it is has one 128-bit
characteristic.

BTW, 16-bit vs. 128-bit characteristic grouping is optional as per
page 1897 (section 3.3.1 "Characteristic Declaration").

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help