Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 06/20] unit/AVDTP: Add /TP/SIG/SMG/BV-08-C test
Date: Mon, 25 Nov 2013 16:54:29 +0200	[thread overview]
Message-ID: <1385391283-10962-7-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1385391283-10962-1-git-send-email-luiz.dentz@gmail.com>

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

Verify that the IUT (ACP) reports the reception of a valid query for
remote SEP capabilities and replies the returned capabilities.
---
 unit/test-avdtp.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
index 81155a4..0b92489 100644
--- a/unit/test-avdtp.c
+++ b/unit/test-avdtp.c
@@ -195,26 +195,64 @@ static void execute_context(struct context *context)
 	g_free(context);
 }
 
+static gboolean sep_getcap_ind(struct avdtp *session,
+					struct avdtp_local_sep *sep,
+					gboolean get_all, GSList **caps,
+					uint8_t *err, void *user_data)
+{
+	struct avdtp_service_capability *media_transport, *media_codec;
+	struct avdtp_media_codec_capability *codec_caps;
+	uint8_t cap[4] = { 0xff, 0xff, 2, 64 };
+
+	*caps = NULL;
+
+	media_transport = avdtp_service_cap_new(AVDTP_MEDIA_TRANSPORT,
+						NULL, 0);
+
+	*caps = g_slist_append(*caps, media_transport);
+
+	codec_caps = g_malloc0(sizeof(*codec_caps) + sizeof(cap));
+	codec_caps->media_type = AVDTP_MEDIA_TYPE_AUDIO;
+	codec_caps->media_codec_type = 0x00;
+	memcpy(codec_caps->data, cap, sizeof(cap));
+
+	media_codec = avdtp_service_cap_new(AVDTP_MEDIA_CODEC, codec_caps,
+					sizeof(*codec_caps) + sizeof(cap));
+
+	*caps = g_slist_append(*caps, media_codec);
+	g_free(codec_caps);
+
+	return TRUE;
+}
+
+static struct avdtp_sep_ind sep_ind = {
+	.get_capability		= sep_getcap_ind,
+};
+
 static void test_server(gconstpointer data)
 {
 	const struct test_data *test = data;
 	struct context *context = create_context(0x0100);
+	struct avdtp_local_sep *sep;
 
 	context->pdu_list = test->pdu_list;
 
-	avdtp_register_sep(AVDTP_SEP_TYPE_SOURCE, AVDTP_MEDIA_TYPE_AUDIO, 0x00,
-							TRUE, NULL, NULL, NULL);
+	sep = avdtp_register_sep(AVDTP_SEP_TYPE_SOURCE, AVDTP_MEDIA_TYPE_AUDIO,
+					0x00, TRUE, &sep_ind, NULL, NULL);
 
 	g_idle_add(send_pdu, context);
 
 	execute_context(context);
 
+	avdtp_unregister_sep(sep);
+
 	g_free(test->pdu_list);
 }
 
 static void discover_cb(struct avdtp *session, GSList *seps,
 				struct avdtp_error *err, void *user_data)
 {
+
 }
 
 static void test_discover(gconstpointer data)
@@ -267,6 +305,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x10, 0x01),
 			raw_pdu(0x12, 0x01, 0x04, 0x00),
 			raw_pdu(0x20, 0x02, 0x04));
+	define_test("/TP/SIG/SMG/BV-08-C", test_server,
+			raw_pdu(0x00, 0x01),
+			raw_pdu(0x02, 0x01, 0x04, 0x00),
+			raw_pdu(0x10, 0x02, 0x04),
+			raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+				0xff, 0xff, 0x02, 0x40));
 
 	return g_test_run();
 }
-- 
1.8.3.1


  parent reply	other threads:[~2013-11-25 14:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 14:54 [PATCH v2 00/20] Initial AVDTP for Android Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 02/20] android/AVDTP: Strip dependencies Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 03/20] unit/AVDTP: Add /TP/SIG/SMG/BV-05-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 04/20] unit/AVDTP: Add /TP/SIG/SMG/BV-06-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 05/20] unit/AVDTP: Add /TP/SIG/SMG/BV-07-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` Luiz Augusto von Dentz [this message]
2013-11-25 14:54 ` [PATCH v2 07/20] unit/AVDTP: Add /TP/SIG/SMG/BV-09-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 08/20] unit/AVDTP: Add /TP/SIG/SMG/BV-10-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 09/20] unit/AVDTP: Add /TP/SIG/SMG/BV-11-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 10/20] unit/AVDTP: Add /TP/SIG/SMG/BV-12-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 11/20] unit/AVDTP: Add /TP/SIG/SMG/BV-15-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 12/20] unit/AVDTP: Add /TP/SIG/SMG/BV-16-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 13/20] unit/AVDTP: Add /TP/SIG/SMG/BV-17-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 14/20] unit/AVDTP: Add /TP/SIG/SMG/BV-18-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 15/20] unit/AVDTP: Add /TP/SIG/SMG/BV-19-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 16/20] unit/AVDTP: Add /TP/SIG/SMG/BV-20-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 17/20] unit/AVDTP: Add /TP/SIG/SMG/BV-21-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 18/20] unit/AVDTP: Add /TP/SIG/SMG/BV-22-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 19/20] unit/AVDTP: Add /TP/SIG/SMG/BV-23-C test Luiz Augusto von Dentz
2013-11-25 14:54 ` [PATCH v2 20/20] unit/AVDTP: Add /TP/SIG/SMG/BV-24-C test Luiz Augusto von Dentz
2013-11-26 13:46 ` [PATCH v2 00/20] Initial AVDTP for Android 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=1385391283-10962-7-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --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