[PATCH_v2 14/15] android/hal-health: Add app state and channel state event handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

diff --git a/android/hal-health.c b/android/hal-health.c
index 5939663..2914a2c 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
@@ -33,9 +33,38 @@ static bool interface_ready(void)
 	return cbacks != NULL;
 }
 
+static void handle_app_registration_state(void *buf, uint16_t len)
+{
+	struct hal_ev_health_app_reg_state *ev = buf;
+
+	if (cbacks->app_reg_state_cb)
+		cbacks->app_reg_state_cb(ev->id, ev->state);
+}
+
+static void handle_channel_state(void *buf, uint16_t len)
+{
+	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, ev->file_descr);
+}
+
 /* 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[] = {
+	{ /* HAL_EV_HEALTH_APP_REG_STATE */
+		.handler = handle_app_registration_state,
+		.var_len = false,
+		.data_len = sizeof(struct hal_ev_health_app_reg_state)
+	},
+	{ /* HAL_EV_HEALTH_CHANNEL_STATE */
+		.handler = handle_channel_state,
+		.var_len = false,
+		.data_len = sizeof(struct hal_ev_health_channel_state)
+	},
 };
 
 static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux