Open Source Telephony
 help / color / mirror / Atom feed
From: Andrzej Zaborowski <andrew.zaborowski@intel.com>
To: ofono@ofono.org
Subject: [PATCH 3/3] call-forwarding: Watch for changes to relevant SIM files.
Date: Sat, 19 Feb 2011 04:54:29 +0100	[thread overview]
Message-ID: <1298087669-11558-3-git-send-email-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <1298087669-11558-1-git-send-email-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2383 bytes --]

---
 src/call-forwarding.c |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index d13f990..fe535b8 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -1358,8 +1358,31 @@ static void sim_cphs_cff_read_cb(int ok, int total_length, int record,
 					DBUS_TYPE_BOOLEAN, &cfu_voice);
 }
 
-static void sim_read_cf_indicator(struct ofono_call_forwarding *cf)
+static void sim_cfis_changed(int id, void *userdata)
 {
+	struct ofono_call_forwarding *cf = userdata;
+
+	if (((cf->flags & CALL_FORWARDING_FLAG_CPHS_CFF) ||
+			cf->cfis_record_id > 0) && is_cfu_enabled(cf, NULL)) {
+		DBusConnection *conn = ofono_dbus_get_connection();
+		const char *path = __ofono_atom_get_path(cf->atom);
+		ofono_bool_t status = FALSE;
+
+		ofono_dbus_signal_property_changed(conn, path,
+					OFONO_CALL_FORWARDING_INTERFACE,
+					"ForwardingFlagOnSim",
+					DBUS_TYPE_BOOLEAN, &status);
+	}
+
+	cf->cfis_record_id = 0;
+	cf->flags &= ~CALL_FORWARDING_FLAG_CPHS_CFF;
+
+	/*
+	 * TODO: remove forwarding rules in
+	 * cf->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL] that
+	 * originate from EFcfis before adding the new rules?
+	 */
+
 	if (__ofono_sim_service_available(cf->sim,
 			SIM_UST_SERVICE_CFIS,
 			SIM_SST_SERVICE_CFIS) == TRUE)
@@ -1372,6 +1395,26 @@ static void sim_read_cf_indicator(struct ofono_call_forwarding *cf)
 				sim_cphs_cff_read_cb, cf);
 }
 
+static void sim_read_cf_indicator(struct ofono_call_forwarding *cf)
+{
+	if (__ofono_sim_service_available(cf->sim,
+			SIM_UST_SERVICE_CFIS,
+			SIM_SST_SERVICE_CFIS) == TRUE) {
+		ofono_sim_read(cf->sim_context, SIM_EFCFIS_FILEID,
+				OFONO_SIM_FILE_STRUCTURE_FIXED,
+				sim_cfis_read_cb, cf);
+		ofono_sim_add_file_watch(cf->sim_context, SIM_EFCFIS_FILEID,
+						sim_cfis_changed, cf, NULL);
+	} else {
+		ofono_sim_read(cf->sim_context, SIM_EF_CPHS_CFF_FILEID,
+				OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
+				sim_cphs_cff_read_cb, cf);
+		ofono_sim_add_file_watch(cf->sim_context,
+						SIM_EF_CPHS_CFF_FILEID,
+						sim_cfis_changed, cf, NULL);
+	}
+}
+
 int ofono_call_forwarding_driver_register(const struct ofono_call_forwarding_driver *d)
 {
 	DBG("driver: %p, name: %s", d, d->name);
-- 
1.7.1.86.g0e460.dirty


  parent reply	other threads:[~2011-02-19  3:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-19  3:54 [PATCH 1/3] sim: Watch for changes to relevant SIM files Andrzej Zaborowski
2011-02-19  3:54 ` [PATCH 2/3] message-waiting: " Andrzej Zaborowski
2011-03-16  2:24   ` Denis Kenzior
2011-02-19  3:54 ` Andrzej Zaborowski [this message]
2011-03-16  2:25   ` [PATCH 3/3] call-forwarding: " Denis Kenzior
2011-03-16  2:24 ` [PATCH 1/3] sim: " Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1298087669-11558-3-git-send-email-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox