diff options
author | Frédéric Danis <frederic.danis@linux.intel.com> | 2011-02-15 16:06:32 +0100 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-02-16 00:23:44 -0600 |
commit | 1bd752eb12b5272d2cd459b078f03ece958ce8b9 (patch) | |
tree | 8ca53324e199f3d3accda7b06b9b2feb611e934c /plugins/hfp_ag.c | |
parent | 421c55bdac6a75bec704416ae494683b4fa91f88 (diff) | |
download | ofono-1bd752eb12b5272d2cd459b078f03ece958ce8b9.tar.bz2 |
hfp_ag: Create emulator with type HFP_AG
Diffstat (limited to 'plugins/hfp_ag.c')
-rw-r--r-- | plugins/hfp_ag.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/hfp_ag.c b/plugins/hfp_ag.c index 41081c51..cbf3ccd8 100644 --- a/plugins/hfp_ag.c +++ b/plugins/hfp_ag.c @@ -94,6 +94,10 @@ static gboolean hfp_ag_disconnect_cb(GIOChannel *io, GIOCondition cond, static void hfp_ag_connect_cb(GIOChannel *io, GError *err, gpointer user_data) { + struct ofono_modem *modem; + struct ofono_emulator *em; + int fd; + DBG(""); if (err) { @@ -101,6 +105,19 @@ static void hfp_ag_connect_cb(GIOChannel *io, GError *err, gpointer user_data) goto failed; } + /* Pick the first voicecall capable modem */ + modem = modems->data; + if (modem == NULL) + goto failed; + DBG("Picked modem %p for emulator", modem); + + em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_HFP); + if (em == NULL) + goto failed; + + fd = g_io_channel_unix_get_fd(io); + ofono_emulator_register(em, fd); + channel_watch = g_io_add_watch(io, G_IO_NVAL | G_IO_HUP | G_IO_ERR, hfp_ag_disconnect_cb, NULL); |