From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 6/7] voicecall: add ATA support for HFP emulator
Date: Tue, 05 Apr 2011 17:40:30 +0200 [thread overview]
Message-ID: <1302018031-12401-7-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1302018031-12401-1-git-send-email-frederic.danis@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2649 bytes --]
---
src/voicecall.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 8e68243..cf02bb6 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2314,6 +2314,13 @@ void ofono_voicecall_driver_unregister(const struct ofono_voicecall_driver *d)
g_drivers = g_slist_remove(g_drivers, (void *) d);
}
+static void emulator_remove_handler(struct ofono_atom *atom, void *data)
+{
+ struct ofono_emulator *em = __ofono_atom_get_data(atom);
+
+ ofono_emulator_remove_handler(em, data);
+}
+
static void voicecall_unregister(struct ofono_atom *atom)
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -2333,6 +2340,11 @@ static void voicecall_unregister(struct ofono_atom *atom)
OFONO_ATOM_TYPE_EMULATOR_HFP,
emulator_callheld_status_cb, 0);
+ __ofono_modem_foreach_registered_atom(modem,
+ OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_remove_handler,
+ "A");
+
__ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
if (vc->sim_watch) {
@@ -2510,12 +2522,54 @@ static void sim_watch(struct ofono_atom *atom,
sim_state_watch(ofono_sim_get_state(sim), vc);
}
+static void emulator_generic_cb(const struct ofono_error *error, void *data)
+{
+ struct ofono_emulator *em = data;
+ struct ofono_error result;
+
+ result.type = error->type;
+
+ ofono_emulator_send_final(em, &result);
+}
+
+static void emulator_ata_cb(struct ofono_emulator *em,
+ struct ofono_emulator_request *req, void *userdata)
+{
+ struct ofono_voicecall *vc = userdata;
+ struct ofono_error result;
+
+ result.error = 0;
+
+ switch (ofono_emulator_request_get_type(req)) {
+ case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY:
+ if (!voicecalls_have_incoming(vc))
+ goto fail;
+
+ if (vc->driver->answer == NULL)
+ goto fail;
+
+ vc->driver->answer(vc, emulator_generic_cb, em);
+ break;
+
+ default:
+fail:
+ result.type = OFONO_ERROR_TYPE_FAILURE;
+ ofono_emulator_send_final(em, &result);
+ };
+}
+
static void emulator_hfp_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
{
- if (cond == OFONO_ATOM_WATCH_CONDITION_REGISTERED)
- notify_emulator_call_status(data);
+ struct ofono_emulator *em = __ofono_atom_get_data(atom);
+
+ if (cond != OFONO_ATOM_WATCH_CONDITION_REGISTERED)
+ return;
+
+ notify_emulator_call_status(data);
+
+ ofono_emulator_add_handler(em, "A", emulator_ata_cb, data, NULL);
}
void ofono_voicecall_register(struct ofono_voicecall *vc)
--
1.7.1
next prev parent reply other threads:[~2011-04-05 15:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 15:40 [PATCH 0/7] emulator: add simple incoming call support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-04-05 15:40 ` [PATCH 1/7] emulator: add defines for call, callsetup and callheld indicators =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-04-05 15:40 ` [PATCH 2/7] emulator: add " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-04-05 15:40 ` [PATCH 3/7] emulator: add RING for HFP AG =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-04-05 15:49 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-04-05 15:54 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-04-05 15:40 ` [PATCH 4/7] emulator: add incoming call API =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-04-05 15:40 ` [PATCH 5/7] emulator: add +CLIP support for HFP AG =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-04-05 15:40 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis [this message]
2011-04-05 15:40 ` [PATCH 7/7] voicecall: add +CHUP support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1302018031-12401-7-git-send-email-frederic.danis@linux.intel.com \
--to=frederic.danis@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox