diff options
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 47 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 32 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 121 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.h | 18 |
4 files changed, 95 insertions, 123 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index ef101413..45123f22 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -2942,14 +2942,10 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self, self->priv->current_operator_id = NULL; g_free (self->priv->current_operator_description); self->priv->current_operator_description = NULL; - mm_iface_modem_3gpp_update_cs_registration_state ( - MM_IFACE_MODEM_3GPP (self), - MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN, - 0, 0, 0); - mm_iface_modem_3gpp_update_ps_registration_state ( - MM_IFACE_MODEM_3GPP (self), - MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN, - 0, 0, 0); + mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN); + mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN); + mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), 0, 0); return; } @@ -3046,20 +3042,10 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self, } /* Report new registration states */ - - mm_iface_modem_3gpp_update_cs_registration_state ( - MM_IFACE_MODEM_3GPP (self), - mm_cs_registration_state, - mm_access_technologies, - lac, - cid); - - mm_iface_modem_3gpp_update_ps_registration_state ( - MM_IFACE_MODEM_3GPP (self), - mm_ps_registration_state, - mm_access_technologies, - lac, - cid); + mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), mm_cs_registration_state); + mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), mm_ps_registration_state); + mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), mm_access_technologies); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid); } static void @@ -3572,19 +3558,10 @@ common_process_system_info_3gpp (MMBroadbandModemQmi *self, } /* Report new registration states */ - mm_iface_modem_3gpp_update_cs_registration_state ( - MM_IFACE_MODEM_3GPP (self), - cs_registration_state, - access_technologies, - lac, - cid); - - mm_iface_modem_3gpp_update_ps_registration_state ( - MM_IFACE_MODEM_3GPP (self), - ps_registration_state, - access_technologies, - lac, - cid); + mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), cs_registration_state); + mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), ps_registration_state); + mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), access_technologies); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid); } static void diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 42f8bcd6..bb53bbbd 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -2509,17 +2509,12 @@ registration_state_changed (MMAtSerialPort *port, /* Report new registration state */ if (cgreg) - mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), - state, - act, - lac, - cell_id); + mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state); else - mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), - state, - act, - lac, - cell_id); + mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), state); + + mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), act); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cell_id); } static void @@ -2833,23 +2828,16 @@ registration_status_check_ready (MMBroadbandModem *self, if (cgreg) { if (ctx->running_cs) mm_dbg ("Got PS registration state when checking CS registration state"); - mm_iface_modem_3gpp_update_ps_registration_state ( - MM_IFACE_MODEM_3GPP (self), - state, - act, - lac, - cid); + mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state); } else { if (ctx->running_ps) mm_dbg ("Got CS registration state when checking PS registration state"); - mm_iface_modem_3gpp_update_cs_registration_state ( - MM_IFACE_MODEM_3GPP (self), - state, - act, - lac, - cid); + mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), state); } + mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), act); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid); + run_registration_checks_context_step (ctx); } diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 9e12befd..0000aee7 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -176,14 +176,10 @@ static void register_in_network_context_failed (RegisterInNetworkContext *ctx, GError *error) { - mm_iface_modem_3gpp_update_cs_registration_state (ctx->self, - MM_MODEM_3GPP_REGISTRATION_STATE_IDLE, - MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, - 0, 0); - mm_iface_modem_3gpp_update_ps_registration_state (ctx->self, - MM_MODEM_3GPP_REGISTRATION_STATE_IDLE, - MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, - 0, 0); + mm_iface_modem_3gpp_update_cs_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_IDLE); + mm_iface_modem_3gpp_update_ps_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_IDLE); + mm_iface_modem_3gpp_update_access_technologies (ctx->self, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); + mm_iface_modem_3gpp_update_location (ctx->self, 0, 0); g_simple_async_result_take_error (ctx->result, error); } @@ -852,12 +848,61 @@ mm_iface_modem_3gpp_reload_current_operator (MMIfaceModem3gpp *self) /*****************************************************************************/ +void +mm_iface_modem_3gpp_update_access_technologies (MMIfaceModem3gpp *self, + MMModemAccessTechnology access_tech) +{ + MMModem3gppRegistrationState state; + + g_object_get (self, + MM_IFACE_MODEM_3GPP_REGISTRATION_STATE, &state, + NULL); + + /* Even if registration state didn't change, report access technology, + * but only if something valid to report */ + if (state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME || + 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, + MM_IFACE_MODEM_3GPP_ALL_ACCESS_TECHNOLOGIES_MASK); + } else + mm_iface_modem_update_access_technologies (MM_IFACE_MODEM (self), + MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, + MM_IFACE_MODEM_3GPP_ALL_ACCESS_TECHNOLOGIES_MASK); +} + +void +mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self, + gulong location_area_code, + gulong cell_id) +{ + MMModem3gppRegistrationState state; + + if (!MM_IS_IFACE_MODEM_LOCATION (self)) + return; + + g_object_get (self, + MM_IFACE_MODEM_3GPP_REGISTRATION_STATE, &state, + NULL); + + /* Even if registration state didn't change, report access technology or + * location updates, but only if something valid to report */ + if (state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME || + state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING) { + if (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_location_3gpp_clear (MM_IFACE_MODEM_LOCATION (self)); +} + +/*****************************************************************************/ + static void update_registration_state (MMIfaceModem3gpp *self, - MMModem3gppRegistrationState new_state, - MMModemAccessTechnology access_tech, - gulong location_area_code, - gulong cell_id) + MMModem3gppRegistrationState new_state) { MMModem3gppRegistrationState old_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; MmGdbusModem3gpp *skeleton = NULL; @@ -905,37 +950,12 @@ update_registration_state (MMIfaceModem3gpp *self, } } - /* 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, - MM_IFACE_MODEM_3GPP_ALL_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, - MM_IFACE_MODEM_3GPP_ALL_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); } void mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self, - MMModem3gppRegistrationState state, - MMModemAccessTechnology access_tech, - gulong location_area_code, - gulong cell_id) + MMModem3gppRegistrationState state) { RegistrationStateContext *ctx; gboolean supported = FALSE; @@ -949,19 +969,12 @@ mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self, ctx = get_registration_state_context (self); ctx->cs = state; - update_registration_state (self, - get_consolidated_reg_state (ctx), - access_tech, - location_area_code, - cell_id); + update_registration_state (self, get_consolidated_reg_state (ctx)); } void mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self, - MMModem3gppRegistrationState state, - MMModemAccessTechnology access_tech, - gulong location_area_code, - gulong cell_id) + MMModem3gppRegistrationState state) { RegistrationStateContext *ctx; gboolean supported = FALSE; @@ -975,11 +988,7 @@ mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self, ctx = get_registration_state_context (self); ctx->ps = state; - update_registration_state (self, - get_consolidated_reg_state (ctx), - access_tech, - location_area_code, - cell_id); + update_registration_state (self, get_consolidated_reg_state (ctx)); } /*****************************************************************************/ @@ -1239,11 +1248,9 @@ interface_disabling_step (DisablingContext *ctx) ctx->step++; case DISABLING_STEP_REGISTRATION_STATE: - update_registration_state (ctx->self, - MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN, - 0, /* access tech */ - 0, /* lac */ - 0); /* cid */ + update_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN); + mm_iface_modem_3gpp_update_access_technologies (ctx->self, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); + mm_iface_modem_3gpp_update_location (ctx->self, 0, 0); /* Fall down to next step */ ctx->step++; diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h index dc96ff1b..2bc25613 100644 --- a/src/mm-iface-modem-3gpp.h +++ b/src/mm-iface-modem-3gpp.h @@ -211,19 +211,19 @@ gboolean mm_iface_modem_3gpp_disable_finish (MMIfaceModem3gpp *self, /* Shutdown Modem 3GPP interface */ void mm_iface_modem_3gpp_shutdown (MMIfaceModem3gpp *self); -/* Objects implementing this interface can report new registration states. +/* Objects implementing this interface can report new registration states, + * access technologies and location. * This may happen when handling unsolicited registration messages, or when * the interface asks to run registration state checks. */ void mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self, - MMModem3gppRegistrationState state, - MMModemAccessTechnology access_tech, - gulong location_area_code, - gulong cell_id); + MMModem3gppRegistrationState state); void mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self, - MMModem3gppRegistrationState state, - MMModemAccessTechnology access_tech, - gulong location_area_code, - gulong cell_id); + MMModem3gppRegistrationState state); +void mm_iface_modem_3gpp_update_access_technologies (MMIfaceModem3gpp *self, + MMModemAccessTechnology access_tech); +void mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self, + gulong location_area_code, + gulong cell_id); /* Run all registration checks */ void mm_iface_modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self, |