api,dbus: rename AllowedBands' to just
Bands'
ModemManager will load: 1) The list of supported bands. Note that this doesn't mean that any possible combination of bands is supported, as modems may support only specific combinations, but at least gives a rough idea of what the modem is capable of handling. 2) The list of CURRENT bands. There is no such "Allowed" bands, as we do with modes, modems will have a specific set of bands being currently used, which will be reported in the `Bands' property. If the modem allows modifying the list of bands to use, this can be done with the `SetBands()' method. If the modem doesn't support using a specific combination of bands, this method will report an error.
This commit is contained in:
@@ -58,7 +58,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_allowed_bands_str;
|
||||
static gchar *set_bands_str;
|
||||
|
||||
static GOptionEntry entries[] = {
|
||||
{ "monitor-state", 'w', 0, G_OPTION_ARG_NONE, &monitor_state_flag,
|
||||
@@ -105,8 +105,8 @@ static GOptionEntry entries[] = {
|
||||
"Set allowed modes in a given modem.",
|
||||
"[MODE1|MODE2...]"
|
||||
},
|
||||
{ "set-allowed-bands", 0, 0, G_OPTION_ARG_STRING, &set_allowed_bands_str,
|
||||
"Set allowed bands in a given modem.",
|
||||
{ "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,
|
||||
@@ -152,7 +152,7 @@ mmcli_modem_options_enabled (void)
|
||||
!!command_str +
|
||||
!!set_allowed_modes_str +
|
||||
!!set_preferred_mode_str +
|
||||
!!set_allowed_bands_str);
|
||||
!!set_bands_str);
|
||||
|
||||
if (n_actions == 0 && mmcli_get_common_modem_string ()) {
|
||||
/* default to info */
|
||||
@@ -272,7 +272,7 @@ print_modem_info (void)
|
||||
gchar *allowed_modes_string;
|
||||
gchar *preferred_mode_string;
|
||||
gchar *supported_bands_string;
|
||||
gchar *allowed_bands_string;
|
||||
gchar *bands_string;
|
||||
MMModemBand *bands = NULL;
|
||||
guint n_bands = 0;
|
||||
|
||||
@@ -304,14 +304,10 @@ print_modem_info (void)
|
||||
mm_modem_get_modem_capabilities (ctx->modem));
|
||||
access_technologies_string = mm_modem_access_technology_build_string_from_mask (
|
||||
mm_modem_get_access_technologies (ctx->modem));
|
||||
mm_modem_get_allowed_bands (ctx->modem,
|
||||
&bands,
|
||||
&n_bands);
|
||||
allowed_bands_string = mm_common_build_bands_string (bands, n_bands);
|
||||
mm_modem_get_bands (ctx->modem, &bands, &n_bands);
|
||||
bands_string = mm_common_build_bands_string (bands, n_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);
|
||||
g_free (bands);
|
||||
allowed_modes_string = mm_modem_mode_build_string_from_mask (
|
||||
@@ -374,9 +370,9 @@ print_modem_info (void)
|
||||
/* Band related stuff */
|
||||
g_print (" -------------------------\n"
|
||||
" Bands | supported: '%s'\n"
|
||||
" | allowed: '%s'\n",
|
||||
" | current: '%s'\n",
|
||||
VALIDATE_UNKNOWN (supported_bands_string),
|
||||
VALIDATE_UNKNOWN (allowed_bands_string));
|
||||
VALIDATE_UNKNOWN (bands_string));
|
||||
|
||||
/* If available, 3GPP related stuff */
|
||||
if (ctx->modem_3gpp) {
|
||||
@@ -434,7 +430,7 @@ print_modem_info (void)
|
||||
VALIDATE_PATH (mm_modem_get_sim_path (ctx->modem)));
|
||||
g_print ("\n");
|
||||
|
||||
g_free (allowed_bands_string);
|
||||
g_free (bands_string);
|
||||
g_free (supported_bands_string);
|
||||
g_free (access_technologies_string);
|
||||
g_free (capabilities_string);
|
||||
@@ -731,44 +727,44 @@ parse_modes (MMModemMode *allowed,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_bands_process_reply (gboolean result,
|
||||
set_bands_process_reply (gboolean result,
|
||||
const GError *error)
|
||||
{
|
||||
if (!result) {
|
||||
g_printerr ("error: couldn't set allowed bands: '%s'\n",
|
||||
g_printerr ("error: couldn't set bands: '%s'\n",
|
||||
error ? error->message : "unknown error");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_print ("successfully set allowed bands in the modem\n");
|
||||
g_print ("successfully set bands in the modem\n");
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_bands_ready (MMModem *modem,
|
||||
set_bands_ready (MMModem *modem,
|
||||
GAsyncResult *result,
|
||||
gpointer nothing)
|
||||
{
|
||||
gboolean operation_result;
|
||||
GError *error = NULL;
|
||||
|
||||
operation_result = mm_modem_set_allowed_bands_finish (modem, result, &error);
|
||||
set_allowed_bands_process_reply (operation_result, error);
|
||||
operation_result = mm_modem_set_bands_finish (modem, result, &error);
|
||||
set_bands_process_reply (operation_result, error);
|
||||
|
||||
mmcli_async_operation_done ();
|
||||
}
|
||||
|
||||
static void
|
||||
parse_bands (MMModemBand **allowed,
|
||||
guint *n_allowed)
|
||||
parse_bands (MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
mm_common_get_bands_from_string (set_allowed_bands_str,
|
||||
allowed,
|
||||
n_allowed,
|
||||
mm_common_get_bands_from_string (set_bands_str,
|
||||
bands,
|
||||
n_bands,
|
||||
&error);
|
||||
if (error) {
|
||||
g_printerr ("error: couldn't parse list of allowed bands: '%s'\n",
|
||||
g_printerr ("error: couldn't parse list of bands: '%s'\n",
|
||||
error->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
@@ -934,18 +930,18 @@ get_modem_ready (GObject *source,
|
||||
}
|
||||
|
||||
/* Request to set allowed bands in a given modem? */
|
||||
if (set_allowed_bands_str) {
|
||||
MMModemBand *allowed;
|
||||
guint n_allowed;
|
||||
if (set_bands_str) {
|
||||
MMModemBand *bands;
|
||||
guint n_bands;
|
||||
|
||||
parse_bands (&allowed, &n_allowed);
|
||||
mm_modem_set_allowed_bands (ctx->modem,
|
||||
allowed,
|
||||
n_allowed,
|
||||
parse_bands (&bands, &n_bands);
|
||||
mm_modem_set_bands (ctx->modem,
|
||||
bands,
|
||||
n_bands,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)set_allowed_bands_ready,
|
||||
(GAsyncReadyCallback)set_bands_ready,
|
||||
NULL);
|
||||
g_free (allowed);
|
||||
g_free (bands);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1114,19 +1110,19 @@ mmcli_modem_run_synchronous (GDBusConnection *connection)
|
||||
}
|
||||
|
||||
/* Request to set allowed bands in a given modem? */
|
||||
if (set_allowed_bands_str) {
|
||||
if (set_bands_str) {
|
||||
gboolean result;
|
||||
MMModemBand *allowed;
|
||||
guint n_allowed;
|
||||
MMModemBand *bands;
|
||||
guint n_bands;
|
||||
|
||||
parse_bands (&allowed, &n_allowed);
|
||||
result = mm_modem_set_allowed_bands_sync (ctx->modem,
|
||||
allowed,
|
||||
n_allowed,
|
||||
parse_bands (&bands, &n_bands);
|
||||
result = mm_modem_set_bands_sync (ctx->modem,
|
||||
bands,
|
||||
n_bands,
|
||||
NULL,
|
||||
&error);
|
||||
g_free (allowed);
|
||||
set_allowed_bands_process_reply (result, error);
|
||||
g_free (bands);
|
||||
set_bands_process_reply (result, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ G_DEFINE_TYPE (MMCommonConnectProperties, mm_common_connect_properties, G_TYPE_O
|
||||
|
||||
#define PROPERTY_PIN "pin"
|
||||
#define PROPERTY_OPERATOR_ID "operator-id"
|
||||
#define PROPERTY_ALLOWED_BANDS "allowed-bands"
|
||||
#define PROPERTY_BANDS "bands"
|
||||
#define PROPERTY_ALLOWED_MODES "allowed-modes"
|
||||
#define PROPERTY_PREFERRED_MODE "preferred-mode"
|
||||
|
||||
@@ -33,8 +33,8 @@ struct _MMCommonConnectPropertiesPrivate {
|
||||
/* Operator ID */
|
||||
gchar *operator_id;
|
||||
/* Bands */
|
||||
MMModemBand *allowed_bands;
|
||||
guint n_allowed_bands;
|
||||
MMModemBand *bands;
|
||||
guint n_bands;
|
||||
/* Modes */
|
||||
gboolean allowed_modes_set;
|
||||
MMModemMode allowed_modes;
|
||||
@@ -62,16 +62,16 @@ mm_common_connect_properties_set_operator_id (MMCommonConnectProperties *self,
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_connect_properties_set_allowed_bands (MMCommonConnectProperties *self,
|
||||
mm_common_connect_properties_set_bands (MMCommonConnectProperties *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands)
|
||||
{
|
||||
g_free (self->priv->allowed_bands);
|
||||
self->priv->n_allowed_bands = n_bands;
|
||||
self->priv->allowed_bands = g_new (MMModemBand, self->priv->n_allowed_bands);
|
||||
memcpy (self->priv->allowed_bands,
|
||||
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,
|
||||
bands,
|
||||
sizeof (MMModemBand) * self->priv->n_allowed_bands);
|
||||
sizeof (MMModemBand) * self->priv->n_bands);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -153,12 +153,12 @@ mm_common_connect_properties_get_operator_id (MMCommonConnectProperties *self)
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_connect_properties_get_allowed_bands (MMCommonConnectProperties *self,
|
||||
mm_common_connect_properties_get_bands (MMCommonConnectProperties *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
*bands = self->priv->allowed_bands;
|
||||
*n_bands = self->priv->n_allowed_bands;
|
||||
*bands = self->priv->bands;
|
||||
*n_bands = self->priv->n_bands;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -235,12 +235,12 @@ mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self)
|
||||
PROPERTY_OPERATOR_ID,
|
||||
g_variant_new_string (self->priv->operator_id));
|
||||
|
||||
if (self->priv->allowed_bands)
|
||||
if (self->priv->bands)
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
PROPERTY_ALLOWED_BANDS,
|
||||
mm_common_bands_array_to_variant (self->priv->allowed_bands,
|
||||
self->priv->n_allowed_bands));
|
||||
PROPERTY_BANDS,
|
||||
mm_common_bands_array_to_variant (self->priv->bands,
|
||||
self->priv->n_bands));
|
||||
|
||||
if (self->priv->allowed_modes_set) {
|
||||
g_variant_builder_add (&builder,
|
||||
@@ -293,13 +293,13 @@ key_value_foreach (const gchar *key,
|
||||
mm_common_connect_properties_set_pin (ctx->properties, value);
|
||||
else if (g_str_equal (key, PROPERTY_OPERATOR_ID))
|
||||
mm_common_connect_properties_set_operator_id (ctx->properties, value);
|
||||
else if (g_str_equal (key, PROPERTY_ALLOWED_BANDS)) {
|
||||
else if (g_str_equal (key, PROPERTY_BANDS)) {
|
||||
MMModemBand *bands = NULL;
|
||||
guint n_bands = 0;
|
||||
|
||||
mm_common_get_bands_from_string (value, &bands, &n_bands, &ctx->error);
|
||||
if (!ctx->error) {
|
||||
mm_common_connect_properties_set_allowed_bands (ctx->properties, bands, n_bands);
|
||||
mm_common_connect_properties_set_bands (ctx->properties, bands, n_bands);
|
||||
g_free (bands);
|
||||
}
|
||||
} else if (g_str_equal (key, PROPERTY_ALLOWED_MODES)) {
|
||||
@@ -405,11 +405,11 @@ mm_common_connect_properties_new_from_dictionary (GVariant *dictionary,
|
||||
mm_common_connect_properties_set_operator_id (
|
||||
properties,
|
||||
g_variant_get_string (value, NULL));
|
||||
else if (g_str_equal (key, PROPERTY_ALLOWED_BANDS)) {
|
||||
else if (g_str_equal (key, PROPERTY_BANDS)) {
|
||||
GArray *array;
|
||||
|
||||
array = mm_common_bands_variant_to_garray (value);
|
||||
mm_common_connect_properties_set_allowed_bands (
|
||||
mm_common_connect_properties_set_bands (
|
||||
properties,
|
||||
(MMModemBand *)array->data,
|
||||
array->len);
|
||||
@@ -483,9 +483,9 @@ mm_common_connect_properties_init (MMCommonConnectProperties *self)
|
||||
self->priv->bearer_properties = mm_common_bearer_properties_new ();
|
||||
self->priv->allowed_modes = MM_MODEM_MODE_ANY;
|
||||
self->priv->preferred_mode = MM_MODEM_MODE_NONE;
|
||||
self->priv->allowed_bands = g_new (MMModemBand, 1);
|
||||
self->priv->allowed_bands[0] = MM_MODEM_BAND_ANY;
|
||||
self->priv->n_allowed_bands = 1;
|
||||
self->priv->bands = g_new (MMModemBand, 1);
|
||||
self->priv->bands[0] = MM_MODEM_BAND_ANY;
|
||||
self->priv->n_bands = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -495,7 +495,7 @@ finalize (GObject *object)
|
||||
|
||||
g_free (self->priv->pin);
|
||||
g_free (self->priv->operator_id);
|
||||
g_free (self->priv->allowed_bands);
|
||||
g_free (self->priv->bands);
|
||||
g_object_unref (self->priv->bearer_properties);
|
||||
|
||||
G_OBJECT_CLASS (mm_common_connect_properties_parent_class)->finalize (object);
|
||||
|
@@ -59,7 +59,7 @@ void mm_common_connect_properties_set_pin (
|
||||
void mm_common_connect_properties_set_operator_id (
|
||||
MMCommonConnectProperties *properties,
|
||||
const gchar *operator_id);
|
||||
void mm_common_connect_properties_set_allowed_bands (
|
||||
void mm_common_connect_properties_set_bands (
|
||||
MMCommonConnectProperties *properties,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands);
|
||||
@@ -90,7 +90,7 @@ const gchar *mm_common_connect_properties_get_pin (
|
||||
MMCommonConnectProperties *properties);
|
||||
const gchar *mm_common_connect_properties_get_operator_id (
|
||||
MMCommonConnectProperties *properties);
|
||||
void mm_common_connect_properties_get_allowed_bands (
|
||||
void mm_common_connect_properties_get_bands (
|
||||
MMCommonConnectProperties *properties,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
|
@@ -34,13 +34,13 @@ mm_modem_simple_connect_properties_set_operator_id (MMModemSimpleConnectProperti
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_simple_connect_properties_set_allowed_bands (MMModemSimpleConnectProperties *self,
|
||||
mm_modem_simple_connect_properties_set_bands (MMModemSimpleConnectProperties *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
|
||||
|
||||
mm_common_connect_properties_set_allowed_bands (self, bands, n_bands);
|
||||
mm_common_connect_properties_set_bands (self, bands, n_bands);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -39,7 +39,7 @@ void mm_modem_simple_connect_properties_set_pin (
|
||||
void mm_modem_simple_connect_properties_set_operator_id (
|
||||
MMModemSimpleConnectProperties *properties,
|
||||
const gchar *operator_id);
|
||||
void mm_modem_simple_connect_properties_set_allowed_bands (
|
||||
void mm_modem_simple_connect_properties_set_bands (
|
||||
MMModemSimpleConnectProperties *properties,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands);
|
||||
|
@@ -680,18 +680,18 @@ mm_modem_get_supported_bands (MMModem *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_get_allowed_bands:
|
||||
* mm_modem_get_bands:
|
||||
* @self: A #MMModem.
|
||||
* @bands: (out): Return location for the array of #MMModemBand values.
|
||||
* @n_bands: (out): Return location for the number of values in @bands.
|
||||
*
|
||||
* Gets the list of radio frequency and technology bands the #MMModem is currently
|
||||
* allowed to use when connecting to a network.
|
||||
* using when connecting to a network.
|
||||
*
|
||||
* For POTS devices, only the #MM_MODEM_BAND_ANY band is supported.
|
||||
*/
|
||||
void
|
||||
mm_modem_get_allowed_bands (MMModem *self,
|
||||
mm_modem_get_bands (MMModem *self,
|
||||
MMModemBand **bands,
|
||||
guint *n_bands)
|
||||
{
|
||||
@@ -701,7 +701,7 @@ mm_modem_get_allowed_bands (MMModem *self,
|
||||
g_return_if_fail (bands != NULL);
|
||||
g_return_if_fail (n_bands != NULL);
|
||||
|
||||
array = mm_common_bands_variant_to_garray (mm_gdbus_modem_get_allowed_bands (self));
|
||||
array = mm_common_bands_variant_to_garray (mm_gdbus_modem_get_bands (self));
|
||||
*n_bands = array->len;
|
||||
*bands = (MMModemBand *)g_array_free (array, FALSE);
|
||||
}
|
||||
@@ -1555,19 +1555,19 @@ mm_modem_set_allowed_modes_sync (MMModem *self,
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_modem_set_allowed_bands_finish (MMModem *self,
|
||||
mm_modem_set_bands_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (MM_GDBUS_IS_MODEM (self), FALSE);
|
||||
|
||||
return mm_gdbus_modem_call_set_allowed_bands_finish (self,
|
||||
return mm_gdbus_modem_call_set_bands_finish (self,
|
||||
res,
|
||||
error);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_set_allowed_bands (MMModem *self,
|
||||
mm_modem_set_bands (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
@@ -1576,7 +1576,7 @@ mm_modem_set_allowed_bands (MMModem *self,
|
||||
{
|
||||
g_return_if_fail (MM_GDBUS_IS_MODEM (self));
|
||||
|
||||
mm_gdbus_modem_call_set_allowed_bands (self,
|
||||
mm_gdbus_modem_call_set_bands (self,
|
||||
mm_common_bands_array_to_variant (bands, n_bands),
|
||||
cancellable,
|
||||
callback,
|
||||
@@ -1584,7 +1584,7 @@ mm_modem_set_allowed_bands (MMModem *self,
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_modem_set_allowed_bands_sync (MMModem *self,
|
||||
mm_modem_set_bands_sync (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
@@ -1592,7 +1592,7 @@ mm_modem_set_allowed_bands_sync (MMModem *self,
|
||||
{
|
||||
g_return_val_if_fail (MM_GDBUS_IS_MODEM (self), FALSE);
|
||||
|
||||
return (mm_gdbus_modem_call_set_allowed_bands_sync (
|
||||
return (mm_gdbus_modem_call_set_bands_sync (
|
||||
self,
|
||||
mm_common_bands_array_to_variant (bands, n_bands),
|
||||
cancellable,
|
||||
|
@@ -74,7 +74,7 @@ MMModemMode mm_modem_get_preferred_mode (MMModem *self);
|
||||
void mm_modem_get_supported_bands (MMModem *self,
|
||||
MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
void mm_modem_get_allowed_bands (MMModem *self,
|
||||
void mm_modem_get_bands (MMModem *self,
|
||||
MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
|
||||
@@ -191,16 +191,16 @@ gboolean mm_modem_set_allowed_modes_sync (MMModem *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void mm_modem_set_allowed_bands (MMModem *self,
|
||||
void mm_modem_set_bands (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_modem_set_allowed_bands_finish (MMModem *self,
|
||||
gboolean mm_modem_set_bands_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
gboolean mm_modem_set_allowed_bands_sync (MMModem *self,
|
||||
gboolean mm_modem_set_bands_sync (MMModem *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands,
|
||||
GCancellable *cancellable,
|
||||
|
@@ -52,7 +52,7 @@
|
||||
given as a string value (signature <literal>"s"</literal>).
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><literal>"allowed-bands"</literal></term>
|
||||
<varlistentry><term><literal>"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
|
||||
|
@@ -136,13 +136,13 @@
|
||||
</method>
|
||||
|
||||
<!--
|
||||
SetAllowedBands:
|
||||
@bands: List of <link linkend="MMModemBand">MMModemBand</link> values, to specify all the bands allowed in the modem.
|
||||
SetBands:
|
||||
@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="SetAllowedBands">
|
||||
<method name="SetBands">
|
||||
<arg name="bands" type="au" direction="in" />
|
||||
</method>
|
||||
|
||||
@@ -419,19 +419,15 @@
|
||||
<property name="SupportedBands" type="au" access="read" />
|
||||
|
||||
<!--
|
||||
AllowedBands:
|
||||
Bands:
|
||||
|
||||
List of <link linkend="MMModemBand">MMModemBand</link> values,
|
||||
specifying the radio frequency and technology bands the device is
|
||||
currently allowed to use when connecting to a network.
|
||||
currently using when connecting to a network.
|
||||
|
||||
It must be a subset of #org.freedesktop.ModemManager1.Modem:SupportedBands.
|
||||
|
||||
For POTS devices, only the
|
||||
<link linkend="MM-MODEM-BAND-ANY:CAPS"><constant>MM_MODEM_BAND_ANY</constant></link>
|
||||
mode is supported.
|
||||
-->
|
||||
<property name="AllowedBands" type="au" access="read" />
|
||||
<property name="Bands" type="au" access="read" />
|
||||
|
||||
</interface>
|
||||
</node>
|
||||
|
@@ -172,7 +172,7 @@ typedef enum {
|
||||
CONNECTION_STEP_UNLOCK_CHECK,
|
||||
CONNECTION_STEP_ENABLE,
|
||||
CONNECTION_STEP_ALLOWED_MODES,
|
||||
CONNECTION_STEP_ALLOWED_BANDS,
|
||||
CONNECTION_STEP_BANDS,
|
||||
CONNECTION_STEP_REGISTER,
|
||||
CONNECTION_STEP_BEARER,
|
||||
CONNECTION_STEP_CONNECT,
|
||||
@@ -286,14 +286,14 @@ set_allowed_modes_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_bands_ready (MMBaseModem *self,
|
||||
set_bands_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
ConnectionContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_iface_modem_set_allowed_bands_finish (MM_IFACE_MODEM (self), res, &error)) {
|
||||
/* If setting allowed bands is unsupported, keep on */
|
||||
if (!mm_iface_modem_set_bands_finish (MM_IFACE_MODEM (self), res, &error)) {
|
||||
/* If setting bands is unsupported, keep on */
|
||||
if (!g_error_matches (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED)) {
|
||||
@@ -303,7 +303,7 @@ set_allowed_bands_ready (MMBaseModem *self,
|
||||
}
|
||||
}
|
||||
|
||||
/* Allowed bands set... almost there! */
|
||||
/* Bands set... almost there! */
|
||||
ctx->step++;
|
||||
connection_step (ctx);
|
||||
}
|
||||
@@ -448,26 +448,26 @@ connection_step (ConnectionContext *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
case CONNECTION_STEP_ALLOWED_BANDS: {
|
||||
case CONNECTION_STEP_BANDS: {
|
||||
GArray *array;
|
||||
const MMModemBand *allowed_bands = NULL;
|
||||
guint n_allowed_bands = 0;
|
||||
const MMModemBand *bands = NULL;
|
||||
guint n_bands = 0;
|
||||
guint i;
|
||||
|
||||
mm_info ("Simple connect state (%d/%d): Allowed bands",
|
||||
mm_info ("Simple connect state (%d/%d): Bands",
|
||||
ctx->step, CONNECTION_STEP_LAST);
|
||||
|
||||
mm_common_connect_properties_get_allowed_bands (ctx->properties,
|
||||
&allowed_bands,
|
||||
&n_allowed_bands);
|
||||
mm_common_connect_properties_get_bands (ctx->properties,
|
||||
&bands,
|
||||
&n_bands);
|
||||
|
||||
array = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), n_allowed_bands);
|
||||
for (i = 0; i < n_allowed_bands; i++)
|
||||
g_array_insert_val (array, i, allowed_bands[i]);
|
||||
array = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), n_bands);
|
||||
for (i = 0; i < n_bands; i++)
|
||||
g_array_insert_val (array, i, bands[i]);
|
||||
|
||||
mm_iface_modem_set_allowed_bands (MM_IFACE_MODEM (ctx->self),
|
||||
mm_iface_modem_set_bands (MM_IFACE_MODEM (ctx->self),
|
||||
array,
|
||||
(GAsyncReadyCallback)set_allowed_bands_ready,
|
||||
(GAsyncReadyCallback)set_bands_ready,
|
||||
ctx);
|
||||
g_array_unref (array);
|
||||
return;
|
||||
|
@@ -59,7 +59,7 @@ mm_iface_modem_bind_simple_status (MMIfaceModem *self,
|
||||
status, MM_COMMON_SIMPLE_PROPERTY_SIGNAL_QUALITY,
|
||||
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_bind_property (skeleton, "allowed-bands",
|
||||
g_object_bind_property (skeleton, "bands",
|
||||
status, MM_COMMON_SIMPLE_PROPERTY_BANDS,
|
||||
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
|
||||
@@ -1226,28 +1226,28 @@ handle_factory_reset (MmGdbusModem *skeleton,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ALLOWED BANDS */
|
||||
/* BANDS */
|
||||
|
||||
typedef struct {
|
||||
MMIfaceModem *self;
|
||||
MmGdbusModem *skeleton;
|
||||
GSimpleAsyncResult *result;
|
||||
GArray *allowed_bands_array;
|
||||
} SetAllowedBandsContext;
|
||||
GArray *bands_array;
|
||||
} SetBandsContext;
|
||||
|
||||
static void
|
||||
set_allowed_bands_context_complete_and_free (SetAllowedBandsContext *ctx)
|
||||
set_bands_context_complete_and_free (SetBandsContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete_in_idle (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
g_object_unref (ctx->self);
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_array_unref (ctx->allowed_bands_array);
|
||||
g_array_unref (ctx->bands_array);
|
||||
g_free (ctx);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_iface_modem_set_allowed_bands_finish (MMIfaceModem *self,
|
||||
mm_iface_modem_set_bands_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -1255,37 +1255,37 @@ mm_iface_modem_set_allowed_bands_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_bands_ready (MMIfaceModem *self,
|
||||
set_bands_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetAllowedBandsContext *ctx)
|
||||
SetBandsContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_bands_finish (self, res, &error))
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands_finish (self, res, &error))
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
else {
|
||||
mm_gdbus_modem_set_allowed_bands (ctx->skeleton,
|
||||
mm_common_bands_garray_to_variant (ctx->allowed_bands_array));
|
||||
mm_gdbus_modem_set_bands (ctx->skeleton,
|
||||
mm_common_bands_garray_to_variant (ctx->bands_array));
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
}
|
||||
|
||||
set_allowed_bands_context_complete_and_free (ctx);
|
||||
set_bands_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
validate_allowed_bands (const GArray *supported_bands_array,
|
||||
const GArray *allowed_bands_array,
|
||||
validate_bands (const GArray *supported_bands_array,
|
||||
const GArray *bands_array,
|
||||
GError **error)
|
||||
{
|
||||
/* When the array has more than one element, there MUST NOT include ANY or
|
||||
* UNKNOWN */
|
||||
if (allowed_bands_array->len > 1) {
|
||||
if (bands_array->len > 1) {
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < allowed_bands_array->len; i++) {
|
||||
for (i = 0; i < bands_array->len; i++) {
|
||||
MMModemBand band;
|
||||
|
||||
band = g_array_index (allowed_bands_array, MMModemBand, i);
|
||||
band = g_array_index (bands_array, MMModemBand, i);
|
||||
if (band == MM_MODEM_BAND_UNKNOWN ||
|
||||
band == MM_MODEM_BAND_ANY) {
|
||||
g_set_error (error,
|
||||
@@ -1330,18 +1330,18 @@ validate_allowed_bands (const GArray *supported_bands_array,
|
||||
}
|
||||
|
||||
void
|
||||
mm_iface_modem_set_allowed_bands (MMIfaceModem *self,
|
||||
mm_iface_modem_set_bands (MMIfaceModem *self,
|
||||
GArray *bands_array,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
SetAllowedBandsContext *ctx;
|
||||
SetBandsContext *ctx;
|
||||
GArray *supported_bands_array;
|
||||
GError *error = NULL;
|
||||
|
||||
/* If setting allowed bands is not implemented, report an error */
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_bands ||
|
||||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_bands_finish) {
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands ||
|
||||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands_finish) {
|
||||
g_simple_async_report_error_in_idle (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
@@ -1352,57 +1352,57 @@ mm_iface_modem_set_allowed_bands (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/* Setup context */
|
||||
ctx = g_new0 (SetAllowedBandsContext, 1);
|
||||
ctx = g_new0 (SetBandsContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
mm_iface_modem_set_allowed_bands);
|
||||
mm_iface_modem_set_bands);
|
||||
g_object_get (self,
|
||||
MM_IFACE_MODEM_DBUS_SKELETON, &ctx->skeleton,
|
||||
NULL);
|
||||
ctx->allowed_bands_array = g_array_ref (bands_array);
|
||||
ctx->bands_array = g_array_ref (bands_array);
|
||||
|
||||
/* Get list of supported bands */
|
||||
supported_bands_array = (mm_common_bands_variant_to_garray (
|
||||
mm_gdbus_modem_get_supported_bands (ctx->skeleton)));
|
||||
|
||||
/* Validate input list of bands */
|
||||
if (!validate_allowed_bands (supported_bands_array,
|
||||
ctx->allowed_bands_array,
|
||||
if (!validate_bands (supported_bands_array,
|
||||
ctx->bands_array,
|
||||
&error)) {
|
||||
g_array_unref (supported_bands_array);
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
set_allowed_bands_context_complete_and_free (ctx);
|
||||
set_bands_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_bands (
|
||||
MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands (
|
||||
self,
|
||||
bands_array,
|
||||
(GAsyncReadyCallback)set_allowed_bands_ready,
|
||||
(GAsyncReadyCallback)set_bands_ready,
|
||||
ctx);
|
||||
|
||||
g_array_unref (supported_bands_array);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_allowed_bands_ready (MMIfaceModem *self,
|
||||
handle_set_bands_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
DbusCallContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_iface_modem_set_allowed_bands_finish (self, res, &error))
|
||||
if (!mm_iface_modem_set_bands_finish (self, res, &error))
|
||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
else
|
||||
mm_gdbus_modem_complete_set_allowed_bands (ctx->skeleton,
|
||||
mm_gdbus_modem_complete_set_bands (ctx->skeleton,
|
||||
ctx->invocation);
|
||||
dbus_call_context_free (ctx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_set_allowed_bands (MmGdbusModem *skeleton,
|
||||
handle_set_bands (MmGdbusModem *skeleton,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *bands_variant,
|
||||
MMIfaceModem *self)
|
||||
@@ -1435,9 +1435,9 @@ handle_set_allowed_bands (MmGdbusModem *skeleton,
|
||||
GArray *bands_array;
|
||||
|
||||
bands_array = mm_common_bands_variant_to_garray (bands_variant);
|
||||
mm_iface_modem_set_allowed_bands (self,
|
||||
mm_iface_modem_set_bands (self,
|
||||
bands_array,
|
||||
(GAsyncReadyCallback)handle_set_allowed_bands_ready,
|
||||
(GAsyncReadyCallback)handle_set_bands_ready,
|
||||
dbus_call_context_new (skeleton,
|
||||
invocation,
|
||||
self));
|
||||
@@ -2579,7 +2579,7 @@ load_supported_bands_ready (MMIfaceModem *self,
|
||||
if (bands_array) {
|
||||
mm_gdbus_modem_set_supported_bands (ctx->skeleton,
|
||||
mm_common_bands_garray_to_variant (bands_array));
|
||||
mm_gdbus_modem_set_allowed_bands (ctx->skeleton,
|
||||
mm_gdbus_modem_set_bands (ctx->skeleton,
|
||||
mm_common_bands_garray_to_variant (bands_array));
|
||||
g_array_unref (bands_array);
|
||||
}
|
||||
@@ -2958,7 +2958,7 @@ interface_initialization_step (InitializationContext *ctx)
|
||||
|
||||
/* Loading supported bands not implemented, default to ANY */
|
||||
mm_gdbus_modem_set_supported_bands (ctx->skeleton, mm_common_build_bands_any ());
|
||||
mm_gdbus_modem_set_allowed_bands (ctx->skeleton, mm_common_build_bands_any ());
|
||||
mm_gdbus_modem_set_bands (ctx->skeleton, mm_common_build_bands_any ());
|
||||
}
|
||||
g_array_unref (supported_bands);
|
||||
|
||||
@@ -3000,7 +3000,7 @@ interface_initialization_step (InitializationContext *ctx)
|
||||
ctx->self);
|
||||
g_signal_connect (ctx->skeleton,
|
||||
"handle-set-allowed-bands",
|
||||
G_CALLBACK (handle_set_allowed_bands),
|
||||
G_CALLBACK (handle_set_bands),
|
||||
ctx->self);
|
||||
g_signal_connect (ctx->skeleton,
|
||||
"handle-set-allowed-modes",
|
||||
@@ -3067,7 +3067,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_allowed_bands (skeleton, mm_common_build_bands_unknown ());
|
||||
mm_gdbus_modem_set_bands (skeleton, mm_common_build_bands_unknown ());
|
||||
|
||||
/* Bind our State property */
|
||||
g_object_bind_property (self, MM_IFACE_MODEM_STATE,
|
||||
|
@@ -174,11 +174,11 @@ struct _MMIfaceModem {
|
||||
GError **error);
|
||||
|
||||
/* Asynchronous allowed band setting operation */
|
||||
void (*set_allowed_bands) (MMIfaceModem *self,
|
||||
void (*set_bands) (MMIfaceModem *self,
|
||||
GArray *bands_array,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*set_allowed_bands_finish) (MMIfaceModem *self,
|
||||
gboolean (*set_bands_finish) (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
@@ -356,12 +356,12 @@ gboolean mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Allow setting allowed bands */
|
||||
void mm_iface_modem_set_allowed_bands (MMIfaceModem *self,
|
||||
/* Allow setting bands */
|
||||
void mm_iface_modem_set_bands (MMIfaceModem *self,
|
||||
GArray *bands_array,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_iface_modem_set_allowed_bands_finish (MMIfaceModem *self,
|
||||
gboolean mm_iface_modem_set_bands_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
|
Reference in New Issue
Block a user