linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arman Uguray <armansito@chromium.org>
To: linux-bluetooth@vger.kernel.org
Cc: Arman Uguray <armansito@chromium.org>
Subject: [PATCH BlueZ v3 2/2] unit/test-gatt: Add /TP/GAD/SR/BV-01-C test
Date: Mon, 24 Nov 2014 12:05:53 -0800	[thread overview]
Message-ID: <1416859553-11027-3-git-send-email-armansito@chromium.org> (raw)
In-Reply-To: <1416859553-11027-1-git-send-email-armansito@chromium.org>

Verify that a Generic Attribute Profile server can support a search for
all Primary Services it contains.
---
 unit/test-gatt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 58885a4..84925af 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -431,6 +431,42 @@ static void client_ready_cb(bool success, uint8_t att_ecode, void *user_data)
 	context_quit(context);
 }
 
+static void populate_db(struct context *context)
+{
+	struct gatt_db *db = context->db;
+	struct gatt_db_attribute *attr;
+	bt_uuid_t uuid;
+	uint128_t u128 = {
+		.data = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+				0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }
+	};
+
+	/* Service 1 */
+	bt_uuid16_create(&uuid, 0x1800);
+	attr = gatt_db_add_service(db, &uuid, true, 5);
+	gatt_db_service_set_active(attr, true);
+
+	/* Service 2 */
+	bt_uuid16_create(&uuid, 0x1801);
+	attr = gatt_db_add_service(db, &uuid, true, 3);
+	gatt_db_service_set_active(attr, true);
+
+	/* Service 3 */
+	bt_uuid16_create(&uuid, 0x180f);
+	attr = gatt_db_add_service(db, &uuid, false, 5);
+	gatt_db_service_set_active(attr, true);
+
+	/* Service 4 */
+	bt_uuid16_create(&uuid, 0x180d);
+	attr = gatt_db_add_service(db, &uuid, true, 8);
+	gatt_db_service_set_active(attr, true);
+
+	/* Service 5 */
+	bt_uuid128_create(&uuid, u128);
+	attr = gatt_db_add_service(db, &uuid, true, 1);
+	gatt_db_service_set_active(attr, true);
+}
+
 static struct context *create_context(uint16_t mtu, gconstpointer data)
 {
 	struct context *context = g_new0(struct context, 1);
@@ -465,6 +501,8 @@ static struct context *create_context(uint16_t mtu, gconstpointer data)
 		context->server = bt_gatt_server_new(context->db, att, mtu);
 		g_assert(context->server);
 
+		populate_db(context);
+
 		if (g_test_verbose())
 			bt_gatt_server_set_debug(context->server, print_debug,
 						"bt_gatt_server:", NULL);
@@ -852,6 +890,20 @@ int main(int argc, char *argv[])
 			raw_pdu(0x10, 0x97, 0x00, 0xff, 0xff, 0x00, 0x28),
 			raw_pdu(0x01, 0x10, 0x97, 0x00, 0x0a));
 
+	define_test_server("/TP/GAD/SR/BV-01-C", test_server, NULL, NULL,
+			raw_pdu(0x03, 0x00, 0x02),
+			raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
+			raw_pdu(0x11, 0x06, 0x01, 0x00, 0x05, 0x00, 0x00, 0x18,
+					0x06, 0x00, 0x08, 0x00, 0x01, 0x18,
+					0x0e, 0x00, 0x15, 0x00, 0x0d, 0x18),
+			raw_pdu(0x10, 0x16, 0x00, 0xff, 0xff, 0x00, 0x28),
+			raw_pdu(0x11, 0x14, 0x16, 0x00, 0x16, 0x00, 0x0f,
+					0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09,
+					0x08, 0x07, 0x06, 0x05, 0x04, 0x03,
+					0x02, 0x01, 0x00),
+			raw_pdu(0x10, 0x17, 0x00, 0xff, 0xff, 0x00, 0x28),
+			raw_pdu(0x01, 0x10, 0x17, 0x00, 0x0a));
+
 	define_test_att("/TP/GAD/CL/BV-02-C-1", test_search_primary, &uuid_16,
 			NULL,
 			raw_pdu(0x02, 0x00, 0x02),
-- 
2.1.0.rc2.206.gedb03e5


  parent reply	other threads:[~2014-11-24 20:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24 20:05 [PATCH Bluez v3 0/2] unit/test-gatt: Add initial server role tests Arman Uguray
2014-11-24 20:05 ` [PATCH BlueZ v3 1/2] unit/test-gatt: Add /TP/GAC/SR/BV-01-C test Arman Uguray
2014-11-24 20:05 ` Arman Uguray [this message]
2014-11-24 20:57 ` [PATCH Bluez v3 0/2] unit/test-gatt: Add initial server role tests Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416859553-11027-3-git-send-email-armansito@chromium.org \
    --to=armansito@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).