diff options
-rw-r--r-- | src/mm-iface-modem-cdma.c | 57 | ||||
-rw-r--r-- | src/mm-iface-modem-cdma.h | 16 |
2 files changed, 68 insertions, 5 deletions
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c index 53ab025f..ecac9282 100644 --- a/src/mm-iface-modem-cdma.c +++ b/src/mm-iface-modem-cdma.c @@ -370,6 +370,53 @@ handle_activate_manual (MmGdbusModemCdma *skeleton, } /*****************************************************************************/ +/* Register in the CDMA network. + * Note that the registration in the CDMA network is usually automatic; so this + * method will really just try to ensure the modem is registered. If not + * registered, it will wait until it is, up to N seconds. + */ + +gboolean +mm_iface_modem_cdma_register_in_network_finish (MMIfaceModemCdma *self, + GAsyncResult *res, + GError **error) +{ + return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); +} + +static void +register_in_network_ready (MMIfaceModemCdma *self, + GAsyncResult *res, + GSimpleAsyncResult *simple) +{ + GError *error = NULL; + + if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->register_in_network_finish (self, res, &error)) + g_simple_async_result_take_error (simple, error); + else + g_simple_async_result_set_op_res_gboolean (simple, TRUE); + g_simple_async_result_complete (simple); + g_object_unref (simple); +} + +void +mm_iface_modem_cdma_register_in_network (MMIfaceModemCdma *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GSimpleAsyncResult *result; + + result = g_simple_async_result_new (G_OBJECT (self), + callback, + user_data, + mm_iface_modem_cdma_register_in_network); + MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->register_in_network ( + self, + (GAsyncReadyCallback)register_in_network_ready, + result); +} + +/*****************************************************************************/ /* Create new CDMA bearer */ MMBearer * @@ -903,7 +950,7 @@ mm_iface_modem_cdma_run_all_registration_checks (MMIfaceModemCdma *self, MM_IFACE_MODEM_CDMA_CDMA1X_NETWORK_SUPPORTED, &ctx->cdma1x_supported, NULL); - mm_dbg ("Running registration checks (CDMA1x: '%s', EVDO: '%s')", + mm_dbg ("Running registration checks (CDMA1x: '%s', EV-DO: '%s')", ctx->cdma1x_supported ? "yes" : "no", ctx->evdo_supported ? "yes" : "no"); @@ -1578,8 +1625,8 @@ iface_modem_cdma_init (gpointer g_iface) g_object_interface_install_property (g_iface, g_param_spec_enum (MM_IFACE_MODEM_CDMA_EVDO_REGISTRATION_STATE, - "EVDO Registration State", - "Registration state of the modem in the EVDO network", + "EV-DO Registration State", + "Registration state of the modem in the EV-DO network", MM_TYPE_MODEM_CDMA_REGISTRATION_STATE, MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, G_PARAM_READWRITE)); @@ -1595,8 +1642,8 @@ iface_modem_cdma_init (gpointer g_iface) g_object_interface_install_property (g_iface, g_param_spec_boolean (MM_IFACE_MODEM_CDMA_EVDO_NETWORK_SUPPORTED, - "EVDO network supported", - "Whether the modem works in the EVDO network", + "EV-DO network supported", + "Whether the modem works in the EV-DO network", TRUE, G_PARAM_READWRITE)); initialized = TRUE; diff --git a/src/mm-iface-modem-cdma.h b/src/mm-iface-modem-cdma.h index 1a297ae5..00289c55 100644 --- a/src/mm-iface-modem-cdma.h +++ b/src/mm-iface-modem-cdma.h @@ -140,6 +140,14 @@ struct _MMIfaceModemCdma { MMModemCdmaRegistrationState *detailed_evdo_state, GError **error); + /* Try to register in the CDMA network */ + void (* register_in_network) (MMIfaceModemCdma *self, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*register_in_network_finish) (MMIfaceModemCdma *self, + GAsyncResult *res, + GError **error); + /* New CDMA bearer */ void (* bearer_new) (MMIfaceModemCdma *self, MMCommonBearerProperties *properties, @@ -214,6 +222,14 @@ gboolean mm_iface_modem_cdma_run_all_registration_checks_finish (MMIfaceModemCdm GAsyncResult *res, GError **error); +/* Register in network */ +void mm_iface_modem_cdma_register_in_network (MMIfaceModemCdma *self, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean mm_iface_modem_cdma_register_in_network_finish (MMIfaceModemCdma *self, + GAsyncResult *res, + GError **error); + /* Create new CDMA bearer */ void mm_iface_modem_cdma_create_bearer (MMIfaceModemCdma *self, MMCommonBearerProperties *properties, |