diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-26 17:32:59 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:58 +0100 |
commit | c9e7e80c3b912b15c8c4f9bdedf627603ff23876 (patch) | |
tree | 1667c0bb82698e572a443d9db8c3bd3f9b9ea362 /src | |
parent | ad37101c0db0cda89b422c4d9d60cb7b61cb3512 (diff) |
iface-modem-3gpp: update access tech and location even if registration didn't change
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 81d99fca..3f7d0de0 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -592,12 +592,12 @@ update_registration_state (MMIfaceModem3gpp *self, MMModem3gppRegistrationState old_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; MmGdbusModem3gpp *skeleton = NULL; - /* Only set new state if different */ g_object_get (self, MM_IFACE_MODEM_3GPP_REGISTRATION_STATE, &old_state, MM_IFACE_MODEM_3GPP_DBUS_SKELETON, &skeleton, NULL); + /* Only set new state if different */ if (new_state != old_state) { mm_info ("Modem %s: 3GPP Registration state changed (%s -> %s)", g_dbus_object_get_object_path (G_DBUS_OBJECT (self)), @@ -610,9 +610,8 @@ update_registration_state (MMIfaceModem3gpp *self, MM_IFACE_MODEM_3GPP_REGISTRATION_STATE, new_state, NULL); - switch (new_state) { - case MM_MODEM_3GPP_REGISTRATION_STATE_HOME: - case MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING: + if (new_state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME || + new_state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING) { /* Launch operator code update */ if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_operator_code && MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_operator_code_finish) @@ -628,36 +627,16 @@ update_registration_state (MMIfaceModem3gpp *self, (GAsyncReadyCallback)load_operator_name_ready, NULL); - mm_iface_modem_update_access_technologies (MM_IFACE_MODEM (self), - access_tech, - ALL_3GPP_ACCESS_TECHNOLOGIES_MASK); - mm_iface_modem_update_subsystem_state (MM_IFACE_MODEM (self), SUBSYSTEM_3GPP, MM_MODEM_STATE_REGISTERED, MM_MODEM_STATE_REASON_NONE); - - /* If we also implement the location interface, update the 3GPP location */ - if (MM_IS_IFACE_MODEM_LOCATION (self)) - mm_iface_modem_location_3gpp_update_lac_ci (MM_IFACE_MODEM_LOCATION (self), - location_area_code, - cell_id); - break; - - case MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING: - case MM_MODEM_3GPP_REGISTRATION_STATE_IDLE: - case MM_MODEM_3GPP_REGISTRATION_STATE_DENIED: - case MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN: + } + /* Not registered neither in home nor roaming network */ + else { mm_gdbus_modem3gpp_set_operator_code (skeleton, NULL); mm_gdbus_modem3gpp_set_operator_name (skeleton, NULL); - if (MM_IS_IFACE_MODEM_LOCATION (self)) - mm_iface_modem_location_3gpp_clear (MM_IFACE_MODEM_LOCATION (self)); - - mm_iface_modem_update_access_technologies (MM_IFACE_MODEM (self), - MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, - ALL_3GPP_ACCESS_TECHNOLOGIES_MASK); - mm_iface_modem_update_subsystem_state ( MM_IFACE_MODEM (self), SUBSYSTEM_3GPP, @@ -665,10 +644,31 @@ update_registration_state (MMIfaceModem3gpp *self, MM_MODEM_STATE_SEARCHING : MM_MODEM_STATE_ENABLED), MM_MODEM_STATE_REASON_NONE); - break; } } + /* Even if registration state didn't change, report access technology or + * location updates, but only if something valid to report */ + if (new_state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME || + new_state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING) { + if (access_tech != MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN) + mm_iface_modem_update_access_technologies (MM_IFACE_MODEM (self), + access_tech, + ALL_3GPP_ACCESS_TECHNOLOGIES_MASK); + if (MM_IS_IFACE_MODEM_LOCATION (self) && + location_area_code > 0 && + cell_id > 0) + mm_iface_modem_location_3gpp_update_lac_ci (MM_IFACE_MODEM_LOCATION (self), + location_area_code, + cell_id); + } else { + mm_iface_modem_update_access_technologies (MM_IFACE_MODEM (self), + MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, + ALL_3GPP_ACCESS_TECHNOLOGIES_MASK); + if (MM_IS_IFACE_MODEM_LOCATION (self)) + mm_iface_modem_location_3gpp_clear (MM_IFACE_MODEM_LOCATION (self)); + } + g_object_unref (skeleton); } |