[PATCH BlueZ 10/10] unit/test-gatt: Adjust the PDUs for characteristic discovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

The new behavior of bt_gatt_client is to discovery the characteristics
of the entire range (0x0001-0xffff) not service by service.
---
 unit/test-gatt.c | 66 ++++++++++++++++++++++++++------------------------------
 1 file changed, 30 insertions(+), 36 deletions(-)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 819bf05..d8971c1 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -136,18 +136,16 @@ struct context {
 		raw_pdu(0x01, 0x10, 0x01, 0x00, 0x0a),			\
 		raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28),	\
 		raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a),			\
-		raw_pdu(0x08, 0x01, 0x00, 0x04, 0x00, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x02, 0x00, 0x02, 0x03, 0x00, 0x00,	\
 				0x2a),					\
-		raw_pdu(0x08, 0x03, 0x00, 0x04, 0x00, 0x03, 0x28),	\
-		raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),			\
-		raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00),			\
-		raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29),		\
-		raw_pdu(0x08, 0x05, 0x00, 0x08, 0x00, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x03, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x06, 0x00, 0x0a, 0x07, 0x00, 0x29,	\
 				0x2a),					\
-		raw_pdu(0x08, 0x07, 0x00, 0x08, 0x00, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x07, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x01, 0x08, 0x07, 0x00, 0x0a),			\
+		raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00),			\
+		raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29),		\
 		raw_pdu(0x04, 0x08, 0x00, 0x08, 0x00),			\
 		raw_pdu(0x05, 0x01, 0x08, 0x00, 0x01, 0x29)
 
@@ -163,18 +161,16 @@ struct context {
 		raw_pdu(0x01, 0x10, 0x01, 0x00, 0x0a),			\
 		raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28),	\
 		raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a),			\
-		raw_pdu(0x08, 0x01, 0x00, 0x04, 0x00, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x02, 0x00, 0x02, 0x03, 0x00, 0x00,	\
 				0x2a),					\
-		raw_pdu(0x08, 0x03, 0x00, 0x04, 0x00, 0x03, 0x28),	\
-		raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),			\
-		raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00),			\
-		raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29),		\
-		raw_pdu(0x08, 0x05, 0x00, 0x0a, 0x00, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x03, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x07, 0x00, 0x0a, 0x08, 0x00, 0x29,	\
 				0x2a),					\
-		raw_pdu(0x08, 0x08, 0x00, 0x0a, 0x00, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x08, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x01, 0x08, 0x08, 0x00, 0x0a),			\
+		raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00),			\
+		raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29),		\
 		raw_pdu(0x04, 0x09, 0x00, 0x0a, 0x00),			\
 		raw_pdu(0x05, 0x01, 0x0a, 0x00, 0x01, 0x29)
 
@@ -191,18 +187,16 @@ struct context {
 		raw_pdu(0x01, 0x10, 0x01, 0x00, 0x0a),			\
 		raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28),	\
 		raw_pdu(0x01, 0x08, 0x00, 0x01, 0x0a),			\
-		raw_pdu(0x08, 0x00, 0x01, 0x21, 0x01, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x10, 0x01, 0x02, 0x11, 0x01, 0x00,	\
 			0x2a, 0x20, 0x01, 0x02, 0x21, 0x01, 0x01, 0x2a),\
-		raw_pdu(0x08, 0x21, 0x01, 0x21, 0x01, 0x03, 0x28),	\
-		raw_pdu(0x01, 0x08, 0x21, 0x01, 0x0a),			\
-		raw_pdu(0x04, 0x12, 0x01, 0x1f, 0x01),			\
-		raw_pdu(0x01, 0x04, 0x12, 0x01, 0x0a),			\
-		raw_pdu(0x08, 0x00, 0x03, 0x20, 0x03, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x21, 0x01, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x10, 0x03, 0x0a, 0x11, 0x03, 0x29,	\
 			0x2a),						\
-		raw_pdu(0x08, 0x11, 0x03, 0x20, 0x03, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x11, 0x03, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x01, 0x08, 0x11, 0x03, 0x0a),			\
+		raw_pdu(0x04, 0x12, 0x01, 0x1f, 0x01),			\
+		raw_pdu(0x01, 0x04, 0x12, 0x01, 0x0a),			\
 		raw_pdu(0x04, 0x12, 0x03, 0x20, 0x03),			\
 		raw_pdu(0x05, 0x01, 0x20, 0x03, 0x02, 0x29)
 
@@ -250,34 +244,32 @@ struct context {
 		raw_pdu(0x01, 0x08, 0x12, 0xf0, 0x0a)
 
 #define CHARACTERISTIC_DISC_SMALL_DB					\
-		raw_pdu(0x08, 0x10, 0xf0, 0x18, 0xf0, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x03, 0x28),	\
+		raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29,	\
+			0x2a),						\
+		raw_pdu(0x08, 0x03, 0x00, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x12, 0xf0, 0x02, 0x13, 0xf0, 0x00,	\
 			0x2a),						\
-		raw_pdu(0x08, 0x13, 0xf0, 0x18, 0xf0, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x13, 0xf0, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x15, 0x14, 0xf0, 0x82, 0x15, 0xf0, 0xef,	\
 			0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x00,	\
 			0x00, 0x00, 0x00, 0x09, 0xB0, 0x00, 0x00),	\
-		raw_pdu(0x08, 0x15, 0xf0, 0x18, 0xf0, 0x03, 0x28),	\
+		raw_pdu(0x08, 0x15, 0xf0, 0xff, 0xff, 0x03, 0x28),	\
 		raw_pdu(0x09, 0x07, 0x17, 0xf0, 0x02, 0x18, 0xf0, 0x01,	\
 			0x2a),						\
-		raw_pdu(0x08, 0x18, 0xf0, 0x18, 0xf0, 0x03, 0x28),	\
-		raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a),			\
-		raw_pdu(0x04, 0x16, 0xf0, 0x16, 0xf0),			\
-		raw_pdu(0x05, 0x01, 0x16, 0xf0, 0x00, 0x29),		\
-		raw_pdu(0x0a, 0x16, 0xf0),				\
-		raw_pdu(0x0b, 0x01, 0x00),				\
-		raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),	\
-		raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29,	\
-			0x2a),						\
-		raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),	\
-		raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a)
+		raw_pdu(0x08, 0x18, 0xf0, 0xff, 0xff, 0x03, 0x28),	\
+		raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a)
 
 #define DESCRIPTOR_DISC_SMALL_DB					\
 		raw_pdu(0x04, 0x04, 0x00, 0x10, 0x00),			\
 		raw_pdu(0x05, 0x01, 0x04, 0x00, 0x02, 0x29, 0x05, 0x00,	\
 			0x01, 0x29),					\
 		raw_pdu(0x04, 0x06, 0x00, 0x10, 0x00),			\
-		raw_pdu(0x01, 0x04, 0x06, 0x00, 0x0a)
+		raw_pdu(0x01, 0x04, 0x06, 0x00, 0x0a),			\
+		raw_pdu(0x04, 0x16, 0xf0, 0x16, 0xf0),			\
+		raw_pdu(0x05, 0x01, 0x16, 0xf0, 0x00, 0x29),		\
+		raw_pdu(0x0a, 0x16, 0xf0),				\
+		raw_pdu(0x0b, 0x01, 0x00)
 
 #define SMALL_DB_DISCOVERY_PDUS						\
 		PRIMARY_DISC_SMALL_DB,					\
@@ -450,6 +442,8 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
 
 	util_hexdump('>', buf, len, test_debug, "GATT: ");
 
+	util_hexdump('=', pdu->data, pdu->size, test_debug, "PDU: ");
+
 	g_assert_cmpint(len, ==, pdu->size);
 
 	g_assert(memcmp(buf, pdu->data, pdu->size) == 0);
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux