[PATCH BlueZ 7/8] unit/gatt: Add TP/GAI/CL/BV-01-C test

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

 



Verify that a Generic Attribute Profile client can respond with a
Confirmation to a Characteristic Value Indication.
---
 unit/test-gatt.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index c45ff3d..94e7e35 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1647,6 +1647,36 @@ static void test_server_indication_confirm(struct context *context)
 	g_assert(indication_received == 1);
 }
 
+static void indication_cb(uint16_t value_handle, const uint8_t *value,
+			    uint16_t length, void *user_data)
+{
+	struct context *context = user_data;
+	const struct test_step *step = context->data->step;
+
+	if (value_handle == step->handle) {
+		g_assert_cmpint(length, ==, step->length);
+
+		g_assert(memcmp(value, step->value, length) == 0);
+	}
+}
+
+static void test_indication(struct context *context)
+{
+	const struct test_step *step = context->data->step;
+
+	g_assert(bt_gatt_client_register_notify(context->client, step->handle,
+						notification_register_cb,
+						indication_cb, context,
+						NULL));
+}
+
+static const struct test_step test_indication_1 = {
+	.handle = 0x0003,
+	.func = test_indication,
+	.value = read_data_1,
+	.length = 0x03,
+};
+
 static void test_server_indication(struct context *context)
 {
 	const struct test_step *step = context->data->step;
@@ -2550,5 +2580,15 @@ int main(int argc, char *argv[])
 			raw_pdu(0x1D, 0x03, 0x00, 0x01, 0x02, 0x03),
 			raw_pdu(0x1E));
 
+	define_test_client("/TP/GAI/CL/BV-01-C", test_client, ts_small_db,
+			&test_indication_1,
+			MTU_EXCHANGE_CLIENT_PDUS,
+			SMALL_DB_DISCOVERY_PDUS,
+			raw_pdu(0x12, 0x04, 0x00, 0x03, 0x00),
+			raw_pdu(0x13),
+			raw_pdu(),
+			raw_pdu(0x1D, 0x03, 0x00, 0x01, 0x02, 0x03),
+			raw_pdu(0x1E));
+
 	return g_test_run();
 }
-- 
2.2.0.rc0.207.ga3a616c

--
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