diff options
author | Frédéric Danis <frederic.danis@linux.intel.com> | 2011-06-08 15:47:25 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-06-16 06:23:14 -0500 |
commit | 3bcaa862f806e686c85811251164a876d42f3d06 (patch) | |
tree | e53a8d59a34013c51436961a194de0cb2a93e005 /src/voicecall.c | |
parent | d3322b351097f98c02b566ba8476e38d0151618b (diff) | |
download | ofono-3bcaa862f806e686c85811251164a876d42f3d06.tar.bz2 |
voicecall: add +BLDN support for HFP emulator
Diffstat (limited to 'src/voicecall.c')
-rw-r--r-- | src/voicecall.c | 34 |
1 files changed, 34 insertions, 0 deletions
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) |