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 4/4] android/pan: Add initial code for handling commands
Date: Mon,  4 Nov 2013 12:56:57 +0200	[thread overview]
Message-ID: <1383562617-9029-4-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/main.c |  4 ++++
 android/pan.c  | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 android/pan.h  |  2 ++
 3 files changed, 62 insertions(+)

diff --git a/android/main.c b/android/main.c
index 29b3882..7d36976 100644
--- a/android/main.c
+++ b/android/main.c
@@ -272,6 +272,10 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
 		bt_a2dp_handle_cmd(hal_cmd_io, msg->opcode, msg->payload,
 								msg->len);
 		break;
+	case HAL_SERVICE_ID_PAN:
+		bt_pan_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;
diff --git a/android/pan.c b/android/pan.c
index 4b988ac..0cc3590 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -32,9 +32,65 @@
 #include "lib/bluetooth.h"
 #include "log.h"
 #include "pan.h"
+#include "hal-msg.h"
+#include "ipc.h"
 
 static GIOChannel *notification_io = NULL;
 
+static uint8_t bt_pan_enable(struct hal_cmd_pan_enable *cmd, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t bt_pan_get_role(void *cmd, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t bt_pan_connect(struct hal_cmd_pan_connect *cmd, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t bt_pan_disconnect(struct hal_cmd_pan_connect *cmd, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	return HAL_STATUS_FAILED;
+}
+
+void bt_pan_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
+								uint16_t len)
+{
+	uint8_t status = HAL_STATUS_FAILED;
+
+	switch (opcode) {
+	case HAL_OP_PAN_ENABLE:
+		status = bt_pan_enable(buf, len);
+		break;
+	case HAL_OP_PAN_GET_ROLE:
+		status = bt_pan_get_role(buf, len);
+		break;
+	case HAL_OP_PAN_CONNECT:
+		status = bt_pan_connect(buf, len);
+		break;
+	case HAL_OP_PAN_DISCONNECT:
+		status = bt_pan_disconnect(buf, len);
+		break;
+	default:
+		DBG("Unhandled command, opcode 0x%x", opcode);
+		break;
+	}
+
+	ipc_send_rsp(io, HAL_SERVICE_ID_A2DP, status);
+}
+
 bool bt_pan_register(GIOChannel *io, const bdaddr_t *addr)
 {
 	DBG("");
diff --git a/android/pan.h b/android/pan.h
index 318f318..1ffba9d 100644
--- a/android/pan.h
+++ b/android/pan.h
@@ -21,5 +21,7 @@
  *
  */
 
+void bt_pan_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf, uint16_t len);
+
 bool bt_pan_register(GIOChannel *io, const bdaddr_t *addr);
 void bt_pan_unregister(void);
-- 
1.8.3.1


  parent 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 ` [PATCH BlueZ 2/4] android/a2dp: Add initial code for handling commands Luiz Augusto von Dentz
2013-11-04 10:56 ` [PATCH BlueZ 3/4] android: Add initial skeleton for pan in the daemon Luiz Augusto von Dentz
2013-11-04 10:56 ` Luiz Augusto von Dentz [this message]
2013-11-04 19:13 ` [PATCH BlueZ 1/4] android: Add initial skeleton for a2dp " 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-4-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