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 BlueZ 2/4] android/a2dp: Add initial code for handling commands
Date: Mon,  4 Nov 2013 12:56:55 +0200	[thread overview]
Message-ID: <1383562617-9029-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1383562617-9029-1-git-send-email-luiz.dentz@gmail.com>

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

---
 android/a2dp.c | 36 ++++++++++++++++++++++++++++++++++++
 android/a2dp.h |  3 +++
 android/main.c |  4 ++++
 3 files changed, 43 insertions(+)

diff --git a/android/a2dp.c b/android/a2dp.c
index 64e5278..28ab4b1 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -35,9 +35,45 @@
 #include "lib/bluetooth.h"
 #include "log.h"
 #include "a2dp.h"
+#include "hal-msg.h"
+#include "ipc.h"
 
 static GIOChannel *notification_io = NULL;
 
+static uint8_t bt_a2dp_connect(struct hal_cmd_av_connect *cmd, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t bt_a2dp_disconnect(struct hal_cmd_av_connect *cmd, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	return HAL_STATUS_FAILED;
+}
+
+void bt_a2dp_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
+								uint16_t len)
+{
+	uint8_t status = HAL_STATUS_FAILED;
+
+	switch (opcode) {
+	case HAL_OP_AV_CONNECT:
+		status = bt_a2dp_connect(buf, len);
+		break;
+	case HAL_OP_AV_DISCONNECT:
+		status = bt_a2dp_disconnect(buf, len);
+		break;
+	default:
+		DBG("Unhandled command, opcode 0x%x", opcode);
+		break;
+	}
+
+	ipc_send_rsp(io, HAL_SERVICE_ID_A2DP, status);
+}
+
 bool bt_a2dp_register(GIOChannel *io, const bdaddr_t *addr)
 {
 	DBG("");
diff --git a/android/a2dp.h b/android/a2dp.h
index b8b14bb..a5ac53e 100644
--- a/android/a2dp.h
+++ b/android/a2dp.h
@@ -21,5 +21,8 @@
  *
  */
 
+void bt_a2dp_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
+								uint16_t len);
+
 bool bt_a2dp_register(GIOChannel *io, const bdaddr_t *addr);
 void bt_a2dp_unregister(void);
diff --git a/android/main.c b/android/main.c
index efa8c37..75ed4bb 100644
--- a/android/main.c
+++ b/android/main.c
@@ -259,6 +259,10 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
 		bt_sock_handle_cmd(hal_cmd_io, msg->opcode, msg->payload,
 								msg->len);
 		break;
+	case HAL_SERVICE_ID_A2DP:
+		bt_a2dp_handle_cmd(hal_cmd_io, msg->opcode, msg->payload,
+								msg->len);
+		break;
 	default:
 		ipc_send_rsp(hal_cmd_io, msg->service_id, HAL_STATUS_FAILED);
 		break;
-- 
1.8.3.1


  reply	other threads:[~2013-11-04 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 10:56 [PATCH BlueZ 1/4] android: Add initial skeleton for a2dp in the daemon Luiz Augusto von Dentz
2013-11-04 10:56 ` Luiz Augusto von Dentz [this message]
2013-11-04 10:56 ` [PATCH BlueZ 3/4] android: Add initial skeleton for pan " Luiz Augusto von Dentz
2013-11-04 10:56 ` [PATCH BlueZ 4/4] android/pan: Add initial code for handling commands Luiz Augusto von Dentz
2013-11-04 19:13 ` [PATCH BlueZ 1/4] android: Add initial skeleton for a2dp in the daemon Johan Hedberg

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=1383562617-9029-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