diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-05-29 10:47:53 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-06-05 19:15:14 +0200 |
commit | 212d00c529ee07131bf3b71a8759dca49292c059 (patch) | |
tree | f84e015d4e2b676c865b68e408651623a317dc2e /src | |
parent | 4dc8d1ff3a88a54707e75859619b020780de2f79 (diff) |
api,instrospection: rename 'Bands' to 'CurrentBands'
... and 'SetBands()' to 'SetCurrentBands()'.
We'll keep the 'Current' keyword in those properties which also have
'Supported' values.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 22 | ||||
-rw-r--r-- | src/mm-iface-modem-simple.c | 32 | ||||
-rw-r--r-- | src/mm-iface-modem.c | 136 | ||||
-rw-r--r-- | src/mm-iface-modem.h | 30 |
4 files changed, 109 insertions, 111 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index b42373cb..77d93754 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -1610,12 +1610,12 @@ modem_load_current_bands (MMIfaceModem *self, } /*****************************************************************************/ -/* Set bands (Modem interface) */ +/* Set current bands (Modem interface) */ static gboolean -set_bands_finish (MMIfaceModem *self, - GAsyncResult *res, - GError **error) +set_current_bands_finish (MMIfaceModem *self, + GAsyncResult *res, + GError **error) { return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); } @@ -1648,10 +1648,10 @@ bands_set_system_selection_preference_ready (QmiClientNas *client, } static void -set_bands (MMIfaceModem *_self, - GArray *bands_array, - GAsyncReadyCallback callback, - gpointer user_data) +set_current_bands (MMIfaceModem *_self, + GArray *bands_array, + GAsyncReadyCallback callback, + gpointer user_data) { MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self); QmiMessageNasSetSystemSelectionPreferenceInput *input; @@ -1668,7 +1668,7 @@ set_bands (MMIfaceModem *_self, result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - set_bands); + set_current_bands); /* Handle ANY separately */ if (bands_array->len == 1 && @@ -8145,8 +8145,8 @@ iface_modem_init (MMIfaceModem *iface) iface->load_signal_quality_finish = load_signal_quality_finish; iface->load_current_bands = modem_load_current_bands; iface->load_current_bands_finish = modem_load_current_bands_finish; - iface->set_bands = set_bands; - iface->set_bands_finish = set_bands_finish; + iface->set_current_bands = set_current_bands; + iface->set_current_bands_finish = set_current_bands_finish; /* Don't try to load access technologies, as we would be using parent's * generic method (QCDM based). Access technologies are already reported via diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index 773d091d..0ab46567 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -175,7 +175,7 @@ typedef enum { CONNECTION_STEP_ENABLE, CONNECTION_STEP_WAIT_FOR_ENABLED, CONNECTION_STEP_ALLOWED_MODES, - CONNECTION_STEP_BANDS, + CONNECTION_STEP_CURRENT_BANDS, CONNECTION_STEP_REGISTER, CONNECTION_STEP_BEARER, CONNECTION_STEP_CONNECT, @@ -313,7 +313,7 @@ set_allowed_modes_ready (MMBaseModem *self, } static gboolean -after_set_bands_timeout_cb (ConnectionContext *ctx) +after_set_current_bands_timeout_cb (ConnectionContext *ctx) { /* Bands set... almost there! */ ctx->step++; @@ -322,13 +322,13 @@ after_set_bands_timeout_cb (ConnectionContext *ctx) } static void -set_bands_ready (MMBaseModem *self, - GAsyncResult *res, - ConnectionContext *ctx) +set_current_bands_ready (MMBaseModem *self, + GAsyncResult *res, + ConnectionContext *ctx) { GError *error = NULL; - if (!mm_iface_modem_set_bands_finish (MM_IFACE_MODEM (self), res, &error)) { + 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)) { @@ -347,7 +347,7 @@ set_bands_ready (MMBaseModem *self, * 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_bands_timeout_cb, ctx); + g_timeout_add_seconds (2, (GSourceFunc)after_set_current_bands_timeout_cb, ctx); } static void @@ -579,17 +579,15 @@ connection_step (ConnectionContext *ctx) ctx->step++; } - case CONNECTION_STEP_BANDS: { + case CONNECTION_STEP_CURRENT_BANDS: { const MMModemBand *bands = NULL; guint n_bands = 0; - mm_info ("Simple connect state (%d/%d): Bands", + 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_bands (ctx->properties, - &bands, - &n_bands)) { + if (mm_simple_connect_properties_get_current_bands (ctx->properties, &bands, &n_bands)) { GArray *array; guint i; @@ -598,10 +596,10 @@ connection_step (ConnectionContext *ctx) for (i = 0; i < n_bands; i++) g_array_insert_val (array, i, bands[i]); - mm_iface_modem_set_bands (MM_IFACE_MODEM (ctx->self), - array, - (GAsyncReadyCallback)set_bands_ready, - ctx); + mm_iface_modem_set_current_bands (MM_IFACE_MODEM (ctx->self), + array, + (GAsyncReadyCallback)set_current_bands_ready, + ctx); g_array_unref (array); return; } @@ -804,7 +802,7 @@ connect_auth_ready (MMBaseModem *self, mm_dbg (" Preferred mode: %s", VALIDATE_UNSPECIFIED (NULL)); } - if (mm_simple_connect_properties_get_bands (ctx->properties, &bands, &n_bands)) { + 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); diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 54340880..8e264629 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -66,8 +66,8 @@ mm_iface_modem_bind_simple_status (MMIfaceModem *self, status, MM_SIMPLE_PROPERTY_SIGNAL_QUALITY, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); - g_object_bind_property (skeleton, "bands", - status, MM_SIMPLE_PROPERTY_BANDS, + g_object_bind_property (skeleton, "current-bands", + status, MM_SIMPLE_PROPERTY_CURRENT_BANDS, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "access-technologies", @@ -1791,17 +1791,17 @@ handle_factory_reset (MmGdbusModem *skeleton, } /*****************************************************************************/ -/* BANDS */ +/* Current bands setting */ typedef struct { MMIfaceModem *self; MmGdbusModem *skeleton; GSimpleAsyncResult *result; GArray *bands_array; -} SetBandsContext; +} SetCurrentBandsContext; static void -set_bands_context_complete_and_free (SetBandsContext *ctx) +set_current_bands_context_complete_and_free (SetCurrentBandsContext *ctx) { g_simple_async_result_complete_in_idle (ctx->result); g_object_unref (ctx->result); @@ -1810,25 +1810,25 @@ set_bands_context_complete_and_free (SetBandsContext *ctx) g_object_unref (ctx->skeleton); if (ctx->bands_array) g_array_unref (ctx->bands_array); - g_free (ctx); + g_slice_free (SetCurrentBandsContext, ctx); } gboolean -mm_iface_modem_set_bands_finish (MMIfaceModem *self, - GAsyncResult *res, - GError **error) +mm_iface_modem_set_current_bands_finish (MMIfaceModem *self, + GAsyncResult *res, + GError **error) { return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); } static void -set_bands_ready (MMIfaceModem *self, - GAsyncResult *res, - SetBandsContext *ctx) +set_current_bands_ready (MMIfaceModem *self, + GAsyncResult *res, + SetCurrentBandsContext *ctx) { GError *error = NULL; - if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands_finish (self, res, &error)) + if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_bands_finish (self, res, &error)) g_simple_async_result_take_error (ctx->result, error); else { /* Never show just 'any' in the interface */ @@ -1838,17 +1838,17 @@ set_bands_ready (MMIfaceModem *self, supported_bands = (mm_common_bands_variant_to_garray ( mm_gdbus_modem_get_supported_bands (ctx->skeleton))); - mm_gdbus_modem_set_bands (ctx->skeleton, - mm_common_bands_garray_to_variant (supported_bands)); + mm_gdbus_modem_set_current_bands (ctx->skeleton, + mm_common_bands_garray_to_variant (supported_bands)); g_array_unref (supported_bands); } else - mm_gdbus_modem_set_bands (ctx->skeleton, - mm_common_bands_garray_to_variant (ctx->bands_array)); + mm_gdbus_modem_set_current_bands (ctx->skeleton, + mm_common_bands_garray_to_variant (ctx->bands_array)); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); } - set_bands_context_complete_and_free (ctx); + set_current_bands_context_complete_and_free (ctx); } static gboolean @@ -1910,20 +1910,20 @@ validate_bands (const GArray *supported_bands_array, } void -mm_iface_modem_set_bands (MMIfaceModem *self, - GArray *bands_array, - GAsyncReadyCallback callback, - gpointer user_data) +mm_iface_modem_set_current_bands (MMIfaceModem *self, + GArray *bands_array, + GAsyncReadyCallback callback, + gpointer user_data) { - SetBandsContext *ctx; + SetCurrentBandsContext *ctx; GArray *supported_bands_array; GArray *current_bands_array; GError *error = NULL; gchar *bands_string; /* If setting allowed bands is not implemented, report an error */ - if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands || - !MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands_finish) { + if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_bands || + !MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_bands_finish) { g_simple_async_report_error_in_idle (G_OBJECT (self), callback, user_data, @@ -1934,12 +1934,12 @@ mm_iface_modem_set_bands (MMIfaceModem *self, } /* Setup context */ - ctx = g_new0 (SetBandsContext, 1); + ctx = g_slice_new0 (SetCurrentBandsContext); ctx->self = g_object_ref (self); ctx->result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - mm_iface_modem_set_bands); + mm_iface_modem_set_current_bands); g_object_get (self, MM_IFACE_MODEM_DBUS_SKELETON, &ctx->skeleton, NULL); @@ -1948,7 +1948,7 @@ mm_iface_modem_set_bands (MMIfaceModem *self, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Couldn't get interface skeleton"); - set_bands_context_complete_and_free (ctx); + set_current_bands_context_complete_and_free (ctx); return; } @@ -1986,7 +1986,7 @@ mm_iface_modem_set_bands (MMIfaceModem *self, /* Simply return if target list of bands equals to current list of bands */ current_bands_array = (mm_common_bands_variant_to_garray ( - mm_gdbus_modem_get_bands (ctx->skeleton))); + mm_gdbus_modem_get_current_bands (ctx->skeleton))); if (mm_common_bands_garray_cmp (ctx->bands_array, current_bands_array)) { mm_dbg ("Requested list of bands (%s) is equal to the current ones, skipping re-set", bands_string); @@ -1994,7 +1994,7 @@ mm_iface_modem_set_bands (MMIfaceModem *self, g_array_unref (supported_bands_array); g_array_unref (current_bands_array); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); - set_bands_context_complete_and_free (ctx); + set_current_bands_context_complete_and_free (ctx); return; } @@ -2015,15 +2015,15 @@ mm_iface_modem_set_bands (MMIfaceModem *self, g_array_unref (supported_bands_array); g_array_unref (current_bands_array); g_simple_async_result_take_error (ctx->result, error); - set_bands_context_complete_and_free (ctx); + set_current_bands_context_complete_and_free (ctx); return; } mm_dbg ("Setting new list of bands: '%s'", bands_string); - MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands ( + MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_bands ( self, ctx->bands_array, - (GAsyncReadyCallback)set_bands_ready, + (GAsyncReadyCallback)set_current_bands_ready, ctx); g_array_unref (supported_bands_array); @@ -2036,37 +2036,37 @@ typedef struct { GDBusMethodInvocation *invocation; MMIfaceModem *self; GVariant *bands; -} HandleSetBandsContext; +} HandleSetCurrentBandsContext; static void -handle_set_bands_context_free (HandleSetBandsContext *ctx) +handle_set_current_bands_context_free (HandleSetCurrentBandsContext *ctx) { g_variant_unref (ctx->bands); g_object_unref (ctx->skeleton); g_object_unref (ctx->invocation); g_object_unref (ctx->self); - g_free (ctx); + g_slice_free (HandleSetCurrentBandsContext, ctx); } static void -handle_set_bands_ready (MMIfaceModem *self, - GAsyncResult *res, - HandleSetBandsContext *ctx) +handle_set_current_bands_ready (MMIfaceModem *self, + GAsyncResult *res, + HandleSetCurrentBandsContext *ctx) { GError *error = NULL; - if (!mm_iface_modem_set_bands_finish (self, res, &error)) + if (!mm_iface_modem_set_current_bands_finish (self, res, &error)) g_dbus_method_invocation_take_error (ctx->invocation, error); else - mm_gdbus_modem_complete_set_bands (ctx->skeleton, ctx->invocation); + mm_gdbus_modem_complete_set_current_bands (ctx->skeleton, ctx->invocation); - handle_set_bands_context_free (ctx); + handle_set_current_bands_context_free (ctx); } static void -handle_set_bands_auth_ready (MMBaseModem *self, - GAsyncResult *res, - HandleSetBandsContext *ctx) +handle_set_current_bands_auth_ready (MMBaseModem *self, + GAsyncResult *res, + HandleSetCurrentBandsContext *ctx) { GArray *bands_array; MMModemState modem_state; @@ -2074,7 +2074,7 @@ handle_set_bands_auth_ready (MMBaseModem *self, if (!mm_base_modem_authorize_finish (self, res, &error)) { g_dbus_method_invocation_take_error (ctx->invocation, error); - handle_set_bands_context_free (ctx); + handle_set_current_bands_context_free (ctx); return; } @@ -2087,29 +2087,29 @@ handle_set_bands_auth_ready (MMBaseModem *self, g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE, - "Cannot set allowed bands: " + "Cannot set current bands: " "not initialized/unlocked yet"); - handle_set_bands_context_free (ctx); + handle_set_current_bands_context_free (ctx); return; } bands_array = mm_common_bands_variant_to_garray (ctx->bands); - mm_iface_modem_set_bands (MM_IFACE_MODEM (self), - bands_array, - (GAsyncReadyCallback)handle_set_bands_ready, - ctx); + mm_iface_modem_set_current_bands (MM_IFACE_MODEM (self), + bands_array, + (GAsyncReadyCallback)handle_set_current_bands_ready, + ctx); g_array_unref (bands_array); } static gboolean -handle_set_bands (MmGdbusModem *skeleton, - GDBusMethodInvocation *invocation, - GVariant *bands_variant, - MMIfaceModem *self) +handle_set_current_bands (MmGdbusModem *skeleton, + GDBusMethodInvocation *invocation, + GVariant *bands_variant, + MMIfaceModem *self) { - HandleSetBandsContext *ctx; + HandleSetCurrentBandsContext *ctx; - ctx = g_new (HandleSetBandsContext, 1); + ctx = g_slice_new (HandleSetCurrentBandsContext); ctx->skeleton = g_object_ref (skeleton); ctx->invocation = g_object_ref (invocation); ctx->self = g_object_ref (self); @@ -2118,7 +2118,7 @@ handle_set_bands (MmGdbusModem *skeleton, mm_base_modem_authorize (MM_BASE_MODEM (self), invocation, MM_AUTHORIZATION_DEVICE_CONTROL, - (GAsyncReadyCallback)handle_set_bands_auth_ready, + (GAsyncReadyCallback)handle_set_current_bands_auth_ready, ctx); return TRUE; } @@ -3002,7 +3002,7 @@ interface_disabling_step (DisablingContext *ctx) case DISABLING_STEP_CURRENT_BANDS: /* Clear current bands */ - mm_gdbus_modem_set_bands (ctx->skeleton, mm_common_build_bands_unknown ()); + mm_gdbus_modem_set_current_bands (ctx->skeleton, mm_common_build_bands_unknown ()); /* Fall down to next step */ ctx->step++; @@ -3244,11 +3244,11 @@ load_current_bands_ready (MMIfaceModem *self, g_array_unref (supported_bands); if (filtered_bands) { - mm_gdbus_modem_set_bands (ctx->skeleton, - mm_common_bands_garray_to_variant (filtered_bands)); + mm_gdbus_modem_set_current_bands (ctx->skeleton, + mm_common_bands_garray_to_variant (filtered_bands)); g_array_unref (filtered_bands); } else - mm_gdbus_modem_set_bands (ctx->skeleton, mm_common_build_bands_unknown ()); + mm_gdbus_modem_set_current_bands (ctx->skeleton, mm_common_build_bands_unknown ()); /* Errors when getting current bands won't be critical */ if (error) { @@ -3381,7 +3381,7 @@ interface_enabling_step (EnablingContext *ctx) ctx); return; } else - mm_gdbus_modem_set_bands (ctx->skeleton, mm_common_build_bands_unknown ()); + mm_gdbus_modem_set_current_bands (ctx->skeleton, mm_common_build_bands_unknown ()); /* Fall down to next step */ ctx->step++; @@ -4049,7 +4049,7 @@ interface_initialization_step (InitializationContext *ctx) /* Loading supported bands not implemented, default to UNKNOWN */ mm_gdbus_modem_set_supported_bands (ctx->skeleton, mm_common_build_bands_unknown ()); - mm_gdbus_modem_set_bands (ctx->skeleton, mm_common_build_bands_unknown ()); + mm_gdbus_modem_set_current_bands (ctx->skeleton, mm_common_build_bands_unknown ()); } g_array_unref (supported_bands); @@ -4192,8 +4192,8 @@ interface_initialization_step (InitializationContext *ctx) G_CALLBACK (handle_factory_reset), ctx->self); g_signal_connect (ctx->skeleton, - "handle-set-bands", - G_CALLBACK (handle_set_bands), + "handle-set-current-bands", + G_CALLBACK (handle_set_current_bands), ctx->self); g_signal_connect (ctx->skeleton, "handle-set-allowed-modes", @@ -4261,7 +4261,7 @@ mm_iface_modem_initialize (MMIfaceModem *self, mm_gdbus_modem_set_allowed_modes (skeleton, MM_MODEM_MODE_NONE); mm_gdbus_modem_set_preferred_mode (skeleton, MM_MODEM_MODE_NONE); mm_gdbus_modem_set_supported_bands (skeleton, mm_common_build_bands_unknown ()); - mm_gdbus_modem_set_bands (skeleton, mm_common_build_bands_unknown ()); + mm_gdbus_modem_set_current_bands (skeleton, mm_common_build_bands_unknown ()); mm_gdbus_modem_set_supported_ip_families (skeleton, MM_BEARER_IP_FAMILY_NONE); mm_gdbus_modem_set_power_state (skeleton, MM_MODEM_POWER_STATE_UNKNOWN); mm_gdbus_modem_set_state_failed_reason (skeleton, MM_MODEM_STATE_FAILED_REASON_NONE); diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h index 5a41aa2a..f14f8cba 100644 --- a/src/mm-iface-modem.h +++ b/src/mm-iface-modem.h @@ -217,14 +217,14 @@ struct _MMIfaceModem { GAsyncResult *res, GError **error); - /* Asynchronous allowed band setting operation */ - void (*set_bands) (MMIfaceModem *self, - GArray *bands_array, - GAsyncReadyCallback callback, - gpointer user_data); - gboolean (*set_bands_finish) (MMIfaceModem *self, - GAsyncResult *res, - GError **error); + /* Asynchronous current band setting operation */ + void (*set_current_bands) (MMIfaceModem *self, + GArray *bands_array, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*set_current_bands_finish) (MMIfaceModem *self, + GAsyncResult *res, + GError **error); /* Asynchronous allowed mode setting operation */ void (*set_allowed_modes) (MMIfaceModem *self, @@ -428,13 +428,13 @@ gboolean mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self, GError **error); /* Allow setting bands */ -void mm_iface_modem_set_bands (MMIfaceModem *self, - GArray *bands_array, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean mm_iface_modem_set_bands_finish (MMIfaceModem *self, - GAsyncResult *res, - GError **error); +void mm_iface_modem_set_current_bands (MMIfaceModem *self, + GArray *bands_array, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean mm_iface_modem_set_current_bands_finish (MMIfaceModem *self, + GAsyncResult *res, + GError **error); /* Allow creating bearers */ void mm_iface_modem_create_bearer (MMIfaceModem *self, |