iface-modem: rework signal check logic to use the iface-specific private context

The signal and access tech loading operation was using a context that
contained both overall state and state specific to the current
attempt.

The overall modem state is now moved to the iface-specific private
context, and the state specific to the operation is kept in a GTask
that is bound to the ongoing loading operation.
This commit is contained in:
Aleksander Morgado
2022-05-16 11:59:47 +02:00
parent 95da87046c
commit 0080ed612d

View File

@@ -42,10 +42,8 @@
#define SIGNAL_CHECK_INITIAL_TIMEOUT_SEC 3 #define SIGNAL_CHECK_INITIAL_TIMEOUT_SEC 3
#define SIGNAL_CHECK_TIMEOUT_SEC 30 #define SIGNAL_CHECK_TIMEOUT_SEC 30
#define SIGNAL_CHECK_CONTEXT_TAG "signal-check-context-tag"
#define RESTART_INITIALIZE_IDLE_TAG "restart-initialize-tag" #define RESTART_INITIALIZE_IDLE_TAG "restart-initialize-tag"
static GQuark signal_check_context_quark;
static GQuark restart_initialize_idle_quark; static GQuark restart_initialize_idle_quark;
/*****************************************************************************/ /*****************************************************************************/
@@ -60,6 +58,20 @@ typedef struct {
/* Signal quality recent flag handling */ /* Signal quality recent flag handling */
guint signal_quality_recent_timeout_source; guint signal_quality_recent_timeout_source;
/* If both signal and access tech polling are either unsupported
* or disabled, we'll automatically stop polling */
gboolean signal_quality_polling_supported;
gboolean signal_quality_polling_disabled;
gboolean access_technology_polling_supported;
gboolean access_technology_polling_disabled;
/* Signal quality and access tech polling support */
gboolean signal_check_enabled;
guint signal_check_timeout_source;
guint signal_check_initial_retries;
gboolean signal_check_initial_done;
gboolean signal_check_running;
} Private; } Private;
static void static void
@@ -69,6 +81,8 @@ private_free (Private *priv)
g_array_unref (priv->subsystem_states); g_array_unref (priv->subsystem_states);
if (priv->signal_quality_recent_timeout_source) if (priv->signal_quality_recent_timeout_source)
g_source_remove (priv->signal_quality_recent_timeout_source); g_source_remove (priv->signal_quality_recent_timeout_source);
if (priv->signal_check_timeout_source)
g_source_remove (priv->signal_check_timeout_source);
g_slice_free (Private, priv); g_slice_free (Private, priv);
} }
@@ -83,6 +97,25 @@ get_private (MMIfaceModem *self)
priv = g_object_get_qdata (G_OBJECT (self), private_quark); priv = g_object_get_qdata (G_OBJECT (self), private_quark);
if (!priv) { if (!priv) {
priv = g_slice_new0 (Private); priv = g_slice_new0 (Private);
/* Initially assume supported if load_access_technologies() is
* implemented. If the plugin reports an UNSUPPORTED error we'll clear
* this flag and no longer poll. */
priv->access_technology_polling_supported = (MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies &&
MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies_finish);
/* Initially assume supported if load_signal_quality() is
* implemented. If the plugin reports an UNSUPPORTED error we'll clear
* this flag and no longer poll. */
priv->signal_quality_polling_supported = (MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality &&
MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality_finish);
/* Get plugin-specific setup for the polling logic */
g_object_get (self,
MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, &priv->signal_quality_polling_disabled,
MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED, &priv->access_technology_polling_disabled,
NULL);
g_object_set_qdata_full (G_OBJECT (self), private_quark, priv, (GDestroyNotify)private_free); g_object_set_qdata_full (G_OBJECT (self), private_quark, priv, (GDestroyNotify)private_free);
} }
@@ -1530,7 +1563,6 @@ mm_iface_modem_update_signal_quality (MMIfaceModem *self,
/* Signal info (quality and access technology) polling */ /* Signal info (quality and access technology) polling */
typedef enum { typedef enum {
SIGNAL_CHECK_STEP_NONE,
SIGNAL_CHECK_STEP_FIRST, SIGNAL_CHECK_STEP_FIRST,
SIGNAL_CHECK_STEP_SIGNAL_QUALITY, SIGNAL_CHECK_STEP_SIGNAL_QUALITY,
SIGNAL_CHECK_STEP_ACCESS_TECHNOLOGIES, SIGNAL_CHECK_STEP_ACCESS_TECHNOLOGIES,
@@ -1538,92 +1570,30 @@ typedef enum {
} SignalCheckStep; } SignalCheckStep;
typedef struct { typedef struct {
gboolean enabled;
guint timeout_source;
/* We first attempt an initial loading, and once it's done we
* setup polling */
guint initial_retries;
gboolean initial_check_done;
/* Values polled in this iteration */ /* Values polled in this iteration */
guint signal_quality; guint signal_quality;
MMModemAccessTechnology access_technologies; MMModemAccessTechnology access_technologies;
guint access_technologies_mask; guint access_technologies_mask;
/* If both signal and access tech polling are either unsupported
* or disabled, we'll automatically stop polling */
gboolean signal_quality_polling_supported;
gboolean signal_quality_polling_disabled;
gboolean access_technology_polling_supported;
gboolean access_technology_polling_disabled;
/* Steps triggered when polling active */ /* Steps triggered when polling active */
SignalCheckStep running_step; SignalCheckStep running_step;
} SignalCheckContext; } SignalCheckContext;
static void
signal_check_context_free (SignalCheckContext *ctx)
{
if (ctx->timeout_source)
g_source_remove (ctx->timeout_source);
g_slice_free (SignalCheckContext, ctx);
}
static SignalCheckContext *
get_signal_check_context (MMIfaceModem *self)
{
SignalCheckContext *ctx;
if (G_UNLIKELY (!signal_check_context_quark))
signal_check_context_quark = (g_quark_from_static_string (
SIGNAL_CHECK_CONTEXT_TAG));
ctx = g_object_get_qdata (G_OBJECT (self), signal_check_context_quark);
if (!ctx) {
/* Create context and attach it to the object */
ctx = g_slice_new0 (SignalCheckContext);
ctx->running_step = SIGNAL_CHECK_STEP_NONE;
/* Initially assume supported if load_access_technologies() is
* implemented. If the plugin reports an UNSUPPORTED error we'll clear
* this flag and no longer poll. */
ctx->access_technology_polling_supported = (MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies &&
MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies_finish);
/* Initially assume supported if load_signal_quality() is
* implemented. If the plugin reports an UNSUPPORTED error we'll clear
* this flag and no longer poll. */
ctx->signal_quality_polling_supported = (MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality &&
MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality_finish);
/* Get plugin-specific setup for the polling logic */
g_object_get (self,
MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, &ctx->signal_quality_polling_disabled,
MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED, &ctx->access_technology_polling_disabled,
NULL);
g_object_set_qdata_full (G_OBJECT (self), signal_check_context_quark,
ctx, (GDestroyNotify) signal_check_context_free);
}
g_assert (ctx);
return ctx;
}
static void periodic_signal_check_disable (MMIfaceModem *self, static void periodic_signal_check_disable (MMIfaceModem *self,
gboolean clear); gboolean clear);
static gboolean periodic_signal_check_cb (MMIfaceModem *self); static gboolean periodic_signal_check_run (MMIfaceModem *self);
static void periodic_signal_check_step (MMIfaceModem *self); static void periodic_signal_check_step (GTask *task);
static void static void
access_technologies_check_ready (MMIfaceModem *self, load_access_technologies_ready (MMIfaceModem *self,
GAsyncResult *res) GAsyncResult *res,
GTask *task)
{ {
GError *error = NULL; g_autoptr(GError) error = NULL;
Private *priv;
SignalCheckContext *ctx; SignalCheckContext *ctx;
ctx = get_signal_check_context (self); priv = get_private (self);
ctx = g_task_get_task_data (task);
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies_finish ( if (!MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies_finish (
self, self,
@@ -1634,95 +1604,96 @@ access_technologies_check_ready (MMIfaceModem *self,
/* Did the plugin report that polling access technology is unsupported? */ /* Did the plugin report that polling access technology is unsupported? */
if (g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) { if (g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) {
mm_obj_dbg (self, "polling to refresh access technologies is unsupported"); mm_obj_dbg (self, "polling to refresh access technologies is unsupported");
ctx->access_technology_polling_supported = FALSE; priv->access_technology_polling_supported = FALSE;
} }
/* Ignore logging any message if the error is in 'in-progress' */ /* Ignore logging any message if the error is in 'in-progress' */
else if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS)) else if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS))
mm_obj_dbg (self, "couldn't refresh access technologies: %s", error->message); mm_obj_dbg (self, "couldn't refresh access technologies: %s", error->message);
g_error_free (error);
} }
/* We may have been disabled while this command was running. */ /* We may have been disabled while this command was running. */
else if (ctx->enabled) else if (priv->signal_check_enabled)
mm_iface_modem_update_access_technologies (self, ctx->access_technologies, ctx->access_technologies_mask); mm_iface_modem_update_access_technologies (self, ctx->access_technologies, ctx->access_technologies_mask);
/* Go on */ /* Go on */
ctx->running_step++; ctx->running_step++;
periodic_signal_check_step (self); periodic_signal_check_step (task);
} }
static void static void
signal_quality_check_ready (MMIfaceModem *self, load_signal_quality_ready (MMIfaceModem *self,
GAsyncResult *res) GAsyncResult *res,
GTask *task)
{ {
GError *error = NULL; g_autoptr(GError) error = NULL;
Private *priv;
SignalCheckContext *ctx; SignalCheckContext *ctx;
ctx = get_signal_check_context (self); priv = get_private (self);
ctx = g_task_get_task_data (task);
ctx->signal_quality = MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality_finish (self, res, &error); ctx->signal_quality = MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality_finish (self, res, &error);
if (error) { if (error) {
/* Did the plugin report that polling signal quality is unsupported? */ /* Did the plugin report that polling signal quality is unsupported? */
if (g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) { if (g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) {
mm_obj_dbg (self, "polling to refresh signal quality is unsupported"); mm_obj_dbg (self, "polling to refresh signal quality is unsupported");
ctx->signal_quality_polling_supported = FALSE; priv->signal_quality_polling_supported = FALSE;
} }
/* Ignore logging any message if the error is in 'in-progress' */ /* Ignore logging any message if the error is in 'in-progress' */
else if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS)) else if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS))
mm_obj_dbg (self, "couldn't refresh signal quality: %s", error->message); mm_obj_dbg (self, "couldn't refresh signal quality: %s", error->message);
g_error_free (error);
} }
/* We may have been disabled while this command was running. */ /* We may have been disabled while this command was running. */
else if (ctx->enabled) else if (priv->signal_check_enabled)
update_signal_quality (self, ctx->signal_quality, TRUE); update_signal_quality (self, ctx->signal_quality, TRUE);
/* Go on */ /* Go on */
ctx->running_step++; ctx->running_step++;
periodic_signal_check_step (self); periodic_signal_check_step (task);
} }
static void static void
periodic_signal_check_step (MMIfaceModem *self) periodic_signal_check_step (GTask *task)
{ {
MMIfaceModem *self;
Private *priv;
SignalCheckContext *ctx; SignalCheckContext *ctx;
ctx = get_signal_check_context (self); self = g_task_get_source_object (task);
priv = get_private (self);
ctx = g_task_get_task_data (task);
switch (ctx->running_step) { switch (ctx->running_step) {
case SIGNAL_CHECK_STEP_NONE:
g_assert_not_reached ();
case SIGNAL_CHECK_STEP_FIRST: case SIGNAL_CHECK_STEP_FIRST:
ctx->running_step++; ctx->running_step++;
/* fall-through */ /* fall-through */
case SIGNAL_CHECK_STEP_SIGNAL_QUALITY: case SIGNAL_CHECK_STEP_SIGNAL_QUALITY:
if (ctx->enabled && ctx->signal_quality_polling_supported && if (priv->signal_check_enabled && priv->signal_quality_polling_supported &&
(!ctx->initial_check_done || !ctx->signal_quality_polling_disabled)) { (!priv->signal_check_initial_done || !priv->signal_quality_polling_disabled)) {
MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality ( MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality (
self, (GAsyncReadyCallback)signal_quality_check_ready, NULL); self, (GAsyncReadyCallback)load_signal_quality_ready, task);
return; return;
} }
ctx->running_step++; ctx->running_step++;
/* fall-through */ /* fall-through */
case SIGNAL_CHECK_STEP_ACCESS_TECHNOLOGIES: case SIGNAL_CHECK_STEP_ACCESS_TECHNOLOGIES:
if (ctx->enabled && ctx->access_technology_polling_supported && if (priv->signal_check_enabled && priv->access_technology_polling_supported &&
(!ctx->initial_check_done || !ctx->access_technology_polling_disabled)) { (!priv->signal_check_initial_done || !priv->access_technology_polling_disabled)) {
MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies ( MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies (
self, (GAsyncReadyCallback)access_technologies_check_ready, NULL); self, (GAsyncReadyCallback)load_access_technologies_ready, task);
return; return;
} }
ctx->running_step++; ctx->running_step++;
/* fall-through */ /* fall-through */
case SIGNAL_CHECK_STEP_LAST: case SIGNAL_CHECK_STEP_LAST:
/* Flag as sequence finished */
ctx->running_step = SIGNAL_CHECK_STEP_NONE;
/* If we have been disabled while we were running the steps, we don't /* If we have been disabled while we were running the steps, we don't
* do anything else. */ * do anything else. */
if (!ctx->enabled) { if (!priv->signal_check_enabled) {
mm_obj_dbg (self, "periodic signal quality and access technology checks not rescheduled: disabled"); mm_obj_dbg (self, "periodic signal quality and access technology checks not rescheduled: disabled");
g_task_return_boolean (task, FALSE);
g_object_unref (task);
return; return;
} }
@@ -1731,38 +1702,40 @@ periodic_signal_check_step (MMIfaceModem *self)
* quality and access technology values. As soon as we get them, OR if * quality and access technology values. As soon as we get them, OR if
* we made too many retries at a high frequency, we fallback to the * we made too many retries at a high frequency, we fallback to the
* slower polling. */ * slower polling. */
if (!ctx->initial_check_done) { if (!priv->signal_check_initial_done) {
gboolean signal_quality_ready; gboolean signal_quality_ready;
gboolean access_technology_ready; gboolean access_technology_ready;
/* Signal quality is ready if unsupported or if we got a valid /* Signal quality is ready if unsupported or if we got a valid
* value reported */ * value reported */
signal_quality_ready = (!ctx->signal_quality_polling_supported || (ctx->signal_quality != 0)); signal_quality_ready = (!priv->signal_quality_polling_supported || (ctx->signal_quality != 0));
/* Access technology is ready if unsupported or if we got a valid /* Access technology is ready if unsupported or if we got a valid
* value reported */ * value reported */
access_technology_ready = (!ctx->access_technology_polling_supported || access_technology_ready = (!priv->access_technology_polling_supported ||
((ctx->access_technologies & ctx->access_technologies_mask) != MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN)); ((ctx->access_technologies & ctx->access_technologies_mask) != MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN));
ctx->initial_check_done = ((signal_quality_ready && access_technology_ready) || (--ctx->initial_retries == 0)); priv->signal_check_initial_done = ((signal_quality_ready && access_technology_ready) || (--priv->signal_check_initial_retries == 0));
} }
/* After running the initial check, if both signal quality and access tech /* After running the initial check, if both signal quality and access tech
* loading are either disabled or unsupported, we'll stop polling completely, * loading are either disabled or unsupported, we'll stop polling completely,
* because they may be loaded asynchronously by unsolicited messages */ * because they may be loaded asynchronously by unsolicited messages */
if (ctx->initial_check_done && if (priv->signal_check_initial_done &&
(!ctx->signal_quality_polling_supported || ctx->signal_quality_polling_disabled) && (!priv->signal_quality_polling_supported || priv->signal_quality_polling_disabled) &&
(!ctx->access_technology_polling_supported || ctx->access_technology_polling_disabled)) { (!priv->access_technology_polling_supported || priv->access_technology_polling_disabled)) {
mm_obj_dbg (self, "periodic signal quality and access technology checks not rescheduled: unneeded or unsupported"); mm_obj_dbg (self, "periodic signal quality and access technology checks not rescheduled: unneeded or unsupported");
periodic_signal_check_disable (self, FALSE); periodic_signal_check_disable (self, FALSE);
return; } else {
mm_obj_dbg (self, "periodic signal quality and access technology checks scheduled");
g_assert (!priv->signal_check_timeout_source);
priv->signal_check_timeout_source = g_timeout_add_seconds (priv->signal_check_initial_done ? SIGNAL_CHECK_TIMEOUT_SEC : SIGNAL_CHECK_INITIAL_TIMEOUT_SEC,
(GSourceFunc) periodic_signal_check_run,
self);
} }
mm_obj_dbg (self, "periodic signal quality and access technology checks scheduled"); g_task_return_boolean (task, TRUE);
g_assert (!ctx->timeout_source); g_object_unref (task);
ctx->timeout_source = g_timeout_add_seconds (ctx->initial_check_done ? SIGNAL_CHECK_TIMEOUT_SEC : SIGNAL_CHECK_INITIAL_TIMEOUT_SEC,
(GSourceFunc) periodic_signal_check_cb,
self);
return; return;
default: default:
@@ -1771,71 +1744,78 @@ periodic_signal_check_step (MMIfaceModem *self)
} }
static gboolean static gboolean
periodic_signal_check_cb (MMIfaceModem *self) periodic_signal_check_run (MMIfaceModem *self)
{ {
GTask *task;
SignalCheckContext *ctx; SignalCheckContext *ctx;
Private *priv;
ctx = get_signal_check_context (self); priv = get_private (self);
g_assert (ctx->enabled);
/* Start the sequence */ task = g_task_new (self, NULL, NULL, NULL);
ctx = g_new0 (SignalCheckContext, 1);
ctx->running_step = SIGNAL_CHECK_STEP_FIRST; ctx->running_step = SIGNAL_CHECK_STEP_FIRST;
ctx->signal_quality = 0; ctx->signal_quality = 0;
ctx->access_technologies = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN; ctx->access_technologies = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
ctx->access_technologies_mask = MM_MODEM_ACCESS_TECHNOLOGY_ANY; ctx->access_technologies_mask = MM_MODEM_ACCESS_TECHNOLOGY_ANY;
periodic_signal_check_step (self); g_task_set_task_data (task, ctx, (GDestroyNotify) g_free);
/* Remove the timeout and clear the source id */ periodic_signal_check_step (task);
if (ctx->timeout_source)
ctx->timeout_source = 0; /* Reset the source id as we're removing the timeout source */
if (priv->signal_check_timeout_source)
priv->signal_check_timeout_source = 0;
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
void void
mm_iface_modem_refresh_signal (MMIfaceModem *self) mm_iface_modem_refresh_signal (MMIfaceModem *self)
{ {
SignalCheckContext *ctx; Private *priv;
ctx = get_signal_check_context (self); priv = get_private (self);
/* Don't refresh polling if we're not enabled */ /* Don't refresh polling if we're not enabled */
if (!ctx->enabled) { if (!priv->signal_check_enabled) {
mm_obj_dbg (self, "periodic signal check refresh ignored: checks not enabled"); mm_obj_dbg (self, "periodic signal check refresh ignored: checks not enabled");
return; return;
} }
/* Don't refresh if we're already doing it */ /* Don't refresh if we're already doing it */
if (ctx->running_step != SIGNAL_CHECK_STEP_NONE) { if (priv->signal_check_running) {
mm_obj_dbg (self, "periodic signal check refresh ignored: check already running"); mm_obj_dbg (self, "periodic signal check refresh ignored: check already running");
return; return;
} }
mm_obj_dbg (self, "periodic signal check refresh requested"); mm_obj_dbg (self, "periodic signal check refresh requested");
priv->signal_check_running = TRUE;
/* Remove the scheduled timeout as we're going to refresh /* Remove the scheduled timeout as we're going to refresh
* right away */ * right away */
if (ctx->timeout_source) { if (priv->signal_check_timeout_source) {
g_source_remove (ctx->timeout_source); g_source_remove (priv->signal_check_timeout_source);
ctx->timeout_source = 0; priv->signal_check_timeout_source = 0;
} }
/* Reset refresh rate and initial retries when we're asked to refresh signal /* Reset refresh rate and initial retries when we're asked to refresh signal
* so that we poll at a higher frequency */ * so that we poll at a higher frequency */
ctx->initial_retries = SIGNAL_CHECK_INITIAL_RETRIES; priv->signal_check_initial_retries = SIGNAL_CHECK_INITIAL_RETRIES;
ctx->initial_check_done = FALSE; priv->signal_check_initial_done = FALSE;
/* Start sequence */ /* Start sequence */
periodic_signal_check_cb (self); periodic_signal_check_run (self);
} }
static void static void
periodic_signal_check_disable (MMIfaceModem *self, periodic_signal_check_disable (MMIfaceModem *self,
gboolean clear) gboolean clear)
{ {
SignalCheckContext *ctx; Private *priv;
ctx = get_signal_check_context (self); priv = get_private (self);
if (!ctx->enabled)
if (!priv->signal_check_enabled)
return; return;
/* Clear access technology and signal quality */ /* Clear access technology and signal quality */
@@ -1847,33 +1827,33 @@ periodic_signal_check_disable (MMIfaceModem *self,
} }
/* Remove scheduled timeout */ /* Remove scheduled timeout */
if (ctx->timeout_source) { if (priv->signal_check_timeout_source) {
g_source_remove (ctx->timeout_source); g_source_remove (priv->signal_check_timeout_source);
ctx->timeout_source = 0; priv->signal_check_timeout_source = 0;
} }
ctx->enabled = FALSE; priv->signal_check_enabled = FALSE;
mm_obj_dbg (self, "periodic signal checks disabled"); mm_obj_dbg (self, "periodic signal checks disabled");
} }
static void static void
periodic_signal_check_enable (MMIfaceModem *self) periodic_signal_check_enable (MMIfaceModem *self)
{ {
SignalCheckContext *ctx; Private *priv;
ctx = get_signal_check_context (self); priv = get_private (self);
/* If polling access technology and signal quality not supported, don't even /* If polling access technology and signal quality not supported, don't even
* bother trying. */ * bother trying. */
if (!ctx->signal_quality_polling_supported && !ctx->access_technology_polling_supported) { if (!priv->signal_quality_polling_supported && !priv->access_technology_polling_supported) {
mm_obj_dbg (self, "not enabling periodic signal checks: unsupported"); mm_obj_dbg (self, "not enabling periodic signal checks: unsupported");
return; return;
} }
/* Log and flag as enabled */ /* Log and flag as enabled */
if (!ctx->enabled) { if (!priv->signal_check_enabled) {
mm_obj_dbg (self, "periodic signal checks enabled"); mm_obj_dbg (self, "periodic signal checks enabled");
ctx->enabled = TRUE; priv->signal_check_enabled = TRUE;
} }
/* And refresh, which will trigger the first check at high frequency */ /* And refresh, which will trigger the first check at high frequency */