Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] Disable automatic notification/indication for Battery state level
@ 2010-10-07 13:53 Claudio Takahasi
  2010-10-07 13:53 ` [PATCH 2/2] TODO: Implement Client Characteristic Configuration Claudio Takahasi
  2010-10-13 16:32 ` [PATCH 1/2] Disable automatic notification/indication in the attribute server Claudio Takahasi
  0 siblings, 2 replies; 6+ messages in thread
From: Claudio Takahasi @ 2010-10-07 13:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Reports of Battery state attribute in the Attribute sample server is
being disabled while a proper interface between the attribute server
and service implementation is not defined.
---
 TODO             |    7 -------
 attrib/example.c |    2 ++
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/TODO b/TODO
index 271fc45..a9f1339 100644
--- a/TODO
+++ b/TODO
@@ -18,13 +18,6 @@ Background
 ATT/GATT
 ========
 
-- Sample server shouldn't send any indications or notifications without
-  the client requesting them
-
-  Priority: Medium
-  Complexity: C2
-  Owner: Claudio Takahasi <claudio.takahasi@openbossa.org>
-
 - gatttool should have the ability to wait for req responses before
   quitting (some servers require a small sleep even with cmd's). Maybe a
   --delay-exit or --timeout command line switch.
diff --git a/attrib/example.c b/attrib/example.c
index c29e1e4..aa249a8 100644
--- a/attrib/example.c
+++ b/attrib/example.c
@@ -70,7 +70,9 @@ static gboolean change_battery_state(gpointer user_data)
 	/* Battery state is being increased every 10 seconds. */
 	atval[0] = state++;
 	sdp_uuid16_create(&uuid, BATTERY_STATE_UUID);
+#if 0
 	attrib_db_update(0x0110, &uuid, atval, 1);
+#endif
 
 	return TRUE;
 }
-- 
1.7.3.1


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

* [PATCH 2/2] TODO: Implement Client Characteristic Configuration
  2010-10-07 13:53 [PATCH 1/2] Disable automatic notification/indication for Battery state level Claudio Takahasi
@ 2010-10-07 13:53 ` Claudio Takahasi
  2010-10-13 16:34   ` Claudio Takahasi
  2010-10-13 16:32 ` [PATCH 1/2] Disable automatic notification/indication in the attribute server Claudio Takahasi
  1 sibling, 1 reply; 6+ messages in thread
From: Claudio Takahasi @ 2010-10-07 13:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

---
 TODO |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index a9f1339..75a929c 100644
--- a/TODO
+++ b/TODO
@@ -18,6 +18,14 @@ Background
 ATT/GATT
 ========
 
+- Implement Client Characteristic Configuration support in the attribute
+  server to manage indications and notications. This is a per client attribute
+  to control how the client wants to receive reports of changes in a given
+  characteristic value.
+
+  Priority: Low
+  Complexity: C2
+
 - gatttool should have the ability to wait for req responses before
   quitting (some servers require a small sleep even with cmd's). Maybe a
   --delay-exit or --timeout command line switch.
-- 
1.7.3.1


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

* [PATCH 1/2] Disable automatic notification/indication in the attribute server
  2010-10-07 13:53 [PATCH 1/2] Disable automatic notification/indication for Battery state level Claudio Takahasi
  2010-10-07 13:53 ` [PATCH 2/2] TODO: Implement Client Characteristic Configuration Claudio Takahasi
@ 2010-10-13 16:32 ` Claudio Takahasi
  2010-10-13 16:59   ` Johan Hedberg
  1 sibling, 1 reply; 6+ messages in thread
From: Claudio Takahasi @ 2010-10-13 16:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Attribute server shall not send automatic indication/notification
messages if the client didn't request them. Client shall use Client
/Server Characteristic Configuration descriptors to be notified about
attribute changes. If the server doesn't support these descriptors,
the client shall implement a polling mechanism to check for attribute
value changes.
---
 TODO                |    7 ------
 src/attrib-server.c |   60 ++++----------------------------------------------
 2 files changed, 5 insertions(+), 62 deletions(-)

diff --git a/TODO b/TODO
index 3885c78..3e62518 100644
--- a/TODO
+++ b/TODO
@@ -18,13 +18,6 @@ Background
 ATT/GATT
 ========
 
-- Sample server shouldn't send any indications or notifications without
-  the client requesting them
-
-  Priority: Medium
-  Complexity: C2
-  Owner: Claudio Takahasi <claudio.takahasi@openbossa.org>
-
 - Add ATT/GATT parsing to hcidump
 
   Priority: Medium
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 666b5fa..1fc1c18 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -590,54 +590,6 @@ static void confirm_event(GIOChannel *io, void *user_data)
 	return;
 }
 
-static gboolean send_notification(gpointer user_data)
-{
-	uint8_t pdu[ATT_MAX_MTU];
-	guint handle = GPOINTER_TO_UINT(user_data);
-	struct attribute *a;
-	GSList *l;
-	uint16_t length;
-
-	l = g_slist_find_custom(database, GUINT_TO_POINTER(handle), handle_cmp);
-	if (!l)
-		return FALSE;
-
-	a = l->data;
-
-	for (l = clients; l; l = l->next) {
-		struct gatt_channel *channel = l->data;
-
-		length = enc_notification(a, pdu, channel->mtu);
-		g_attrib_send(channel->attrib, pdu[0], pdu, length, NULL, NULL, NULL);
-	}
-
-	return FALSE;
-}
-
-static gboolean send_indication(gpointer user_data)
-{
-	uint8_t pdu[ATT_MAX_MTU];
-	guint handle = GPOINTER_TO_UINT(user_data);
-	struct attribute *a;
-	GSList *l;
-	uint16_t length;
-
-	l = g_slist_find_custom(database, GUINT_TO_POINTER(handle), handle_cmp);
-	if (!l)
-		return FALSE;
-
-	a = l->data;
-
-	for (l = clients; l; l = l->next) {
-		struct gatt_channel *channel = l->data;
-
-		length = enc_indication(a, pdu, channel->mtu);
-		g_attrib_send(channel->attrib, pdu[0], pdu, length, NULL, NULL, NULL);
-	}
-
-	return FALSE;
-}
-
 int attrib_server_init(void)
 {
 	GError *gerr = NULL;
@@ -757,14 +709,12 @@ int attrib_db_update(uint16_t handle, uuid_t *uuid, const uint8_t *value,
 	memcpy(a->data, value, len);
 
 	/*
-	 * Characteristic configuration descriptor is not being used yet.
-	 * If the attribute changes, all connected clients will be notified.
-	 * For testing purposes, we send a Notification and a Indication for
-	 * each update.
+	 * <<Client/Server Characteristic Configuration>> descriptors are
+	 * not supported yet. If a given attribute changes, the attribute
+	 * server shall report the new values using the mechanism selected
+	 * by the client. Notification/Indication shall not be automatically
+	 * sent if the client didn't request them.
 	 */
-	g_idle_add(send_notification, GUINT_TO_POINTER(h));
-
-	g_idle_add(send_indication, GUINT_TO_POINTER(h));
 
 	return 0;
 }
-- 
1.7.3.1


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

* [PATCH 2/2] TODO: Implement Client Characteristic Configuration
  2010-10-07 13:53 ` [PATCH 2/2] TODO: Implement Client Characteristic Configuration Claudio Takahasi
@ 2010-10-13 16:34   ` Claudio Takahasi
  2010-10-13 16:59     ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Claudio Takahasi @ 2010-10-13 16:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

---
 TODO |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index 3e62518..7939d9d 100644
--- a/TODO
+++ b/TODO
@@ -89,3 +89,12 @@ ATT/GATT
 
   Priority: Low
   Complexity: C2
+
+- Implement Client Characteristic Configuration support in the attribute
+  server to manage indications and notications. This is a per client attribute
+  to control how the client wants to receive reports of changes in a given
+  characteristic value.
+  See Volume 3, Part G, section 3.3.3.3 for more information
+
+  Priority: Low
+  Complexity: C2
-- 
1.7.3.1


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

* Re: [PATCH 1/2] Disable automatic notification/indication in the attribute server
  2010-10-13 16:32 ` [PATCH 1/2] Disable automatic notification/indication in the attribute server Claudio Takahasi
@ 2010-10-13 16:59   ` Johan Hedberg
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hedberg @ 2010-10-13 16:59 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Wed, Oct 13, 2010, Claudio Takahasi wrote:
> Attribute server shall not send automatic indication/notification
> messages if the client didn't request them. Client shall use Client
> /Server Characteristic Configuration descriptors to be notified about
> attribute changes. If the server doesn't support these descriptors,
> the client shall implement a polling mechanism to check for attribute
> value changes.
> ---
>  TODO                |    7 ------
>  src/attrib-server.c |   60 ++++----------------------------------------------
>  2 files changed, 5 insertions(+), 62 deletions(-)

Thanks. The patch is now upstream.

Johan

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

* Re: [PATCH 2/2] TODO: Implement Client Characteristic Configuration
  2010-10-13 16:34   ` Claudio Takahasi
@ 2010-10-13 16:59     ` Johan Hedberg
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hedberg @ 2010-10-13 16:59 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Wed, Oct 13, 2010, Claudio Takahasi wrote:
> ---
>  TODO |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)

Thanks. This one has also been pushed upstream.

Johan

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

end of thread, other threads:[~2010-10-13 16:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 13:53 [PATCH 1/2] Disable automatic notification/indication for Battery state level Claudio Takahasi
2010-10-07 13:53 ` [PATCH 2/2] TODO: Implement Client Characteristic Configuration Claudio Takahasi
2010-10-13 16:34   ` Claudio Takahasi
2010-10-13 16:59     ` Johan Hedberg
2010-10-13 16:32 ` [PATCH 1/2] Disable automatic notification/indication in the attribute server Claudio Takahasi
2010-10-13 16:59   ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox