aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-11 16:24:02 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:49 +0100
commitcc4e469b1a91a5c1f247706acddebd406db46702 (patch)
treed390c556667139c562f01458d5275c19b2178aad /src
parent787a651f198c1c85635e1f8598d4ffb9752d1dd4 (diff)
iface-modem-3gpp: let caller decide the maximum registration timeout
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c15
-rw-r--r--src/mm-iface-modem-3gpp.c7
-rw-r--r--src/mm-iface-modem-3gpp.h4
3 files changed, 15 insertions, 11 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 36a4223e..a5d3e4aa 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -2101,15 +2101,12 @@ modem_3gpp_scan_networks (MMIfaceModem3gpp *self,
/*****************************************************************************/
/* Register in network (3GPP interface) */
-/* Maximum time to wait for a successful registration when polling
- * periodically */
-#define MAX_3GPP_REGISTRATION_CHECK_WAIT_TIME 60
-
typedef struct {
MMBroadbandModem *self;
GSimpleAsyncResult *result;
GCancellable *cancellable;
GTimer *timer;
+ guint max_registration_time;
} RegisterIn3gppNetworkContext;
static void
@@ -2199,7 +2196,7 @@ run_all_3gpp_registration_checks_ready (MMBroadbandModem *self,
}
/* Don't spend too much time waiting to get registered */
- if (g_timer_elapsed (ctx->timer, NULL) > MAX_3GPP_REGISTRATION_CHECK_WAIT_TIME) {
+ if (g_timer_elapsed (ctx->timer, NULL) > ctx->max_registration_time) {
mm_dbg ("3GPP registration check timed out");
mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self),
MM_MODEM_3GPP_REGISTRATION_STATE_IDLE,
@@ -2258,7 +2255,8 @@ register_in_3gpp_network_ready (MMBroadbandModem *self,
static void
modem_3gpp_register_in_network (MMIfaceModem3gpp *self,
- const gchar *network_id,
+ const gchar *operator_id,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -2274,6 +2272,7 @@ modem_3gpp_register_in_network (MMIfaceModem3gpp *self,
ctx = g_new0 (RegisterIn3gppNetworkContext, 1);
ctx->self = g_object_ref (self);
+ ctx->max_registration_time = max_registration_time;
ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback,
user_data,
@@ -2286,8 +2285,8 @@ modem_3gpp_register_in_network (MMIfaceModem3gpp *self,
g_object_ref (ctx->cancellable);
/* If the user sent a specific network to use, lock it in. */
- if (network_id && network_id[0]) {
- command = g_strdup_printf ("+COPS=1,2,\"%s\"", network_id);
+ if (operator_id && operator_id[0]) {
+ command = g_strdup_printf ("+COPS=1,2,\"%s\"", operator_id);
broadband->priv->modem_3gpp_manual_registration = TRUE;
}
/* If no specific network was given, and the modem is not registered and not
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index 54c02c58..18f71e7d 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -124,6 +124,7 @@ register_in_network_ready (MMIfaceModem3gpp *self,
void
mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self,
const gchar *operator_id,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -136,6 +137,7 @@ mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self,
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->register_in_network (
self,
operator_id,
+ max_registration_time,
(GAsyncReadyCallback)register_in_network_ready,
result);
}
@@ -161,7 +163,7 @@ handle_register_ready (MMIfaceModem3gpp *self,
static gboolean
handle_register (MmGdbusModem3gpp *skeleton,
GDBusMethodInvocation *invocation,
- const gchar *network_id,
+ const gchar *operator_id,
MMIfaceModem3gpp *self)
{
MMModemState modem_state;
@@ -191,7 +193,8 @@ handle_register (MmGdbusModem3gpp *skeleton,
case MM_MODEM_STATE_SEARCHING:
case MM_MODEM_STATE_REGISTERED:
mm_iface_modem_3gpp_register_in_network (self,
- network_id,
+ operator_id,
+ 60,
(GAsyncReadyCallback)handle_register_ready,
dbus_call_context_new (skeleton,
invocation,
diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h
index b7523477..ded5e61c 100644
--- a/src/mm-iface-modem-3gpp.h
+++ b/src/mm-iface-modem-3gpp.h
@@ -140,7 +140,8 @@ struct _MMIfaceModem3gpp {
/* Try to register in the network */
void (* register_in_network) (MMIfaceModem3gpp *self,
- const gchar *network_id,
+ const gchar *operator_id,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*register_in_network_finish) (MMIfaceModem3gpp *self,
@@ -244,6 +245,7 @@ gboolean mm_iface_modem_3gpp_register_in_network_finish (MMIfaceModem3gpp *self,
GError **error);
void mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self,
const gchar *operator_id,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data);