Skip to contentSkip to conversation

Add a MessageWaiting interface to track message waiting indications.

PATCH In review Andrzej Zaborowski 4 participants 18 messages Jul 30, 2009 – Aug 19, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 Add a MessageWaiting interface to track message waiting indications.

Comments are welcome about how the interface should look. The state of the indications is kept in memory and written back to the SIM after any changes.

Patch is untested because write ofono_sim_write is unimplemented, I'll add it as a separate patch. Should it take a callback parameter?

---
 src/Makefile.am       |    3 +-
 src/driver.h          |    3 +
 src/message-waiting.c |  512 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/message-waiting.h |   33 ++++
 src/modem.h           |    1 +
 src/simutil.h         |    3 +
 src/sms.c             |  216 ++++++++++++++++++++-
 src/smsutil.h         |    1 +
 8 files changed, 765 insertions(+), 7 deletions(-)
 create mode 100644 src/message-waiting.c
 create mode 100644 src/message-waiting.h
src/Makefile.am +2 -1
index 2fb3f06..144b872 100644
@@ -13,7 +13,8 @@ ofonod_SOURCES = main.c ofono.h log.c plugin.c \
 		network.c voicecall.c ussd.h ussd.c sms.c \
 		call-settings.c call-forwarding.c call-meter.c \
 		smsutil.h smsutil.c cssn.h cssn.c call-barring.c sim.h sim.c \
-		phonebook.c history.c simutil.h simutil.c
+		phonebook.c history.c simutil.h simutil.c \
+		message-waiting.c message-waiting.h
 
 ofonod_LDADD = $(top_builddir)/plugins/libbuiltin.la \
 		$(top_builddir)/drivers/libbuiltin.la \
src/driver.h +3 -0
index 928c20a..51e5587 100644
@@ -439,3 +439,6 @@ void ofono_phonebook_entry(struct ofono_modem *modem, int index,
 				const char *adnumber, int adtype,
 				const char *secondtext, const char *email,
 				const char *sip_uri, const char *tel_uri);
+
+int ofono_message_waiting_register(struct ofono_modem *modem);
+void ofono_message_waiting_unregister(struct ofono_modem *modem);
src/message-waiting.c new file +512 -0

512 lines not on this page · raw message

src/message-waiting.h new file +33 -0
new file mode 100644
index 0000000..cad4c40
@@ -0,0 +1,33 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2009  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+enum mwi_information_type {
+	MWI_UNSPECIFIED = -1,
+	MWI_MESSAGES_WAITING = -2,
+	MWI_NO_MESSAGES_WAITING = -3,
+};
+
+/* information either a positive (or zero) message count or a
+ * partial information using one of mwi_information_type constants
+ */
+void ofono_message_waiting_notify(struct ofono_modem *modem, int information,
+					enum sms_mwi_type type, int profile);
+void ofono_message_waiting_message(struct ofono_modem *modem, const char *msg);
src/modem.h +1 -0
index d322df8..90993ca 100644
@@ -43,6 +43,7 @@ struct ofono_modem {
 	struct sim_manager_data *sim_manager;
 	struct sms_manager_data *sms_manager;
 	struct phonebook_data *phonebook;
+	struct message_waiting_data *message_waiting;
 
 	GSList *history_contexts;
 };
src/simutil.h +3 -0
index 6572e72..c2b1e20 100644
@@ -24,6 +24,9 @@ enum sim_fileid {
 	SIM_EFSPN_FILEID = 0x6f46,
 	SIM_EFPNN_FILEID = 0x6fc5,
 	SIM_EFOPL_FILEID = 0x6fc6,
+	SIM_EFMBDN_FILEID = 0x6fc7,
+	SIM_EFMBI_FILEID = 0x6fc9,
+	SIM_EFMWIS_FILEID = 0x6fca,
 	SIM_EFSPDI_FILEID = 0x6fcd,
 };
 
src/sms.c +210 -6

256 lines not on this page · raw message

src/smsutil.h +1 -0
index 89da973..d362aa9 100644
@@ -158,6 +158,7 @@ enum sms_mwi_type {
 	SMS_MWI_TYPE_FAX = 1,
 	SMS_MWI_TYPE_EMAIL = 2,
 	SMS_MWI_TYPE_OTHER = 3,
+	SMS_MWI_TYPE_VIDEO = 4,
 };
 
 enum sms_pid_type {
Signature · 1 line
1.6.1
#1 lore raw

Hi,

Quoted 6 lines

Comments are welcome about how the interface should look. The state of the indications is kept in memory and written back to the SIM after any changes.

Patch is untested because write ofono_sim_write is unimplemented, I'll add it as a separate patch. Should it take a callback parameter?

Probably would be useful in case you want to notify an external app that storing a file failed (e.g. update of MBDN / MSISDN). For other cases, maybe less useful.

src/driver.h void ofono_phonebook_entry(struct ofono_modem *modem, · line 444

Quoted 11 lines
src/driver.h +3 -0
index 928c20a..51e5587 100644
@@ -439,3 +439,6 @@ void ofono_phonebook_entry(struct ofono_modem *modem,
 int index, const char *adnumber, int adtype,
 				const char *secondtext, const char *email,
 				const char *sip_uri, const char *tel_uri);
+
+int ofono_message_waiting_register(struct ofono_modem *modem);
+void ofono_message_waiting_unregister(struct ofono_modem *modem);

Lets keep this out of driver.h, there's nothing here that a driver can provide. Put it in ofono.h or messagewaiting.h

Quoted 4 lines
src/driver.h +4 -0
+	if (mw->messages[i] != value) {
+		mw->messages[i] = value;
+
+		if (!mw->pending)

src/driver.h

Quoted 10 lines
src/driver.h +10 -0
+			mw->pending = g_timeout_add(0, mw_mwis_update, modem);
+
+		dbus_gsm_signal_property_changed(conn, modem->path,
+				MESSAGE_WAITING_INTERFACE,
+				mw_messages_property_name[i],
+				DBUS_TYPE_BYTE, &value);
+	}
+
+	return dbus_message_new_method_return(msg);
+}

Ok, I'm a bit confused here. Are you sure that MWIs should have the ability to be cleared out by the user? The way I understood it, the user dials the voice mail system and the provider sends another MWI message which clears out the status.

Quoted 18 lines

+void ofono_message_waiting_message(struct ofono_modem *modem, const char *msg) +{

src/driver.h +16 -0
+	struct message_waiting_data *mw = modem->message_waiting;
+	DBusConnection *conn = dbus_gsm_connection();
+
+	if (!mw)
+		return;
+
+	if (mw->last_message && !strcmp(mw->last_message, msg))
+		return;
+
+	if (mw->last_message)
+		g_free(mw->last_message);
+
+	mw->last_message = g_strdup(msg);
+
+	dbus_gsm_signal_property_changed(conn, modem->path,
+			MESSAGE_WAITING_INTERFACE, "LastNotificationText",

src/driver.h

Quoted 10 lines
src/driver.h +8 -0
+			DBUS_TYPE_STRING, &mw->last_message);
+}
 
 
+
+enum mwi_information_type {
+	MWI_UNSPECIFIED = -1,
+	MWI_MESSAGES_WAITING = -2,
+	MWI_NO_MESSAGES_WAITING = -3,
+};

Is there a reason these are negative?

src/modem.h struct ofono_modem { · line 49

Quoted 10 lines
src/modem.h +1 -0
@@ -43,6 +43,7 @@ struct ofono_modem {
 	struct sim_manager_data *sim_manager;
 	struct sms_manager_data *sms_manager;
 	struct phonebook_data *phonebook;
+	struct message_waiting_data *message_waiting;
 
 	GSList *history_contexts;
 };

Please rebase, this file is now defunct

src/modem.h

Quoted 13 lines
src/modem.h +13 -0
+static void handle_mwi(struct ofono_modem *modem,
+			struct sms *sms, gboolean *out_discard)
+{
+	gboolean active, discard;
+	enum sms_mwi_type type;
+	char *message;
+	int profile = 1;
+	GSList *sms_list;
+
+	/* "Store" bits are ORed if multiple MWI types are present
+	 * but if neither Special SMS Message Indication nor DCS based
+	 * indication is present, the bit must remain set.  */
+	int set = 1, store = 0;

What is this comment about, since I don't see any ORing going on below. Are you trying to accommodate this piece of stupidity from 23.040 9.2.3.24.2? "In the event of a conflict between this setting and the setting of the Data Coding Scheme (see 3GPP TS 23.038 [9]) then the message shall be stored if either the DCS indicates this, or Octet 1 above indicates this."

src/modem.h

Quoted 3 lines
src/modem.h +3 -0
+
+	/* Check MWI types in the order from lowest to highest priority
+	 * because they will override one another.  */

Can we instead process the different sources from highest to lowest instead and bail out early? No sense in calling message_waiting_notify several times (and possibly emitting spurious signals) when only once is required.

src/modem.h

Quoted 2 lines
src/modem.h +2 -0
+	if (sms_dcs_decode(sms->deliver.dcs, NULL, NULL, NULL, NULL) &&
+			sms->deliver.udhi) {

This seems to be incorrect. An MWI DCS message can still contain enhanced IEIs. Should this check just for UDHI instead?

src/modem.h

Quoted 5 lines
src/modem.h +5 -0
+final:
+	/* Only bother the Message Waiting interface with textual
+	 * notifications that are not to be stored together with other
+	 * Short Messages in ME.  The other messages will be delivered
+	 * to the user through normal SMS store.  */

It sounds to me like we can completely ignore the text of such messages. The network is basically saying: "the text isn't important, the contents are."

Regards,
-Denis

#2 lore raw

2009/7/31 Denis Kenzior <[email protected]>:

Quoted 11 lines
Quoted 11 lines

+     if (mw->messages[i] != value) {
+             mw->messages[i] = value;

(quoted diff) +9 -0
+
+             if (!mw->pending)
+                     mw->pending = g_timeout_add(0, mw_mwis_update, modem);
+
+             dbus_gsm_signal_property_changed(conn, modem->path,
+                             MESSAGE_WAITING_INTERFACE,
+                             mw_messages_property_name[i],
+                             DBUS_TYPE_BYTE, &value);
+     }
Quoted 8 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+     return dbus_message_new_method_return(msg);
+}

Ok, I'm a bit confused here.  Are you sure that MWIs should have the ability to be cleared out by the user?  The way I understood it, the user dials the voice mail system and the provider sends another MWI message which clears out the status.

You're right, there's probably no point to provide this method. I haven't found the exact statement in the docs saying that the provider should send a new MWI but it's logical. Otherwise I thought the D-Bus client might be able to tell somehow that the mailbox should now have 1 message less and want to update us.

Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+
+enum mwi_information_type {
+     MWI_UNSPECIFIED = -1,
+     MWI_MESSAGES_WAITING = -2,
+     MWI_NO_MESSAGES_WAITING = -3,
+};

Is there a reason these are negative?

So the caller can give the exact number of messages (zero or positive) or partial information using one of the constants.

Quoted 12 lines
Quoted 12 lines
(quoted diff) +11 -0
+static void handle_mwi(struct ofono_modem *modem,
+                     struct sms *sms, gboolean *out_discard)
+{
+     gboolean active, discard;
+     enum sms_mwi_type type;
+     char *message;
+     int profile = 1;
+     GSList *sms_list;
+
+     /* "Store" bits are ORed if multiple MWI types are present
+      * but if neither Special SMS Message Indication nor DCS based
Quoted 8 lines
Quoted 2 lines

+      * indication is present, the bit must remain set.  */
+     int set = 1, store = 0;

What is this comment about, since I don't see any ORing going on below.  Are you trying to accommodate this piece of stupidity from 23.040 9.2.3.24.2? "In the event of a conflict between this setting and the setting of the Data Coding Scheme (see 3GPP TS 23.038 [9]) then the message shall be stored if either the DCS indicates this, or Octet 1 above indicates this."

Yes. :-)

I'm thinking it's better to try to implement what's in the text so when someone needs to know how ofono will react to something, you can point at the specification, barring any TODOs in the code.

Quoted 8 lines
Quoted 4 lines

+
+     /* Check MWI types in the order from lowest to highest priority
+      * because they will override one another.  */

Can we instead process the different sources from highest to lowest instead and bail out early?  No sense in calling message_waiting_notify several times (and possibly emitting spurious signals) when only once is required.

We can but then we won't comply with that 23.040 9.2.3.24.2 above. There's also a tiny possibility someone might send us updates for the different mailboxes (out of the 5 types defined) one using DCS and another one in UDH. In the attached patch I left this as is and made sure PropertyChanged is only sent from the time callback (bottom half) which was my original intention. I can still change this.

Quoted 6 lines
Quoted 3 lines

+     if (sms_dcs_decode(sms->deliver.dcs, NULL, NULL, NULL, NULL) &&
+                     sms->deliver.udhi) {

This seems to be incorrect.  An MWI DCS message can still contain enhanced IEIs.  Should this check just for UDHI instead?

True, I had wrongly copied the condition from ofono_sms_deliver_notify.

Quoted 9 lines
Quoted 6 lines

+final:
+     /* Only bother the Message Waiting interface with textual
+      * notifications that are not to be stored together with other
+      * Short Messages in ME.  The other messages will be delivered
+      * to the user through normal SMS store.  */

It sounds to me like we can completely ignore the text of such messages.  The network is basically saying: "the text isn't important, the contents are."

Probably, although with the Return Call type of notification there's no other information beside the text. I left it in the updated patch.

Regards

From 68f9bb3807a003f873ca3f33575013291b094e89 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <[email protected]>
Date: Sat, 1 Aug 2009 15:40:58 +0200
Subject: [PATCH] Add a MessageWaiting interface for tracking message waiting indications.

The state of the indications is kept in memory and written back to the SIM after any changes.

---
 src/Makefile.am       |    3 +-
 src/message-waiting.c |  467 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/message-waiting.h |   33 ++++
 src/ofono.h           |    4 +
 src/simutil.h         |    3 +
 src/sms.c             |  218 ++++++++++++++++++++++-
 src/smsutil.h         |    1 +
 7 files changed, 722 insertions(+), 7 deletions(-)
 create mode 100644 src/message-waiting.c
 create mode 100644 src/message-waiting.h
src/Makefile.am +2 -1
index 2e3e607..4644c69 100644
@@ -13,7 +13,8 @@ ofonod_SOURCES = main.c ofono.h log.c plugin.c \
 		network.c voicecall.c ussd.h ussd.c sms.c \
 		call-settings.c call-forwarding.c call-meter.c \
 		smsutil.h smsutil.c cssn.h cssn.c call-barring.c sim.h sim.c \
-		phonebook.c history.c simutil.h simutil.c
+		phonebook.c history.c simutil.h simutil.c \
+		message-waiting.c message-waiting.h
 
 ofonod_LDADD = $(top_builddir)/plugins/libbuiltin.la \
 		$(top_builddir)/drivers/libbuiltin.la \
src/message-waiting.c new file +467 -0

467 lines not on this page · raw message

src/message-waiting.h new file +33 -0
new file mode 100644
index 0000000..cad4c40
@@ -0,0 +1,33 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2009  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+enum mwi_information_type {
+	MWI_UNSPECIFIED = -1,
+	MWI_MESSAGES_WAITING = -2,
+	MWI_NO_MESSAGES_WAITING = -3,
+};
+
+/* information either a positive (or zero) message count or a
+ * partial information using one of mwi_information_type constants
+ */
+void ofono_message_waiting_notify(struct ofono_modem *modem, int information,
+					enum sms_mwi_type type, int profile);
+void ofono_message_waiting_message(struct ofono_modem *modem, const char *msg);
src/ofono.h +4 -0
index 3cb2d75..4e34430 100644
@@ -79,6 +79,7 @@ struct ofono_modem {
 	struct sim_manager_data *sim_manager;
 	struct sms_manager_data *sms_manager;
 	struct phonebook_data *phonebook;
+	struct message_waiting_data *message_waiting;
 
 	GSList *history_contexts;
 };
@@ -99,3 +100,6 @@ void __ofono_history_call_ended(struct ofono_modem *modem,
 
 void __ofono_history_call_missed(struct ofono_modem *modem,
 				const struct ofono_call *call, time_t when);
+
+int ofono_message_waiting_register(struct ofono_modem *modem);
+void ofono_message_waiting_unregister(struct ofono_modem *modem);
src/simutil.h +3 -0
index 6572e72..c2b1e20 100644
@@ -24,6 +24,9 @@ enum sim_fileid {
 	SIM_EFSPN_FILEID = 0x6f46,
 	SIM_EFPNN_FILEID = 0x6fc5,
 	SIM_EFOPL_FILEID = 0x6fc6,
+	SIM_EFMBDN_FILEID = 0x6fc7,
+	SIM_EFMBI_FILEID = 0x6fc9,
+	SIM_EFMWIS_FILEID = 0x6fca,
 	SIM_EFSPDI_FILEID = 0x6fcd,
 };
 
src/sms.c +212 -6

258 lines not on this page · raw message

src/smsutil.h +1 -0
index 89da973..d362aa9 100644
@@ -158,6 +158,7 @@ enum sms_mwi_type {
 	SMS_MWI_TYPE_FAX = 1,
 	SMS_MWI_TYPE_EMAIL = 2,
 	SMS_MWI_TYPE_OTHER = 3,
+	SMS_MWI_TYPE_VIDEO = 4,
 };
 
 enum sms_pid_type {
Signature · 1 line
1.6.1
#3 lore raw

Hi,

Quoted 21 lines

2009/7/31 Denis Kenzior <[email protected]>:

Quoted 11 lines
Quoted 11 lines
(quoted diff) +5 -0
+     if (mw->messages[i] != value) {
+             mw->messages[i] = value;
+
+             if (!mw->pending)
+                     mw->pending = g_timeout_add(0, mw_mwis_update,

modem); +

src/message-waiting.c new file +5 -0
+             dbus_gsm_signal_property_changed(conn, modem->path,
+                             MESSAGE_WAITING_INTERFACE,
+                             mw_messages_property_name[i],
+                             DBUS_TYPE_BYTE, &value);
+     }
Quoted 8 lines

src/message-waiting.c line 63

Quoted 3 lines
src/message-waiting.c new file +3 -0
+
+     return dbus_message_new_method_return(msg);
+}

Ok, I'm a bit confused here. Are you sure that MWIs should have the ability to be cleared out by the user? The way I understood it, the user dials the voice mail system and the provider sends another MWI message which clears out the status.

Quoted 5 lines

You're right, there's probably no point to provide this method. I haven't found the exact statement in the docs saying that the provider should send a new MWI but it's logical. Otherwise I thought the D-Bus client might be able to tell somehow that the mailbox should now have 1 message less and want to update us.

Ok, now you've taken out the method entirely. We still want to set the MBDN :) So just add SetProperty that can set the MBDN.

Quoted 10 lines
Quoted 9 lines

src/message-waiting.h line 26

Quoted 7 lines
src/message-waiting.h new file +6 -0
+
+enum mwi_information_type {
+     MWI_UNSPECIFIED = -1,
+     MWI_MESSAGES_WAITING = -2,
+     MWI_NO_MESSAGES_WAITING = -3,
+};

Is there a reason these are negative?

Quoted 3 lines

So the caller can give the exact number of messages (zero or positive) or partial information using one of the constants.

I'm still not sure what the point is, since you just set messages to 1 if MWI_MESSAGES_WAITING and to 0 if MWI_NO_MESSAGES_WAITING. And MWI_UNSPECIFIED is just simply ignored. Perhaps you want to break up the attributes into two:

FooMailWaiting -> True / False
FooMessages -> Number, with 0 in case we're not sure

Also, please move all the MWI parsing stuff to message-waiting.c since this will allow us to extend the interface more readily. In particular I'd like to eventually support Message ID, Message Calling Line Identity by exposing an additional EnhancedMessageInfo interface.

Names are for illustration only at this point:
EnhancedMessages -> "/modem1/mwi/4344", "/modem1/mwi/2255"

EnhancedMessageInfo Properties:

RetentionDays
Priority
CallingParty

However, this one's lower priority.

Quoted 6 lines

Yes. :-)

I'm thinking it's better to try to implement what's in the text so when someone needs to know how ofono will react to something, you can point at the specification, barring any TODOs in the code.

Sure, it might be a good idea to quote the relevant parts of the spec.

Quoted 11 lines
Quoted 4 lines

Can we instead process the different sources from highest to lowest instead and bail out early? No sense in calling message_waiting_notify several times (and possibly emitting spurious signals) when only once is required.

We can but then we won't comply with that 23.040 9.2.3.24.2 above. There's also a tiny possibility someone might send us updates for the different mailboxes (out of the 5 types defined) one using DCS and another one in UDH. In the attached patch I left this as is and made sure PropertyChanged is only sent from the time callback (bottom half) which was my original intention. I can still change this.

I still don't understand why we can't do something like:

if sms_contains_enhanced_vm_iei(sms):
handle_enhanced_vm_info
return

if sms_contains_special_vm_iei(sms):

	discard = extract_discard_from_iei_data
	// Quote relevant part of the spec here
	if mwi_dcs_decode(sms, ... ,dcsdiscard)
		discard = discard || dcsdiscard
	return

if mwi_dcs_decode:
handle simple DCS MWI
return

if "Return Call Message"
return

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
src/sms.c +5 -0
+final:
+     /* Only bother the Message Waiting interface with textual
+      * notifications that are not to be stored together with other
+      * Short Messages in ME.  The other messages will be delivered
+      * to the user through normal SMS store.  */
Quoted 6 lines
Quoted 3 lines

It sounds to me like we can completely ignore the text of such messages.
The network is basically saying: "the text isn't important, the contents
are."

Probably, although with the Return Call type of notification there's no other information beside the text. I left it in the updated patch.

So I still say lets get rid of LastNotificationText entirely. Remember, most likely scenario is that carriers will send something like:

.pid = Return Call
.dcs = mwi dcs
.uhdi = true
.udh = contains special iei, contains enhanced iei.

to cover all phase mobiles in some way.

The only case you're really covering here is if we get a pure Return Call Message. This should not happen on any modern network, and we should not give it to the MessageWaiting interface anyway, since there's nothing useful it can do with it. Instead, we process it like any regular text SMS.

Regards,
-Denis

#4 lore raw

Hi,

2009/8/3 Denis Kenzior <[email protected]>:

Quoted 2 lines

Ok, now you've taken out the method entirely.  We still want to set the MBDN :)  So just add SetProperty that can set the MBDN.

Added. Note that the provider can also control the EF-MBDN on your sim through the Enhanced Voicemail notifications (I'll send a patch later for this and for writing EF-MBDN back to SIM after SetProperty).

Quoted 7 lines
Quoted 3 lines

So the caller can give the exact number of messages (zero or positive) or partial information using one of the constants.

I'm still not sure what the point is, since you just set messages to 1 if MWI_MESSAGES_WAITING and to 0 if MWI_NO_MESSAGES_WAITING.  And MWI_UNSPECIFIED is just simply ignored.

Yes, this way sms.c gives all the information it has available (according to specs) in a call to ofono_message_waiting_notify, which on the message-waiting.c side decides how this information will be presented to D-Bus clients on MessageWaiting interface (this part isn't in the specs). I agree this isn't very useful.

Quoted 4 lines

Perhaps you want to break up the attributes into two:

FooMailWaiting -> True / False
FooMessages -> Number, with 0 in case we're not sure

We can do that although I think the setting to 0 or 1 when we're not sure is a good enough approximation? The 1 being a little lie.

Quoted 6 lines

Also, please move all the MWI parsing stuff to message-waiting.c since this will allow us to extend the interface more readily.  In particular I'd like to eventually support Message ID, Message Calling Line Identity by exposing an additional EnhancedMessageInfo interface.

Quoted 8 lines

Names are for illustration only at this point:
EnhancedMessages -> "/modem1/mwi/4344", "/modem1/mwi/2255"

EnhancedMessageInfo Properties:

RetentionDays
Priority
CallingParty

Sounds like a good idea.

Quoted 25 lines
Quoted 11 lines
Quoted 4 lines

Can we instead process the different sources from highest to lowest instead and bail out early?  No sense in calling message_waiting_notify several times (and possibly emitting spurious signals) when only once is required.

We can but then we won't comply with that 23.040 9.2.3.24.2 above. There's also a tiny possibility someone might send us updates for the different mailboxes (out of the 5 types defined) one using DCS and another one in UDH.  In the attached patch I left this as is and made sure PropertyChanged is only sent from the time callback (bottom half) which was my original intention.  I can still change this.

I still don't understand why we can't do something like:

if sms_contains_enhanced_vm_iei(sms):
       handle_enhanced_vm_info
       return

if sms_contains_special_vm_iei(sms):
       discard = extract_discard_from_iei_data
       // Quote relevant part of the spec here
       if mwi_dcs_decode(sms, ... ,dcsdiscard)
               discard = discard || dcsdiscard
       return

Quoted 6 lines

if mwi_dcs_decode:
       handle simple DCS MWI
       return

if "Return Call Message"
       return

Err, yes we can, but then we don't account for the little corner cases like the two mentioned:

* Special Message Indication IEI says discard the message but DCS
says store it.
* Special IEI says there are 3 emails waiting and DCS says there's a
voicemail message.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

+final:
+     /* Only bother the Message Waiting interface with textual
+      * notifications that are not to be stored together with other
+      * Short Messages in ME.  The other messages will be delivered
+      * to the user through normal SMS store.  */

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

It sounds to me like we can completely ignore the text of such messages. The network is basically saying: "the text isn't important, the contents are."

Probably, although with the Return Call type of notification there's no other information beside the text.  I left it in the updated patch.

So I still say lets get rid of LastNotificationText entirely.

Ok, removed it.

Quoted 8 lines

 Remember, most
likely scenario is that carriers will send something like:

.pid = Return Call
.dcs = mwi dcs
.uhdi = true
.udh = contains special iei, contains enhanced iei.

Quoted 4 lines

to cover all phase mobiles in some way.

The only case you're really covering here is if we get a pure Return Call Message.

Right.

Quoted 3 lines

 This should not happen on any modern network, and  we should not give it to the MessageWaiting interface anyway, since there's nothing useful it can do with it.

It still gives us one piece of information: the message is concerning waiting messages. So perhaps it should be that interface providing the message and from there it can be displayed on the screen.

Regards

From 1bfc2e2088edd9a393dcd0abdd2745c6e6cd8bc8 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <[email protected]>
Date: Mon, 3 Aug 2009 11:36:38 +0200
Subject: [PATCH] Add a MessageWaiting interface to track message waiting indications.

The state of the indications is kept in memory and written back to the SIM after any changes.

---
 src/Makefile.am       |    3 +-
 src/message-waiting.c |  704 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/message-waiting.h |   35 +++
 src/ofono.h           |    4 +
 src/simutil.h         |    3 +
 src/sms.c             |   30 ++-
 src/smsutil.h         |    1 +
 7 files changed, 770 insertions(+), 10 deletions(-)
 create mode 100644 src/message-waiting.c
 create mode 100644 src/message-waiting.h
src/Makefile.am +2 -1
index 2e3e607..4644c69 100644
@@ -13,7 +13,8 @@ ofonod_SOURCES = main.c ofono.h log.c plugin.c \
 		network.c voicecall.c ussd.h ussd.c sms.c \
 		call-settings.c call-forwarding.c call-meter.c \
 		smsutil.h smsutil.c cssn.h cssn.c call-barring.c sim.h sim.c \
-		phonebook.c history.c simutil.h simutil.c
+		phonebook.c history.c simutil.h simutil.c \
+		message-waiting.c message-waiting.h
 
 ofonod_LDADD = $(top_builddir)/plugins/libbuiltin.la \
 		$(top_builddir)/drivers/libbuiltin.la \
src/message-waiting.c new file +704 -0

704 lines not on this page · raw message

src/message-waiting.h new file +35 -0
new file mode 100644
index 0000000..08a5843
@@ -0,0 +1,35 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2009  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+enum mwi_information_type {
+	MWI_UNSPECIFIED = -1,
+	MWI_MESSAGES_WAITING = -2,
+	MWI_NO_MESSAGES_WAITING = -3,
+};
+
+/* information is either a positive (or zero) message count or a
+ * partial information using one of mwi_information_type constants
+ */
+void ofono_message_waiting_notify(struct ofono_modem *modem, int information,
+					enum sms_mwi_type type, int profile);
+
+void ofono_handle_sms_mwi(struct ofono_modem *modem,
+				struct sms *sms, gboolean *out_discard);
src/ofono.h +4 -0
index 3cb2d75..4e34430 100644
@@ -79,6 +79,7 @@ struct ofono_modem {
 	struct sim_manager_data *sim_manager;
 	struct sms_manager_data *sms_manager;
 	struct phonebook_data *phonebook;
+	struct message_waiting_data *message_waiting;
 
 	GSList *history_contexts;
 };
@@ -99,3 +100,6 @@ void __ofono_history_call_ended(struct ofono_modem *modem,
 
 void __ofono_history_call_missed(struct ofono_modem *modem,
 				const struct ofono_call *call, time_t when);
+
+int ofono_message_waiting_register(struct ofono_modem *modem);
+void ofono_message_waiting_unregister(struct ofono_modem *modem);
src/simutil.h +3 -0
index 6572e72..c2b1e20 100644
@@ -24,6 +24,9 @@ enum sim_fileid {
 	SIM_EFSPN_FILEID = 0x6f46,
 	SIM_EFPNN_FILEID = 0x6fc5,
 	SIM_EFOPL_FILEID = 0x6fc6,
+	SIM_EFMBDN_FILEID = 0x6fc7,
+	SIM_EFMBI_FILEID = 0x6fc9,
+	SIM_EFMWIS_FILEID = 0x6fca,
 	SIM_EFSPDI_FILEID = 0x6fcd,
 };
 
src/sms.c +21 -9
index 3a471e3..84b98de 100644
@@ -36,6 +36,7 @@
 #include "util.h"
 #include "sim.h"
 #include "smsutil.h"
+#include "message-waiting.h"
 
 #define uninitialized_var(x) x = x
 
@@ -655,11 +656,6 @@ static void handle_deliver(struct ofono_modem *modem,
 	g_slist_free(l);
 }
 
-static void handle_mwi(struct ofono_modem *modem, struct sms *mwi)
-{
-	ofono_error("MWI information not yet handled");
-}
-
 void ofono_sms_deliver_notify(struct ofono_modem *modem, unsigned char *pdu,
 				int len, int tpdu_len)
 {
@@ -685,14 +681,18 @@ void ofono_sms_deliver_notify(struct ofono_modem *modem, unsigned char *pdu,
 	/* This is an older style MWI notification, process MWI
 	 * headers and handle it like any other message */
 	if (sms.deliver.pid == SMS_PID_TYPE_RETURN_CALL) {
-		handle_mwi(modem, &sms);
+		ofono_handle_sms_mwi(modem, &sms, &discard);
+
+		if (discard)
+			return;
+
 		goto out;
 	}
 
 	/* The DCS indicates this is an MWI notification, process it
 	 * and then handle the User-Data as any other message */
-	if (sms_mwi_dcs_decode(sms.deliver.dcs, NULL, NULL, NULL, &discard)) {
-		handle_mwi(modem, &sms);
+	if (sms_mwi_dcs_decode(sms.deliver.dcs, NULL, NULL, NULL, NULL)) {
+		ofono_handle_sms_mwi(modem, &sms, &discard);
 
 		if (discard)
 			return;
@@ -757,7 +757,14 @@ void ofono_sms_deliver_notify(struct ofono_modem *modem, unsigned char *pdu,
 			switch (iei) {
 			case SMS_IEI_SPECIAL_MESSAGE_INDICATION:
 			case SMS_IEI_ENHANCED_VOICE_MAIL_INFORMATION:
-				handle_mwi(modem, &sms);
+				/* TODO: ignore if not in the very first
+				 * segment of a concatenated SM so as not
+				 * to repeat the indication.  */
+				ofono_handle_sms_mwi(modem, &sms, &discard);
+
+				if (discard)
+					return;
+
 				goto out;
 			case SMS_IEI_WCMP:
 				ofono_error("No support for WCMP, ignoring");
@@ -789,6 +796,9 @@ int ofono_sms_manager_register(struct ofono_modem *modem,
 	if (ops == NULL)
 		return -1;
 
+	if (ofono_message_waiting_register(modem))
+		return -1;
+
 	modem->sms_manager = sms_manager_create();
 
 	if (!modem->sms_manager)
@@ -824,4 +834,6 @@ void ofono_sms_manager_unregister(struct ofono_modem *modem)
 					SMS_MANAGER_INTERFACE);
 
 	ofono_modem_remove_interface(modem, SMS_MANAGER_INTERFACE);
+
+	ofono_message_waiting_unregister(modem);
 }
src/smsutil.h +1 -0
index 89da973..d362aa9 100644
@@ -158,6 +158,7 @@ enum sms_mwi_type {
 	SMS_MWI_TYPE_FAX = 1,
 	SMS_MWI_TYPE_EMAIL = 2,
 	SMS_MWI_TYPE_OTHER = 3,
+	SMS_MWI_TYPE_VIDEO = 4,
 };
 
 enum sms_pid_type {
Signature · 1 line
1.6.1
#5 lore raw

Hi,

Quoted 7 lines
Quoted 4 lines

Perhaps you want to break up the attributes into two:

FooMailWaiting -> True / False
FooMessages -> Number, with 0 in case we're not sure

We can do that although I think the setting to 0 or 1 when we're not sure is a good enough approximation? The 1 being a little lie.

Lets go with two attributes. It should give the UI a chance to display the indicators differently, depending on what the carrier supports.

Quoted 5 lines

Err, yes we can, but then we don't account for the little corner cases like the two mentioned:

* Special Message Indication IEI says discard the message but DCS
says store it.

Sure we do,
if sms_contains_special_vm_iei(sms):

	discard = extract_discard_from_iei_data
	// Quote relevant part of the spec here
	if mwi_dcs_decode(sms, ... ,dcsdiscard)
		discard = discard || dcsdiscard  <--- here
	return
Quoted 2 lines

* Special IEI says there are 3 emails waiting and DCS says there's a
voicemail message.

While the spec doesn't really forbid this, its not really in the spirit of what is intended: "The third level is described here, and provides the maximum detail level for analysis by the mobile, i.e. an indication of the number and type of messages waiting in systems connected to the PLMN."

I say we don't worry about this case, just assume that the network provider is sane.

Quoted 7 lines
Quoted 3 lines

This should not happen on any modern network, and we should not
give it to the MessageWaiting interface anyway, since there's nothing useful it can do with it.

It still gives us one piece of information: the message is concerning waiting messages. So perhaps it should be that interface providing the message and from there it can be displayed on the screen.

Yes, so we leave the option to do something about it later, but for now pure "return call" messages are useless.

Regards,
-Denis

#6 lore raw

2009/8/3 Denis Kenzior <[email protected]>:

Quoted 2 lines

Lets go with two attributes.  It should give the UI a chance to display the indicators differently, depending on what the carrier supports.

Now changed.

Quoted 7 lines
Quoted 6 lines

Err, yes we can, but then we don't account for the little corner cases like the two mentioned:

 * Special Message Indication IEI says discard the message but DCS says store it.

Quoted 7 lines

Sure we do,
if sms_contains_special_vm_iei(sms):
       discard = extract_discard_from_iei_data // Quote relevant part of the spec here if mwi_dcs_decode(sms, ... ,dcsdiscard) discard = discard || dcsdiscard  <--- here return

True, now the order of the checks is changed to what you suggested. If there's an enhanced voicemail IEI then we don't check for other types of mailboxes, such as email but I suppose it's okay because even if they're used, they'll very rarely be all in the same message.

Regards

From 9efe5da3654e152d6cb81c639a8ec5124904aa51 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <[email protected]>
Date: Mon, 3 Aug 2009 14:50:14 +0200
Subject: [PATCH] Add a MessageWaiting interface to track message waiting indications.

The state of the indications is kept in memory and written back to the SIM after any changes.

---
 src/Makefile.am       |    3 +-
 src/message-waiting.c |  761 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/message-waiting.h |   30 ++
 src/ofono.h           |    4 +
 src/simutil.h         |    3 +
 src/sms.c             |   30 ++-
 src/smsutil.h         |    1 +
 7 files changed, 822 insertions(+), 10 deletions(-)
 create mode 100644 src/message-waiting.c
 create mode 100644 src/message-waiting.h
src/Makefile.am +2 -1
index 2e3e607..4644c69 100644
@@ -13,7 +13,8 @@ ofonod_SOURCES = main.c ofono.h log.c plugin.c \
 		network.c voicecall.c ussd.h ussd.c sms.c \
 		call-settings.c call-forwarding.c call-meter.c \
 		smsutil.h smsutil.c cssn.h cssn.c call-barring.c sim.h sim.c \
-		phonebook.c history.c simutil.h simutil.c
+		phonebook.c history.c simutil.h simutil.c \
+		message-waiting.c message-waiting.h
 
 ofonod_LDADD = $(top_builddir)/plugins/libbuiltin.la \
 		$(top_builddir)/drivers/libbuiltin.la \
src/message-waiting.c new file +761 -0

761 lines not on this page · raw message

src/message-waiting.h new file +30 -0
new file mode 100644
index 0000000..c0e60bf
@@ -0,0 +1,30 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2009  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+void ofono_message_waiting_present_notify(struct ofono_modem *modem,
+						enum sms_mwi_type type,
+						gboolean present, int profile);
+void ofono_message_waiting_count_notify(struct ofono_modem *modem,
+					enum sms_mwi_type type, int count,
+					int profile);
+
+void ofono_handle_sms_mwi(struct ofono_modem *modem,
+				struct sms *sms, gboolean *out_discard);
src/ofono.h +4 -0
index 3cb2d75..4e34430 100644
@@ -79,6 +79,7 @@ struct ofono_modem {
 	struct sim_manager_data *sim_manager;
 	struct sms_manager_data *sms_manager;
 	struct phonebook_data *phonebook;
+	struct message_waiting_data *message_waiting;
 
 	GSList *history_contexts;
 };
@@ -99,3 +100,6 @@ void __ofono_history_call_ended(struct ofono_modem *modem,
 
 void __ofono_history_call_missed(struct ofono_modem *modem,
 				const struct ofono_call *call, time_t when);
+
+int ofono_message_waiting_register(struct ofono_modem *modem);
+void ofono_message_waiting_unregister(struct ofono_modem *modem);
src/simutil.h +3 -0
index 6572e72..c2b1e20 100644
@@ -24,6 +24,9 @@ enum sim_fileid {
 	SIM_EFSPN_FILEID = 0x6f46,
 	SIM_EFPNN_FILEID = 0x6fc5,
 	SIM_EFOPL_FILEID = 0x6fc6,
+	SIM_EFMBDN_FILEID = 0x6fc7,
+	SIM_EFMBI_FILEID = 0x6fc9,
+	SIM_EFMWIS_FILEID = 0x6fca,
 	SIM_EFSPDI_FILEID = 0x6fcd,
 };
 
src/sms.c +21 -9
index 3a471e3..84b98de 100644
@@ -36,6 +36,7 @@
 #include "util.h"
 #include "sim.h"
 #include "smsutil.h"
+#include "message-waiting.h"
 
 #define uninitialized_var(x) x = x
 
@@ -655,11 +656,6 @@ static void handle_deliver(struct ofono_modem *modem,
 	g_slist_free(l);
 }
 
-static void handle_mwi(struct ofono_modem *modem, struct sms *mwi)
-{
-	ofono_error("MWI information not yet handled");
-}
-
 void ofono_sms_deliver_notify(struct ofono_modem *modem, unsigned char *pdu,
 				int len, int tpdu_len)
 {
@@ -685,14 +681,18 @@ void ofono_sms_deliver_notify(struct ofono_modem *modem, unsigned char *pdu,
 	/* This is an older style MWI notification, process MWI
 	 * headers and handle it like any other message */
 	if (sms.deliver.pid == SMS_PID_TYPE_RETURN_CALL) {
-		handle_mwi(modem, &sms);
+		ofono_handle_sms_mwi(modem, &sms, &discard);
+
+		if (discard)
+			return;
+
 		goto out;
 	}
 
 	/* The DCS indicates this is an MWI notification, process it
 	 * and then handle the User-Data as any other message */
-	if (sms_mwi_dcs_decode(sms.deliver.dcs, NULL, NULL, NULL, &discard)) {
-		handle_mwi(modem, &sms);
+	if (sms_mwi_dcs_decode(sms.deliver.dcs, NULL, NULL, NULL, NULL)) {
+		ofono_handle_sms_mwi(modem, &sms, &discard);
 
 		if (discard)
 			return;
@@ -757,7 +757,14 @@ void ofono_sms_deliver_notify(struct ofono_modem *modem, unsigned char *pdu,
 			switch (iei) {
 			case SMS_IEI_SPECIAL_MESSAGE_INDICATION:
 			case SMS_IEI_ENHANCED_VOICE_MAIL_INFORMATION:
-				handle_mwi(modem, &sms);
+				/* TODO: ignore if not in the very first
+				 * segment of a concatenated SM so as not
+				 * to repeat the indication.  */
+				ofono_handle_sms_mwi(modem, &sms, &discard);
+
+				if (discard)
+					return;
+
 				goto out;
 			case SMS_IEI_WCMP:
 				ofono_error("No support for WCMP, ignoring");
@@ -789,6 +796,9 @@ int ofono_sms_manager_register(struct ofono_modem *modem,
 	if (ops == NULL)
 		return -1;
 
+	if (ofono_message_waiting_register(modem))
+		return -1;
+
 	modem->sms_manager = sms_manager_create();
 
 	if (!modem->sms_manager)
@@ -824,4 +834,6 @@ void ofono_sms_manager_unregister(struct ofono_modem *modem)
 					SMS_MANAGER_INTERFACE);
 
 	ofono_modem_remove_interface(modem, SMS_MANAGER_INTERFACE);
+
+	ofono_message_waiting_unregister(modem);
 }
src/smsutil.h +1 -0
index 89da973..d362aa9 100644
@@ -158,6 +158,7 @@ enum sms_mwi_type {
 	SMS_MWI_TYPE_FAX = 1,
 	SMS_MWI_TYPE_EMAIL = 2,
 	SMS_MWI_TYPE_OTHER = 3,
+	SMS_MWI_TYPE_VIDEO = 4,
 };
 
 enum sms_pid_type {
Signature · 1 line
1.6.1
#7 lore raw

Hi,

I've pushed this patch and heavily customized it afterwards to simplify the logic a bit. Can you check that it is still working as intended?

Writing of MBDN fields is still missing. Can you send another patch for this? Also one fo writing of MSISDN records in SimManager would be good as well.

Regards,
-Denis

#8 lore raw

2009/8/4 Denis Kenzior <[email protected]>:

Quoted 2 lines

I've pushed this patch and heavily customized it afterwards to simplify the logic a bit.  Can you check that it is still working as intended?

It is kind of working but one of the things "simplified away" is using the D-Bus interface even without working EF-MBDN or EF-MWIS files on the SIM, i.e. if the write fails then the user never finds out there was a notification.

Consistently with the change to return invalid_args on D-Bus type mismatch, I'm attaching a diff to do the same thing for other interfaces we have.

You might want to add G_DBUS_METHOD_FLAG_ASYNC to SetProperty signature and remove mw_update declaration which is now unused. Also the check in cache_info should probably be if (r < len).

Quoted 2 lines

Writing of MBDN fields is still missing.  Can you send another patch for this?

Sent separately.

Quoted 1 line

Also one fo writing of MSISDN records in SimManager would be good as well.

Will get on it today.

Regards

From 4096f07b8b08005866ee69188763e5885574ed8c Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <[email protected]>
Date: Wed, 5 Aug 2009 07:17:10 +0200
Subject: [PATCH] Use invalid_args instead of invalid_format

---
 src/call-barring.c  |    4 ++--
 src/call-meter.c    |    4 ++--
 src/call-settings.c |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
src/call-barring.c +2 -2
index 36deaf7..386a127 100644
@@ -882,13 +882,13 @@ static DBusMessage *cb_set_property(DBusConnection *conn, DBusMessage *msg,
 	dbus_message_iter_recurse(&iter, &var);
 
 	if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
-		return __ofono_error_invalid_format(msg);
+		return __ofono_error_invalid_args(msg);
 
 	dbus_message_iter_get_basic(&var, &value);
 
 	if (!cb_lock_property_lookup(name, value, BEARER_CLASS_VOICE,
 					&lock, &cls, &mode))
-		return __ofono_error_invalid_format(msg);
+		return __ofono_error_invalid_args(msg);
 
 	if (dbus_message_iter_next(&iter)) {
 		if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
src/call-meter.c +2 -2
index 421fe0c..6147540 100644
@@ -584,7 +584,7 @@ static DBusMessage *cm_set_property(DBusConnection *conn, DBusMessage *msg,
 		return __ofono_error_invalid_args(msg);
 
 	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
-			return __ofono_error_invalid_args(msg);
+		return __ofono_error_invalid_args(msg);
 
 	dbus_message_iter_get_basic(&iter, &passwd);
 
@@ -596,7 +596,7 @@ static DBusMessage *cm_set_property(DBusConnection *conn, DBusMessage *msg,
 			continue;
 
 		if (dbus_message_iter_get_arg_type(&var) != property->type)
-			return __ofono_error_invalid_format(msg);
+			return __ofono_error_invalid_args(msg);
 
 		return property->set(msg, modem, &var, passwd);
 	}
src/call-settings.c +2 -2
index 18e8189..9fcb59e 100644
@@ -1167,7 +1167,7 @@ static DBusMessage *cs_set_property(DBusConnection *conn, DBusMessage *msg,
 		const char *setting;
 
 		if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
-			return __ofono_error_invalid_format(msg);
+			return __ofono_error_invalid_args(msg);
 
 		dbus_message_iter_get_basic(&var, &setting);
 
@@ -1176,7 +1176,7 @@ static DBusMessage *cs_set_property(DBusConnection *conn, DBusMessage *msg,
 		const char *setting;
 
 		if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
-			return __ofono_error_invalid_format(msg);
+			return __ofono_error_invalid_args(msg);
 
 		dbus_message_iter_get_basic(&var, &setting);
 
Signature · 1 line
1.6.1
#9 lore raw

Hi,

Quoted 4 lines

It is kind of working but one of the things "simplified away" is using the D-Bus interface even without working EF-MBDN or EF-MWIS files on the SIM, i.e. if the write fails then the user never finds out there was a notification.

Sorry I don't quite follow. The mw_set_indicator function sets the value and emits the signals regardless of whether the MWIS file could be written. Can you explain some more?

For setting mailbox numbers, a working EF-MBDN is required since the only alternative would be to store them on the filesystem.

Quoted 4 lines

Consistently with the change to return invalid_args on D-Bus type mismatch, I'm attaching a diff to do the same thing for other interfaces we have.

Patch has been applied.

Quoted 4 lines

You might want to add G_DBUS_METHOD_FLAG_ASYNC to SetProperty signature and remove mw_update declaration which is now unused. Also the check in cache_info should probably be if (r < len).

Yep, yep and yep. Thanks.

Regards,
-Denis

#10 lore raw

2009/8/5 Denis Kenzior <[email protected]>:

Quoted 6 lines

Sorry I don't quite follow.  The mw_set_indicator function sets the value and emits the signals regardless of whether the MWIS file could be written.  Can you explain some more?

For setting mailbox numbers, a working EF-MBDN is required since the only alternative would be to store them on the filesystem.

mw_set_indicator does the right thing, I missed this fact. But when a mailbox number is set or received from network all clients get a PropertyChanged and the new number can be retrieved from the interface but only when the store succeeded, previously it would be available regardless of MBDN on the card and the writing to card was secondary. The number is kind of important if you want to hear the messages.

Regards

#11 lore raw

Hi Andrew,

Quoted 9 lines
Quoted 2 lines

For setting mailbox numbers, a working EF-MBDN is required since the only alternative would be to store them on the filesystem.

mw_set_indicator does the right thing, I missed this fact. But when a mailbox number is set or received from network all clients get a PropertyChanged and the new number can be retrieved from the interface but only when the store succeeded, previously it would be available regardless of MBDN on the card and the writing to card was secondary. The number is kind of important if you want to hear the messages.

So you're right that even if we get an enhanced voice mail notification message the Mailbox number won't be signaled unless we have the SIM provisioned with EF-MBI & EF-MBDN.

The problem is, if we don't have the SIM files available, then the next time oFono is restarted this information is lost anyway until the next MWI notification arrives. So you're back to not being able to dial the mailbox.

This is also an issue with the indications themselves. If we don't have EF- MWIS provisioned, the information is lost when oFono is restarted. So we're now inconsistent between MBDN/MWIS, so maybe we shouldn't update them either in this case.

One solution is to always store this info on the filesystem and backup to SIM.

The other solution is to preserve current behavior, but to also expose the enhanced notifications in a separate interface (as discussed previously) and include any Mailbox numbers there.

Thoughts?

Regards,
-Denis

#12 lore raw

2009/8/5 Denis Kenzior <[email protected]>:

Quoted 16 lines

Hi Andrew,

Quoted 9 lines
Quoted 2 lines

For setting mailbox numbers, a working EF-MBDN is required since the only alternative would be to store them on the filesystem.

mw_set_indicator does the right thing, I missed this fact.  But when a mailbox number is set or received from network all clients get a PropertyChanged and the new number can be retrieved from the interface but only when the store succeeded, previously it would be available regardless of MBDN on the card and the writing to card was secondary. The number is kind of important if you want to hear the messages.

So you're right that even if we get an enhanced voice mail notification message the Mailbox number won't be signaled unless we have the SIM provisioned with EF-MBI & EF-MBDN.

Quoted 8 lines

The problem is, if we don't have the SIM files available, then the next time oFono is restarted this information is lost anyway until the next MWI notification arrives.  So you're back to not being able to dial the mailbox.

This is also an issue with the indications themselves.  If we don't have EF- MWIS provisioned, the information is lost when oFono is restarted.  So we're now inconsistent between MBDN/MWIS, so maybe we shouldn't update them either in this case.

True. (or update them both in this case)

It would make sense for the providers to resend the MWI information everytime subscriber connects the network and then it would be less problematic in case the information couldn't be written to SIM, but I don't know if they ever do this.

Regards

#13 lore raw

Hi Andrew,

Quoted 27 lines

2009/8/5 Denis Kenzior <[email protected]>:

Quoted 21 lines

Hi Andrew,

Quoted 9 lines
Quoted 2 lines

For setting mailbox numbers, a working EF-MBDN is required since the only alternative would be to store them on the filesystem.

mw_set_indicator does the right thing, I missed this fact. But when a mailbox number is set or received from network all clients get a PropertyChanged and the new number can be retrieved from the interface but only when the store succeeded, previously it would be available regardless of MBDN on the card and the writing to card was secondary. The number is kind of important if you want to hear the messages.

So you're right that even if we get an enhanced voice mail notification message the Mailbox number won't be signaled unless we have the SIM provisioned with EF-MBI & EF-MBDN.

The problem is, if we don't have the SIM files available, then the next time oFono is restarted this information is lost anyway until the next MWI notification arrives. So you're back to not being able to dial the mailbox.

Quoted 4 lines

This is also an issue with the indications themselves. If we don't have EF- MWIS provisioned, the information is lost when oFono is restarted.
So we're now inconsistent between MBDN/MWIS, so maybe we shouldn't
update them either in this case.

Quoted 6 lines

True. (or update them both in this case)

It would make sense for the providers to resend the MWI information everytime subscriber connects the network and then it would be less problematic in case the information couldn't be written to SIM, but I don't know if they ever do this.

Probably they don't, there are also weird roaming cases to consider, where you receive MWI, turn phone off, step on a plane and turn phone on with some other network entirely.

Can we make the MWI interface smarter somehow? Perhaps by not enabling it unless at least the EFmwis file is available, or by always storing the EFmwis contents on the filesystem?

Regards,
-Denis

#14 lore raw

2009/8/10 Denis Kenzior <[email protected]>:

Quoted 8 lines
Quoted 4 lines

It would make sense for the providers to resend the MWI information everytime subscriber connects the network and then it would be less problematic in case the information couldn't be written to SIM, but I don't know if they ever do this.

Probably they don't, there are also weird roaming cases to consider, where you receive MWI, turn phone off, step on a plane and turn phone on with some other network entirely.

There is another case to consider when the SIM is moved to a completely different phone. In fact, I think this is the original reason to store the MWI flag to the SIM.

Quoted 3 lines

Can we make the MWI interface smarter somehow?  Perhaps by not enabling it unless at least the EFmwis file is available, or by always storing the EFmwis contents on the filesystem?

I think this makes sense. There is another, related issue with some Nokia modems, though. They might not support low-level, EF access directly, but have some higher level API for accessing things like the MWI flag, HPLMN list and SPN. We might need to think about adding such high-level API support to the driver API as (optional) ops -- especially if other modems behave similarly -- otherwise the ISI modem driver may need some kluge to handing EF writes.

Cheers,
Aki

#15 lore raw

Hi Aki,

Quoted 6 lines

2009/8/10 Denis Kenzior <[email protected]>:

Quoted 5 lines
Quoted 4 lines

It would make sense for the providers to resend the MWI information everytime subscriber connects the network and then it would be less problematic in case the information couldn't be written to SIM, but I don't know if they ever do this.

Quoted 7 lines
Quoted 3 lines

Probably they don't, there are also weird roaming cases to consider, where you receive MWI, turn phone off, step on a plane and turn phone on with some other network entirely.

There is another case to consider when the SIM is moved to a completely different phone. In fact, I think this is the original reason to store the MWI flag to the SIM.

This is why we always attempt to write to the SIM for EFmwis. If the SIM doesn't support this file, then there's nothing we can do to preserve the MWIS information in the case you describe above.

There are other cases as well:
- EFmbdn & perhaps EFmbi
- EFmsisdn
- EFcbmid
- EFcbmir
- EFcfis

Quoted 5 lines
Quoted 4 lines

Can we make the MWI interface smarter somehow? Perhaps by not enabling it unless at least the EFmwis file is available, or by always storing the EFmwis contents on the filesystem?

Quoted 7 lines

I think this makes sense. There is another, related issue with some Nokia modems, though. They might not support low-level, EF access directly, but have some higher level API for accessing things like the MWI flag, HPLMN list and SPN. We might need to think about adding such high-level API support to the driver API as (optional) ops -- especially if other modems behave similarly -- otherwise the ISI modem driver may need some kluge to handing EF writes.

There is vast amount of information stored on the SIM that we need to expose. Today oFono processes:
- EFspn
- EFpnn
- EFopl
- EFmbi
- EFmbdn
- EFmwis
- EFspdi
- EFmsisdn

We also eventually need to support:
- EFecc
- EFsdn
- EFad
- EFcbmid
- EFcbmir
- EFehplmn
- EFehplmnpi
- EFici
- EFict
- EFoci
- EFoct
- EFcfis

So there are two issues here:
- There is absolutely no standard data format for such vendor commands. So
coming up with a higher level API that supports all modems might be tricky. The advantage of using low-level SIM access is that the command syntax & data format is standard and should be supported by any modem out there. Of course, as you point out, many don't.
- This presents the issue of having many more code paths to debug inside the
core and potentially many more plugin functions to implement.

I'd like to keep the core as clean and small as possible. What is your feeling for the level of bloat such higher level APIs will introduce in comparison to a giant if-else statement inside the driver itself?

Regards,
-Denis

#16 lore raw

2009/8/12 Denis Kenzior <[email protected]>:

Quoted 3 lines

 So there are two issues here:
       - There is absolutely no standard data format for such vendor commands.  So coming up with a higher level API that supports all modems might be tricky.

Agree, this might be a problem. And in the worst case, might force drivers to do data format conversions anyway.

Quoted 6 lines

       - This presents the issue of having many more code paths to debug inside the core and potentially many more plugin functions to implement.

I'd like to keep the core as clean and small as possible.  What is your feeling for the level of bloat such higher level APIs will introduce in comparison to a giant if-else statement inside the driver itself?

At least with the current set of EF types, I think we can manage faking it in the driver code.

Cheers,
Aki

#17 lore raw
In reply to Denis Kenzior

Hi,

2009/8/10 Denis Kenzior <[email protected]>:

Quoted 29 lines
Quoted 22 lines

2009/8/5 Denis Kenzior <[email protected]>:

Quoted 16 lines
Quoted 6 lines

mw_set_indicator does the right thing, I missed this fact.  But when a mailbox number is set or received from network all clients get a PropertyChanged and the new number can be retrieved from the interface but only when the store succeeded, previously it would be available regardless of MBDN on the card and the writing to card was secondary. The number is kind of important if you want to hear the messages.

So you're right that even if we get an enhanced voice mail notification message the Mailbox number won't be signaled unless we have the SIM provisioned with EF-MBI & EF-MBDN.

The problem is, if we don't have the SIM files available, then the next time oFono is restarted this information is lost anyway until the next MWI notification arrives.  So you're back to not being able to dial the mailbox.

Quoted 4 lines

This is also an issue with the indications themselves.  If we don't have EF- MWIS provisioned, the information is lost when oFono is restarted. So we're now inconsistent between MBDN/MWIS, so maybe we shouldn't update them either in this case.

Quoted 6 lines

True.  (or update them both in this case)

It would make sense for the providers to resend the MWI information everytime subscriber connects the network and then it would be less problematic in case the information couldn't be written to SIM, but I don't know if they ever do this.

Quoted 7 lines

Probably they don't, there are also weird roaming cases to consider, where you receive MWI, turn phone off, step on a plane and turn phone on with some other network entirely.

Can we make the MWI interface smarter somehow?  Perhaps by not enabling it unless at least the EFmwis file is available, or by always storing the EFmwis contents on the filesystem?

We could re-use the "sim cache" functions to cheaply save the state of notifications to filesystem, like in the attached patch (only an example). This is not ideal because the SIM might be used in a different phone or with a different software stack between ofonod runs, but seems better than not providing the information at all. Really we don't lose anything even if we don't store the state and provide the information (MWIS, MBDN) only for the duration of the ofonod session.

Regards