diff --git a/android/a2dp.c b/android/a2dp.c
index 107cbb8..2de2f66 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
bdaddr_t dst;
uint8_t state;
GIOChannel *io;
- guint watch;
struct avdtp *session;
};
if (dev->session)
avdtp_unref(dev->session);
- if (dev->watch > 0)
- g_source_remove(dev->watch);
-
if (dev->io)
g_io_channel_unref(dev->io);
a2dp_device_free(dev);
}
-static gboolean watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
+static void disconnect_cb(void *user_data)
{
- struct a2dp_device *dev = data;
+ struct a2dp_device *dev = user_data;
bt_a2dp_notify_state(dev, HAL_A2DP_STATE_DISCONNECTED);
-
- return FALSE;
}
static void signaling_connect_cb(GIOChannel *chan, GError *err,
/* FIXME: Add proper version */
fd = g_io_channel_unix_get_fd(chan);
dev->session = avdtp_new(fd, imtu, omtu, 0x0100);
-
- dev->watch = g_io_add_watch(dev->io, G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- watch_cb, dev);
+ avdtp_add_disconnect_cb(dev->session, disconnect_cb, dev);
bt_a2dp_notify_state(dev, HAL_A2DP_STATE_CONNECTED);
}