api,instrospection: rename 'Bands' to 'CurrentBands'

... and 'SetBands()' to 'SetCurrentBands()'.

We'll keep the 'Current' keyword in those properties which also have
'Supported' values.
This commit is contained in:
Aleksander Morgado
2013-05-29 10:47:53 +02:00
parent 4dc8d1ff3a
commit 212d00c529
19 changed files with 406 additions and 409 deletions

View File

@@ -234,7 +234,7 @@ status_process_reply (MMSimpleStatus *result,
signal_quality = (mm_simple_status_get_signal_quality ( signal_quality = (mm_simple_status_get_signal_quality (
result, result,
&signal_quality_recent)); &signal_quality_recent));
mm_simple_status_get_bands (result, &bands, &n_bands); mm_simple_status_get_current_bands (result, &bands, &n_bands);
bands_str = mm_common_build_bands_string (bands, n_bands); bands_str = mm_common_build_bands_string (bands, n_bands);
access_tech_str = (mm_modem_access_technology_build_string_from_mask ( access_tech_str = (mm_modem_access_technology_build_string_from_mask (
mm_simple_status_get_access_technologies (result))); mm_simple_status_get_access_technologies (result)));

View File

@@ -59,7 +59,7 @@ static gchar *create_bearer_str;
static gchar *delete_bearer_str; static gchar *delete_bearer_str;
static gchar *set_allowed_modes_str; static gchar *set_allowed_modes_str;
static gchar *set_preferred_mode_str; static gchar *set_preferred_mode_str;
static gchar *set_bands_str; static gchar *set_current_bands_str;
static GOptionEntry entries[] = { static GOptionEntry entries[] = {
{ "monitor-state", 'w', 0, G_OPTION_ARG_NONE, &monitor_state_flag, { "monitor-state", 'w', 0, G_OPTION_ARG_NONE, &monitor_state_flag,
@@ -110,14 +110,14 @@ static GOptionEntry entries[] = {
"Set allowed modes in a given modem.", "Set allowed modes in a given modem.",
"[MODE1|MODE2...]" "[MODE1|MODE2...]"
}, },
{ "set-bands", 0, 0, G_OPTION_ARG_STRING, &set_bands_str,
"Set bands to be used by a given modem.",
"[BAND1|BAND2...]"
},
{ "set-preferred-mode", 0, 0, G_OPTION_ARG_STRING, &set_preferred_mode_str, { "set-preferred-mode", 0, 0, G_OPTION_ARG_STRING, &set_preferred_mode_str,
"Set preferred mode in a given modem (Must give allowed modes with --set-allowed-modes)", "Set preferred mode in a given modem (Must give allowed modes with --set-allowed-modes)",
"[MODE]" "[MODE]"
}, },
{ "set-current-bands", 0, 0, G_OPTION_ARG_STRING, &set_current_bands_str,
"Set bands to be used by a given modem.",
"[BAND1|BAND2...]"
},
{ NULL } { NULL }
}; };
@@ -159,7 +159,7 @@ mmcli_modem_options_enabled (void)
!!command_str + !!command_str +
!!set_allowed_modes_str + !!set_allowed_modes_str +
!!set_preferred_mode_str + !!set_preferred_mode_str +
!!set_bands_str); !!set_current_bands_str);
if (n_actions == 0 && mmcli_get_common_modem_string ()) { if (n_actions == 0 && mmcli_get_common_modem_string ()) {
/* default to info */ /* default to info */
@@ -242,13 +242,13 @@ print_modem_info (void)
gchar *allowed_modes_string; gchar *allowed_modes_string;
gchar *preferred_mode_string; gchar *preferred_mode_string;
gchar *supported_bands_string; gchar *supported_bands_string;
gchar *bands_string; gchar *current_bands_string;
gchar *supported_ip_families_string; gchar *supported_ip_families_string;
gchar *unlock_retries_string; gchar *unlock_retries_string;
gchar *own_numbers_string; gchar *own_numbers_string;
MMModemBand *bands = NULL; MMModemBand *bands = NULL;
MMUnlockRetries *unlock_retries;
guint n_bands = 0; guint n_bands = 0;
MMUnlockRetries *unlock_retries;
guint signal_quality = 0; guint signal_quality = 0;
gboolean signal_quality_recent = FALSE; gboolean signal_quality_recent = FALSE;
@@ -266,8 +266,8 @@ print_modem_info (void)
mm_modem_get_current_capabilities (ctx->modem)); mm_modem_get_current_capabilities (ctx->modem));
access_technologies_string = mm_modem_access_technology_build_string_from_mask ( access_technologies_string = mm_modem_access_technology_build_string_from_mask (
mm_modem_get_access_technologies (ctx->modem)); mm_modem_get_access_technologies (ctx->modem));
mm_modem_get_bands (ctx->modem, &bands, &n_bands); mm_modem_get_current_bands (ctx->modem, &bands, &n_bands);
bands_string = mm_common_build_bands_string (bands, n_bands); current_bands_string = mm_common_build_bands_string (bands, n_bands);
g_free (bands); g_free (bands);
mm_modem_get_supported_bands (ctx->modem, &bands, &n_bands); mm_modem_get_supported_bands (ctx->modem, &bands, &n_bands);
supported_bands_string = mm_common_build_bands_string (bands, n_bands); supported_bands_string = mm_common_build_bands_string (bands, n_bands);
@@ -384,7 +384,7 @@ print_modem_info (void)
" Bands | supported: '%s'\n" " Bands | supported: '%s'\n"
" | current: '%s'\n", " | current: '%s'\n",
VALIDATE_UNKNOWN (supported_bands_string), VALIDATE_UNKNOWN (supported_bands_string),
VALIDATE_UNKNOWN (bands_string)); VALIDATE_UNKNOWN (current_bands_string));
/* IP families */ /* IP families */
g_print (" -------------------------\n" g_print (" -------------------------\n"
@@ -459,7 +459,7 @@ print_modem_info (void)
g_print ("\n"); g_print ("\n");
g_free (supported_ip_families_string); g_free (supported_ip_families_string);
g_free (bands_string); g_free (current_bands_string);
g_free (supported_bands_string); g_free (supported_bands_string);
g_free (access_technologies_string); g_free (access_technologies_string);
g_free (modem_capabilities_string); g_free (modem_capabilities_string);
@@ -801,39 +801,39 @@ parse_modes (MMModemMode *allowed,
} }
static void static void
set_bands_process_reply (gboolean result, set_current_bands_process_reply (gboolean result,
const GError *error) const GError *error)
{ {
if (!result) { if (!result) {
g_printerr ("error: couldn't set bands: '%s'\n", g_printerr ("error: couldn't set current bands: '%s'\n",
error ? error->message : "unknown error"); error ? error->message : "unknown error");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
g_print ("successfully set bands in the modem\n"); g_print ("successfully set current bands in the modem\n");
} }
static void static void
set_bands_ready (MMModem *modem, set_current_bands_ready (MMModem *modem,
GAsyncResult *result, GAsyncResult *result,
gpointer nothing) gpointer nothing)
{ {
gboolean operation_result; gboolean operation_result;
GError *error = NULL; GError *error = NULL;
operation_result = mm_modem_set_bands_finish (modem, result, &error); operation_result = mm_modem_set_current_bands_finish (modem, result, &error);
set_bands_process_reply (operation_result, error); set_current_bands_process_reply (operation_result, error);
mmcli_async_operation_done (); mmcli_async_operation_done ();
} }
static void static void
parse_bands (MMModemBand **bands, parse_current_bands (MMModemBand **bands,
guint *n_bands) guint *n_bands)
{ {
GError *error = NULL; GError *error = NULL;
mm_common_get_bands_from_string (set_bands_str, mm_common_get_bands_from_string (set_current_bands_str,
bands, bands,
n_bands, n_bands,
&error); &error);
@@ -844,7 +844,6 @@ parse_bands (MMModemBand **bands,
} }
} }
static void static void
state_changed (MMModem *modem, state_changed (MMModem *modem,
MMModemState old_state, MMModemState old_state,
@@ -1039,19 +1038,19 @@ get_modem_ready (GObject *source,
return; return;
} }
/* Request to set allowed bands in a given modem? */ /* Request to set current bands in a given modem? */
if (set_bands_str) { if (set_current_bands_str) {
MMModemBand *bands; MMModemBand *current_bands;
guint n_bands; guint n_current_bands;
parse_bands (&bands, &n_bands); parse_current_bands (&current_bands, &n_current_bands);
mm_modem_set_bands (ctx->modem, mm_modem_set_current_bands (ctx->modem,
bands, current_bands,
n_bands, n_current_bands,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)set_bands_ready, (GAsyncReadyCallback)set_current_bands_ready,
NULL); NULL);
g_free (bands); g_free (current_bands);
return; return;
} }
@@ -1254,19 +1253,19 @@ mmcli_modem_run_synchronous (GDBusConnection *connection)
} }
/* Request to set allowed bands in a given modem? */ /* Request to set allowed bands in a given modem? */
if (set_bands_str) { if (set_current_bands_str) {
gboolean result; gboolean result;
MMModemBand *bands; MMModemBand *current_bands;
guint n_bands; guint n_current_bands;
parse_bands (&bands, &n_bands); parse_current_bands (&current_bands, &n_current_bands);
result = mm_modem_set_bands_sync (ctx->modem, result = mm_modem_set_current_bands_sync (ctx->modem,
bands, current_bands,
n_bands, n_current_bands,
NULL, NULL,
&error); &error);
g_free (bands); g_free (current_bands);
set_bands_process_reply (result, error); set_current_bands_process_reply (result, error);
return; return;
} }

View File

@@ -111,8 +111,8 @@ mm_modem_get_allowed_modes
mm_modem_get_preferred_mode mm_modem_get_preferred_mode
mm_modem_peek_supported_bands mm_modem_peek_supported_bands
mm_modem_get_supported_bands mm_modem_get_supported_bands
mm_modem_peek_bands mm_modem_peek_current_bands
mm_modem_get_bands mm_modem_get_current_bands
mm_modem_get_supported_ip_families mm_modem_get_supported_ip_families
mm_modem_get_signal_quality mm_modem_get_signal_quality
mm_modem_get_access_technologies mm_modem_get_access_technologies
@@ -135,9 +135,9 @@ mm_modem_set_power_state_sync
mm_modem_set_allowed_modes mm_modem_set_allowed_modes
mm_modem_set_allowed_modes_finish mm_modem_set_allowed_modes_finish
mm_modem_set_allowed_modes_sync mm_modem_set_allowed_modes_sync
mm_modem_set_bands mm_modem_set_current_bands
mm_modem_set_bands_finish mm_modem_set_current_bands_finish
mm_modem_set_bands_sync mm_modem_set_current_bands_sync
mm_modem_reset mm_modem_reset
mm_modem_reset_finish mm_modem_reset_finish
mm_modem_reset_sync mm_modem_reset_sync
@@ -634,8 +634,8 @@ mm_simple_connect_properties_get_pin
mm_simple_connect_properties_set_pin mm_simple_connect_properties_set_pin
mm_simple_connect_properties_get_operator_id mm_simple_connect_properties_get_operator_id
mm_simple_connect_properties_set_operator_id mm_simple_connect_properties_set_operator_id
mm_simple_connect_properties_get_bands mm_simple_connect_properties_get_current_bands
mm_simple_connect_properties_set_bands mm_simple_connect_properties_set_current_bands
mm_simple_connect_properties_get_allowed_modes mm_simple_connect_properties_get_allowed_modes
mm_simple_connect_properties_set_allowed_modes mm_simple_connect_properties_set_allowed_modes
mm_simple_connect_properties_get_apn mm_simple_connect_properties_get_apn
@@ -677,7 +677,7 @@ MMSimpleStatus
mm_simple_status_get_state mm_simple_status_get_state
mm_simple_status_get_signal_quality mm_simple_status_get_signal_quality
mm_simple_status_get_access_technologies mm_simple_status_get_access_technologies
mm_simple_status_get_bands mm_simple_status_get_current_bands
mm_simple_status_get_3gpp_registration_state mm_simple_status_get_3gpp_registration_state
mm_simple_status_get_3gpp_operator_code mm_simple_status_get_3gpp_operator_code
mm_simple_status_get_3gpp_operator_name mm_simple_status_get_3gpp_operator_name
@@ -690,7 +690,7 @@ MM_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE
MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME
MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE
MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES
MM_SIMPLE_PROPERTY_BANDS MM_SIMPLE_PROPERTY_CURRENT_BANDS
MM_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE MM_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE
MM_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE MM_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE
MM_SIMPLE_PROPERTY_CDMA_NID MM_SIMPLE_PROPERTY_CDMA_NID
@@ -1417,8 +1417,8 @@ MmGdbusModemIface
<SUBSECTION Getters> <SUBSECTION Getters>
mm_gdbus_modem_get_access_technologies mm_gdbus_modem_get_access_technologies
mm_gdbus_modem_get_allowed_modes mm_gdbus_modem_get_allowed_modes
mm_gdbus_modem_get_bands mm_gdbus_modem_get_current_bands
mm_gdbus_modem_dup_bands mm_gdbus_modem_dup_current_bands
mm_gdbus_modem_get_current_capabilities mm_gdbus_modem_get_current_capabilities
mm_gdbus_modem_get_device mm_gdbus_modem_get_device
mm_gdbus_modem_dup_device mm_gdbus_modem_dup_device
@@ -1483,16 +1483,16 @@ mm_gdbus_modem_call_factory_reset_sync
mm_gdbus_modem_call_set_allowed_modes mm_gdbus_modem_call_set_allowed_modes
mm_gdbus_modem_call_set_allowed_modes_finish mm_gdbus_modem_call_set_allowed_modes_finish
mm_gdbus_modem_call_set_allowed_modes_sync mm_gdbus_modem_call_set_allowed_modes_sync
mm_gdbus_modem_call_set_bands mm_gdbus_modem_call_set_current_bands
mm_gdbus_modem_call_set_bands_finish mm_gdbus_modem_call_set_current_bands_finish
mm_gdbus_modem_call_set_bands_sync mm_gdbus_modem_call_set_current_bands_sync
mm_gdbus_modem_call_command mm_gdbus_modem_call_command
mm_gdbus_modem_call_command_finish mm_gdbus_modem_call_command_finish
mm_gdbus_modem_call_command_sync mm_gdbus_modem_call_command_sync
<SUBSECTION Private> <SUBSECTION Private>
mm_gdbus_modem_set_access_technologies mm_gdbus_modem_set_access_technologies
mm_gdbus_modem_set_allowed_modes mm_gdbus_modem_set_allowed_modes
mm_gdbus_modem_set_bands mm_gdbus_modem_set_current_bands
mm_gdbus_modem_set_current_capabilities mm_gdbus_modem_set_current_capabilities
mm_gdbus_modem_set_device mm_gdbus_modem_set_device
mm_gdbus_modem_set_device_identifier mm_gdbus_modem_set_device_identifier
@@ -1528,7 +1528,7 @@ mm_gdbus_modem_complete_factory_reset
mm_gdbus_modem_complete_list_bearers mm_gdbus_modem_complete_list_bearers
mm_gdbus_modem_complete_reset mm_gdbus_modem_complete_reset
mm_gdbus_modem_complete_set_allowed_modes mm_gdbus_modem_complete_set_allowed_modes
mm_gdbus_modem_complete_set_bands mm_gdbus_modem_complete_set_current_bands
mm_gdbus_modem_interface_info mm_gdbus_modem_interface_info
mm_gdbus_modem_override_properties mm_gdbus_modem_override_properties
<SUBSECTION Standard> <SUBSECTION Standard>

View File

@@ -52,7 +52,7 @@
given as a string value (signature <literal>"s"</literal>). given as a string value (signature <literal>"s"</literal>).
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry><term><literal>"bands"</literal></term> <varlistentry><term><literal>"current-bands"</literal></term>
<listitem> <listitem>
List of <link linkend="MMModemBand">MMModemBand</link> values, List of <link linkend="MMModemBand">MMModemBand</link> values,
to specify all the bands allowed in the modem, given as a list of to specify all the bands allowed in the modem, given as a list of
@@ -165,7 +165,7 @@
(signature <literal>"u"</literal>). (signature <literal>"u"</literal>).
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry><term><literal>"bands"</literal></term> <varlistentry><term><literal>"current-bands"</literal></term>
<listitem> <listitem>
List of <link linkend="MMModemBand">MMModemBand</link> values, List of <link linkend="MMModemBand">MMModemBand</link> values,
given only when registered, as a list of given only when registered, as a list of

View File

@@ -150,13 +150,13 @@
</method> </method>
<!-- <!--
SetBands: SetCurrentBands:
@bands: List of <link linkend="MMModemBand">MMModemBand</link> values, to specify the bands to be used. @bands: List of <link linkend="MMModemBand">MMModemBand</link> values, to specify the bands to be used.
Set the radio frequency and technology bands the device is currently Set the radio frequency and technology bands the device is currently
allowed to use when connecting to a network. allowed to use when connecting to a network.
--> -->
<method name="SetBands"> <method name="SetCurrentBands">
<arg name="bands" type="au" direction="in" /> <arg name="bands" type="au" direction="in" />
</method> </method>
@@ -460,7 +460,7 @@
<property name="SupportedBands" type="au" access="read" /> <property name="SupportedBands" type="au" access="read" />
<!-- <!--
Bands: CurrentBands:
List of <link linkend="MMModemBand">MMModemBand</link> values, List of <link linkend="MMModemBand">MMModemBand</link> values,
specifying the radio frequency and technology bands the device is specifying the radio frequency and technology bands the device is
@@ -468,7 +468,7 @@
It must be a subset of #org.freedesktop.ModemManager1.Modem:SupportedBands. It must be a subset of #org.freedesktop.ModemManager1.Modem:SupportedBands.
--> -->
<property name="Bands" type="au" access="read" /> <property name="CurrentBands" type="au" access="read" />
<!-- <!--
SupportedIpFamilies: SupportedIpFamilies:

View File

@@ -54,10 +54,10 @@ struct _MMModemPrivate {
guint supported_bands_id; guint supported_bands_id;
GArray *supported_bands; GArray *supported_bands;
/* Bands */ /* Current Bands */
GMutex bands_mutex; GMutex current_bands_mutex;
guint bands_id; guint current_bands_id;
GArray *bands; GArray *current_bands;
}; };
/*****************************************************************************/ /*****************************************************************************/
@@ -1093,74 +1093,74 @@ mm_modem_peek_supported_bands (MMModem *self,
/*****************************************************************************/ /*****************************************************************************/
static void static void
bands_updated (MMModem *self, current_bands_updated (MMModem *self,
GParamSpec *pspec) GParamSpec *pspec)
{ {
g_mutex_lock (&self->priv->bands_mutex); g_mutex_lock (&self->priv->current_bands_mutex);
{ {
GVariant *dictionary; GVariant *dictionary;
if (self->priv->bands) if (self->priv->current_bands)
g_array_unref (self->priv->bands); g_array_unref (self->priv->current_bands);
dictionary = mm_gdbus_modem_get_bands (MM_GDBUS_MODEM (self)); dictionary = mm_gdbus_modem_get_current_bands (MM_GDBUS_MODEM (self));
self->priv->bands = (dictionary ? self->priv->current_bands = (dictionary ?
mm_common_bands_variant_to_garray (dictionary) : mm_common_bands_variant_to_garray (dictionary) :
NULL); NULL);
} }
g_mutex_unlock (&self->priv->bands_mutex); g_mutex_unlock (&self->priv->current_bands_mutex);
} }
static gboolean static gboolean
ensure_internal_bands (MMModem *self, ensure_internal_current_bands (MMModem *self,
MMModemBand **dup_bands, MMModemBand **dup_bands,
guint *dup_bands_n) guint *dup_bands_n)
{ {
gboolean ret; gboolean ret;
g_mutex_lock (&self->priv->bands_mutex); g_mutex_lock (&self->priv->current_bands_mutex);
{ {
/* If this is the first time ever asking for the array, setup the /* If this is the first time ever asking for the array, setup the
* update listener and the initial array, if any. */ * update listener and the initial array, if any. */
if (!self->priv->bands_id) { if (!self->priv->current_bands_id) {
GVariant *dictionary; GVariant *dictionary;
dictionary = mm_gdbus_modem_dup_bands (MM_GDBUS_MODEM (self)); dictionary = mm_gdbus_modem_dup_current_bands (MM_GDBUS_MODEM (self));
if (dictionary) { if (dictionary) {
self->priv->bands = mm_common_bands_variant_to_garray (dictionary); self->priv->current_bands = mm_common_bands_variant_to_garray (dictionary);
g_variant_unref (dictionary); g_variant_unref (dictionary);
} }
/* No need to clear this signal connection when freeing self */ /* No need to clear this signal connection when freeing self */
self->priv->bands_id = self->priv->current_bands_id =
g_signal_connect (self, g_signal_connect (self,
"notify::bands", "notify::current-bands",
G_CALLBACK (bands_updated), G_CALLBACK (current_bands_updated),
NULL); NULL);
} }
if (!self->priv->bands) if (!self->priv->current_bands)
ret = FALSE; ret = FALSE;
else { else {
ret = TRUE; ret = TRUE;
if (dup_bands && dup_bands_n) { if (dup_bands && dup_bands_n) {
*dup_bands_n = self->priv->bands->len; *dup_bands_n = self->priv->current_bands->len;
if (self->priv->bands->len > 0) { if (self->priv->current_bands->len > 0) {
*dup_bands = g_malloc (sizeof (MMModemBand) * self->priv->bands->len); *dup_bands = g_malloc (sizeof (MMModemBand) * self->priv->current_bands->len);
memcpy (*dup_bands, self->priv->bands->data, sizeof (MMModemBand) * self->priv->bands->len); memcpy (*dup_bands, self->priv->current_bands->data, sizeof (MMModemBand) * self->priv->current_bands->len);
} else } else
*dup_bands = NULL; *dup_bands = NULL;
} }
} }
} }
g_mutex_unlock (&self->priv->bands_mutex); g_mutex_unlock (&self->priv->current_bands_mutex);
return ret; return ret;
} }
/** /**
* mm_modem_get_bands: * mm_modem_get_current_bands:
* @self: A #MMModem. * @self: A #MMModem.
* @bands: (out) (array length=n_bands): Return location for the array of #MMModemBand values. The returned array should be freed with g_free() when no longer needed. * @bands: (out) (array length=n_bands): Return location for the array of #MMModemBand values. The returned array should be freed with g_free() when no longer needed.
* @n_bands: (out): Return location for the number of values in @bands. * @n_bands: (out): Return location for the number of values in @bands.
@@ -1173,7 +1173,7 @@ ensure_internal_bands (MMModem *self,
* Returns: %TRUE if @bands and @n_bands are set, %FALSE otherwise. * Returns: %TRUE if @bands and @n_bands are set, %FALSE otherwise.
*/ */
gboolean gboolean
mm_modem_get_bands (MMModem *self, mm_modem_get_current_bands (MMModem *self,
MMModemBand **bands, MMModemBand **bands,
guint *n_bands) guint *n_bands)
{ {
@@ -1181,11 +1181,11 @@ mm_modem_get_bands (MMModem *self,
g_return_val_if_fail (bands != NULL, FALSE); g_return_val_if_fail (bands != NULL, FALSE);
g_return_val_if_fail (n_bands != NULL, FALSE); g_return_val_if_fail (n_bands != NULL, FALSE);
return ensure_internal_bands (self, bands, n_bands); return ensure_internal_current_bands (self, bands, n_bands);
} }
/** /**
* mm_modem_peek_bands: * mm_modem_peek_current_bands:
* @self: A #MMModem. * @self: A #MMModem.
* @bands: (out) (array length=n_storages): Return location for the array of #MMModemBand values. Do not free the returned value, it is owned by @self. * @bands: (out) (array length=n_storages): Return location for the array of #MMModemBand values. Do not free the returned value, it is owned by @self.
* @n_bands: (out): Return location for the number of values in @bands. * @n_bands: (out): Return location for the number of values in @bands.
@@ -1198,7 +1198,7 @@ mm_modem_get_bands (MMModem *self,
* Returns: %TRUE if @bands and @n_bands are set, %FALSE otherwise. * Returns: %TRUE if @bands and @n_bands are set, %FALSE otherwise.
*/ */
gboolean gboolean
mm_modem_peek_bands (MMModem *self, mm_modem_peek_current_bands (MMModem *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_bands) guint *n_bands)
{ {
@@ -1206,11 +1206,11 @@ mm_modem_peek_bands (MMModem *self,
g_return_val_if_fail (bands != NULL, FALSE); g_return_val_if_fail (bands != NULL, FALSE);
g_return_val_if_fail (n_bands != NULL, FALSE); g_return_val_if_fail (n_bands != NULL, FALSE);
if (!ensure_internal_bands (self, NULL, NULL)) if (!ensure_internal_current_bands (self, NULL, NULL))
return FALSE; return FALSE;
*n_bands = self->priv->bands->len; *n_bands = self->priv->current_bands->len;
*bands = (MMModemBand *)self->priv->bands->data; *bands = (MMModemBand *)self->priv->current_bands->data;
return TRUE; return TRUE;
} }
@@ -2295,27 +2295,27 @@ mm_modem_set_allowed_modes_sync (MMModem *self,
/*****************************************************************************/ /*****************************************************************************/
/** /**
* mm_modem_set_bands_finish: * mm_modem_set_current_bands_finish:
* @self: A #MMModem. * @self: A #MMModem.
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_set_bands(). * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_set_current_bands().
* @error: Return location for error or %NULL. * @error: Return location for error or %NULL.
* *
* Finishes an operation started with mm_modem_set_bands(). * Finishes an operation started with mm_modem_set_current_bands().
* *
* Returns: %TRUE if the bands were successfully set, %FALSE if @error is set. * Returns: %TRUE if the bands were successfully set, %FALSE if @error is set.
*/ */
gboolean gboolean
mm_modem_set_bands_finish (MMModem *self, mm_modem_set_current_bands_finish (MMModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
g_return_val_if_fail (MM_IS_MODEM (self), FALSE); g_return_val_if_fail (MM_IS_MODEM (self), FALSE);
return mm_gdbus_modem_call_set_bands_finish (MM_GDBUS_MODEM (self), res, error); return mm_gdbus_modem_call_set_current_bands_finish (MM_GDBUS_MODEM (self), res, error);
} }
/** /**
* mm_modem_set_bands: * mm_modem_set_current_bands:
* @self: A #MMModem. * @self: A #MMModem.
* @bands: An array of #MMModemBand values specifying which bands are allowed. * @bands: An array of #MMModemBand values specifying which bands are allowed.
* @n_bands: Number of elements in @bands. * @n_bands: Number of elements in @bands.
@@ -2327,12 +2327,12 @@ mm_modem_set_bands_finish (MMModem *self,
* allowed to use when connecting to a network. * allowed to use when connecting to a network.
* *
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call mm_modem_set_bands_finish() to get the result of the operation. * You can then call mm_modem_set_current_bands_finish() to get the result of the operation.
* *
* See mm_modem_set_bands_sync() for the synchronous, blocking version of this method. * See mm_modem_set_current_bands_sync() for the synchronous, blocking version of this method.
*/ */
void void
mm_modem_set_bands (MMModem *self, mm_modem_set_current_bands (MMModem *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_bands, guint n_bands,
GCancellable *cancellable, GCancellable *cancellable,
@@ -2341,7 +2341,7 @@ mm_modem_set_bands (MMModem *self,
{ {
g_return_if_fail (MM_IS_MODEM (self)); g_return_if_fail (MM_IS_MODEM (self));
mm_gdbus_modem_call_set_bands (MM_GDBUS_MODEM (self), mm_gdbus_modem_call_set_current_bands (MM_GDBUS_MODEM (self),
mm_common_bands_array_to_variant (bands, n_bands), mm_common_bands_array_to_variant (bands, n_bands),
cancellable, cancellable,
callback, callback,
@@ -2349,7 +2349,7 @@ mm_modem_set_bands (MMModem *self,
} }
/** /**
* mm_modem_set_bands_sync: * mm_modem_set_current_bands_sync:
* @self: A #MMModem. * @self: A #MMModem.
* @bands: An array of #MMModemBand values specifying which bands are allowed. * @bands: An array of #MMModemBand values specifying which bands are allowed.
* @n_bands: Number of elements in @bands. * @n_bands: Number of elements in @bands.
@@ -2359,13 +2359,13 @@ mm_modem_set_bands (MMModem *self,
* Synchronously sets the radio frequency and technology bands the device is currently * Synchronously sets the radio frequency and technology bands the device is currently
* allowed to use when connecting to a network. * allowed to use when connecting to a network.
* *
* The calling thread is blocked until a reply is received. See mm_modem_set_bands() * The calling thread is blocked until a reply is received. See mm_modem_set_current_bands()
* for the asynchronous version of this method. * for the asynchronous version of this method.
* *
* Returns: %TRUE if the bands were successfully set, %FALSE if @error is set. * Returns: %TRUE if the bands were successfully set, %FALSE if @error is set.
*/ */
gboolean gboolean
mm_modem_set_bands_sync (MMModem *self, mm_modem_set_current_bands_sync (MMModem *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_bands, guint n_bands,
GCancellable *cancellable, GCancellable *cancellable,
@@ -2373,7 +2373,7 @@ mm_modem_set_bands_sync (MMModem *self,
{ {
g_return_val_if_fail (MM_IS_MODEM (self), FALSE); g_return_val_if_fail (MM_IS_MODEM (self), FALSE);
return (mm_gdbus_modem_call_set_bands_sync ( return (mm_gdbus_modem_call_set_current_bands_sync (
MM_GDBUS_MODEM (self), MM_GDBUS_MODEM (self),
mm_common_bands_array_to_variant (bands, n_bands), mm_common_bands_array_to_variant (bands, n_bands),
cancellable, cancellable,
@@ -2534,7 +2534,7 @@ mm_modem_init (MMModem *self)
MMModemPrivate); MMModemPrivate);
g_mutex_init (&self->priv->unlock_retries_mutex); g_mutex_init (&self->priv->unlock_retries_mutex);
g_mutex_init (&self->priv->supported_bands_mutex); g_mutex_init (&self->priv->supported_bands_mutex);
g_mutex_init (&self->priv->bands_mutex); g_mutex_init (&self->priv->current_bands_mutex);
} }
static void static void
@@ -2544,12 +2544,12 @@ finalize (GObject *object)
g_mutex_clear (&self->priv->unlock_retries_mutex); g_mutex_clear (&self->priv->unlock_retries_mutex);
g_mutex_clear (&self->priv->supported_bands_mutex); g_mutex_clear (&self->priv->supported_bands_mutex);
g_mutex_clear (&self->priv->bands_mutex); g_mutex_clear (&self->priv->current_bands_mutex);
if (self->priv->supported_bands) if (self->priv->supported_bands)
g_array_unref (self->priv->supported_bands); g_array_unref (self->priv->supported_bands);
if (self->priv->bands) if (self->priv->current_bands)
g_array_unref (self->priv->bands); g_array_unref (self->priv->current_bands);
G_OBJECT_CLASS (mm_modem_parent_class)->finalize (object); G_OBJECT_CLASS (mm_modem_parent_class)->finalize (object);
} }

View File

@@ -140,10 +140,10 @@ gboolean mm_modem_get_supported_bands (MMModem *self,
MMModemBand **bands, MMModemBand **bands,
guint *n_bands); guint *n_bands);
gboolean mm_modem_peek_bands (MMModem *self, gboolean mm_modem_peek_current_bands (MMModem *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_bands); guint *n_bands);
gboolean mm_modem_get_bands (MMModem *self, gboolean mm_modem_get_current_bands (MMModem *self,
MMModemBand **bands, MMModemBand **bands,
guint *n_bands); guint *n_bands);
@@ -275,16 +275,16 @@ gboolean mm_modem_set_allowed_modes_sync (MMModem *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
void mm_modem_set_bands (MMModem *self, void mm_modem_set_current_bands (MMModem *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_bands, guint n_bands,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean mm_modem_set_bands_finish (MMModem *self, gboolean mm_modem_set_current_bands_finish (MMModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
gboolean mm_modem_set_bands_sync (MMModem *self, gboolean mm_modem_set_current_bands_sync (MMModem *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_bands, guint n_bands,
GCancellable *cancellable, GCancellable *cancellable,

View File

@@ -35,7 +35,7 @@ G_DEFINE_TYPE (MMSimpleConnectProperties, mm_simple_connect_properties, G_TYPE_O
#define PROPERTY_PIN "pin" #define PROPERTY_PIN "pin"
#define PROPERTY_OPERATOR_ID "operator-id" #define PROPERTY_OPERATOR_ID "operator-id"
#define PROPERTY_BANDS "bands" #define PROPERTY_CURRENT_BANDS "current-bands"
#define PROPERTY_ALLOWED_MODES "allowed-modes" #define PROPERTY_ALLOWED_MODES "allowed-modes"
#define PROPERTY_PREFERRED_MODE "preferred-mode" #define PROPERTY_PREFERRED_MODE "preferred-mode"
@@ -45,9 +45,9 @@ struct _MMSimpleConnectPropertiesPrivate {
/* Operator ID */ /* Operator ID */
gchar *operator_id; gchar *operator_id;
/* Bands */ /* Bands */
gboolean bands_set; gboolean current_bands_set;
MMModemBand *bands; MMModemBand *current_bands;
guint n_bands; guint n_current_bands;
/* Modes */ /* Modes */
gboolean allowed_modes_set; gboolean allowed_modes_set;
MMModemMode allowed_modes; MMModemMode allowed_modes;
@@ -129,7 +129,7 @@ mm_simple_connect_properties_get_operator_id (MMSimpleConnectProperties *self)
/*****************************************************************************/ /*****************************************************************************/
/** /**
* mm_simple_connect_properties_set_bands: * mm_simple_connect_properties_set_current_bands:
* @self: a #MMSimpleConnectProperties. * @self: a #MMSimpleConnectProperties.
* @bands: array of #MMModemBand values. * @bands: array of #MMModemBand values.
* @n_bands: number of elements in @bands. * @n_bands: number of elements in @bands.
@@ -137,23 +137,23 @@ mm_simple_connect_properties_get_operator_id (MMSimpleConnectProperties *self)
* Sets the frequency bands to use. * Sets the frequency bands to use.
*/ */
void void
mm_simple_connect_properties_set_bands (MMSimpleConnectProperties *self, mm_simple_connect_properties_set_current_bands (MMSimpleConnectProperties *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_bands) guint n_bands)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self)); g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
g_free (self->priv->bands); g_free (self->priv->current_bands);
self->priv->n_bands = n_bands; self->priv->n_current_bands = n_bands;
self->priv->bands = g_new (MMModemBand, self->priv->n_bands); self->priv->current_bands = g_new (MMModemBand, self->priv->n_current_bands);
memcpy (self->priv->bands, memcpy (self->priv->current_bands,
bands, bands,
sizeof (MMModemBand) * self->priv->n_bands); sizeof (MMModemBand) * self->priv->n_current_bands);
self->priv->bands_set = TRUE; self->priv->current_bands_set = TRUE;
} }
/** /**
* mm_simple_connect_properties_get_bands: * mm_simple_connect_properties_get_current_bands:
* @self: a #MMSimpleConnectProperties. * @self: a #MMSimpleConnectProperties.
* @bands: (out): location for the array of #MMModemBand values. Do not free the returned value, it is owned by @self. * @bands: (out): location for the array of #MMModemBand values. Do not free the returned value, it is owned by @self.
* @n_bands: (out) number of elements in @bands. * @n_bands: (out) number of elements in @bands.
@@ -163,7 +163,7 @@ mm_simple_connect_properties_set_bands (MMSimpleConnectProperties *self,
* Returns: %TRUE if @bands is set, %FALSE otherwise. * Returns: %TRUE if @bands is set, %FALSE otherwise.
*/ */
gboolean gboolean
mm_simple_connect_properties_get_bands (MMSimpleConnectProperties *self, mm_simple_connect_properties_get_current_bands (MMSimpleConnectProperties *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_bands) guint *n_bands)
{ {
@@ -171,9 +171,9 @@ mm_simple_connect_properties_get_bands (MMSimpleConnectProperties *self,
g_return_val_if_fail (bands != NULL, FALSE); g_return_val_if_fail (bands != NULL, FALSE);
g_return_val_if_fail (n_bands != NULL, FALSE); g_return_val_if_fail (n_bands != NULL, FALSE);
if (self->priv->bands_set) { if (self->priv->current_bands_set) {
*bands = self->priv->bands; *bands = self->priv->current_bands;
*n_bands = self->priv->n_bands; *n_bands = self->priv->n_current_bands;
return TRUE; return TRUE;
} }
@@ -517,12 +517,12 @@ mm_simple_connect_properties_get_dictionary (MMSimpleConnectProperties *self)
PROPERTY_OPERATOR_ID, PROPERTY_OPERATOR_ID,
g_variant_new_string (self->priv->operator_id)); g_variant_new_string (self->priv->operator_id));
if (self->priv->bands) if (self->priv->current_bands)
g_variant_builder_add (&builder, g_variant_builder_add (&builder,
"{sv}", "{sv}",
PROPERTY_BANDS, PROPERTY_CURRENT_BANDS,
mm_common_bands_array_to_variant (self->priv->bands, mm_common_bands_array_to_variant (self->priv->current_bands,
self->priv->n_bands)); self->priv->n_current_bands));
if (self->priv->allowed_modes_set) { if (self->priv->allowed_modes_set) {
g_variant_builder_add (&builder, g_variant_builder_add (&builder,
@@ -575,13 +575,13 @@ key_value_foreach (const gchar *key,
mm_simple_connect_properties_set_pin (ctx->self, value); mm_simple_connect_properties_set_pin (ctx->self, value);
else if (g_str_equal (key, PROPERTY_OPERATOR_ID)) else if (g_str_equal (key, PROPERTY_OPERATOR_ID))
mm_simple_connect_properties_set_operator_id (ctx->self, value); mm_simple_connect_properties_set_operator_id (ctx->self, value);
else if (g_str_equal (key, PROPERTY_BANDS)) { else if (g_str_equal (key, PROPERTY_CURRENT_BANDS)) {
MMModemBand *bands = NULL; MMModemBand *bands = NULL;
guint n_bands = 0; guint n_bands = 0;
mm_common_get_bands_from_string (value, &bands, &n_bands, &ctx->error); mm_common_get_bands_from_string (value, &bands, &n_bands, &ctx->error);
if (!ctx->error) { if (!ctx->error) {
mm_simple_connect_properties_set_bands (ctx->self, bands, n_bands); mm_simple_connect_properties_set_current_bands (ctx->self, bands, n_bands);
g_free (bands); g_free (bands);
} }
} else if (g_str_equal (key, PROPERTY_ALLOWED_MODES)) { } else if (g_str_equal (key, PROPERTY_ALLOWED_MODES)) {
@@ -696,11 +696,11 @@ mm_simple_connect_properties_new_from_dictionary (GVariant *dictionary,
mm_simple_connect_properties_set_operator_id ( mm_simple_connect_properties_set_operator_id (
self, self,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_BANDS)) { else if (g_str_equal (key, PROPERTY_CURRENT_BANDS)) {
GArray *array; GArray *array;
array = mm_common_bands_variant_to_garray (value); array = mm_common_bands_variant_to_garray (value);
mm_simple_connect_properties_set_bands ( mm_simple_connect_properties_set_current_bands (
self, self,
(MMModemBand *)array->data, (MMModemBand *)array->data,
array->len); array->len);
@@ -781,9 +781,9 @@ mm_simple_connect_properties_init (MMSimpleConnectProperties *self)
self->priv->bearer_properties = mm_bearer_properties_new (); self->priv->bearer_properties = mm_bearer_properties_new ();
self->priv->allowed_modes = MM_MODEM_MODE_ANY; self->priv->allowed_modes = MM_MODEM_MODE_ANY;
self->priv->preferred_mode = MM_MODEM_MODE_NONE; self->priv->preferred_mode = MM_MODEM_MODE_NONE;
self->priv->bands = g_new (MMModemBand, 1); self->priv->current_bands = g_new (MMModemBand, 1);
self->priv->bands[0] = MM_MODEM_BAND_UNKNOWN; self->priv->current_bands[0] = MM_MODEM_BAND_UNKNOWN;
self->priv->n_bands = 1; self->priv->n_current_bands = 1;
} }
static void static void
@@ -793,7 +793,7 @@ finalize (GObject *object)
g_free (self->priv->pin); g_free (self->priv->pin);
g_free (self->priv->operator_id); g_free (self->priv->operator_id);
g_free (self->priv->bands); g_free (self->priv->current_bands);
g_object_unref (self->priv->bearer_properties); g_object_unref (self->priv->bearer_properties);
G_OBJECT_CLASS (mm_simple_connect_properties_parent_class)->finalize (object); G_OBJECT_CLASS (mm_simple_connect_properties_parent_class)->finalize (object);

View File

@@ -63,7 +63,7 @@ void mm_simple_connect_properties_set_pin (MMSimpleConnectProperties *
const gchar *pin); const gchar *pin);
void mm_simple_connect_properties_set_operator_id (MMSimpleConnectProperties *self, void mm_simple_connect_properties_set_operator_id (MMSimpleConnectProperties *self,
const gchar *operator_id); const gchar *operator_id);
void mm_simple_connect_properties_set_bands (MMSimpleConnectProperties *self, void mm_simple_connect_properties_set_current_bands (MMSimpleConnectProperties *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_bands); guint n_bands);
void mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self, void mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self,
@@ -86,7 +86,7 @@ void mm_simple_connect_properties_set_number (MMSimpleConnectProperties *
const gchar *mm_simple_connect_properties_get_pin (MMSimpleConnectProperties *self); const gchar *mm_simple_connect_properties_get_pin (MMSimpleConnectProperties *self);
const gchar *mm_simple_connect_properties_get_operator_id (MMSimpleConnectProperties *self); const gchar *mm_simple_connect_properties_get_operator_id (MMSimpleConnectProperties *self);
gboolean mm_simple_connect_properties_get_bands (MMSimpleConnectProperties *self, gboolean mm_simple_connect_properties_get_current_bands (MMSimpleConnectProperties *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_bands); guint *n_bands);
gboolean mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self, gboolean mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self,

View File

@@ -39,7 +39,7 @@ enum {
PROP_0, PROP_0,
PROP_STATE, PROP_STATE,
PROP_SIGNAL_QUALITY, PROP_SIGNAL_QUALITY,
PROP_BANDS, PROP_CURRENT_BANDS,
PROP_ACCESS_TECHNOLOGIES, PROP_ACCESS_TECHNOLOGIES,
PROP_3GPP_REGISTRATION_STATE, PROP_3GPP_REGISTRATION_STATE,
PROP_3GPP_OPERATOR_CODE, PROP_3GPP_OPERATOR_CODE,
@@ -60,8 +60,8 @@ struct _MMSimpleStatusPrivate {
/* Signal quality, given only when registered, signature '(ub)' */ /* Signal quality, given only when registered, signature '(ub)' */
GVariant *signal_quality; GVariant *signal_quality;
/* List of bands, given only when registered, signature: au */ /* List of bands, given only when registered, signature: au */
GVariant *bands; GVariant *current_bands;
GArray *bands_array; GArray *current_bands_array;
/* Access technologies, given only when registered, signature: u */ /* Access technologies, given only when registered, signature: u */
MMModemAccessTechnology access_technologies; MMModemAccessTechnology access_technologies;
@@ -137,7 +137,7 @@ mm_simple_status_get_signal_quality (MMSimpleStatus *self,
/*****************************************************************************/ /*****************************************************************************/
/** /**
* mm_simple_status_get_bands: * mm_simple_status_get_current_bands:
* @self: a #MMSimpleStatus. * @self: a #MMSimpleStatus.
* @bands: (out): location for an array of #MMModemBand values. Do not free the returned value, it is owned by @self. * @bands: (out): location for an array of #MMModemBand values. Do not free the returned value, it is owned by @self.
* @n_bands: (out): number of elements in @bands. * @n_bands: (out): number of elements in @bands.
@@ -145,17 +145,17 @@ mm_simple_status_get_signal_quality (MMSimpleStatus *self,
* Gets the currently used frequency bands. * Gets the currently used frequency bands.
*/ */
void void
mm_simple_status_get_bands (MMSimpleStatus *self, mm_simple_status_get_current_bands (MMSimpleStatus *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_bands) guint *n_bands)
{ {
g_return_if_fail (MM_IS_SIMPLE_STATUS (self)); g_return_if_fail (MM_IS_SIMPLE_STATUS (self));
if (!self->priv->bands_array) if (!self->priv->current_bands_array)
self->priv->bands_array = mm_common_bands_variant_to_garray (self->priv->bands); self->priv->current_bands_array = mm_common_bands_variant_to_garray (self->priv->current_bands);
*n_bands = self->priv->bands_array->len; *n_bands = self->priv->current_bands_array->len;
*bands = (const MMModemBand *)self->priv->bands_array->data; *bands = (const MMModemBand *)self->priv->current_bands_array->data;
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -329,8 +329,8 @@ mm_simple_status_get_dictionary (MMSimpleStatus *self)
self->priv->signal_quality); self->priv->signal_quality);
g_variant_builder_add (&builder, g_variant_builder_add (&builder,
"{sv}", "{sv}",
MM_SIMPLE_PROPERTY_BANDS, MM_SIMPLE_PROPERTY_CURRENT_BANDS,
self->priv->bands); self->priv->current_bands);
g_variant_builder_add (&builder, g_variant_builder_add (&builder,
"{sv}", "{sv}",
MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES,
@@ -428,7 +428,7 @@ mm_simple_status_new_from_dictionary (GVariant *dictionary,
g_object_set (properties, g_object_set (properties,
key, g_variant_get_string (value, NULL), key, g_variant_get_string (value, NULL),
NULL); NULL);
} else if (g_str_equal (key, MM_SIMPLE_PROPERTY_BANDS) || } else if (g_str_equal (key, MM_SIMPLE_PROPERTY_CURRENT_BANDS) ||
g_str_equal (key, MM_SIMPLE_PROPERTY_SIGNAL_QUALITY)) { g_str_equal (key, MM_SIMPLE_PROPERTY_SIGNAL_QUALITY)) {
/* remaining complex types, as variant */ /* remaining complex types, as variant */
g_object_set (properties, g_object_set (properties,
@@ -482,14 +482,14 @@ set_property (GObject *object,
g_variant_unref (self->priv->signal_quality); g_variant_unref (self->priv->signal_quality);
self->priv->signal_quality = g_value_dup_variant (value); self->priv->signal_quality = g_value_dup_variant (value);
break; break;
case PROP_BANDS: case PROP_CURRENT_BANDS:
if (self->priv->bands) if (self->priv->current_bands)
g_variant_unref (self->priv->bands); g_variant_unref (self->priv->current_bands);
if (self->priv->bands_array) { if (self->priv->current_bands_array) {
g_array_unref (self->priv->bands_array); g_array_unref (self->priv->current_bands_array);
self->priv->bands_array = NULL; self->priv->current_bands_array = NULL;
} }
self->priv->bands = g_value_dup_variant (value); self->priv->current_bands = g_value_dup_variant (value);
break; break;
case PROP_ACCESS_TECHNOLOGIES: case PROP_ACCESS_TECHNOLOGIES:
self->priv->access_technologies = g_value_get_flags (value); self->priv->access_technologies = g_value_get_flags (value);
@@ -538,8 +538,8 @@ get_property (GObject *object,
case PROP_SIGNAL_QUALITY: case PROP_SIGNAL_QUALITY:
g_value_set_variant (value, self->priv->signal_quality); g_value_set_variant (value, self->priv->signal_quality);
break; break;
case PROP_BANDS: case PROP_CURRENT_BANDS:
g_value_set_variant (value, self->priv->bands); g_value_set_variant (value, self->priv->current_bands);
break; break;
case PROP_ACCESS_TECHNOLOGIES: case PROP_ACCESS_TECHNOLOGIES:
g_value_set_flags (value, self->priv->access_technologies); g_value_set_flags (value, self->priv->access_technologies);
@@ -582,7 +582,7 @@ mm_simple_status_init (MMSimpleStatus *self)
self->priv->state = MM_MODEM_STATE_UNKNOWN; self->priv->state = MM_MODEM_STATE_UNKNOWN;
self->priv->access_technologies = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN; self->priv->access_technologies = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
self->priv->modem_3gpp_registration_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; self->priv->modem_3gpp_registration_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN;
self->priv->bands = g_variant_ref_sink (mm_common_build_bands_unknown ()); self->priv->current_bands = g_variant_ref_sink (mm_common_build_bands_unknown ());
self->priv->signal_quality = g_variant_ref_sink (g_variant_new ("(ub)", 0, 0)); self->priv->signal_quality = g_variant_ref_sink (g_variant_new ("(ub)", 0, 0));
self->priv->modem_cdma_cdma1x_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN; self->priv->modem_cdma_cdma1x_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
self->priv->modem_cdma_evdo_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN; self->priv->modem_cdma_evdo_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
@@ -596,9 +596,9 @@ finalize (GObject *object)
MMSimpleStatus *self = MM_SIMPLE_STATUS (object); MMSimpleStatus *self = MM_SIMPLE_STATUS (object);
g_variant_unref (self->priv->signal_quality); g_variant_unref (self->priv->signal_quality);
g_variant_unref (self->priv->bands); g_variant_unref (self->priv->current_bands);
if (self->priv->bands_array) if (self->priv->current_bands_array)
g_array_unref (self->priv->bands_array); g_array_unref (self->priv->current_bands_array);
g_free (self->priv->modem_3gpp_operator_code); g_free (self->priv->modem_3gpp_operator_code);
g_free (self->priv->modem_3gpp_operator_name); g_free (self->priv->modem_3gpp_operator_name);
@@ -635,14 +635,14 @@ mm_simple_status_class_init (MMSimpleStatusClass *klass)
G_PARAM_READWRITE); G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_SIGNAL_QUALITY, properties[PROP_SIGNAL_QUALITY]); g_object_class_install_property (object_class, PROP_SIGNAL_QUALITY, properties[PROP_SIGNAL_QUALITY]);
properties[PROP_BANDS] = properties[PROP_CURRENT_BANDS] =
g_param_spec_variant (MM_SIMPLE_PROPERTY_BANDS, g_param_spec_variant (MM_SIMPLE_PROPERTY_CURRENT_BANDS,
"Bands", "Current Bands",
"Frequency bands used by the modem", "Frequency bands used by the modem",
G_VARIANT_TYPE ("au"), G_VARIANT_TYPE ("au"),
NULL, NULL,
G_PARAM_READWRITE); G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_BANDS, properties[PROP_BANDS]); g_object_class_install_property (object_class, PROP_CURRENT_BANDS, properties[PROP_CURRENT_BANDS]);
properties[PROP_ACCESS_TECHNOLOGIES] = properties[PROP_ACCESS_TECHNOLOGIES] =
g_param_spec_flags (MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, g_param_spec_flags (MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES,

View File

@@ -59,7 +59,7 @@ GType mm_simple_status_get_type (void);
MMModemState mm_simple_status_get_state (MMSimpleStatus *self); MMModemState mm_simple_status_get_state (MMSimpleStatus *self);
guint32 mm_simple_status_get_signal_quality (MMSimpleStatus *self, guint32 mm_simple_status_get_signal_quality (MMSimpleStatus *self,
gboolean *recent); gboolean *recent);
void mm_simple_status_get_bands (MMSimpleStatus *self, void mm_simple_status_get_current_bands (MMSimpleStatus *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_bands); guint *n_bands);
MMModemAccessTechnology mm_simple_status_get_access_technologies (MMSimpleStatus *self); MMModemAccessTechnology mm_simple_status_get_access_technologies (MMSimpleStatus *self);
@@ -82,7 +82,7 @@ guint mm_simple_status_get_cdma_nid
#define MM_SIMPLE_PROPERTY_STATE "state" #define MM_SIMPLE_PROPERTY_STATE "state"
#define MM_SIMPLE_PROPERTY_SIGNAL_QUALITY "signal-quality" #define MM_SIMPLE_PROPERTY_SIGNAL_QUALITY "signal-quality"
#define MM_SIMPLE_PROPERTY_BANDS "bands" #define MM_SIMPLE_PROPERTY_CURRENT_BANDS "current-bands"
#define MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES "access-technologies" #define MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES "access-technologies"
#define MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE "m3gpp-registration-state" #define MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE "m3gpp-registration-state"

View File

@@ -879,10 +879,10 @@ load_current_bands (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* SET BANDS */ /* Set current bands (Modem interface) */
static gboolean static gboolean
set_bands_finish (MMIfaceModem *self, set_current_bands_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -1074,7 +1074,7 @@ set_bands_2g (MMIfaceModem *self,
} }
static void static void
set_bands (MMIfaceModem *self, set_current_bands (MMIfaceModem *self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@@ -1090,7 +1090,7 @@ set_bands (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_bands); set_current_bands);
if (mm_iface_modem_is_3g (self)) if (mm_iface_modem_is_3g (self))
set_bands_3g (self, bands_array, result); set_bands_3g (self, bands_array, result);
@@ -1197,8 +1197,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_supported_bands_finish = load_supported_bands_finish; iface->load_supported_bands_finish = load_supported_bands_finish;
iface->load_current_bands = load_current_bands; iface->load_current_bands = load_current_bands;
iface->load_current_bands_finish = load_current_bands_finish; iface->load_current_bands_finish = load_current_bands_finish;
iface->set_bands = set_bands; iface->set_current_bands = set_current_bands;
iface->set_bands_finish = set_bands_finish; iface->set_current_bands_finish = set_current_bands_finish;
iface->load_access_technologies = load_access_technologies; iface->load_access_technologies = load_access_technologies;
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->setup_flow_control = setup_flow_control; iface->setup_flow_control = setup_flow_control;

View File

@@ -1005,10 +1005,10 @@ load_current_bands (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Set bands (Modem interface) */ /* Set current bands (Modem interface) */
static gboolean static gboolean
set_bands_finish (MMIfaceModem *self, set_current_bands_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -1033,7 +1033,7 @@ syscfg_set_ready (MMBaseModem *self,
} }
static void static void
set_bands (MMIfaceModem *self, set_current_bands (MMIfaceModem *self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@@ -1046,7 +1046,7 @@ set_bands (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_bands); set_current_bands);
bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array->data, bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array->data,
bands_array->len); bands_array->len);
@@ -2658,8 +2658,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish; iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;
iface->load_current_bands = load_current_bands; iface->load_current_bands = load_current_bands;
iface->load_current_bands_finish = load_current_bands_finish; iface->load_current_bands_finish = load_current_bands_finish;
iface->set_bands = set_bands; iface->set_current_bands = set_current_bands;
iface->set_bands_finish = set_bands_finish; iface->set_current_bands_finish = set_current_bands_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_allowed_modes = load_allowed_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_allowed_modes_finish = load_allowed_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_allowed_modes = set_allowed_modes;

View File

@@ -1157,7 +1157,7 @@ load_supported_bands_response_processor (MMBaseModem *self,
} }
static void static void
load_supported_bands_get_bands_ready (MMIfaceModem *self, load_supported_bands_get_current_bands_ready (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GSimpleAsyncResult *operation_result) GSimpleAsyncResult *operation_result)
{ {
@@ -1228,7 +1228,7 @@ modem_load_supported_bands (MMIfaceModem *self,
"%IPBM?", "%IPBM?",
3, 3,
FALSE, FALSE,
(GAsyncReadyCallback)load_supported_bands_get_bands_ready, (GAsyncReadyCallback)load_supported_bands_get_current_bands_ready,
g_simple_async_result_new (G_OBJECT (self), g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
@@ -1305,14 +1305,14 @@ modem_load_current_bands (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Set bands (Modem interface) */ /* Set current bands (Modem interface) */
typedef struct { typedef struct {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
guint bandbits; guint bandbits;
guint enablebits; guint enablebits;
guint disablebits; guint disablebits;
} SetBandsContext; } SetCurrentBandsContext;
/* /*
* The modem's band-setting command (%IPBM=) enables or disables one * The modem's band-setting command (%IPBM=) enables or disables one
@@ -1322,34 +1322,34 @@ typedef struct {
* disable any removed bands. * disable any removed bands.
*/ */
static gboolean static gboolean
modem_set_bands_finish (MMIfaceModem *self, modem_set_current_bands_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
} }
static void set_one_band (MMIfaceModem *self, SetBandsContext *ctx); static void set_one_band (MMIfaceModem *self, SetCurrentBandsContext *ctx);
static void static void
set_bands_context_complete_and_free (SetBandsContext *ctx) set_current_bands_context_complete_and_free (SetCurrentBandsContext *ctx)
{ {
g_simple_async_result_complete (ctx->result); g_simple_async_result_complete (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
g_free (ctx); g_slice_free (SetCurrentBandsContext, ctx);
} }
static void static void
set_bands_next (MMIfaceModem *self, set_current_bands_next (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
SetBandsContext *ctx) SetCurrentBandsContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error)) { if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error)) {
mm_dbg ("Couldn't set bands: '%s'", error->message); mm_dbg ("Couldn't set current bands: '%s'", error->message);
g_simple_async_result_take_error (ctx->result, error); 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; return;
} }
@@ -1358,7 +1358,7 @@ set_bands_next (MMIfaceModem *self,
static void static void
set_one_band (MMIfaceModem *self, set_one_band (MMIfaceModem *self,
SetBandsContext *ctx) SetCurrentBandsContext *ctx)
{ {
guint enable, band; guint enable, band;
gchar *command; gchar *command;
@@ -1373,7 +1373,7 @@ set_one_band (MMIfaceModem *self,
if (band == 0) { if (band == 0) {
/* Both enabling and disabling are done */ /* Both enabling and disabling are done */
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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; return;
} }
@@ -1397,7 +1397,7 @@ set_one_band (MMIfaceModem *self,
command, command,
10, 10,
FALSE, FALSE,
(GAsyncReadyCallback)set_bands_next, (GAsyncReadyCallback)set_current_bands_next,
ctx); ctx);
g_free (command); g_free (command);
} }
@@ -1424,9 +1424,9 @@ band_array_to_bandbits (GArray *bands)
} }
static void static void
set_bands_got_current_bands (MMIfaceModem *self, set_current_bands_got_current_bands (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
SetBandsContext *ctx) SetCurrentBandsContext *ctx)
{ {
GArray *bands; GArray *bands;
GError *error = NULL; GError *error = NULL;
@@ -1435,7 +1435,7 @@ set_bands_got_current_bands (MMIfaceModem *self,
bands = modem_load_current_bands_finish (self, res, &error); bands = modem_load_current_bands_finish (self, res, &error);
if (!bands) { if (!bands) {
g_simple_async_result_take_error (ctx->result, error); 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; return;
} }
@@ -1447,18 +1447,18 @@ set_bands_got_current_bands (MMIfaceModem *self,
} }
static void static void
modem_set_bands (MMIfaceModem *self, modem_set_current_bands (MMIfaceModem *self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
SetBandsContext *ctx; SetCurrentBandsContext *ctx;
ctx = g_new0 (SetBandsContext, 1); ctx = g_slice_new0 (SetCurrentBandsContext);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
modem_set_bands); modem_set_current_bands);
ctx->bandbits = band_array_to_bandbits (bands_array); ctx->bandbits = band_array_to_bandbits (bands_array);
/* /*
@@ -1472,7 +1472,7 @@ modem_set_bands (MMIfaceModem *self,
} }
modem_load_current_bands (self, modem_load_current_bands (self,
(GAsyncReadyCallback)set_bands_got_current_bands, (GAsyncReadyCallback)set_current_bands_got_current_bands,
ctx); ctx);
} }
@@ -1789,8 +1789,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->modem_power_down_finish = modem_power_down_finish; iface->modem_power_down_finish = modem_power_down_finish;
iface->reset = modem_reset; iface->reset = modem_reset;
iface->reset_finish = modem_reset_finish; iface->reset_finish = modem_reset_finish;
iface->set_bands = modem_set_bands; iface->set_current_bands = modem_set_current_bands;
iface->set_bands_finish = modem_set_bands_finish; iface->set_current_bands_finish = modem_set_current_bands_finish;
iface->create_bearer = modem_create_bearer; iface->create_bearer = modem_create_bearer;
iface->create_bearer_finish = modem_create_bearer_finish; iface->create_bearer_finish = modem_create_bearer_finish;
} }

View File

@@ -745,10 +745,10 @@ load_current_bands (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Set bands (Modem interface) */ /* Set current_bands (Modem interface) */
static gboolean static gboolean
set_bands_finish (MMIfaceModem *self, set_current_bands_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -908,7 +908,7 @@ set_bands_2g (MMIfaceModem *self,
} }
static void static void
set_bands (MMIfaceModem *self, set_current_bands (MMIfaceModem *self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@@ -924,7 +924,7 @@ set_bands (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_bands); set_current_bands);
if (mm_iface_modem_is_3g (self)) if (mm_iface_modem_is_3g (self))
set_bands_3g (self, bands_array, result); set_bands_3g (self, bands_array, result);
@@ -1154,8 +1154,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_supported_bands_finish = load_supported_bands_finish; iface->load_supported_bands_finish = load_supported_bands_finish;
iface->load_current_bands = load_current_bands; iface->load_current_bands = load_current_bands;
iface->load_current_bands_finish = load_current_bands_finish; iface->load_current_bands_finish = load_current_bands_finish;
iface->set_bands = set_bands; iface->set_current_bands = set_current_bands;
iface->set_bands_finish = set_bands_finish; iface->set_current_bands_finish = set_current_bands_finish;
iface->load_access_technologies = load_access_technologies; iface->load_access_technologies = load_access_technologies;
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->setup_flow_control = setup_flow_control; iface->setup_flow_control = setup_flow_control;

View File

@@ -1610,10 +1610,10 @@ modem_load_current_bands (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Set bands (Modem interface) */ /* Set current bands (Modem interface) */
static gboolean static gboolean
set_bands_finish (MMIfaceModem *self, set_current_bands_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -1648,7 +1648,7 @@ bands_set_system_selection_preference_ready (QmiClientNas *client,
} }
static void static void
set_bands (MMIfaceModem *_self, set_current_bands (MMIfaceModem *_self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@@ -1668,7 +1668,7 @@ set_bands (MMIfaceModem *_self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_bands); set_current_bands);
/* Handle ANY separately */ /* Handle ANY separately */
if (bands_array->len == 1 && 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_signal_quality_finish = load_signal_quality_finish;
iface->load_current_bands = modem_load_current_bands; iface->load_current_bands = modem_load_current_bands;
iface->load_current_bands_finish = modem_load_current_bands_finish; iface->load_current_bands_finish = modem_load_current_bands_finish;
iface->set_bands = set_bands; iface->set_current_bands = set_current_bands;
iface->set_bands_finish = set_bands_finish; iface->set_current_bands_finish = set_current_bands_finish;
/* Don't try to load access technologies, as we would be using parent's /* Don't try to load access technologies, as we would be using parent's
* generic method (QCDM based). Access technologies are already reported via * generic method (QCDM based). Access technologies are already reported via

View File

@@ -175,7 +175,7 @@ typedef enum {
CONNECTION_STEP_ENABLE, CONNECTION_STEP_ENABLE,
CONNECTION_STEP_WAIT_FOR_ENABLED, CONNECTION_STEP_WAIT_FOR_ENABLED,
CONNECTION_STEP_ALLOWED_MODES, CONNECTION_STEP_ALLOWED_MODES,
CONNECTION_STEP_BANDS, CONNECTION_STEP_CURRENT_BANDS,
CONNECTION_STEP_REGISTER, CONNECTION_STEP_REGISTER,
CONNECTION_STEP_BEARER, CONNECTION_STEP_BEARER,
CONNECTION_STEP_CONNECT, CONNECTION_STEP_CONNECT,
@@ -313,7 +313,7 @@ set_allowed_modes_ready (MMBaseModem *self,
} }
static gboolean static gboolean
after_set_bands_timeout_cb (ConnectionContext *ctx) after_set_current_bands_timeout_cb (ConnectionContext *ctx)
{ {
/* Bands set... almost there! */ /* Bands set... almost there! */
ctx->step++; ctx->step++;
@@ -322,13 +322,13 @@ after_set_bands_timeout_cb (ConnectionContext *ctx)
} }
static void static void
set_bands_ready (MMBaseModem *self, set_current_bands_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
ConnectionContext *ctx) ConnectionContext *ctx)
{ {
GError *error = NULL; 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, if (g_error_matches (error,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED)) { 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 * of seconds to settle down. This sleep time just makes sure that the modem
* has enough time to report being unregistered. */ * has enough time to report being unregistered. */
mm_dbg ("Will wait to settle down after updating bands"); 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 static void
@@ -579,17 +579,15 @@ connection_step (ConnectionContext *ctx)
ctx->step++; ctx->step++;
} }
case CONNECTION_STEP_BANDS: { case CONNECTION_STEP_CURRENT_BANDS: {
const MMModemBand *bands = NULL; const MMModemBand *bands = NULL;
guint n_bands = 0; 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); ctx->step, CONNECTION_STEP_LAST);
/* Don't set bands unless explicitly requested to do so */ /* Don't set bands unless explicitly requested to do so */
if (mm_simple_connect_properties_get_bands (ctx->properties, if (mm_simple_connect_properties_get_current_bands (ctx->properties, &bands, &n_bands)) {
&bands,
&n_bands)) {
GArray *array; GArray *array;
guint i; guint i;
@@ -598,9 +596,9 @@ connection_step (ConnectionContext *ctx)
for (i = 0; i < n_bands; i++) for (i = 0; i < n_bands; i++)
g_array_insert_val (array, i, bands[i]); g_array_insert_val (array, i, bands[i]);
mm_iface_modem_set_bands (MM_IFACE_MODEM (ctx->self), mm_iface_modem_set_current_bands (MM_IFACE_MODEM (ctx->self),
array, array,
(GAsyncReadyCallback)set_bands_ready, (GAsyncReadyCallback)set_current_bands_ready,
ctx); ctx);
g_array_unref (array); g_array_unref (array);
return; return;
@@ -804,7 +802,7 @@ connect_auth_ready (MMBaseModem *self,
mm_dbg (" Preferred mode: %s", VALIDATE_UNSPECIFIED (NULL)); 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); str = mm_common_build_bands_string (bands, n_bands);
mm_dbg (" Bands: %s", str); mm_dbg (" Bands: %s", str);
g_free (str); g_free (str);

View File

@@ -66,8 +66,8 @@ mm_iface_modem_bind_simple_status (MMIfaceModem *self,
status, MM_SIMPLE_PROPERTY_SIGNAL_QUALITY, status, MM_SIMPLE_PROPERTY_SIGNAL_QUALITY,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (skeleton, "bands", g_object_bind_property (skeleton, "current-bands",
status, MM_SIMPLE_PROPERTY_BANDS, status, MM_SIMPLE_PROPERTY_CURRENT_BANDS,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (skeleton, "access-technologies", g_object_bind_property (skeleton, "access-technologies",
@@ -1791,17 +1791,17 @@ handle_factory_reset (MmGdbusModem *skeleton,
} }
/*****************************************************************************/ /*****************************************************************************/
/* BANDS */ /* Current bands setting */
typedef struct { typedef struct {
MMIfaceModem *self; MMIfaceModem *self;
MmGdbusModem *skeleton; MmGdbusModem *skeleton;
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
GArray *bands_array; GArray *bands_array;
} SetBandsContext; } SetCurrentBandsContext;
static void 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_simple_async_result_complete_in_idle (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
@@ -1810,11 +1810,11 @@ set_bands_context_complete_and_free (SetBandsContext *ctx)
g_object_unref (ctx->skeleton); g_object_unref (ctx->skeleton);
if (ctx->bands_array) if (ctx->bands_array)
g_array_unref (ctx->bands_array); g_array_unref (ctx->bands_array);
g_free (ctx); g_slice_free (SetCurrentBandsContext, ctx);
} }
gboolean gboolean
mm_iface_modem_set_bands_finish (MMIfaceModem *self, mm_iface_modem_set_current_bands_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -1822,13 +1822,13 @@ mm_iface_modem_set_bands_finish (MMIfaceModem *self,
} }
static void static void
set_bands_ready (MMIfaceModem *self, set_current_bands_ready (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
SetBandsContext *ctx) SetCurrentBandsContext *ctx)
{ {
GError *error = NULL; 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); g_simple_async_result_take_error (ctx->result, error);
else { else {
/* Never show just 'any' in the interface */ /* Never show just 'any' in the interface */
@@ -1838,17 +1838,17 @@ set_bands_ready (MMIfaceModem *self,
supported_bands = (mm_common_bands_variant_to_garray ( supported_bands = (mm_common_bands_variant_to_garray (
mm_gdbus_modem_get_supported_bands (ctx->skeleton))); mm_gdbus_modem_get_supported_bands (ctx->skeleton)));
mm_gdbus_modem_set_bands (ctx->skeleton, mm_gdbus_modem_set_current_bands (ctx->skeleton,
mm_common_bands_garray_to_variant (supported_bands)); mm_common_bands_garray_to_variant (supported_bands));
g_array_unref (supported_bands); g_array_unref (supported_bands);
} else } else
mm_gdbus_modem_set_bands (ctx->skeleton, mm_gdbus_modem_set_current_bands (ctx->skeleton,
mm_common_bands_garray_to_variant (ctx->bands_array)); mm_common_bands_garray_to_variant (ctx->bands_array));
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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 static gboolean
@@ -1910,20 +1910,20 @@ validate_bands (const GArray *supported_bands_array,
} }
void void
mm_iface_modem_set_bands (MMIfaceModem *self, mm_iface_modem_set_current_bands (MMIfaceModem *self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
SetBandsContext *ctx; SetCurrentBandsContext *ctx;
GArray *supported_bands_array; GArray *supported_bands_array;
GArray *current_bands_array; GArray *current_bands_array;
GError *error = NULL; GError *error = NULL;
gchar *bands_string; gchar *bands_string;
/* If setting allowed bands is not implemented, report an error */ /* If setting allowed bands is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands || if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_bands ||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands_finish) { !MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_bands_finish) {
g_simple_async_report_error_in_idle (G_OBJECT (self), g_simple_async_report_error_in_idle (G_OBJECT (self),
callback, callback,
user_data, user_data,
@@ -1934,12 +1934,12 @@ mm_iface_modem_set_bands (MMIfaceModem *self,
} }
/* Setup context */ /* Setup context */
ctx = g_new0 (SetBandsContext, 1); ctx = g_slice_new0 (SetCurrentBandsContext);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
mm_iface_modem_set_bands); mm_iface_modem_set_current_bands);
g_object_get (self, g_object_get (self,
MM_IFACE_MODEM_DBUS_SKELETON, &ctx->skeleton, MM_IFACE_MODEM_DBUS_SKELETON, &ctx->skeleton,
NULL); NULL);
@@ -1948,7 +1948,7 @@ mm_iface_modem_set_bands (MMIfaceModem *self,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Couldn't get interface skeleton"); "Couldn't get interface skeleton");
set_bands_context_complete_and_free (ctx); set_current_bands_context_complete_and_free (ctx);
return; 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 */ /* Simply return if target list of bands equals to current list of bands */
current_bands_array = (mm_common_bands_variant_to_garray ( 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)) { 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", mm_dbg ("Requested list of bands (%s) is equal to the current ones, skipping re-set",
bands_string); bands_string);
@@ -1994,7 +1994,7 @@ mm_iface_modem_set_bands (MMIfaceModem *self,
g_array_unref (supported_bands_array); g_array_unref (supported_bands_array);
g_array_unref (current_bands_array); g_array_unref (current_bands_array);
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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; return;
} }
@@ -2015,15 +2015,15 @@ mm_iface_modem_set_bands (MMIfaceModem *self,
g_array_unref (supported_bands_array); g_array_unref (supported_bands_array);
g_array_unref (current_bands_array); g_array_unref (current_bands_array);
g_simple_async_result_take_error (ctx->result, error); 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; return;
} }
mm_dbg ("Setting new list of bands: '%s'", bands_string); 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, self,
ctx->bands_array, ctx->bands_array,
(GAsyncReadyCallback)set_bands_ready, (GAsyncReadyCallback)set_current_bands_ready,
ctx); ctx);
g_array_unref (supported_bands_array); g_array_unref (supported_bands_array);
@@ -2036,37 +2036,37 @@ typedef struct {
GDBusMethodInvocation *invocation; GDBusMethodInvocation *invocation;
MMIfaceModem *self; MMIfaceModem *self;
GVariant *bands; GVariant *bands;
} HandleSetBandsContext; } HandleSetCurrentBandsContext;
static void static void
handle_set_bands_context_free (HandleSetBandsContext *ctx) handle_set_current_bands_context_free (HandleSetCurrentBandsContext *ctx)
{ {
g_variant_unref (ctx->bands); g_variant_unref (ctx->bands);
g_object_unref (ctx->skeleton); g_object_unref (ctx->skeleton);
g_object_unref (ctx->invocation); g_object_unref (ctx->invocation);
g_object_unref (ctx->self); g_object_unref (ctx->self);
g_free (ctx); g_slice_free (HandleSetCurrentBandsContext, ctx);
} }
static void static void
handle_set_bands_ready (MMIfaceModem *self, handle_set_current_bands_ready (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
HandleSetBandsContext *ctx) HandleSetCurrentBandsContext *ctx)
{ {
GError *error = NULL; 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); g_dbus_method_invocation_take_error (ctx->invocation, error);
else 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 static void
handle_set_bands_auth_ready (MMBaseModem *self, handle_set_current_bands_auth_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
HandleSetBandsContext *ctx) HandleSetCurrentBandsContext *ctx)
{ {
GArray *bands_array; GArray *bands_array;
MMModemState modem_state; MMModemState modem_state;
@@ -2074,7 +2074,7 @@ handle_set_bands_auth_ready (MMBaseModem *self,
if (!mm_base_modem_authorize_finish (self, res, &error)) { if (!mm_base_modem_authorize_finish (self, res, &error)) {
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_bands_context_free (ctx); handle_set_current_bands_context_free (ctx);
return; return;
} }
@@ -2087,29 +2087,29 @@ handle_set_bands_auth_ready (MMBaseModem *self,
g_dbus_method_invocation_return_error (ctx->invocation, g_dbus_method_invocation_return_error (ctx->invocation,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_WRONG_STATE, MM_CORE_ERROR_WRONG_STATE,
"Cannot set allowed bands: " "Cannot set current bands: "
"not initialized/unlocked yet"); "not initialized/unlocked yet");
handle_set_bands_context_free (ctx); handle_set_current_bands_context_free (ctx);
return; return;
} }
bands_array = mm_common_bands_variant_to_garray (ctx->bands); bands_array = mm_common_bands_variant_to_garray (ctx->bands);
mm_iface_modem_set_bands (MM_IFACE_MODEM (self), mm_iface_modem_set_current_bands (MM_IFACE_MODEM (self),
bands_array, bands_array,
(GAsyncReadyCallback)handle_set_bands_ready, (GAsyncReadyCallback)handle_set_current_bands_ready,
ctx); ctx);
g_array_unref (bands_array); g_array_unref (bands_array);
} }
static gboolean static gboolean
handle_set_bands (MmGdbusModem *skeleton, handle_set_current_bands (MmGdbusModem *skeleton,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GVariant *bands_variant, GVariant *bands_variant,
MMIfaceModem *self) MMIfaceModem *self)
{ {
HandleSetBandsContext *ctx; HandleSetCurrentBandsContext *ctx;
ctx = g_new (HandleSetBandsContext, 1); ctx = g_slice_new (HandleSetCurrentBandsContext);
ctx->skeleton = g_object_ref (skeleton); ctx->skeleton = g_object_ref (skeleton);
ctx->invocation = g_object_ref (invocation); ctx->invocation = g_object_ref (invocation);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
@@ -2118,7 +2118,7 @@ handle_set_bands (MmGdbusModem *skeleton,
mm_base_modem_authorize (MM_BASE_MODEM (self), mm_base_modem_authorize (MM_BASE_MODEM (self),
invocation, invocation,
MM_AUTHORIZATION_DEVICE_CONTROL, MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_set_bands_auth_ready, (GAsyncReadyCallback)handle_set_current_bands_auth_ready,
ctx); ctx);
return TRUE; return TRUE;
} }
@@ -3002,7 +3002,7 @@ interface_disabling_step (DisablingContext *ctx)
case DISABLING_STEP_CURRENT_BANDS: case DISABLING_STEP_CURRENT_BANDS:
/* Clear 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 */ /* Fall down to next step */
ctx->step++; ctx->step++;
@@ -3244,11 +3244,11 @@ load_current_bands_ready (MMIfaceModem *self,
g_array_unref (supported_bands); g_array_unref (supported_bands);
if (filtered_bands) { if (filtered_bands) {
mm_gdbus_modem_set_bands (ctx->skeleton, mm_gdbus_modem_set_current_bands (ctx->skeleton,
mm_common_bands_garray_to_variant (filtered_bands)); mm_common_bands_garray_to_variant (filtered_bands));
g_array_unref (filtered_bands); g_array_unref (filtered_bands);
} else } 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 */ /* Errors when getting current bands won't be critical */
if (error) { if (error) {
@@ -3381,7 +3381,7 @@ interface_enabling_step (EnablingContext *ctx)
ctx); ctx);
return; return;
} else } 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 */ /* Fall down to next step */
ctx->step++; ctx->step++;
@@ -4049,7 +4049,7 @@ interface_initialization_step (InitializationContext *ctx)
/* Loading supported bands not implemented, default to UNKNOWN */ /* 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_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); g_array_unref (supported_bands);
@@ -4192,8 +4192,8 @@ interface_initialization_step (InitializationContext *ctx)
G_CALLBACK (handle_factory_reset), G_CALLBACK (handle_factory_reset),
ctx->self); ctx->self);
g_signal_connect (ctx->skeleton, g_signal_connect (ctx->skeleton,
"handle-set-bands", "handle-set-current-bands",
G_CALLBACK (handle_set_bands), G_CALLBACK (handle_set_current_bands),
ctx->self); ctx->self);
g_signal_connect (ctx->skeleton, g_signal_connect (ctx->skeleton,
"handle-set-allowed-modes", "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_allowed_modes (skeleton, MM_MODEM_MODE_NONE);
mm_gdbus_modem_set_preferred_mode (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_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_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_power_state (skeleton, MM_MODEM_POWER_STATE_UNKNOWN);
mm_gdbus_modem_set_state_failed_reason (skeleton, MM_MODEM_STATE_FAILED_REASON_NONE); mm_gdbus_modem_set_state_failed_reason (skeleton, MM_MODEM_STATE_FAILED_REASON_NONE);

View File

@@ -217,12 +217,12 @@ struct _MMIfaceModem {
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
/* Asynchronous allowed band setting operation */ /* Asynchronous current band setting operation */
void (*set_bands) (MMIfaceModem *self, void (*set_current_bands) (MMIfaceModem *self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean (*set_bands_finish) (MMIfaceModem *self, gboolean (*set_current_bands_finish) (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
@@ -428,11 +428,11 @@ gboolean mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self,
GError **error); GError **error);
/* Allow setting bands */ /* Allow setting bands */
void mm_iface_modem_set_bands (MMIfaceModem *self, void mm_iface_modem_set_current_bands (MMIfaceModem *self,
GArray *bands_array, GArray *bands_array,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean mm_iface_modem_set_bands_finish (MMIfaceModem *self, gboolean mm_iface_modem_set_current_bands_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);