Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 2/6] android: Add initial code for handling adapter commands
Date: Tue, 22 Oct 2013 18:47:52 +0200	[thread overview]
Message-ID: <1382460476-6604-2-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1382460476-6604-1-git-send-email-szymon.janc@tieto.com>

No commands are handled yet.
---
 android/adapter.c | 14 ++++++++++++++
 android/adapter.h |  3 +++
 android/main.c    |  4 ++++
 3 files changed, 21 insertions(+)

diff --git a/android/adapter.c b/android/adapter.c
index cae3187..f891bc2 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -23,10 +23,14 @@
 
 #include <errno.h>
 
+#include <glib.h>
+
 #include "lib/bluetooth.h"
 #include "src/shared/mgmt.h"
 #include "lib/mgmt.h"
 #include "log.h"
+#include "hal-msg.h"
+#include "ipc.h"
 #include "adapter.h"
 
 struct bt_adapter {
@@ -285,3 +289,13 @@ bool bt_adapter_init(uint16_t index, struct mgmt *mgmt_if,
 
 	return adapter;
 }
+
+void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
+								uint16_t len)
+{
+	switch (opcode) {
+	default:
+		ipc_send_error(io, HAL_SERVICE_ID_CORE, HAL_ERROR_FAILED);
+		break;
+	}
+}
diff --git a/android/adapter.h b/android/adapter.h
index d8ad191..bfd4932 100644
--- a/android/adapter.h
+++ b/android/adapter.h
@@ -34,3 +34,6 @@ typedef void (*bt_adapter_ready)(struct bt_adapter *adapter, int err);
 
 bool bt_adapter_init(uint16_t index, struct mgmt *mgmt_if,
 						bt_adapter_ready func);
+
+void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
+								uint16_t len);
diff --git a/android/main.c b/android/main.c
index d4916ca..f3e2baa 100644
--- a/android/main.c
+++ b/android/main.c
@@ -155,6 +155,10 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
 	case HAL_SERVICE_ID_CORE:
 		handle_service_core(msg->opcode, buf + sizeof(*msg), msg->len);
 		break;
+	case HAL_SERVICE_ID_BLUETOOTH:
+		bt_adapter_handle_cmd(hal_cmd_io, msg->opcode, msg->payload,
+								msg->len);
+		break;
 	default:
 		ipc_send_error(hal_cmd_io, msg->service_id, HAL_ERROR_FAILED);
 		break;
-- 
1.8.4


  reply	other threads:[~2013-10-22 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 16:47 [PATCH 1/6] android: Handle mgmt changed events Szymon Janc
2013-10-22 16:47 ` Szymon Janc [this message]
2013-10-22 16:47 ` [PATCH 3/6] adapter: Print debug message with IPC message header parameters Szymon Janc
2013-10-22 16:47 ` [PATCH 4/6] android/hal: Use correct service id for adapter commands Szymon Janc
2013-10-22 16:47 ` [PATCH 5/6] android: Fix error response for unknown command Szymon Janc
2013-10-22 16:47 ` [PATCH 6/6] adapter: Implement adapter enable and disable commands Szymon Janc
2013-10-22 20:23 ` [PATCH 1/6] android: Handle mgmt changed events 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=1382460476-6604-2-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.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