aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-11 16:24:29 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:49 +0100
commita0255273f0195c234062f326dfdc46c45d3116eb (patch)
tree1b054e64b3a8f364ffade0012c1bcea1321e23f5 /src
parentcc4e469b1a91a5c1f247706acddebd406db46702 (diff)
iface-modem-cdma: let caller decide the maximum registration timeout
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c9
-rw-r--r--src/mm-iface-modem-cdma.c2
-rw-r--r--src/mm-iface-modem-cdma.h2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index a5d3e4aa..3fa7661a 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -3791,15 +3791,12 @@ modem_cdma_setup_registration_checks (MMIfaceModemCdma *self,
/*****************************************************************************/
/* Register in network (CDMA interface) */
-/* Maximum time to wait for a successful registration when polling
- * periodically */
-#define MAX_CDMA_REGISTRATION_CHECK_WAIT_TIME 60
-
typedef struct {
MMBroadbandModem *self;
GSimpleAsyncResult *result;
GCancellable *cancellable;
GTimer *timer;
+ guint max_registration_time;
} RegisterInCdmaNetworkContext;
static void
@@ -3893,7 +3890,7 @@ run_all_cdma_registration_checks_ready (MMBroadbandModem *self,
}
/* Don't spend too much time waiting to get registered */
- if (g_timer_elapsed (ctx->timer, NULL) > MAX_CDMA_REGISTRATION_CHECK_WAIT_TIME) {
+ if (g_timer_elapsed (ctx->timer, NULL) > ctx->max_registration_time) {
mm_dbg ("CDMA registration check timed out");
mm_iface_modem_cdma_update_cdma1x_registration_state (
MM_IFACE_MODEM_CDMA (self),
@@ -3919,6 +3916,7 @@ run_all_cdma_registration_checks_ready (MMBroadbandModem *self,
static void
modem_cdma_register_in_network (MMIfaceModemCdma *self,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -3933,6 +3931,7 @@ modem_cdma_register_in_network (MMIfaceModemCdma *self,
ctx = g_new0 (RegisterInCdmaNetworkContext, 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,
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c
index ecac9282..c2f721f5 100644
--- a/src/mm-iface-modem-cdma.c
+++ b/src/mm-iface-modem-cdma.c
@@ -401,6 +401,7 @@ register_in_network_ready (MMIfaceModemCdma *self,
void
mm_iface_modem_cdma_register_in_network (MMIfaceModemCdma *self,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -412,6 +413,7 @@ mm_iface_modem_cdma_register_in_network (MMIfaceModemCdma *self,
mm_iface_modem_cdma_register_in_network);
MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->register_in_network (
self,
+ max_registration_time,
(GAsyncReadyCallback)register_in_network_ready,
result);
}
diff --git a/src/mm-iface-modem-cdma.h b/src/mm-iface-modem-cdma.h
index 00289c55..d8ffeafc 100644
--- a/src/mm-iface-modem-cdma.h
+++ b/src/mm-iface-modem-cdma.h
@@ -142,6 +142,7 @@ struct _MMIfaceModemCdma {
/* Try to register in the CDMA network */
void (* register_in_network) (MMIfaceModemCdma *self,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*register_in_network_finish) (MMIfaceModemCdma *self,
@@ -224,6 +225,7 @@ gboolean mm_iface_modem_cdma_run_all_registration_checks_finish (MMIfaceModemCdm
/* Register in network */
void mm_iface_modem_cdma_register_in_network (MMIfaceModemCdma *self,
+ guint max_registration_time,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_iface_modem_cdma_register_in_network_finish (MMIfaceModemCdma *self,