diff options
author | Frédéric Danis <frederic.danis@linux.intel.com> | 2011-06-21 18:48:34 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-06-21 12:08:25 -0500 |
commit | ba81abed67cddd21240395786f9efde813aec27d (patch) | |
tree | 924e843d683847961ffda325f0a9fc035dc58c30 /src/voicecall.c | |
parent | a79546eaf4f3d07ee96d6e5030e765c7c894c012 (diff) | |
download | ofono-ba81abed67cddd21240395786f9efde813aec27d.tar.bz2 |
voicecall: add ATD> support for HFP emulator
Diffstat (limited to 'src/voicecall.c')
-rw-r--r-- | src/voicecall.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/voicecall.c b/src/voicecall.c index 1f0d3b89..96208382 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -3084,6 +3084,7 @@ static void emulator_atd_cb(struct ofono_emulator *em, struct ofono_emulator_request *req, void *userdata) { struct ofono_voicecall *vc = userdata; + struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom); const char *str; size_t len; char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1]; @@ -3102,10 +3103,34 @@ static void emulator_atd_cb(struct ofono_emulator *em, str[len - 1] != ';') goto fail; - strncpy(number, str, len - 1); - number[len - 1] = '\0'; + if (len == 3 && str[0] == '>' && str[1] == '1') { + struct ofono_atom *mw_atom; + struct ofono_message_waiting *mw; + const struct ofono_phone_number *ph; + const char *num; + + mw_atom = __ofono_modem_find_atom(modem, + OFONO_ATOM_TYPE_MESSAGE_WAITING); + + if (mw_atom == NULL) + goto fail; + + mw = __ofono_atom_get_data(mw_atom); + ph = __ofono_message_waiting_get_mbdn(mw, 0); + + if (ph == NULL) + goto fail; + + num = phone_number_to_string(ph); + + emulator_dial(em, vc, num); + } else { + strncpy(number, str, len - 1); + number[len - 1] = '\0'; + + emulator_dial(em, vc, number); + } - emulator_dial(em, vc, number); break; default: |