android/AVRCP: Add bt_avrcp_disconnect
This adds bt_avrcp_disconnect function which can be used to disconnect
AVRCP sessions.
diff --git a/android/avrcp.c b/android/avrcp.c
index 8600d98..f61ed34 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -135,6 +135,11 @@
if (dev->session)
avctp_shutdown(dev->session);
+ if (dev->io) {
+ g_io_channel_shutdown(dev->io, FALSE, NULL);
+ g_io_channel_unref(dev->io);
+ }
+
devices = g_slist_remove(devices, dev);
g_free(dev);
}
@@ -338,3 +343,24 @@
ba2str(&dev->dst, addr);
DBG("connecting to %s", addr);
}
+
+void bt_avrcp_disconnect(const bdaddr_t *dst)
+{
+ struct avrcp_device *dev;
+ GSList *l;
+
+ DBG("");
+
+ l = g_slist_find_custom(devices, dst, device_cmp);
+ if (!l)
+ return;
+
+ dev = l->data;
+
+ if (dev->session) {
+ avctp_shutdown(dev->session);
+ return;
+ }
+
+ avrcp_device_free(dev);
+}