diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2014-06-30 15:53:45 +0300 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-06-30 15:14:08 +0200 |
commit | ac404e671c1e252be9c1f269275f26995c1ac00e (patch) | |
tree | dae55601c451ff52a1915757bec0b82524aa6810 /android/health.c | |
parent | 147049dac962a4a8698fa70a9eb45203100817a3 (diff) | |
download | bluez-ac404e671c1e252be9c1f269275f26995c1ac00e.tar.gz |
android/health: Add channel_notify for incoming connections
For other then ECHO mdep send send_channel_state_notify with fd.
Diffstat (limited to 'android/health.c')
-rw-r--r-- | android/health.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/android/health.c b/android/health.c index 0b86d0fcc..c618039b2 100644 --- a/android/health.c +++ b/android/health.c @@ -1136,25 +1136,36 @@ static gboolean serve_echo(GIOChannel *io, GIOCondition cond, gpointer data) static void mcap_mdl_connected_cb(struct mcap_mdl *mdl, void *data) { struct health_channel *channel = data; + int fd; if (!channel->mdl) channel->mdl = mcap_mdl_ref(mdl); DBG("Data channel connected: mdl %p channel %p", mdl, channel); + fd = mcap_mdl_get_fd(channel->mdl); + if (fd < 0) { + error("health: error retrieving fd"); + goto fail; + } + if (channel->mdep_id == MDEP_ECHO) { GIOChannel *io; - int fd; - - fd = mcap_mdl_get_fd(channel->mdl); - if (fd < 0) - return; io = g_io_channel_unix_new(fd); g_io_add_watch(io, G_IO_ERR | G_IO_HUP | G_IO_NVAL | G_IO_IN, serve_echo, channel); g_io_channel_unref(io); + + return; } + + send_channel_state_notify(channel, HAL_HEALTH_CHANNEL_CONNECTED, fd); + + return; +fail: + /* TODO: mcap_mdl_abort */ + destroy_channel(channel); } static void mcap_mdl_closed_cb(struct mcap_mdl *mdl, void *data) |