From bb0dfd9b6db108b3fbf773ec515e393cb5240969 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 12 Jan 2010 17:54:18 -0600 Subject: [PATCH] Fix: Make the CPHS MWIS version actually work --- src/message-waiting.c | 53 +++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/src/message-waiting.c b/src/message-waiting.c index 6d328dc..a0065da 100644 --- a/src/message-waiting.c +++ b/src/message-waiting.c @@ -414,19 +414,12 @@ static void mw_cphs_mwis_read_cb(int ok, int total_length, int record, int record_length, void *userdata) { struct ofono_message_waiting *mw = userdata; - int i; struct mailbox_state info; - dbus_bool_t indication; - unsigned char count; - DBusConnection *conn = ofono_dbus_get_connection(); - const char *path = __ofono_atom_get_path(mw->atom); + unsigned char indication; if (!ok || total_length < 1) { - ofono_error("Unable to read CPHS waiting messages indicator " - "status from SIM"); - + ofono_debug("No CPHS MWIS on SIM"); mw->ef_cphs_mwis_length = 0; - return; } @@ -435,32 +428,26 @@ static void mw_cphs_mwis_read_cb(int ok, int total_length, int record, if (mw->efmwis_length != 0) return; - for (i = 0; i < 5 && i < total_length; i++) { - info.indication = (data[i] == 0xa); - info.message_count = 0; - - if (mw->messages[i].indication != info.indication || - mw->messages[i].message_count != - info.message_count) { - memcpy(&mw->messages[i], &info, sizeof(info)); - - indication = info.indication; - count = info.message_count; + /* Read Line 1 indication */ + indication = data[0] & 0xf; + info.indication = (indication == 0xa); + info.message_count = 0; + update_indicator_and_emit(mw, 0, &info); - if (!mw_message_waiting_property_name[i]) - continue; - - ofono_dbus_signal_property_changed(conn, path, - MESSAGE_WAITING_INTERFACE, - mw_message_waiting_property_name[i], - DBUS_TYPE_BOOLEAN, &indication); + if (total_length == 1) + return; - ofono_dbus_signal_property_changed(conn, path, - MESSAGE_WAITING_INTERFACE, - mw_message_count_property_name[i], - DBUS_TYPE_BYTE, &count); - } - } + /* Read Fax indication */ + indication = data[1] & 0xf; + info.indication = (indication == 0xa); + info.message_count = 0; + update_indicator_and_emit(mw, 1, &info); + + /* Read Data indication, map to 'Other' */ + indication = (data[1] >> 4) & 0xf; + info.indication = (indication == 0xa); + info.message_count = 0; + update_indicator_and_emit(mw, 3, &info); } static void mw_mwis_read_cb(int ok, int total_length, int record, -- 2.7.4