From ba81abed67cddd21240395786f9efde813aec27d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Danis?= Date: Tue, 21 Jun 2011 18:48:34 +0200 Subject: [PATCH] voicecall: add ATD> support for HFP emulator --- src/voicecall.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/voicecall.c b/src/voicecall.c index 1f0d3b8..9620838 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: -- 2.7.4