From 3bcaa862f806e686c85811251164a876d42f3d06 Mon Sep 17 00:00:00 2001 From: Frédéric Danis Date: Wed, 8 Jun 2011 15:47:25 +0200 Subject: voicecall: add +BLDN support for HFP emulator --- src/voicecall.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/voicecall.c') diff --git a/src/voicecall.c b/src/voicecall.c index e14b88c3..1f0d3b89 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -2488,6 +2488,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom) OFONO_ATOM_TYPE_EMULATOR_HFP, emulator_remove_handler, "D"); + __ofono_modem_foreach_registered_atom(modem, + OFONO_ATOM_TYPE_EMULATOR_HFP, + emulator_remove_handler, + "+BLDN"); __ofono_modem_remove_atom_watch(modem, vc->hfp_watch); } @@ -3112,6 +3116,35 @@ fail: }; } +static void emulator_bldn_cb(struct ofono_emulator *em, + struct ofono_emulator_request *req, void *userdata) +{ + struct ofono_voicecall *vc = userdata; + const char *number; + struct ofono_error result; + GError *error = NULL; + + switch (ofono_emulator_request_get_type(req)) { + case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY: + if (vc->settings == NULL) + goto fail; + + number = g_key_file_get_string(vc->settings, SETTINGS_GROUP, + "Number", &error); + if (number == NULL || number[0] == '\0') + goto fail; + + emulator_dial(em, vc, number); + break; + + default: +fail: + result.error = 0; + 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) @@ -3129,6 +3162,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom, ofono_emulator_add_handler(em, "+CHLD", emulator_chld_cb, data, NULL); ofono_emulator_add_handler(em, "+VTS", emulator_vts_cb, data, NULL); ofono_emulator_add_handler(em, "D", emulator_atd_cb, data, NULL); + ofono_emulator_add_handler(em, "+BLDN", emulator_bldn_cb, data, NULL); } void ofono_voicecall_register(struct ofono_voicecall *vc) -- cgit v1.2.3