Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [BlueZ v4 2/6] audio/A2DP: Add implemention of audio Close command
Date: Mon, 13 Jan 2014 14:10:00 +0200	[thread overview]
Message-ID: <1389615004-32612-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1389615004-32612-1-git-send-email-luiz.dentz@gmail.com>

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

---
 android/a2dp.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/android/a2dp.c b/android/a2dp.c
index b6b46e4..354895a 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -517,11 +517,37 @@ failed:
 	audio_ipc_send_rsp(AUDIO_OP_OPEN, AUDIO_STATUS_FAILED);
 }
 
+static struct a2dp_endpoint *find_endpoint(uint8_t id)
+{
+	GSList *l;
+
+	for (l = endpoints; l; l = g_slist_next(l)) {
+		struct a2dp_endpoint *endpoint = l->data;
+
+		if (endpoint->id == id)
+			return endpoint;
+	}
+
+	return NULL;
+}
+
 static void bt_audio_close(const void *buf, uint16_t len)
 {
-	DBG("Not Implemented");
+	const struct audio_cmd_close *cmd = buf;
+	struct a2dp_endpoint *endpoint;
+
+	DBG("");
+
+	endpoint = find_endpoint(cmd->id);
+	if (!endpoint) {
+		error("Unable to find endpoint %u", cmd->id);
+		audio_ipc_send_rsp(AUDIO_OP_CLOSE, AUDIO_STATUS_FAILED);
+		return;
+	}
+
+	unregister_endpoint(endpoint);
 
-	audio_ipc_send_rsp(AUDIO_OP_CLOSE, HAL_STATUS_FAILED);
+	audio_ipc_send_rsp(AUDIO_OP_CLOSE, AUDIO_STATUS_SUCCESS);
 }
 
 static void bt_stream_open(const void *buf, uint16_t len)
-- 
1.8.4.2


  reply	other threads:[~2014-01-13 12:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 12:09 [BlueZ v4 1/6] audio/A2DP: Add implemention of audio Open command Luiz Augusto von Dentz
2014-01-13 12:10 ` Luiz Augusto von Dentz [this message]
2014-01-13 12:10 ` [BlueZ v4 3/6] audio/A2DP: Add implemention of audio Open Stream command Luiz Augusto von Dentz
2014-01-13 12:10 ` [BlueZ v4 4/6] audio/A2DP: Add implemention of audio Close " Luiz Augusto von Dentz
2014-01-13 12:10 ` [BlueZ v4 5/6] audio/A2DP: Add implemention of audio Resume " Luiz Augusto von Dentz
2014-01-13 12:10 ` [BlueZ v4 6/6] audio/A2DP: Add implemention of audio Suspend " Luiz Augusto von Dentz
2014-01-13 12:35 ` [BlueZ v4 1/6] audio/A2DP: Add implemention of audio Open command 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=1389615004-32612-2-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