OSDN Git Service

android/hal-health: Add channel state event handler
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Thu, 12 Jun 2014 13:10:13 +0000 (16:10 +0300)
committerSzymon Janc <szymon.janc@tieto.com>
Mon, 16 Jun 2014 07:24:23 +0000 (09:24 +0200)
android/hal-health.c

index 0ef6afc..012b6b7 100644 (file)
@@ -41,6 +41,16 @@ static void handle_app_registration_state(void *buf, uint16_t len, int fd)
                cbacks->app_reg_state_cb(ev->id, ev->state);
 }
 
+static void handle_channel_state(void *buf, uint16_t len, int fd)
+{
+       struct hal_ev_health_channel_state *ev = buf;
+
+       if (cbacks->channel_state_cb)
+               cbacks->channel_state_cb(ev->app_id, (bt_bdaddr_t *) ev->bdaddr,
+                                               ev->mdep_index, ev->channel_id,
+                                               ev->channel_state, fd);
+}
+
 /*
  * handlers will be called from notification thread context,
  * index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -49,6 +59,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
        /* HAL_EV_HEALTH_APP_REG_STATE */
        { handle_app_registration_state, false,
                                sizeof(struct hal_ev_health_app_reg_state) },
+       /* HAL_EV_HEALTH_CHANNEL_STATE */
+       { handle_channel_state, false,
+                               sizeof(struct hal_ev_health_channel_state) },
 };
 
 static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)