All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Subject: [PATCH 08/15] android/hal-health: Add HDP .init method
Date: Wed, 12 Mar 2014 17:10:51 +0200	[thread overview]
Message-ID: <1394637058-586-9-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1394637058-586-1-git-send-email-ravikumar.veeramally@linux.intel.com>

---
 android/hal-health.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/android/hal-health.c b/android/hal-health.c
index 55db7f6..649661e 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
@@ -26,9 +26,50 @@
 #include "ipc-common.h"
 #include "hal-ipc.h"
 
+static const bthl_callbacks_t *cbacks;
+
+static bool interface_ready(void)
+{
+	return cbacks != NULL;
+}
+
+/* handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
+static const struct hal_ipc_handler ev_handlers[] = {
+};
+
+static bt_status_t init(bthl_callbacks_t *callbacks)
+{
+	struct hal_cmd_register_module cmd;
+	int ret;
+
+	DBG("");
+
+	if (interface_ready())
+		return BT_STATUS_DONE;
+
+	/* store reference to user callbacks */
+	cbacks = callbacks;
+
+	hal_ipc_register(HAL_SERVICE_ID_HEALTH, ev_handlers,
+				sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
+	cmd.service_id = HAL_SERVICE_ID_HEALTH;
+
+	ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
+
+	if (ret != BT_STATUS_SUCCESS) {
+		cbacks = NULL;
+		hal_ipc_unregister(HAL_SERVICE_ID_HEALTH);
+	}
+
+	return ret;
+}
+
 static bthl_interface_t health_if = {
 	.size = sizeof(health_if),
-	.init = NULL,
+	.init = init,
 	.register_application = NULL,
 	.unregister_application = NULL,
 	.connect_channel = NULL,
-- 
1.8.3.2


  parent reply	other threads:[~2014-03-12 15:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 15:10 [PATCH 00/15] Add HDP profile support at HAL side Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 01/15] android/hal-msg: Add HDP app registration struct Ravi kumar Veeramally
2014-03-12 15:39   ` Luiz Augusto von Dentz
2014-03-12 17:39     ` Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 02/15] android/hal-msg: Add HDP app unregistration struct Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 03/15] android/hal-msg: Add HDP connect channel struct Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 04/15] android/hal-msg: Add HDP destroy " Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 05/15] android/hal-msg: Add HDP app registration state event struct Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 06/15] android/hal-msg: Add HDP app channel " Ravi kumar Veeramally
2014-03-12 15:57   ` Andrzej Kaczmarek
2014-03-12 17:36     ` Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 07/15] android/hal-health: Add hal-health file Ravi kumar Veeramally
2014-03-12 19:53   ` Szymon Janc
2014-03-12 15:10 ` Ravi kumar Veeramally [this message]
2014-03-12 19:56   ` [PATCH 08/15] android/hal-health: Add HDP .init method Szymon Janc
2014-03-12 15:10 ` [PATCH 09/15] android/hal-health: Add HDP .cleanup method Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 10/15] android/hal-health: Add HDP .register_application method Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 11/15] android/hal-health: Add HDP .unregister_application method Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 12/15] android/hal-health: Add HDP .connect_channel method Ravi kumar Veeramally
2014-03-12 20:05   ` Szymon Janc
2014-03-13  9:22     ` Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 13/15] android/hal-health: Add HDP .destroy_channel method Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 14/15] android/hal-health: Add app state and channel state event handlers Ravi kumar Veeramally
2014-03-12 15:10 ` [PATCH 15/15] android/health: Add health.c|h file with basic calls Ravi kumar Veeramally
2014-03-12 15:18   ` Grzegorz Kolodziejczyk
2014-03-12 17:37     ` Ravi kumar Veeramally

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=1394637058-586-9-git-send-email-ravikumar.veeramally@linux.intel.com \
    --to=ravikumar.veeramally@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.