iface-modem-3gpp: helpers to check if specific domains are supported
This commit is contained in:

committed by
Aleksander Morgado

parent
1fa67b3842
commit
7b0b3e7e48
@@ -106,6 +106,25 @@ get_private (MMIfaceModem3gpp *self)
|
|||||||
return priv;
|
return priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define GET_NETWORK_SUPPORTED(domain,DOMAIN) \
|
||||||
|
static gboolean \
|
||||||
|
get_##domain##_network_supported (MMIfaceModem3gpp *self) \
|
||||||
|
{ \
|
||||||
|
gboolean supported = FALSE; \
|
||||||
|
\
|
||||||
|
g_object_get (self, \
|
||||||
|
MM_IFACE_MODEM_3GPP_##DOMAIN##_NETWORK_SUPPORTED, &supported, \
|
||||||
|
NULL); \
|
||||||
|
return supported; \
|
||||||
|
}
|
||||||
|
|
||||||
|
GET_NETWORK_SUPPORTED (cs, CS)
|
||||||
|
GET_NETWORK_SUPPORTED (ps, PS)
|
||||||
|
GET_NETWORK_SUPPORTED (eps, EPS)
|
||||||
|
GET_NETWORK_SUPPORTED (5gs, 5GS)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Helper method to wait for a final packet service state */
|
/* Helper method to wait for a final packet service state */
|
||||||
|
|
||||||
@@ -1747,19 +1766,17 @@ mm_iface_modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gboolean is_cs_supported = FALSE;
|
gboolean is_cs_supported;
|
||||||
gboolean is_ps_supported = FALSE;
|
gboolean is_ps_supported;
|
||||||
gboolean is_eps_supported = FALSE;
|
gboolean is_eps_supported;
|
||||||
gboolean is_5gs_supported = FALSE;
|
gboolean is_5gs_supported;
|
||||||
|
|
||||||
g_assert (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_registration_checks != NULL);
|
g_assert (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_registration_checks != NULL);
|
||||||
|
|
||||||
g_object_get (self,
|
is_cs_supported = get_cs_network_supported (self);
|
||||||
MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &is_cs_supported,
|
is_ps_supported = get_ps_network_supported (self);
|
||||||
MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &is_ps_supported,
|
is_eps_supported = get_eps_network_supported (self);
|
||||||
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED, &is_eps_supported,
|
is_5gs_supported = get_5gs_network_supported (self);
|
||||||
MM_IFACE_MODEM_3GPP_5GS_NETWORK_SUPPORTED, &is_5gs_supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
mm_obj_dbg (self, "running registration checks (CS: '%s', PS: '%s', EPS: '%s', 5GS: '%s')",
|
mm_obj_dbg (self, "running registration checks (CS: '%s', PS: '%s', EPS: '%s', 5GS: '%s')",
|
||||||
is_cs_supported ? "yes" : "no",
|
is_cs_supported ? "yes" : "no",
|
||||||
@@ -2139,93 +2156,28 @@ update_registration_state (MMIfaceModem3gpp *self,
|
|||||||
update_non_registered_state (self, old_state, new_state);
|
update_non_registered_state (self, old_state, new_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
#define UPDATE_REGISTRATION_STATE(domain) \
|
||||||
mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self,
|
void \
|
||||||
MMModem3gppRegistrationState state,
|
mm_iface_modem_3gpp_update_##domain##_registration_state (MMIfaceModem3gpp *self, \
|
||||||
gboolean deferred)
|
MMModem3gppRegistrationState state, \
|
||||||
{
|
gboolean deferred) \
|
||||||
Private *priv;
|
{ \
|
||||||
gboolean supported = FALSE;
|
Private *priv; \
|
||||||
|
\
|
||||||
g_object_get (self,
|
if (!get_##domain##_network_supported (self)) \
|
||||||
MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &supported,
|
return; \
|
||||||
NULL);
|
\
|
||||||
|
priv = get_private (self); \
|
||||||
if (!supported)
|
priv->state_##domain = state; \
|
||||||
return;
|
\
|
||||||
|
if (!deferred) \
|
||||||
priv = get_private (self);
|
mm_iface_modem_3gpp_apply_deferred_registration_state (self); \
|
||||||
priv->state_cs = state;
|
|
||||||
|
|
||||||
if (!deferred)
|
|
||||||
mm_iface_modem_3gpp_apply_deferred_registration_state (self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
UPDATE_REGISTRATION_STATE (cs)
|
||||||
mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self,
|
UPDATE_REGISTRATION_STATE (ps)
|
||||||
MMModem3gppRegistrationState state,
|
UPDATE_REGISTRATION_STATE (eps)
|
||||||
gboolean deferred)
|
UPDATE_REGISTRATION_STATE (5gs)
|
||||||
{
|
|
||||||
Private *priv;
|
|
||||||
gboolean supported = FALSE;
|
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!supported)
|
|
||||||
return;
|
|
||||||
|
|
||||||
priv = get_private (self);
|
|
||||||
priv->state_ps = state;
|
|
||||||
|
|
||||||
if (!deferred)
|
|
||||||
mm_iface_modem_3gpp_apply_deferred_registration_state (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
mm_iface_modem_3gpp_update_eps_registration_state (MMIfaceModem3gpp *self,
|
|
||||||
MMModem3gppRegistrationState state,
|
|
||||||
gboolean deferred)
|
|
||||||
{
|
|
||||||
Private *priv;
|
|
||||||
gboolean supported = FALSE;
|
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED, &supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!supported)
|
|
||||||
return;
|
|
||||||
|
|
||||||
priv = get_private (self);
|
|
||||||
priv->state_eps = state;
|
|
||||||
|
|
||||||
if (!deferred)
|
|
||||||
mm_iface_modem_3gpp_apply_deferred_registration_state (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
mm_iface_modem_3gpp_update_5gs_registration_state (MMIfaceModem3gpp *self,
|
|
||||||
MMModem3gppRegistrationState state,
|
|
||||||
gboolean deferred)
|
|
||||||
{
|
|
||||||
Private *priv;
|
|
||||||
gboolean supported = FALSE;
|
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_5GS_NETWORK_SUPPORTED, &supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!supported)
|
|
||||||
return;
|
|
||||||
|
|
||||||
priv = get_private (self);
|
|
||||||
priv->state_5gs = state;
|
|
||||||
|
|
||||||
if (!deferred)
|
|
||||||
mm_iface_modem_3gpp_apply_deferred_registration_state (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mm_iface_modem_3gpp_apply_deferred_registration_state (MMIfaceModem3gpp *self)
|
mm_iface_modem_3gpp_apply_deferred_registration_state (MMIfaceModem3gpp *self)
|
||||||
@@ -2403,13 +2355,7 @@ reload_initial_eps_bearer_ready (MMIfaceModem3gpp *self,
|
|||||||
void
|
void
|
||||||
mm_iface_modem_3gpp_reload_initial_eps_bearer (MMIfaceModem3gpp *self)
|
mm_iface_modem_3gpp_reload_initial_eps_bearer (MMIfaceModem3gpp *self)
|
||||||
{
|
{
|
||||||
gboolean eps_supported = FALSE;
|
if (get_eps_network_supported (self) &&
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED, &eps_supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (eps_supported &&
|
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer &&
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer &&
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer_finish) {
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer_finish) {
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer (
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer (
|
||||||
@@ -2513,30 +2459,20 @@ interface_disabling_step (GTask *task)
|
|||||||
ctx->step++;
|
ctx->step++;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case DISABLING_STEP_DISABLE_UNSOLICITED_REGISTRATION_EVENTS: {
|
case DISABLING_STEP_DISABLE_UNSOLICITED_REGISTRATION_EVENTS:
|
||||||
gboolean cs_supported = FALSE;
|
|
||||||
gboolean ps_supported = FALSE;
|
|
||||||
gboolean eps_supported = FALSE;
|
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &cs_supported,
|
|
||||||
MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &ps_supported,
|
|
||||||
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED, &eps_supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_unsolicited_registration_events &&
|
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_unsolicited_registration_events &&
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_unsolicited_registration_events_finish) {
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_unsolicited_registration_events_finish) {
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_unsolicited_registration_events (
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_unsolicited_registration_events (
|
||||||
self,
|
self,
|
||||||
cs_supported,
|
get_cs_network_supported (self),
|
||||||
ps_supported,
|
get_ps_network_supported (self),
|
||||||
eps_supported,
|
get_eps_network_supported (self),
|
||||||
(GAsyncReadyCallback)disable_unsolicited_registration_events_ready,
|
(GAsyncReadyCallback)disable_unsolicited_registration_events_ready,
|
||||||
task);
|
task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
} /* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION_EVENTS:
|
case DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION_EVENTS:
|
||||||
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->cleanup_unsolicited_registration_events &&
|
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->cleanup_unsolicited_registration_events &&
|
||||||
@@ -2844,39 +2780,23 @@ interface_enabling_step (GTask *task)
|
|||||||
ctx->step++;
|
ctx->step++;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case ENABLING_STEP_ENABLE_UNSOLICITED_REGISTRATION_EVENTS: {
|
case ENABLING_STEP_ENABLE_UNSOLICITED_REGISTRATION_EVENTS:
|
||||||
gboolean cs_supported = FALSE;
|
|
||||||
gboolean ps_supported = FALSE;
|
|
||||||
gboolean eps_supported = FALSE;
|
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &cs_supported,
|
|
||||||
MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &ps_supported,
|
|
||||||
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED, &eps_supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->enable_unsolicited_registration_events &&
|
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->enable_unsolicited_registration_events &&
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->enable_unsolicited_registration_events_finish) {
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->enable_unsolicited_registration_events_finish) {
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->enable_unsolicited_registration_events (
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->enable_unsolicited_registration_events (
|
||||||
self,
|
self,
|
||||||
cs_supported,
|
get_cs_network_supported (self),
|
||||||
ps_supported,
|
get_ps_network_supported (self),
|
||||||
eps_supported,
|
get_eps_network_supported (self),
|
||||||
(GAsyncReadyCallback)enable_unsolicited_registration_events_ready,
|
(GAsyncReadyCallback)enable_unsolicited_registration_events_ready,
|
||||||
task);
|
task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
} /* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case ENABLING_STEP_INITIAL_EPS_BEARER: {
|
case ENABLING_STEP_INITIAL_EPS_BEARER:
|
||||||
gboolean eps_supported = FALSE;
|
if (get_eps_network_supported (self) &&
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED, &eps_supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (eps_supported &&
|
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer &&
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer &&
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer_finish) {
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer_finish) {
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer (
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer (
|
||||||
@@ -2886,7 +2806,7 @@ interface_enabling_step (GTask *task)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
} /* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case ENABLING_STEP_LAST:
|
case ENABLING_STEP_LAST:
|
||||||
/* We are done without errors! */
|
/* We are done without errors! */
|
||||||
@@ -2985,14 +2905,9 @@ sync_eps_bearer (MMIfaceModem3gpp *self,
|
|||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
SyncingContext *ctx;
|
SyncingContext *ctx;
|
||||||
gboolean eps_supported = FALSE;
|
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED, &eps_supported,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Refresh EPS bearer if supported */
|
/* Refresh EPS bearer if supported */
|
||||||
if (eps_supported &&
|
if (get_eps_network_supported (self) &&
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer &&
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer &&
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer_finish) {
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer_finish) {
|
||||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer (
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer (
|
||||||
|
Reference in New Issue
Block a user