iface-modem-3gpp: provide separate methods to update access tech and location
This commit is contained in:
@@ -2942,14 +2942,10 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self,
|
|||||||
self->priv->current_operator_id = NULL;
|
self->priv->current_operator_id = NULL;
|
||||||
g_free (self->priv->current_operator_description);
|
g_free (self->priv->current_operator_description);
|
||||||
self->priv->current_operator_description = NULL;
|
self->priv->current_operator_description = NULL;
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (
|
mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN);
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN);
|
||||||
MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN,
|
mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
|
||||||
0, 0, 0);
|
mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), 0, 0);
|
||||||
mm_iface_modem_3gpp_update_ps_registration_state (
|
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
|
||||||
MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN,
|
|
||||||
0, 0, 0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3046,20 +3042,10 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Report new registration states */
|
/* Report new registration states */
|
||||||
|
mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), mm_cs_registration_state);
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (
|
mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), mm_ps_registration_state);
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), mm_access_technologies);
|
||||||
mm_cs_registration_state,
|
mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3572,19 +3558,10 @@ common_process_system_info_3gpp (MMBroadbandModemQmi *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Report new registration states */
|
/* Report new registration states */
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (
|
mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), cs_registration_state);
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), ps_registration_state);
|
||||||
cs_registration_state,
|
mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), access_technologies);
|
||||||
access_technologies,
|
mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid);
|
||||||
lac,
|
|
||||||
cid);
|
|
||||||
|
|
||||||
mm_iface_modem_3gpp_update_ps_registration_state (
|
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
|
||||||
ps_registration_state,
|
|
||||||
access_technologies,
|
|
||||||
lac,
|
|
||||||
cid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -2509,17 +2509,12 @@ registration_state_changed (MMAtSerialPort *port,
|
|||||||
|
|
||||||
/* Report new registration state */
|
/* Report new registration state */
|
||||||
if (cgreg)
|
if (cgreg)
|
||||||
mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self),
|
mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state);
|
||||||
state,
|
|
||||||
act,
|
|
||||||
lac,
|
|
||||||
cell_id);
|
|
||||||
else
|
else
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self),
|
mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), state);
|
||||||
state,
|
|
||||||
act,
|
mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), act);
|
||||||
lac,
|
mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cell_id);
|
||||||
cell_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2833,23 +2828,16 @@ registration_status_check_ready (MMBroadbandModem *self,
|
|||||||
if (cgreg) {
|
if (cgreg) {
|
||||||
if (ctx->running_cs)
|
if (ctx->running_cs)
|
||||||
mm_dbg ("Got PS registration state when checking CS registration state");
|
mm_dbg ("Got PS registration state when checking CS registration state");
|
||||||
mm_iface_modem_3gpp_update_ps_registration_state (
|
mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state);
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
|
||||||
state,
|
|
||||||
act,
|
|
||||||
lac,
|
|
||||||
cid);
|
|
||||||
} else {
|
} else {
|
||||||
if (ctx->running_ps)
|
if (ctx->running_ps)
|
||||||
mm_dbg ("Got CS registration state when checking PS registration state");
|
mm_dbg ("Got CS registration state when checking PS registration state");
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (
|
mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), state);
|
||||||
MM_IFACE_MODEM_3GPP (self),
|
|
||||||
state,
|
|
||||||
act,
|
|
||||||
lac,
|
|
||||||
cid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
run_registration_checks_context_step (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -176,14 +176,10 @@ static void
|
|||||||
register_in_network_context_failed (RegisterInNetworkContext *ctx,
|
register_in_network_context_failed (RegisterInNetworkContext *ctx,
|
||||||
GError *error)
|
GError *error)
|
||||||
{
|
{
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (ctx->self,
|
mm_iface_modem_3gpp_update_cs_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_IDLE);
|
||||||
MM_MODEM_3GPP_REGISTRATION_STATE_IDLE,
|
mm_iface_modem_3gpp_update_ps_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_IDLE);
|
||||||
MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN,
|
mm_iface_modem_3gpp_update_access_technologies (ctx->self, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
|
||||||
0, 0);
|
mm_iface_modem_3gpp_update_location (ctx->self, 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);
|
|
||||||
|
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
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
|
static void
|
||||||
update_registration_state (MMIfaceModem3gpp *self,
|
update_registration_state (MMIfaceModem3gpp *self,
|
||||||
MMModem3gppRegistrationState new_state,
|
MMModem3gppRegistrationState new_state)
|
||||||
MMModemAccessTechnology access_tech,
|
|
||||||
gulong location_area_code,
|
|
||||||
gulong cell_id)
|
|
||||||
{
|
{
|
||||||
MMModem3gppRegistrationState old_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN;
|
MMModem3gppRegistrationState old_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN;
|
||||||
MmGdbusModem3gpp *skeleton = NULL;
|
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);
|
g_object_unref (skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self,
|
mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self,
|
||||||
MMModem3gppRegistrationState state,
|
MMModem3gppRegistrationState state)
|
||||||
MMModemAccessTechnology access_tech,
|
|
||||||
gulong location_area_code,
|
|
||||||
gulong cell_id)
|
|
||||||
{
|
{
|
||||||
RegistrationStateContext *ctx;
|
RegistrationStateContext *ctx;
|
||||||
gboolean supported = FALSE;
|
gboolean supported = FALSE;
|
||||||
@@ -949,19 +969,12 @@ mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self,
|
|||||||
|
|
||||||
ctx = get_registration_state_context (self);
|
ctx = get_registration_state_context (self);
|
||||||
ctx->cs = state;
|
ctx->cs = state;
|
||||||
update_registration_state (self,
|
update_registration_state (self, get_consolidated_reg_state (ctx));
|
||||||
get_consolidated_reg_state (ctx),
|
|
||||||
access_tech,
|
|
||||||
location_area_code,
|
|
||||||
cell_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self,
|
mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self,
|
||||||
MMModem3gppRegistrationState state,
|
MMModem3gppRegistrationState state)
|
||||||
MMModemAccessTechnology access_tech,
|
|
||||||
gulong location_area_code,
|
|
||||||
gulong cell_id)
|
|
||||||
{
|
{
|
||||||
RegistrationStateContext *ctx;
|
RegistrationStateContext *ctx;
|
||||||
gboolean supported = FALSE;
|
gboolean supported = FALSE;
|
||||||
@@ -975,11 +988,7 @@ mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self,
|
|||||||
|
|
||||||
ctx = get_registration_state_context (self);
|
ctx = get_registration_state_context (self);
|
||||||
ctx->ps = state;
|
ctx->ps = state;
|
||||||
update_registration_state (self,
|
update_registration_state (self, get_consolidated_reg_state (ctx));
|
||||||
get_consolidated_reg_state (ctx),
|
|
||||||
access_tech,
|
|
||||||
location_area_code,
|
|
||||||
cell_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -1239,11 +1248,9 @@ interface_disabling_step (DisablingContext *ctx)
|
|||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
case DISABLING_STEP_REGISTRATION_STATE:
|
case DISABLING_STEP_REGISTRATION_STATE:
|
||||||
update_registration_state (ctx->self,
|
update_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN);
|
||||||
MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN,
|
mm_iface_modem_3gpp_update_access_technologies (ctx->self, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
|
||||||
0, /* access tech */
|
mm_iface_modem_3gpp_update_location (ctx->self, 0, 0);
|
||||||
0, /* lac */
|
|
||||||
0); /* cid */
|
|
||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
|
@@ -211,19 +211,19 @@ gboolean mm_iface_modem_3gpp_disable_finish (MMIfaceModem3gpp *self,
|
|||||||
/* Shutdown Modem 3GPP interface */
|
/* Shutdown Modem 3GPP interface */
|
||||||
void mm_iface_modem_3gpp_shutdown (MMIfaceModem3gpp *self);
|
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
|
* This may happen when handling unsolicited registration messages, or when
|
||||||
* the interface asks to run registration state checks. */
|
* the interface asks to run registration state checks. */
|
||||||
void mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self,
|
void mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self,
|
||||||
MMModem3gppRegistrationState state,
|
MMModem3gppRegistrationState state);
|
||||||
MMModemAccessTechnology access_tech,
|
|
||||||
gulong location_area_code,
|
|
||||||
gulong cell_id);
|
|
||||||
void mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self,
|
void mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self,
|
||||||
MMModem3gppRegistrationState state,
|
MMModem3gppRegistrationState state);
|
||||||
MMModemAccessTechnology access_tech,
|
void mm_iface_modem_3gpp_update_access_technologies (MMIfaceModem3gpp *self,
|
||||||
gulong location_area_code,
|
MMModemAccessTechnology access_tech);
|
||||||
gulong cell_id);
|
void mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self,
|
||||||
|
gulong location_area_code,
|
||||||
|
gulong cell_id);
|
||||||
|
|
||||||
/* Run all registration checks */
|
/* Run all registration checks */
|
||||||
void mm_iface_modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
void mm_iface_modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
||||||
|
Reference in New Issue
Block a user