Skip to contentSkip to conversation

Add ATD>1; support for HFP emulator

PATCH In review Frédéric Danis 2 participants 4 messages Jun 21, 2011

lore
Share & tools
lore
#0 lore raw

v2 cover Add ATD>1; support for HFP emulator

Only ATD>1; will be managed through HFP AG, and it will call the voicemail number retrieved from the message-waiting atom.

Frédéric Danis (2):
message-waiting: API to retrieve voicemail number
voicecall: add ATD> support for HFP emulator

 src/message-waiting.c |    7 +++++++
 src/ofono.h           |    4 ++++
 src/voicecall.c       |   30 +++++++++++++++++++++++++++---
 3 files changed, 38 insertions(+), 3 deletions(-)
#1 lore raw

PATCH v2 1/2 message-waiting: API to retrieve voicemail number

---
 src/message-waiting.c |    7 +++++++
 src/ofono.h           |    4 ++++
 2 files changed, 11 insertions(+), 0 deletions(-)
src/message-waiting.c +7 -0
index ad534d9..7e8c3f4 100644
@@ -605,6 +605,13 @@ static void mw_cphs_mbdn_changed(int id, void *userdata)
 			mw_cphs_mbdn_read_cb, mw);
 }
 
+const struct ofono_phone_number *__ofono_message_waiting_get_mbdn(
+					struct ofono_message_waiting *mw,
+					unsigned int index)
+{
+	return &mw->mailbox_number[index];
+}
+
 static void mw_mbi_read_cb(int ok, int total_length, int record,
 				const unsigned char *data,
 				int record_length, void *userdata)
src/ofono.h +4 -0
index 33eaf93..6524806 100644
@@ -447,6 +447,10 @@ struct sms;
 void __ofono_message_waiting_mwi(struct ofono_message_waiting *mw,
 				struct sms *sms, gboolean *out_discard);
 
+const struct ofono_phone_number *__ofono_message_waiting_get_mbdn(
+					struct ofono_message_waiting *mw,
+					unsigned int index);
+
 #include <ofono/nettime.h>
 
 void __ofono_nettime_probe_drivers(struct ofono_modem *modem);
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/2 voicecall: add ATD> support for HFP emulator

In reply to Frédéric Danis
---
 src/voicecall.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)
src/voicecall.c +27 -3
index 1f0d3b8..2eb32a6 100644
@@ -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,33 @@ 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;
 
-		emulator_dial(em, vc, number);
+			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);
+		}
 		break;
 
 	default:
Signature · 1 line
1.7.1
#3 lore raw
In reply to Frédéric Danis

Hi Frédéric,

Quoted 12 lines · Frédéric Danis

Only ATD>1; will be managed through HFP AG, and it will call the voicemail number retrieved from the message-waiting atom.

Frédéric Danis (2):
message-waiting: API to retrieve voicemail number
voicecall: add ATD> support for HFP emulator

 src/message-waiting.c |    7 +++++++
 src/ofono.h           |    4 ++++
 src/voicecall.c       |   30 +++++++++++++++++++++++++++---
 3 files changed, 38 insertions(+), 3 deletions(-)

Both patches have been applied, thanks.

Regards,
-Denis