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:
@@ -234,7 +234,7 @@ status_process_reply (MMSimpleStatus *result,
|
||||
signal_quality = (mm_simple_status_get_signal_quality (
|
||||
result,
|
||||
&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);
|
||||
access_tech_str = (mm_modem_access_technology_build_string_from_mask (
|
||||
mm_simple_status_get_access_technologies (result)));
|
||||
|
@@ -59,7 +59,7 @@ static gchar *create_bearer_str;
|
||||
static gchar *delete_bearer_str;
|
||||
static gchar *set_allowed_modes_str;
|
||||
static gchar *set_preferred_mode_str;
|
||||
static gchar *set_bands_str;
|
||||
static gchar *set_current_bands_str;
|
||||
|
||||
static GOptionEntry entries[] = {
|
||||
{ "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.",
|
||||
"[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 in a given modem (Must give allowed modes with --set-allowed-modes)",
|
||||
"[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 }
|
||||
};
|
||||
|
||||
@@ -159,7 +159,7 @@ mmcli_modem_options_enabled (void)
|
||||
!!command_str +
|
||||
!!set_allowed_modes_str +
|
||||
!!set_preferred_mode_str +
|
||||
!!set_bands_str);
|
||||
!!set_current_bands_str);
|
||||
|
||||
if (n_actions == 0 && mmcli_get_common_modem_string ()) {
|
||||
/* default to info */
|
||||
@@ -242,13 +242,13 @@ print_modem_info (void)
|
||||
gchar *allowed_modes_string;
|
||||
gchar *preferred_mode_string;
|
||||
gchar *supported_bands_string;
|
||||
gchar *bands_string;
|
||||
gchar *current_bands_string;
|
||||
gchar *supported_ip_families_string;
|
||||
gchar *unlock_retries_string;
|
||||
gchar *own_numbers_string;
|
||||
MMModemBand *bands = NULL;
|
||||
MMUnlockRetries *unlock_retries;
|
||||
guint n_bands = 0;
|
||||
MMUnlockRetries *unlock_retries;
|
||||
guint signal_quality = 0;
|
||||
gboolean signal_quality_recent = FALSE;
|
||||
|
||||
@@ -266,8 +266,8 @@ print_modem_info (void)
|
||||
mm_modem_get_current_capabilities (ctx->modem));
|
||||
access_technologies_string = mm_modem_access_technology_build_string_from_mask (
|
||||
mm_modem_get_access_technologies (ctx->modem));
|
||||
mm_modem_get_bands (ctx->modem, &bands, &n_bands);
|
||||
bands_string = mm_common_build_bands_string (bands, n_bands);
|
||||
mm_modem_get_current_bands (ctx->modem, &bands, &n_bands);
|
||||
current_bands_string = mm_common_build_bands_string (bands, n_bands);
|
||||
g_free (bands);
|
||||
mm_modem_get_supported_bands (ctx->modem, &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"
|
||||
" | current: '%s'\n",
|
||||
VALIDATE_UNKNOWN (supported_bands_string),
|
||||
VALIDATE_UNKNOWN (bands_string));
|
||||
VALIDATE_UNKNOWN (current_bands_string));
|
||||
|
||||
/* IP families */
|
||||
g_print (" -------------------------\n"
|
||||
@@ -459,7 +459,7 @@ print_modem_info (void)
|
||||
g_print ("\n");
|
||||
|
||||
g_free (supported_ip_families_string);
|
||||
g_free (bands_string);
|
||||
g_free (current_bands_string);
|
||||
g_free (supported_bands_string);
|
||||
g_free (access_technologies_string);
|
||||
g_free (modem_capabilities_string);
|
||||
@@ -801,39 +801,39 @@ parse_modes (MMModemMode *allowed,
|
||||
}
|
||||
|
||||
static void
|
||||
set_bands_process_reply (gboolean result,
|
||||
const GError *error)
|
||||
set_current_bands_process_reply (gboolean result,
|
||||
const GError *error)
|
||||
{
|
||||
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");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_print ("successfully set bands in the modem\n");
|
||||
g_print ("successfully set current bands in the modem\n");
|
||||
}
|
||||
|
||||
static void
|
||||
set_bands_ready (MMModem *modem,
|
||||
GAsyncResult *result,
|
||||
gpointer nothing)
|
||||
set_current_bands_ready (MMModem *modem,
|
||||
GAsyncResult *result,
|
||||
gpointer nothing)
|
||||
{
|
||||
gboolean operation_result;
|
||||
GError *error = NULL;
|
||||
|
||||
operation_result = mm_modem_set_bands_finish (modem, result, &error);
|
||||
set_bands_process_reply (operation_result, error);
|
||||
operation_result = mm_modem_set_current_bands_finish (modem, result, &error);
|
||||
set_current_bands_process_reply (operation_result, error);
|
||||
|
||||
mmcli_async_operation_done ();
|
||||
}
|
||||
|
||||
static void
|
||||
parse_bands (MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
parse_current_bands (MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
mm_common_get_bands_from_string (set_bands_str,
|
||||
mm_common_get_bands_from_string (set_current_bands_str,
|
||||
bands,
|
||||
n_bands,
|
||||
&error);
|
||||
@@ -844,7 +844,6 @@ parse_bands (MMModemBand **bands,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
state_changed (MMModem *modem,
|
||||
MMModemState old_state,
|
||||
@@ -1039,19 +1038,19 @@ get_modem_ready (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Request to set allowed bands in a given modem? */
|
||||
if (set_bands_str) {
|
||||
MMModemBand *bands;
|
||||
guint n_bands;
|
||||
/* Request to set current bands in a given modem? */
|
||||
if (set_current_bands_str) {
|
||||
MMModemBand *current_bands;
|
||||
guint n_current_bands;
|
||||
|
||||
parse_bands (&bands, &n_bands);
|
||||
mm_modem_set_bands (ctx->modem,
|
||||
bands,
|
||||
n_bands,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)set_bands_ready,
|
||||
NULL);
|
||||
g_free (bands);
|
||||
parse_current_bands (¤t_bands, &n_current_bands);
|
||||
mm_modem_set_current_bands (ctx->modem,
|
||||
current_bands,
|
||||
n_current_bands,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)set_current_bands_ready,
|
||||
NULL);
|
||||
g_free (current_bands);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1254,19 +1253,19 @@ mmcli_modem_run_synchronous (GDBusConnection *connection)
|
||||
}
|
||||
|
||||
/* Request to set allowed bands in a given modem? */
|
||||
if (set_bands_str) {
|
||||
if (set_current_bands_str) {
|
||||
gboolean result;
|
||||
MMModemBand *bands;
|
||||
guint n_bands;
|
||||
MMModemBand *current_bands;
|
||||
guint n_current_bands;
|
||||
|
||||
parse_bands (&bands, &n_bands);
|
||||
result = mm_modem_set_bands_sync (ctx->modem,
|
||||
bands,
|
||||
n_bands,
|
||||
NULL,
|
||||
&error);
|
||||
g_free (bands);
|
||||
set_bands_process_reply (result, error);
|
||||
parse_current_bands (¤t_bands, &n_current_bands);
|
||||
result = mm_modem_set_current_bands_sync (ctx->modem,
|
||||
current_bands,
|
||||
n_current_bands,
|
||||
NULL,
|
||||
&error);
|
||||
g_free (current_bands);
|
||||
set_current_bands_process_reply (result, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -111,8 +111,8 @@ mm_modem_get_allowed_modes
|
||||
mm_modem_get_preferred_mode
|
||||
mm_modem_peek_supported_bands
|
||||
mm_modem_get_supported_bands
|
||||
mm_modem_peek_bands
|
||||
mm_modem_get_bands
|
||||
mm_modem_peek_current_bands
|
||||
mm_modem_get_current_bands
|
||||
mm_modem_get_supported_ip_families
|
||||
mm_modem_get_signal_quality
|
||||
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_finish
|
||||
mm_modem_set_allowed_modes_sync
|
||||
mm_modem_set_bands
|
||||
mm_modem_set_bands_finish
|
||||
mm_modem_set_bands_sync
|
||||
mm_modem_set_current_bands
|
||||
mm_modem_set_current_bands_finish
|
||||
mm_modem_set_current_bands_sync
|
||||
mm_modem_reset
|
||||
mm_modem_reset_finish
|
||||
mm_modem_reset_sync
|
||||
@@ -634,8 +634,8 @@ mm_simple_connect_properties_get_pin
|
||||
mm_simple_connect_properties_set_pin
|
||||
mm_simple_connect_properties_get_operator_id
|
||||
mm_simple_connect_properties_set_operator_id
|
||||
mm_simple_connect_properties_get_bands
|
||||
mm_simple_connect_properties_set_bands
|
||||
mm_simple_connect_properties_get_current_bands
|
||||
mm_simple_connect_properties_set_current_bands
|
||||
mm_simple_connect_properties_get_allowed_modes
|
||||
mm_simple_connect_properties_set_allowed_modes
|
||||
mm_simple_connect_properties_get_apn
|
||||
@@ -677,7 +677,7 @@ MMSimpleStatus
|
||||
mm_simple_status_get_state
|
||||
mm_simple_status_get_signal_quality
|
||||
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_operator_code
|
||||
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_REGISTRATION_STATE
|
||||
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_EVDO_REGISTRATION_STATE
|
||||
MM_SIMPLE_PROPERTY_CDMA_NID
|
||||
@@ -1417,8 +1417,8 @@ MmGdbusModemIface
|
||||
<SUBSECTION Getters>
|
||||
mm_gdbus_modem_get_access_technologies
|
||||
mm_gdbus_modem_get_allowed_modes
|
||||
mm_gdbus_modem_get_bands
|
||||
mm_gdbus_modem_dup_bands
|
||||
mm_gdbus_modem_get_current_bands
|
||||
mm_gdbus_modem_dup_current_bands
|
||||
mm_gdbus_modem_get_current_capabilities
|
||||
mm_gdbus_modem_get_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_finish
|
||||
mm_gdbus_modem_call_set_allowed_modes_sync
|
||||
mm_gdbus_modem_call_set_bands
|
||||
mm_gdbus_modem_call_set_bands_finish
|
||||
mm_gdbus_modem_call_set_bands_sync
|
||||
mm_gdbus_modem_call_set_current_bands
|
||||
mm_gdbus_modem_call_set_current_bands_finish
|
||||
mm_gdbus_modem_call_set_current_bands_sync
|
||||
mm_gdbus_modem_call_command
|
||||
mm_gdbus_modem_call_command_finish
|
||||
mm_gdbus_modem_call_command_sync
|
||||
<SUBSECTION Private>
|
||||
mm_gdbus_modem_set_access_technologies
|
||||
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_device
|
||||
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_reset
|
||||
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_override_properties
|
||||
<SUBSECTION Standard>
|
||||
|
@@ -52,7 +52,7 @@
|
||||
given as a string value (signature <literal>"s"</literal>).
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><literal>"bands"</literal></term>
|
||||
<varlistentry><term><literal>"current-bands"</literal></term>
|
||||
<listitem>
|
||||
List of <link linkend="MMModemBand">MMModemBand</link> values,
|
||||
to specify all the bands allowed in the modem, given as a list of
|
||||
@@ -165,7 +165,7 @@
|
||||
(signature <literal>"u"</literal>).
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><literal>"bands"</literal></term>
|
||||
<varlistentry><term><literal>"current-bands"</literal></term>
|
||||
<listitem>
|
||||
List of <link linkend="MMModemBand">MMModemBand</link> values,
|
||||
given only when registered, as a list of
|
||||
|
@@ -150,13 +150,13 @@
|
||||
</method>
|
||||
|
||||
<!--
|
||||
SetBands:
|
||||
SetCurrentBands:
|
||||
@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
|
||||
allowed to use when connecting to a network.
|
||||
-->
|
||||
<method name="SetBands">
|
||||
<method name="SetCurrentBands">
|
||||
<arg name="bands" type="au" direction="in" />
|
||||
</method>
|
||||
|
||||
@@ -460,7 +460,7 @@
|
||||
<property name="SupportedBands" type="au" access="read" />
|
||||
|
||||
<!--
|
||||
Bands:
|
||||
CurrentBands:
|
||||
|
||||
List of <link linkend="MMModemBand">MMModemBand</link> values,
|
||||
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.
|
||||
-->
|
||||
<property name="Bands" type="au" access="read" />
|
||||
<property name="CurrentBands" type="au" access="read" />
|
||||
|
||||
<!--
|
||||
SupportedIpFamilies:
|
||||
|
@@ -54,10 +54,10 @@ struct _MMModemPrivate {
|
||||
guint supported_bands_id;
|
||||
GArray *supported_bands;
|
||||
|
||||
/* Bands */
|
||||
GMutex bands_mutex;
|
||||
guint bands_id;
|
||||
GArray *bands;
|
||||
/* Current Bands */
|
||||
GMutex current_bands_mutex;
|
||||
guint current_bands_id;
|
||||
GArray *current_bands;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1093,74 +1093,74 @@ mm_modem_peek_supported_bands (MMModem *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
bands_updated (MMModem *self,
|
||||
GParamSpec *pspec)
|
||||
current_bands_updated (MMModem *self,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
g_mutex_lock (&self->priv->bands_mutex);
|
||||
g_mutex_lock (&self->priv->current_bands_mutex);
|
||||
{
|
||||
GVariant *dictionary;
|
||||
|
||||
if (self->priv->bands)
|
||||
g_array_unref (self->priv->bands);
|
||||
if (self->priv->current_bands)
|
||||
g_array_unref (self->priv->current_bands);
|
||||
|
||||
dictionary = mm_gdbus_modem_get_bands (MM_GDBUS_MODEM (self));
|
||||
self->priv->bands = (dictionary ?
|
||||
mm_common_bands_variant_to_garray (dictionary) :
|
||||
NULL);
|
||||
dictionary = mm_gdbus_modem_get_current_bands (MM_GDBUS_MODEM (self));
|
||||
self->priv->current_bands = (dictionary ?
|
||||
mm_common_bands_variant_to_garray (dictionary) :
|
||||
NULL);
|
||||
}
|
||||
g_mutex_unlock (&self->priv->bands_mutex);
|
||||
g_mutex_unlock (&self->priv->current_bands_mutex);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ensure_internal_bands (MMModem *self,
|
||||
MMModemBand **dup_bands,
|
||||
guint *dup_bands_n)
|
||||
ensure_internal_current_bands (MMModem *self,
|
||||
MMModemBand **dup_bands,
|
||||
guint *dup_bands_n)
|
||||
{
|
||||
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
|
||||
* update listener and the initial array, if any. */
|
||||
if (!self->priv->bands_id) {
|
||||
if (!self->priv->current_bands_id) {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
/* No need to clear this signal connection when freeing self */
|
||||
self->priv->bands_id =
|
||||
self->priv->current_bands_id =
|
||||
g_signal_connect (self,
|
||||
"notify::bands",
|
||||
G_CALLBACK (bands_updated),
|
||||
"notify::current-bands",
|
||||
G_CALLBACK (current_bands_updated),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!self->priv->bands)
|
||||
if (!self->priv->current_bands)
|
||||
ret = FALSE;
|
||||
else {
|
||||
ret = TRUE;
|
||||
|
||||
if (dup_bands && dup_bands_n) {
|
||||
*dup_bands_n = self->priv->bands->len;
|
||||
if (self->priv->bands->len > 0) {
|
||||
*dup_bands = g_malloc (sizeof (MMModemBand) * self->priv->bands->len);
|
||||
memcpy (*dup_bands, self->priv->bands->data, sizeof (MMModemBand) * self->priv->bands->len);
|
||||
*dup_bands_n = self->priv->current_bands->len;
|
||||
if (self->priv->current_bands->len > 0) {
|
||||
*dup_bands = g_malloc (sizeof (MMModemBand) * self->priv->current_bands->len);
|
||||
memcpy (*dup_bands, self->priv->current_bands->data, sizeof (MMModemBand) * self->priv->current_bands->len);
|
||||
} else
|
||||
*dup_bands = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_mutex_unlock (&self->priv->bands_mutex);
|
||||
g_mutex_unlock (&self->priv->current_bands_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_get_bands:
|
||||
* mm_modem_get_current_bands:
|
||||
* @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.
|
||||
* @n_bands: (out): Return location for the number of values in @bands.
|
||||
@@ -1173,19 +1173,19 @@ ensure_internal_bands (MMModem *self,
|
||||
* Returns: %TRUE if @bands and @n_bands are set, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_get_bands (MMModem *self,
|
||||
MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
mm_modem_get_current_bands (MMModem *self,
|
||||
MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM (self), FALSE);
|
||||
g_return_val_if_fail (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.
|
||||
* @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.
|
||||
@@ -1198,19 +1198,19 @@ mm_modem_get_bands (MMModem *self,
|
||||
* Returns: %TRUE if @bands and @n_bands are set, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_peek_bands (MMModem *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
mm_modem_peek_current_bands (MMModem *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM (self), FALSE);
|
||||
g_return_val_if_fail (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;
|
||||
|
||||
*n_bands = self->priv->bands->len;
|
||||
*bands = (MMModemBand *)self->priv->bands->data;
|
||||
*n_bands = self->priv->current_bands->len;
|
||||
*bands = (MMModemBand *)self->priv->current_bands->data;
|
||||
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.
|
||||
* @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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_set_bands_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
mm_modem_set_current_bands_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
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.
|
||||
* @bands: An array of #MMModemBand values specifying which bands are allowed.
|
||||
* @n_bands: Number of elements in @bands.
|
||||
@@ -2327,29 +2327,29 @@ mm_modem_set_bands_finish (MMModem *self,
|
||||
* 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.
|
||||
* 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
|
||||
mm_modem_set_bands (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
mm_modem_set_current_bands (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM (self));
|
||||
|
||||
mm_gdbus_modem_call_set_bands (MM_GDBUS_MODEM (self),
|
||||
mm_common_bands_array_to_variant (bands, n_bands),
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
mm_gdbus_modem_call_set_current_bands (MM_GDBUS_MODEM (self),
|
||||
mm_common_bands_array_to_variant (bands, n_bands),
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_set_bands_sync:
|
||||
* mm_modem_set_current_bands_sync:
|
||||
* @self: A #MMModem.
|
||||
* @bands: An array of #MMModemBand values specifying which bands are allowed.
|
||||
* @n_bands: Number of elements in @bands.
|
||||
@@ -2359,21 +2359,21 @@ mm_modem_set_bands (MMModem *self,
|
||||
* Synchronously sets the radio frequency and technology bands the device is currently
|
||||
* 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.
|
||||
*
|
||||
* Returns: %TRUE if the bands were successfully set, %FALSE if @error is set.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_set_bands_sync (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
mm_modem_set_current_bands_sync (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
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_common_bands_array_to_variant (bands, n_bands),
|
||||
cancellable,
|
||||
@@ -2534,7 +2534,7 @@ mm_modem_init (MMModem *self)
|
||||
MMModemPrivate);
|
||||
g_mutex_init (&self->priv->unlock_retries_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
|
||||
@@ -2544,12 +2544,12 @@ finalize (GObject *object)
|
||||
|
||||
g_mutex_clear (&self->priv->unlock_retries_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)
|
||||
g_array_unref (self->priv->supported_bands);
|
||||
if (self->priv->bands)
|
||||
g_array_unref (self->priv->bands);
|
||||
if (self->priv->current_bands)
|
||||
g_array_unref (self->priv->current_bands);
|
||||
|
||||
G_OBJECT_CLASS (mm_modem_parent_class)->finalize (object);
|
||||
}
|
||||
|
@@ -140,10 +140,10 @@ gboolean mm_modem_get_supported_bands (MMModem *self,
|
||||
MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
|
||||
gboolean mm_modem_peek_bands (MMModem *self,
|
||||
gboolean mm_modem_peek_current_bands (MMModem *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
gboolean mm_modem_get_bands (MMModem *self,
|
||||
gboolean mm_modem_get_current_bands (MMModem *self,
|
||||
MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
|
||||
@@ -275,20 +275,20 @@ gboolean mm_modem_set_allowed_modes_sync (MMModem *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void mm_modem_set_bands (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_modem_set_bands_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
gboolean mm_modem_set_bands_sync (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void mm_modem_set_current_bands (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_modem_set_current_bands_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
gboolean mm_modem_set_current_bands_sync (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void mm_modem_get_sim (MMModem *self,
|
||||
GCancellable *cancellable,
|
||||
|
@@ -35,7 +35,7 @@ G_DEFINE_TYPE (MMSimpleConnectProperties, mm_simple_connect_properties, G_TYPE_O
|
||||
|
||||
#define PROPERTY_PIN "pin"
|
||||
#define PROPERTY_OPERATOR_ID "operator-id"
|
||||
#define PROPERTY_BANDS "bands"
|
||||
#define PROPERTY_CURRENT_BANDS "current-bands"
|
||||
#define PROPERTY_ALLOWED_MODES "allowed-modes"
|
||||
#define PROPERTY_PREFERRED_MODE "preferred-mode"
|
||||
|
||||
@@ -45,9 +45,9 @@ struct _MMSimpleConnectPropertiesPrivate {
|
||||
/* Operator ID */
|
||||
gchar *operator_id;
|
||||
/* Bands */
|
||||
gboolean bands_set;
|
||||
MMModemBand *bands;
|
||||
guint n_bands;
|
||||
gboolean current_bands_set;
|
||||
MMModemBand *current_bands;
|
||||
guint n_current_bands;
|
||||
/* Modes */
|
||||
gboolean allowed_modes_set;
|
||||
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.
|
||||
* @bands: array of #MMModemBand values.
|
||||
* @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.
|
||||
*/
|
||||
void
|
||||
mm_simple_connect_properties_set_bands (MMSimpleConnectProperties *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands)
|
||||
mm_simple_connect_properties_set_current_bands (MMSimpleConnectProperties *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands)
|
||||
{
|
||||
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
|
||||
|
||||
g_free (self->priv->bands);
|
||||
self->priv->n_bands = n_bands;
|
||||
self->priv->bands = g_new (MMModemBand, self->priv->n_bands);
|
||||
memcpy (self->priv->bands,
|
||||
g_free (self->priv->current_bands);
|
||||
self->priv->n_current_bands = n_bands;
|
||||
self->priv->current_bands = g_new (MMModemBand, self->priv->n_current_bands);
|
||||
memcpy (self->priv->current_bands,
|
||||
bands,
|
||||
sizeof (MMModemBand) * self->priv->n_bands);
|
||||
self->priv->bands_set = TRUE;
|
||||
sizeof (MMModemBand) * self->priv->n_current_bands);
|
||||
self->priv->current_bands_set = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_simple_connect_properties_get_bands:
|
||||
* mm_simple_connect_properties_get_current_bands:
|
||||
* @self: a #MMSimpleConnectProperties.
|
||||
* @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.
|
||||
@@ -163,17 +163,17 @@ mm_simple_connect_properties_set_bands (MMSimpleConnectProperties *self,
|
||||
* Returns: %TRUE if @bands is set, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
mm_simple_connect_properties_get_bands (MMSimpleConnectProperties *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
mm_simple_connect_properties_get_current_bands (MMSimpleConnectProperties *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), FALSE);
|
||||
g_return_val_if_fail (bands != NULL, FALSE);
|
||||
g_return_val_if_fail (n_bands != NULL, FALSE);
|
||||
|
||||
if (self->priv->bands_set) {
|
||||
*bands = self->priv->bands;
|
||||
*n_bands = self->priv->n_bands;
|
||||
if (self->priv->current_bands_set) {
|
||||
*bands = self->priv->current_bands;
|
||||
*n_bands = self->priv->n_current_bands;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -517,12 +517,12 @@ mm_simple_connect_properties_get_dictionary (MMSimpleConnectProperties *self)
|
||||
PROPERTY_OPERATOR_ID,
|
||||
g_variant_new_string (self->priv->operator_id));
|
||||
|
||||
if (self->priv->bands)
|
||||
if (self->priv->current_bands)
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
PROPERTY_BANDS,
|
||||
mm_common_bands_array_to_variant (self->priv->bands,
|
||||
self->priv->n_bands));
|
||||
PROPERTY_CURRENT_BANDS,
|
||||
mm_common_bands_array_to_variant (self->priv->current_bands,
|
||||
self->priv->n_current_bands));
|
||||
|
||||
if (self->priv->allowed_modes_set) {
|
||||
g_variant_builder_add (&builder,
|
||||
@@ -575,13 +575,13 @@ key_value_foreach (const gchar *key,
|
||||
mm_simple_connect_properties_set_pin (ctx->self, value);
|
||||
else if (g_str_equal (key, PROPERTY_OPERATOR_ID))
|
||||
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;
|
||||
guint n_bands = 0;
|
||||
|
||||
mm_common_get_bands_from_string (value, &bands, &n_bands, &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);
|
||||
}
|
||||
} 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 (
|
||||
self,
|
||||
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;
|
||||
|
||||
array = mm_common_bands_variant_to_garray (value);
|
||||
mm_simple_connect_properties_set_bands (
|
||||
mm_simple_connect_properties_set_current_bands (
|
||||
self,
|
||||
(MMModemBand *)array->data,
|
||||
array->len);
|
||||
@@ -781,9 +781,9 @@ mm_simple_connect_properties_init (MMSimpleConnectProperties *self)
|
||||
self->priv->bearer_properties = mm_bearer_properties_new ();
|
||||
self->priv->allowed_modes = MM_MODEM_MODE_ANY;
|
||||
self->priv->preferred_mode = MM_MODEM_MODE_NONE;
|
||||
self->priv->bands = g_new (MMModemBand, 1);
|
||||
self->priv->bands[0] = MM_MODEM_BAND_UNKNOWN;
|
||||
self->priv->n_bands = 1;
|
||||
self->priv->current_bands = g_new (MMModemBand, 1);
|
||||
self->priv->current_bands[0] = MM_MODEM_BAND_UNKNOWN;
|
||||
self->priv->n_current_bands = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -793,7 +793,7 @@ finalize (GObject *object)
|
||||
|
||||
g_free (self->priv->pin);
|
||||
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_CLASS (mm_simple_connect_properties_parent_class)->finalize (object);
|
||||
|
@@ -63,7 +63,7 @@ void mm_simple_connect_properties_set_pin (MMSimpleConnectProperties *
|
||||
const gchar *pin);
|
||||
void mm_simple_connect_properties_set_operator_id (MMSimpleConnectProperties *self,
|
||||
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,
|
||||
guint n_bands);
|
||||
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_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,
|
||||
guint *n_bands);
|
||||
gboolean mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self,
|
||||
|
@@ -39,7 +39,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_STATE,
|
||||
PROP_SIGNAL_QUALITY,
|
||||
PROP_BANDS,
|
||||
PROP_CURRENT_BANDS,
|
||||
PROP_ACCESS_TECHNOLOGIES,
|
||||
PROP_3GPP_REGISTRATION_STATE,
|
||||
PROP_3GPP_OPERATOR_CODE,
|
||||
@@ -60,8 +60,8 @@ struct _MMSimpleStatusPrivate {
|
||||
/* Signal quality, given only when registered, signature '(ub)' */
|
||||
GVariant *signal_quality;
|
||||
/* List of bands, given only when registered, signature: au */
|
||||
GVariant *bands;
|
||||
GArray *bands_array;
|
||||
GVariant *current_bands;
|
||||
GArray *current_bands_array;
|
||||
/* Access technologies, given only when registered, signature: u */
|
||||
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.
|
||||
* @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.
|
||||
@@ -145,17 +145,17 @@ mm_simple_status_get_signal_quality (MMSimpleStatus *self,
|
||||
* Gets the currently used frequency bands.
|
||||
*/
|
||||
void
|
||||
mm_simple_status_get_bands (MMSimpleStatus *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
mm_simple_status_get_current_bands (MMSimpleStatus *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
g_return_if_fail (MM_IS_SIMPLE_STATUS (self));
|
||||
|
||||
if (!self->priv->bands_array)
|
||||
self->priv->bands_array = mm_common_bands_variant_to_garray (self->priv->bands);
|
||||
if (!self->priv->current_bands_array)
|
||||
self->priv->current_bands_array = mm_common_bands_variant_to_garray (self->priv->current_bands);
|
||||
|
||||
*n_bands = self->priv->bands_array->len;
|
||||
*bands = (const MMModemBand *)self->priv->bands_array->data;
|
||||
*n_bands = self->priv->current_bands_array->len;
|
||||
*bands = (const MMModemBand *)self->priv->current_bands_array->data;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -329,8 +329,8 @@ mm_simple_status_get_dictionary (MMSimpleStatus *self)
|
||||
self->priv->signal_quality);
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
MM_SIMPLE_PROPERTY_BANDS,
|
||||
self->priv->bands);
|
||||
MM_SIMPLE_PROPERTY_CURRENT_BANDS,
|
||||
self->priv->current_bands);
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES,
|
||||
@@ -428,7 +428,7 @@ mm_simple_status_new_from_dictionary (GVariant *dictionary,
|
||||
g_object_set (properties,
|
||||
key, g_variant_get_string (value, 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)) {
|
||||
/* remaining complex types, as variant */
|
||||
g_object_set (properties,
|
||||
@@ -482,14 +482,14 @@ set_property (GObject *object,
|
||||
g_variant_unref (self->priv->signal_quality);
|
||||
self->priv->signal_quality = g_value_dup_variant (value);
|
||||
break;
|
||||
case PROP_BANDS:
|
||||
if (self->priv->bands)
|
||||
g_variant_unref (self->priv->bands);
|
||||
if (self->priv->bands_array) {
|
||||
g_array_unref (self->priv->bands_array);
|
||||
self->priv->bands_array = NULL;
|
||||
case PROP_CURRENT_BANDS:
|
||||
if (self->priv->current_bands)
|
||||
g_variant_unref (self->priv->current_bands);
|
||||
if (self->priv->current_bands_array) {
|
||||
g_array_unref (self->priv->current_bands_array);
|
||||
self->priv->current_bands_array = NULL;
|
||||
}
|
||||
self->priv->bands = g_value_dup_variant (value);
|
||||
self->priv->current_bands = g_value_dup_variant (value);
|
||||
break;
|
||||
case PROP_ACCESS_TECHNOLOGIES:
|
||||
self->priv->access_technologies = g_value_get_flags (value);
|
||||
@@ -538,8 +538,8 @@ get_property (GObject *object,
|
||||
case PROP_SIGNAL_QUALITY:
|
||||
g_value_set_variant (value, self->priv->signal_quality);
|
||||
break;
|
||||
case PROP_BANDS:
|
||||
g_value_set_variant (value, self->priv->bands);
|
||||
case PROP_CURRENT_BANDS:
|
||||
g_value_set_variant (value, self->priv->current_bands);
|
||||
break;
|
||||
case PROP_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->access_technologies = MM_MODEM_ACCESS_TECHNOLOGY_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->modem_cdma_cdma1x_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);
|
||||
|
||||
g_variant_unref (self->priv->signal_quality);
|
||||
g_variant_unref (self->priv->bands);
|
||||
if (self->priv->bands_array)
|
||||
g_array_unref (self->priv->bands_array);
|
||||
g_variant_unref (self->priv->current_bands);
|
||||
if (self->priv->current_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_name);
|
||||
|
||||
@@ -635,14 +635,14 @@ mm_simple_status_class_init (MMSimpleStatusClass *klass)
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (object_class, PROP_SIGNAL_QUALITY, properties[PROP_SIGNAL_QUALITY]);
|
||||
|
||||
properties[PROP_BANDS] =
|
||||
g_param_spec_variant (MM_SIMPLE_PROPERTY_BANDS,
|
||||
"Bands",
|
||||
properties[PROP_CURRENT_BANDS] =
|
||||
g_param_spec_variant (MM_SIMPLE_PROPERTY_CURRENT_BANDS,
|
||||
"Current Bands",
|
||||
"Frequency bands used by the modem",
|
||||
G_VARIANT_TYPE ("au"),
|
||||
NULL,
|
||||
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] =
|
||||
g_param_spec_flags (MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES,
|
||||
|
@@ -58,10 +58,10 @@ GType mm_simple_status_get_type (void);
|
||||
|
||||
MMModemState mm_simple_status_get_state (MMSimpleStatus *self);
|
||||
guint32 mm_simple_status_get_signal_quality (MMSimpleStatus *self,
|
||||
gboolean *recent);
|
||||
void mm_simple_status_get_bands (MMSimpleStatus *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
gboolean *recent);
|
||||
void mm_simple_status_get_current_bands (MMSimpleStatus *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
MMModemAccessTechnology mm_simple_status_get_access_technologies (MMSimpleStatus *self);
|
||||
|
||||
MMModem3gppRegistrationState mm_simple_status_get_3gpp_registration_state (MMSimpleStatus *self);
|
||||
@@ -82,7 +82,7 @@ guint mm_simple_status_get_cdma_nid
|
||||
|
||||
#define MM_SIMPLE_PROPERTY_STATE "state"
|
||||
#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_3GPP_REGISTRATION_STATE "m3gpp-registration-state"
|
||||
|
@@ -879,12 +879,12 @@ load_current_bands (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* SET BANDS */
|
||||
/* 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);
|
||||
}
|
||||
@@ -1074,10 +1074,10 @@ set_bands_2g (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
|
||||
@@ -1090,7 +1090,7 @@ set_bands (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_bands);
|
||||
set_current_bands);
|
||||
|
||||
if (mm_iface_modem_is_3g (self))
|
||||
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_current_bands = load_current_bands;
|
||||
iface->load_current_bands_finish = 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;
|
||||
iface->load_access_technologies = load_access_technologies;
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->setup_flow_control = setup_flow_control;
|
||||
|
@@ -1005,12 +1005,12 @@ 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);
|
||||
}
|
||||
@@ -1033,10 +1033,10 @@ syscfg_set_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
gchar *cmd;
|
||||
@@ -1046,7 +1046,7 @@ set_bands (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_bands);
|
||||
set_current_bands);
|
||||
|
||||
bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array->data,
|
||||
bands_array->len);
|
||||
@@ -2658,8 +2658,8 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;
|
||||
iface->load_current_bands = load_current_bands;
|
||||
iface->load_current_bands_finish = 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;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
|
@@ -1157,9 +1157,9 @@ load_supported_bands_response_processor (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_supported_bands_get_bands_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *operation_result)
|
||||
load_supported_bands_get_current_bands_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *operation_result)
|
||||
{
|
||||
SupportedBandsContext *ctx;
|
||||
const gchar *response;
|
||||
@@ -1228,7 +1228,7 @@ modem_load_supported_bands (MMIfaceModem *self,
|
||||
"%IPBM?",
|
||||
3,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback)load_supported_bands_get_bands_ready,
|
||||
(GAsyncReadyCallback)load_supported_bands_get_current_bands_ready,
|
||||
g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
@@ -1305,14 +1305,14 @@ modem_load_current_bands (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Set bands (Modem interface) */
|
||||
/* Set current bands (Modem interface) */
|
||||
|
||||
typedef struct {
|
||||
GSimpleAsyncResult *result;
|
||||
guint bandbits;
|
||||
guint enablebits;
|
||||
guint disablebits;
|
||||
} SetBandsContext;
|
||||
} SetCurrentBandsContext;
|
||||
|
||||
/*
|
||||
* The modem's band-setting command (%IPBM=) enables or disables one
|
||||
@@ -1322,34 +1322,34 @@ typedef struct {
|
||||
* disable any removed bands.
|
||||
*/
|
||||
static gboolean
|
||||
modem_set_bands_finish (MMIfaceModem *self,
|
||||
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_one_band (MMIfaceModem *self, SetBandsContext *ctx);
|
||||
static void set_one_band (MMIfaceModem *self, SetCurrentBandsContext *ctx);
|
||||
|
||||
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_object_unref (ctx->result);
|
||||
g_free (ctx);
|
||||
g_slice_free (SetCurrentBandsContext, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
set_bands_next (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetBandsContext *ctx)
|
||||
set_current_bands_next (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetCurrentBandsContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
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);
|
||||
set_bands_context_complete_and_free (ctx);
|
||||
set_current_bands_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1358,7 +1358,7 @@ set_bands_next (MMIfaceModem *self,
|
||||
|
||||
static void
|
||||
set_one_band (MMIfaceModem *self,
|
||||
SetBandsContext *ctx)
|
||||
SetCurrentBandsContext *ctx)
|
||||
{
|
||||
guint enable, band;
|
||||
gchar *command;
|
||||
@@ -1373,7 +1373,7 @@ set_one_band (MMIfaceModem *self,
|
||||
if (band == 0) {
|
||||
/* Both enabling and disabling are done */
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1397,7 +1397,7 @@ set_one_band (MMIfaceModem *self,
|
||||
command,
|
||||
10,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback)set_bands_next,
|
||||
(GAsyncReadyCallback)set_current_bands_next,
|
||||
ctx);
|
||||
g_free (command);
|
||||
}
|
||||
@@ -1424,9 +1424,9 @@ band_array_to_bandbits (GArray *bands)
|
||||
}
|
||||
|
||||
static void
|
||||
set_bands_got_current_bands (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetBandsContext *ctx)
|
||||
set_current_bands_got_current_bands (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetCurrentBandsContext *ctx)
|
||||
{
|
||||
GArray *bands;
|
||||
GError *error = NULL;
|
||||
@@ -1435,7 +1435,7 @@ set_bands_got_current_bands (MMIfaceModem *self,
|
||||
bands = modem_load_current_bands_finish (self, res, &error);
|
||||
if (!bands) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1447,18 +1447,18 @@ set_bands_got_current_bands (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
modem_set_bands (MMIfaceModem *self,
|
||||
GArray *bands_array,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
modem_set_current_bands (MMIfaceModem *self,
|
||||
GArray *bands_array,
|
||||
GAsyncReadyCallback callback,
|
||||
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),
|
||||
callback,
|
||||
user_data,
|
||||
modem_set_bands);
|
||||
modem_set_current_bands);
|
||||
ctx->bandbits = band_array_to_bandbits (bands_array);
|
||||
|
||||
/*
|
||||
@@ -1472,7 +1472,7 @@ modem_set_bands (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
modem_load_current_bands (self,
|
||||
(GAsyncReadyCallback)set_bands_got_current_bands,
|
||||
(GAsyncReadyCallback)set_current_bands_got_current_bands,
|
||||
ctx);
|
||||
}
|
||||
|
||||
@@ -1789,8 +1789,8 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->modem_power_down_finish = modem_power_down_finish;
|
||||
iface->reset = modem_reset;
|
||||
iface->reset_finish = modem_reset_finish;
|
||||
iface->set_bands = modem_set_bands;
|
||||
iface->set_bands_finish = modem_set_bands_finish;
|
||||
iface->set_current_bands = modem_set_current_bands;
|
||||
iface->set_current_bands_finish = modem_set_current_bands_finish;
|
||||
iface->create_bearer = modem_create_bearer;
|
||||
iface->create_bearer_finish = modem_create_bearer_finish;
|
||||
}
|
||||
|
@@ -745,12 +745,12 @@ 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);
|
||||
}
|
||||
@@ -908,10 +908,10 @@ set_bands_2g (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
|
||||
@@ -924,7 +924,7 @@ set_bands (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_bands);
|
||||
set_current_bands);
|
||||
|
||||
if (mm_iface_modem_is_3g (self))
|
||||
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_current_bands = load_current_bands;
|
||||
iface->load_current_bands_finish = 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;
|
||||
iface->load_access_technologies = load_access_technologies;
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->setup_flow_control = setup_flow_control;
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user