Skip to contentSkip to conversation

Add ATD>1; support for HFP emulator

PATCH Superseded Frédéric Danis 2 participants 5 messages Jun 20, 2011

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#2 lore raw

Re: [PATCH 1/3] message-waiting: add API to retrieve voicemail number

In reply to Frédéric Danis

Hi Frédéric,

Quoted 9 lines · Frédéric Danis
---
 include/message-waiting.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/message-waiting.h +0 -0
index b40993e..adb7ef2 100644

include/message-waiting.h struct ofono_message_waiting; · line 37

Quoted 5 lines
include/message-waiting.h +2 -0
@@ -33,6 +33,8 @@ struct ofono_message_waiting;
 struct ofono_message_waiting *ofono_message_waiting_create(struct ofono_modem *modem);
 void ofono_message_waiting_register(struct ofono_message_waiting *mw);
 void ofono_message_waiting_remove(struct ofono_message_waiting *mw);
+const struct ofono_phone_number *ofono_message_waiting_get_voicemail_number(
+					struct ofono_message_waiting *mw);

I'd like to keep this API private for now, so lets move this to ofono.h and combine patch 1 & 2 together.

Also, can you please use the following signature:

const struct ofono_phone_number *__ofono_message_waiting_get_mbdn(

					struct ofono_message_waiting *mw, unsigned int index);

Regards,
-Denis

#0 lore raw

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 (3):
message-waiting: add API to retrieve voicemail number
message-waiting: API to retrieve voicemail number
voicecall: add ATD> support for HFP emulator

 include/message-waiting.h |    2 ++
 src/message-waiting.c     |    6 ++++++
 src/voicecall.c           |   30 +++++++++++++++++++++++++++---
 3 files changed, 35 insertions(+), 3 deletions(-)
#1 lore raw

PATCH 1/3 message-waiting: add API to retrieve voicemail number

---
 include/message-waiting.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/message-waiting.h +2 -0
index b40993e..adb7ef2 100644
@@ -33,6 +33,8 @@ struct ofono_message_waiting;
 struct ofono_message_waiting *ofono_message_waiting_create(struct ofono_modem *modem);
 void ofono_message_waiting_register(struct ofono_message_waiting *mw);
 void ofono_message_waiting_remove(struct ofono_message_waiting *mw);
+const struct ofono_phone_number *ofono_message_waiting_get_voicemail_number(
+					struct ofono_message_waiting *mw);
 
 #ifdef __cplusplus
 }
Signature · 1 line
1.7.1
#3 lore raw

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

In reply to Frédéric Danis
---
 src/message-waiting.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
src/message-waiting.c +6 -0
index ad534d9..bce881b 100644
@@ -605,6 +605,12 @@ 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_voicemail_number(
+					struct ofono_message_waiting *mw)
+{
+	return &mw->mailbox_number[0];
+}
+
 static void mw_mbi_read_cb(int ok, int total_length, int record,
 				const unsigned char *data,
 				int record_length, void *userdata)
Signature · 1 line
1.7.1
#4 lore raw

PATCH 3/3 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..06ab3ce 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_voicemail_number(mw);
+
+			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