call-forwarding: Reregister on EF-CFIS refresh

This commit is contained in:
Andrzej Zaborowski 2011-03-31 15:01:23 +02:00 committed by Denis Kenzior
parent ccaff5f4c0
commit c57d6049bf
1 changed files with 15 additions and 32 deletions

View File

@ -74,6 +74,7 @@ static void get_query_next_cf_cond(struct ofono_call_forwarding *cf);
static void set_query_next_cf_cond(struct ofono_call_forwarding *cf);
static void ss_set_query_next_cf_cond(struct ofono_call_forwarding *cf);
static void cf_unregister_ss_controls(struct ofono_call_forwarding *cf);
static void call_forwarding_unregister(struct ofono_atom *atom);
struct cf_ss_request {
int ss_type;
@ -1368,41 +1369,21 @@ static void sim_cfis_changed(int id, void *userdata)
{
struct ofono_call_forwarding *cf = userdata;
if (cf->flags & CALL_FORWARDING_FLAG_CACHED)
goto done;
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);
}
done:
cf->cfis_record_id = 0;
cf->flags &= ~CALL_FORWARDING_FLAG_CPHS_CFF;
if (!(cf->flags & CALL_FORWARDING_FLAG_CACHED))
return;
/*
* TODO: remove forwarding rules in
* cf->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL] that
* originate from EFcfis before adding the new rules?
* If the values are cached it's because at least one client
* requested them and we need to notify them about this
* change. However the authoritative source of current
* Call-Forwarding settings is the network operator and the
* query can take a noticeable amount of time. Instead of
* sedning PropertyChanged, we reregister the Call Forwarding
* atom. The client will invoke GetProperties only if it
* is still interested.
*/
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);
else
ofono_sim_read(cf->sim_context, SIM_EF_CPHS_CFF_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_cphs_cff_read_cb, cf);
call_forwarding_unregister(cf->atom);
ofono_call_forwarding_register(cf);
}
static void sim_read_cf_indicator(struct ofono_call_forwarding *cf)
@ -1465,6 +1446,8 @@ static void call_forwarding_unregister(struct ofono_atom *atom)
if (cf->ussd_watch)
__ofono_modem_remove_atom_watch(modem, cf->ussd_watch);
cf->flags = 0;
}
static void call_forwarding_remove(struct ofono_atom *atom)