Diff between 9b67ebb0e6e8e8d3cf9c6d2518a2ffefb30cc172 and 7bca531f62197e1bccbd48e8714db99c0542f35c

Changed Files

File Additions Deletions Status
android/hal-av.c +13 -0 modified
android/hal-msg.h +6 -0 modified

Full Patch

diff --git a/android/hal-av.c b/android/hal-av.c
index 051fc3e..4fb37a2 100644
--- a/android/hal-av.c
+++ b/android/hal-av.c
@@ -20,6 +20,7 @@
 
 #include "hal-log.h"
 #include "hal.h"
+#include "hal-msg.h"
 
 static const btav_callbacks_t *cbs = NULL;
 
@@ -28,6 +29,15 @@ static bool interface_ready(void)
 	return cbs != NULL;
 }
 
+static void handle_connection_state(void *buf)
+{
+	struct hal_ev_av_connection_state *ev = buf;
+
+	if (cbs->connection_state_cb)
+		cbs->connection_state_cb(ev->state,
+						(bt_bdaddr_t *) (ev->bdaddr));
+}
+
 /* will be called from notification thread context */
 void bt_notify_av(uint16_t opcode, void *buf, uint16_t len)
 {
@@ -35,6 +45,9 @@ void bt_notify_av(uint16_t opcode, void *buf, uint16_t len)
 		return;
 
 	switch (opcode) {
+	case HAL_EV_AV_CONNECTION_STATE:
+		handle_connection_state(buf);
+		break;
 	default:
 		DBG("Unhandled callback opcode=0x%x", opcode);
 		break;
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 8edd0ce..a7c961e 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -364,3 +364,9 @@ struct hal_ev_le_test_mode {
 	uint8_t  status;
 	uint16_t num_packets;
 } __attribute__((packed));
+
+#define HAL_EV_AV_CONNECTION_STATE	0x81
+struct hal_ev_av_connection_state {
+	uint8_t state;
+	uint8_t bdaddr[6];
+} __attribute__((packed));