Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v4] Implement ATT handle indications
@ 2011-03-10 14:01 Elvis Pfützenreuter
  2011-03-10 14:16 ` Claudio Takahasi
  2011-03-10 14:31 ` Johan Hedberg
  0 siblings, 2 replies; 5+ messages in thread
From: Elvis Pfützenreuter @ 2011-03-10 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: epx

This patch takes advantage of g_attrib_send() implicit guarantee of
queueing i.e. indication is only sent if the previous one has been
confirmed, so we don't need to maintain an explicit queue.
---
 src/attrib-server.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index b980b28..f157424 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -875,6 +875,8 @@ static void channel_handler(const uint8_t *ipdu, uint16_t len,
 		length = find_by_type(start, end, &uuid, value, vlen,
 							opdu, channel->mtu);
 		break;
+	case ATT_OP_HANDLE_CNF:
+		return;
 	case ATT_OP_READ_MULTI_REQ:
 	case ATT_OP_PREP_WRITE_REQ:
 	case ATT_OP_EXEC_WRITE_REQ:
@@ -972,6 +974,20 @@ static void attrib_notify_clients(struct attribute *attr)
 			g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
 							NULL, NULL, NULL);
 		}
+
+		/* Indication */
+		if (g_slist_find_custom(channel->indicate,
+					GUINT_TO_POINTER(handle), handle_cmp)) {
+			uint8_t pdu[ATT_MAX_MTU];
+			uint16_t len;
+
+			len = enc_indication(attr, pdu, channel->mtu);
+			if (len == 0)
+				return;
+
+			g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
+							NULL, NULL, NULL);
+		}
 	}
 }
 
-- 
1.7.1


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

end of thread, other threads:[~2011-03-10 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-10 14:01 [PATCH v4] Implement ATT handle indications Elvis Pfützenreuter
2011-03-10 14:16 ` Claudio Takahasi
2011-03-10 14:35   ` Elvis Pfützenreuter
2011-03-10 14:48   ` Anderson Lizardo
2011-03-10 14:31 ` Johan Hedberg

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