diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem.c | 31 | ||||
-rw-r--r-- | src/mm-iface-modem.h | 3 |
2 files changed, 29 insertions, 5 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 9228bebf..c0241977 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -964,6 +964,30 @@ periodic_access_technologies_check (MMIfaceModem *self) return TRUE; } +void +mm_iface_modem_refresh_access_technologies (MMIfaceModem *self) +{ + AccessTechnologiesCheckContext *ctx; + + if (G_UNLIKELY (!access_technologies_check_context_quark)) + access_technologies_check_context_quark = (g_quark_from_static_string ( + ACCESS_TECHNOLOGIES_CHECK_CONTEXT_TAG)); + + ctx = g_object_get_qdata (G_OBJECT (self), access_technologies_check_context_quark); + if (!ctx) + return; + + /* Re-set timeout */ + if (ctx->timeout_source) + g_source_remove (ctx->timeout_source); + ctx->timeout_source = g_timeout_add_seconds (ACCESS_TECHNOLOGIES_CHECK_TIMEOUT_SEC, + (GSourceFunc)periodic_access_technologies_check, + self); + + /* Get first access technology value */ + periodic_access_technologies_check (self); +} + static void periodic_access_technologies_check_disable (MMIfaceModem *self) { @@ -1011,16 +1035,13 @@ periodic_access_technologies_check_enable (MMIfaceModem *self) /* Create context and keep it as object data */ mm_dbg ("Periodic access technology checks enabled"); ctx = g_new0 (AccessTechnologiesCheckContext, 1); - ctx->timeout_source = g_timeout_add_seconds (ACCESS_TECHNOLOGIES_CHECK_TIMEOUT_SEC, - (GSourceFunc)periodic_access_technologies_check, - self); g_object_set_qdata_full (G_OBJECT (self), access_technologies_check_context_quark, ctx, (GDestroyNotify)access_technologies_check_context_free); - /* Get first access technology value */ - periodic_access_technologies_check (self); + /* Get first and setup timeout */ + mm_iface_modem_refresh_access_technologies (self); } /*****************************************************************************/ diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h index 265b965b..5ff26d97 100644 --- a/src/mm-iface-modem.h +++ b/src/mm-iface-modem.h @@ -435,6 +435,9 @@ void mm_iface_modem_update_access_technologies (MMIfaceModem *self, MMModemAccessTechnology access_tech, guint32 mask); +/* Allow requesting to refresh access tech */ +void mm_iface_modem_refresh_access_technologies (MMIfaceModem *self); + /* Allow updating signal quality */ void mm_iface_modem_update_signal_quality (MMIfaceModem *self, guint signal_quality); |