summaryrefslogtreecommitdiff
path: root/android/hal-health.c
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2014-03-13 13:58:45 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-03-14 13:34:16 +0100
commit840dcd6868caf11871ce4d7cfa147e02f67847f7 (patch)
tree42bc1b111f6528314e5b43f333ffb1e23726ef92 /android/hal-health.c
parentd7e5e16a360c9ca48aa65defc3238b671ace3e7e (diff)
downloadbluez-840dcd6868caf11871ce4d7cfa147e02f67847f7.tar.gz
android/hal-health: Add HDP .init method
Diffstat (limited to 'android/hal-health.c')
-rw-r--r--android/hal-health.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/android/hal-health.c b/android/hal-health.c
index 59f8cca38..d099ae23c 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 = NULL;
+
+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,