From: Nicolas Bertrand <nicolas.bertrand@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH] call-forward: Call forwarding state handling
Date: Tue, 07 Jun 2011 18:51:29 +0200 [thread overview]
Message-ID: <1307465489-2039-1-git-send-email-nicolas.bertrand@linux.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3227 bytes --]
When CFU is active be cautious with conditional
call-forward activation/deactivation
---
src/call-forwarding.c | 44 ++++++++++++++++++++++++++++++++++++++------
1 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 73ce433..42d681e 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -504,6 +504,7 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
DBusMessageIter dict;
int i;
dbus_bool_t status;
+ GSList *hidden = NULL;
reply = dbus_message_new_method_return(msg);
if (reply == NULL)
@@ -515,17 +516,31 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
OFONO_PROPERTIES_ARRAY_SIGNATURE,
&dict);
- for (i = 0; i < 4; i++)
- property_append_cf_conditions(&dict, cf->cf_conditions[i],
- BEARER_CLASS_VOICE,
- cf_type_lut[i]);
-
if ((cf->flags & CALL_FORWARDING_FLAG_CPHS_CFF) ||
cf->cfis_record_id > 0)
status = is_cfu_enabled(cf, NULL);
else
status = FALSE;
+ // If unconditional call-forwarding is enabled,
+ // hide conditionnal status
+ if (status == TRUE) {
+ struct ofono_call_forwarding_condition cd = {0, 0, {"", 0}, 0};
+
+ for (i = 0; i < 4; i++)
+ hidden = g_slist_prepend(hidden, &cd);
+ }
+
+ for (i = 0; i < 4; i++)
+ property_append_cf_conditions(&dict, (status &&
+ i != CALL_FORWARDING_TYPE_UNCONDITIONAL) ?
+ hidden : cf->cf_conditions[i],
+ BEARER_CLASS_VOICE,
+ cf_type_lut[i]);
+
+ if (status == TRUE)
+ g_slist_free(hidden);
+
ofono_dbus_dict_append(&dict, "ForwardingFlagOnSim", DBUS_TYPE_BOOLEAN,
&status);
@@ -552,6 +567,13 @@ static void get_query_cf_callback(const struct ofono_error *error, int total,
cf->flags |= CALL_FORWARDING_FLAG_CACHED;
}
+ if (cf->query_next == CALL_FORWARDING_TYPE_UNCONDITIONAL &&
+ is_cfu_enabled(cf, NULL) == TRUE) {
+ DBusMessage *reply = cf_get_properties_reply(cf->pending, cf);
+ __ofono_dbus_pending_reply(&cf->pending, reply);
+ return;
+ }
+
if (cf->query_next == CALL_FORWARDING_TYPE_NOT_REACHABLE) {
DBusMessage *reply = cf_get_properties_reply(cf->pending, cf);
__ofono_dbus_pending_reply(&cf->pending, reply);
@@ -575,7 +597,8 @@ static DBusMessage *cf_get_properties(DBusConnection *conn, DBusMessage *msg,
struct ofono_modem *modem = __ofono_atom_get_modem(cf->atom);
if ((cf->flags & CALL_FORWARDING_FLAG_CACHED) ||
- ofono_modem_get_online(modem) == FALSE)
+ ofono_modem_get_online(modem) == FALSE ||
+ is_cfu_enabled(cf, NULL) == TRUE)
return cf_get_properties_reply(msg, cf);
if (cf->driver->query == NULL)
@@ -698,6 +721,15 @@ static void set_property_callback(const struct ofono_error *error, void *data)
return;
}
+ if (cf->query_next != CALL_FORWARDING_TYPE_UNCONDITIONAL &&
+ is_cfu_enabled(cf, NULL) == TRUE) {
+ DBusMessage *reply;
+ cf->flags &= ~CALL_FORWARDING_FLAG_CACHED;
+ reply = dbus_message_new_method_return(cf->pending);
+ __ofono_dbus_pending_reply(&cf->pending, reply);
+ return;
+ }
+
/* Successfully set, query the entire set just in case */
set_query_next_cf_cond(cf);
}
--
1.7.1
next reply other threads:[~2011-06-07 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 16:51 Nicolas Bertrand [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-06-16 14:31 [PATCH] call-forward: Call forwarding state handling Nicolas Bertrand
2011-06-23 17:45 ` 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=1307465489-2039-1-git-send-email-nicolas.bertrand@linux.intel.com \
--to=nicolas.bertrand@linux.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