aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-simple.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-06-03 12:44:40 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-06-05 19:15:15 +0200
commit5b080915200d0ba5de28d50bb088eba0aef9b362 (patch)
tree7e7d8a785ecd9c05e1249bd4659963ae95a59a64 /src/mm-iface-modem-simple.c
parentb41278c423cb81547c65da46057912ad9372715d (diff)
api,introspection: Simple.Connect() won't change neither bands nor allowed modes
We won't allow changing modes or bands through Simple.Connect(). Applications should instead look at the corresponding SupportedBands or SupportedModes, and then use SetCurrentBands() or SetCurrentModes() explicitly.
Diffstat (limited to 'src/mm-iface-modem-simple.c')
-rw-r--r--src/mm-iface-modem-simple.c160
1 files changed, 0 insertions, 160 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c
index 5d1e1b21..bb850a18 100644
--- a/src/mm-iface-modem-simple.c
+++ b/src/mm-iface-modem-simple.c
@@ -174,8 +174,6 @@ typedef enum {
CONNECTION_STEP_WAIT_FOR_INITIALIZED,
CONNECTION_STEP_ENABLE,
CONNECTION_STEP_WAIT_FOR_ENABLED,
- CONNECTION_STEP_CURRENT_MODES,
- CONNECTION_STEP_CURRENT_BANDS,
CONNECTION_STEP_REGISTER,
CONNECTION_STEP_BEARER,
CONNECTION_STEP_CONNECT,
@@ -187,8 +185,6 @@ typedef struct {
GDBusMethodInvocation *invocation;
MMIfaceModemSimple *self;
ConnectionStep step;
- gulong state_changed_id;
- guint state_changed_wait_id;
/* Expected input properties */
GVariant *dictionary;
@@ -201,9 +197,6 @@ typedef struct {
static void
connection_context_free (ConnectionContext *ctx)
{
- g_assert (ctx->state_changed_id == 0);
- g_assert (ctx->state_changed_wait_id == 0);
-
g_variant_unref (ctx->dictionary);
if (ctx->properties)
g_object_unref (ctx->properties);
@@ -274,82 +267,6 @@ register_in_3gpp_or_cdma_network_ready (MMIfaceModemSimple *self,
connection_step (ctx);
}
-static gboolean
-after_set_current_modes_timeout_cb (ConnectionContext *ctx)
-{
- /* Allowed modes set... almost there! */
- ctx->step++;
- connection_step (ctx);
- return FALSE;
-}
-
-static void
-set_current_modes_ready (MMBaseModem *self,
- GAsyncResult *res,
- ConnectionContext *ctx)
-{
- GError *error = NULL;
-
- if (!mm_iface_modem_set_current_modes_finish (MM_IFACE_MODEM (self), res, &error)) {
- if (g_error_matches (error,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED)) {
- g_error_free (error);
- /* If setting bands is unsupported, keep on without sleep */
- ctx->step++;
- connection_step (ctx);
- } else {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
- connection_context_free (ctx);
- }
- return;
- }
-
- /* Setting allowed modes will reset the current registration, so we'll need
- * a couple of seconds to settle down. This sleep time just makes sure that
- * the modem has enough time to report being unregistered. */
- mm_dbg ("Will wait to settle down after updating allowed modes");
- g_timeout_add_seconds (2, (GSourceFunc)after_set_current_modes_timeout_cb, ctx);
-}
-
-static gboolean
-after_set_current_bands_timeout_cb (ConnectionContext *ctx)
-{
- /* Bands set... almost there! */
- ctx->step++;
- connection_step (ctx);
- return FALSE;
-}
-
-static void
-set_current_bands_ready (MMBaseModem *self,
- GAsyncResult *res,
- ConnectionContext *ctx)
-{
- GError *error = NULL;
-
- if (!mm_iface_modem_set_current_bands_finish (MM_IFACE_MODEM (self), res, &error)) {
- if (g_error_matches (error,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED)) {
- g_error_free (error);
- /* If setting bands is unsupported, keep on without sleep */
- ctx->step++;
- connection_step (ctx);
- } else {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
- connection_context_free (ctx);
- }
- return;
- }
-
- /* Setting bands will reset the current registration, so we'll need a couple
- * of seconds to settle down. This sleep time just makes sure that the modem
- * has enough time to report being unregistered. */
- mm_dbg ("Will wait to settle down after updating bands");
- g_timeout_add_seconds (2, (GSourceFunc)after_set_current_bands_timeout_cb, ctx);
-}
-
static void
wait_for_enabled_ready (MMIfaceModem *self,
GAsyncResult *res,
@@ -556,59 +473,6 @@ connection_step (ConnectionContext *ctx)
ctx);
return;
- case CONNECTION_STEP_CURRENT_MODES: {
- MMModemMode allowed_modes = MM_MODEM_MODE_ANY;
- MMModemMode preferred_mode = MM_MODEM_MODE_NONE;
-
- mm_info ("Simple connect state (%d/%d): Current modes",
- ctx->step, CONNECTION_STEP_LAST);
-
- /* Don't set modes unless explicitly requested to do so */
- if (mm_simple_connect_properties_get_current_modes (ctx->properties,
- &allowed_modes,
- &preferred_mode)) {
- mm_iface_modem_set_current_modes (MM_IFACE_MODEM (ctx->self),
- allowed_modes,
- preferred_mode,
- (GAsyncReadyCallback)set_current_modes_ready,
- ctx);
- return;
- }
-
- /* Fall down to next step */
- ctx->step++;
- }
-
- case CONNECTION_STEP_CURRENT_BANDS: {
- const MMModemBand *bands = NULL;
- guint n_bands = 0;
-
- mm_info ("Simple connect state (%d/%d): Current Bands",
- ctx->step, CONNECTION_STEP_LAST);
-
- /* Don't set bands unless explicitly requested to do so */
- if (mm_simple_connect_properties_get_current_bands (ctx->properties, &bands, &n_bands)) {
- GArray *array;
- guint i;
-
- if (bands && *bands) {
- array = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), n_bands);
- for (i = 0; i < n_bands; i++)
- g_array_insert_val (array, i, bands[i]);
-
- mm_iface_modem_set_current_bands (MM_IFACE_MODEM (ctx->self),
- array,
- (GAsyncReadyCallback)set_current_bands_ready,
- ctx);
- g_array_unref (array);
- return;
- }
- }
-
- /* Fall down to next step */
- ctx->step++;
- }
-
case CONNECTION_STEP_REGISTER:
mm_info ("Simple connect state (%d/%d): Register",
ctx->step, CONNECTION_STEP_LAST);
@@ -778,10 +642,6 @@ connect_auth_ready (MMBaseModem *self,
/* Log about all the parameters being used for the simple connect */
{
- const MMModemBand *bands;
- guint n_bands;
- MMModemMode allowed;
- MMModemMode preferred;
MMBearerAllowedAuth allowed_auth;
gchar *str;
MMBearerIpFamily ip_family;
@@ -790,25 +650,6 @@ connect_auth_ready (MMBaseModem *self,
mm_dbg (" PIN: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_pin (ctx->properties)));
- if (mm_simple_connect_properties_get_current_modes (ctx->properties, &allowed, &preferred)) {
- str = mm_modem_mode_build_string_from_mask (allowed);
- mm_dbg (" Allowed mode: %s", str);
- g_free (str);
- str = mm_modem_mode_build_string_from_mask (preferred);
- mm_dbg (" Preferred mode: %s", str);
- g_free (str);
- } else {
- mm_dbg (" Allowed mode: %s", VALIDATE_UNSPECIFIED (NULL));
- mm_dbg (" Preferred mode: %s", VALIDATE_UNSPECIFIED (NULL));
- }
-
- if (mm_simple_connect_properties_get_current_bands (ctx->properties, &bands, &n_bands)) {
- str = mm_common_build_bands_string (bands, n_bands);
- mm_dbg (" Bands: %s", str);
- g_free (str);
- } else
- mm_dbg (" Bands: %s", VALIDATE_UNSPECIFIED (NULL));
-
mm_dbg (" Operator ID: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_operator_id (ctx->properties)));
mm_dbg (" Allowed roaming: %s", mm_simple_connect_properties_get_allow_roaming (ctx->properties) ? "yes" : "no");
@@ -831,7 +672,6 @@ connect_auth_ready (MMBaseModem *self,
} else
mm_dbg (" Allowed authentication: %s", VALIDATE_UNSPECIFIED (NULL));
-
mm_dbg (" User: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_user (ctx->properties)));
mm_dbg (" Password: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_password (ctx->properties)));