api: deprecate 'number' in bearer properties
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/99
This commit is contained in:
committed by
Dan Williams
parent
5dc79ce606
commit
55c3026643
@@ -158,7 +158,6 @@ print_bearer_info (MMBearer *bearer)
|
||||
gchar *ip_family_str = NULL;
|
||||
const gchar *user = NULL;
|
||||
const gchar *password = NULL;
|
||||
const gchar *number = NULL;
|
||||
const gchar *rm_protocol = NULL;
|
||||
|
||||
if (properties) {
|
||||
@@ -168,7 +167,6 @@ print_bearer_info (MMBearer *bearer)
|
||||
password = mm_bearer_properties_get_password (properties);
|
||||
if (mm_bearer_get_bearer_type (bearer) != MM_BEARER_TYPE_DEFAULT_ATTACH) {
|
||||
roaming = mm_bearer_properties_get_allow_roaming (properties) ? "allowed" : "forbidden";
|
||||
number = mm_bearer_properties_get_number (properties);
|
||||
rm_protocol = mm_modem_cdma_rm_protocol_get_string (mm_bearer_properties_get_rm_protocol (properties));
|
||||
}
|
||||
}
|
||||
@@ -178,7 +176,6 @@ print_bearer_info (MMBearer *bearer)
|
||||
mmcli_output_string_take (MMC_F_BEARER_PROPERTIES_IP_TYPE, ip_family_str);
|
||||
mmcli_output_string (MMC_F_BEARER_PROPERTIES_USER, user);
|
||||
mmcli_output_string (MMC_F_BEARER_PROPERTIES_PASSWORD, password);
|
||||
mmcli_output_string (MMC_F_BEARER_PROPERTIES_NUMBER, number);
|
||||
mmcli_output_string (MMC_F_BEARER_PROPERTIES_RM_PROTOCOL, rm_protocol);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,12 @@ G_DEFINE_TYPE (MMBearerProperties, mm_bearer_properties, G_TYPE_OBJECT);
|
||||
#define PROPERTY_USER "user"
|
||||
#define PROPERTY_PASSWORD "password"
|
||||
#define PROPERTY_IP_TYPE "ip-type"
|
||||
#define PROPERTY_NUMBER "number"
|
||||
#define PROPERTY_ALLOW_ROAMING "allow-roaming"
|
||||
#define PROPERTY_RM_PROTOCOL "rm-protocol"
|
||||
|
||||
/* no longer used properties */
|
||||
#define DEPRECATED_PROPERTY_NUMBER "number"
|
||||
|
||||
struct _MMBearerPropertiesPrivate {
|
||||
/* APN */
|
||||
gchar *apn;
|
||||
@@ -49,8 +51,6 @@ struct _MMBearerPropertiesPrivate {
|
||||
MMBearerIpFamily ip_type;
|
||||
/* Allowed auth */
|
||||
MMBearerAllowedAuth allowed_auth;
|
||||
/* Number */
|
||||
gchar *number;
|
||||
/* User */
|
||||
gchar *user;
|
||||
/* Password */
|
||||
@@ -273,12 +273,17 @@ mm_bearer_properties_get_allow_roaming (MMBearerProperties *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef MM_DISABLE_DEPRECATED
|
||||
|
||||
/**
|
||||
* mm_bearer_properties_set_number:
|
||||
* @self: a #MMBearerProperties.
|
||||
* @number: the number.
|
||||
*
|
||||
* Sets the number to use when performing the connection.
|
||||
*
|
||||
* Deprecated: 1.10.0. The number setting is not used anywhere, and therefore
|
||||
* it doesn't make sense to expose it in the ModemManager interface.
|
||||
*/
|
||||
void
|
||||
mm_bearer_properties_set_number (MMBearerProperties *self,
|
||||
@@ -286,8 +291,7 @@ mm_bearer_properties_set_number (MMBearerProperties *self,
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
g_free (self->priv->number);
|
||||
self->priv->number = g_strdup (number);
|
||||
/* NO-OP */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -297,15 +301,21 @@ mm_bearer_properties_set_number (MMBearerProperties *self,
|
||||
* Gets the number to use when performing the connection.
|
||||
*
|
||||
* Returns: (transfer none): the number, or #NULL if not set. Do not free the returned value, it is owned by @self.
|
||||
*
|
||||
* Deprecated: 1.10.0. The number setting is not used anywhere, and therefore
|
||||
* it doesn't make sense to expose it in the ModemManager interface.
|
||||
*/
|
||||
const gchar *
|
||||
mm_bearer_properties_get_number (MMBearerProperties *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
|
||||
|
||||
return self->priv->number;
|
||||
/* NO-OP */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* MM_DISABLE_DEPRECATED */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
@@ -385,12 +395,6 @@ mm_bearer_properties_get_dictionary (MMBearerProperties *self)
|
||||
PROPERTY_IP_TYPE,
|
||||
g_variant_new_uint32 (self->priv->ip_type));
|
||||
|
||||
if (self->priv->number)
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
PROPERTY_NUMBER,
|
||||
g_variant_new_string (self->priv->number));
|
||||
|
||||
if (self->priv->allow_roaming_set)
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
@@ -452,9 +456,7 @@ mm_bearer_properties_consume_string (MMBearerProperties *self,
|
||||
return FALSE;
|
||||
}
|
||||
mm_bearer_properties_set_allow_roaming (self, allow_roaming);
|
||||
} else if (g_str_equal (key, PROPERTY_NUMBER))
|
||||
mm_bearer_properties_set_number (self, value);
|
||||
else if (g_str_equal (key, PROPERTY_RM_PROTOCOL)) {
|
||||
} else if (g_str_equal (key, PROPERTY_RM_PROTOCOL)) {
|
||||
GError *inner_error = NULL;
|
||||
MMModemCdmaRmProtocol protocol;
|
||||
|
||||
@@ -464,6 +466,8 @@ mm_bearer_properties_consume_string (MMBearerProperties *self,
|
||||
return FALSE;
|
||||
}
|
||||
mm_bearer_properties_set_rm_protocol (self, protocol);
|
||||
} else if (g_str_equal (key, DEPRECATED_PROPERTY_NUMBER)) {
|
||||
/* NO-OP */
|
||||
} else {
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
@@ -545,15 +549,13 @@ mm_bearer_properties_consume_variant (MMBearerProperties *properties,
|
||||
mm_bearer_properties_set_ip_type (
|
||||
properties,
|
||||
g_variant_get_uint32 (value));
|
||||
else if (g_str_equal (key, PROPERTY_NUMBER))
|
||||
mm_bearer_properties_set_number (
|
||||
properties,
|
||||
g_variant_get_string (value, NULL));
|
||||
else if (g_str_equal (key, PROPERTY_ALLOW_ROAMING))
|
||||
mm_bearer_properties_set_allow_roaming (
|
||||
properties,
|
||||
g_variant_get_boolean (value));
|
||||
else {
|
||||
else if (g_str_equal (key, DEPRECATED_PROPERTY_NUMBER)) {
|
||||
/* NO-OP */
|
||||
} else {
|
||||
/* Set error */
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
@@ -646,7 +648,6 @@ mm_bearer_properties_cmp (MMBearerProperties *a,
|
||||
{
|
||||
return ((!g_strcmp0 (a->priv->apn, b->priv->apn)) &&
|
||||
(a->priv->ip_type == b->priv->ip_type) &&
|
||||
(!g_strcmp0 (a->priv->number, b->priv->number)) &&
|
||||
(a->priv->allowed_auth == b->priv->allowed_auth) &&
|
||||
(!g_strcmp0 (a->priv->user, b->priv->user)) &&
|
||||
(!g_strcmp0 (a->priv->password, b->priv->password)) &&
|
||||
@@ -693,7 +694,6 @@ finalize (GObject *object)
|
||||
g_free (self->priv->apn);
|
||||
g_free (self->priv->user);
|
||||
g_free (self->priv->password);
|
||||
g_free (self->priv->number);
|
||||
|
||||
G_OBJECT_CLASS (mm_bearer_properties_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,6 @@ void mm_bearer_properties_set_ip_type (MMBearerProperties *self,
|
||||
MMBearerIpFamily ip_type);
|
||||
void mm_bearer_properties_set_allow_roaming (MMBearerProperties *self,
|
||||
gboolean allow_roaming);
|
||||
void mm_bearer_properties_set_number (MMBearerProperties *self,
|
||||
const gchar *number);
|
||||
void mm_bearer_properties_set_rm_protocol (MMBearerProperties *self,
|
||||
MMModemCdmaRmProtocol protocol);
|
||||
|
||||
@@ -84,9 +82,16 @@ const gchar *mm_bearer_properties_get_user (MMBearerPropertie
|
||||
const gchar *mm_bearer_properties_get_password (MMBearerProperties *self);
|
||||
MMBearerIpFamily mm_bearer_properties_get_ip_type (MMBearerProperties *self);
|
||||
gboolean mm_bearer_properties_get_allow_roaming (MMBearerProperties *self);
|
||||
const gchar *mm_bearer_properties_get_number (MMBearerProperties *self);
|
||||
MMModemCdmaRmProtocol mm_bearer_properties_get_rm_protocol (MMBearerProperties *self);
|
||||
|
||||
#ifndef MM_DISABLE_DEPRECATED
|
||||
G_DEPRECATED
|
||||
void mm_bearer_properties_set_number (MMBearerProperties *self,
|
||||
const gchar *number);
|
||||
G_DEPRECATED
|
||||
const gchar *mm_bearer_properties_get_number (MMBearerProperties *self);
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ModemManager/libmm-glib/mmcli specific methods */
|
||||
|
||||
|
||||
@@ -328,12 +328,17 @@ mm_simple_connect_properties_get_allow_roaming (MMSimpleConnectProperties *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef MM_DISABLE_DEPRECATED
|
||||
|
||||
/**
|
||||
* mm_simple_connect_properties_set_number:
|
||||
* @self: a #MMSimpleConnectProperties.
|
||||
* @number: the number.
|
||||
*
|
||||
* Sets the number to use when performing the connection.
|
||||
*
|
||||
* Deprecated: 1.10.0. The number setting is not used anywhere, and therefore
|
||||
* it doesn't make sense to expose it in the ModemManager interface.
|
||||
*/
|
||||
void
|
||||
mm_simple_connect_properties_set_number (MMSimpleConnectProperties *self,
|
||||
@@ -341,8 +346,7 @@ mm_simple_connect_properties_set_number (MMSimpleConnectProperties *self,
|
||||
{
|
||||
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
|
||||
|
||||
mm_bearer_properties_set_number (self->priv->bearer_properties,
|
||||
number);
|
||||
/* NO-OP */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,15 +356,21 @@ mm_simple_connect_properties_set_number (MMSimpleConnectProperties *self,
|
||||
* Gets the number to use when performing the connection.
|
||||
*
|
||||
* Returns: (transfer none): the number, or #NULL if not set. Do not free the returned value, it is owned by @self.
|
||||
*
|
||||
* Deprecated: 1.10.0. The number setting is not used anywhere, and therefore
|
||||
* it doesn't make sense to expose it in the ModemManager interface.
|
||||
*/
|
||||
const gchar *
|
||||
mm_simple_connect_properties_get_number (MMSimpleConnectProperties *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
|
||||
|
||||
return mm_bearer_properties_get_number (self->priv->bearer_properties);
|
||||
/* NO-OP */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* MM_DISABLE_DEPRECATED */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,8 +79,6 @@ void mm_simple_connect_properties_set_ip_type (MMSimpleConnectProperties *
|
||||
MMBearerIpFamily ip_type);
|
||||
void mm_simple_connect_properties_set_allow_roaming (MMSimpleConnectProperties *self,
|
||||
gboolean allow_roaming);
|
||||
void mm_simple_connect_properties_set_number (MMSimpleConnectProperties *self,
|
||||
const gchar *number);
|
||||
|
||||
const gchar *mm_simple_connect_properties_get_pin (MMSimpleConnectProperties *self);
|
||||
const gchar *mm_simple_connect_properties_get_operator_id (MMSimpleConnectProperties *self);
|
||||
@@ -90,7 +88,14 @@ const gchar *mm_simple_connect_properties_get_user (MMSimpleCon
|
||||
const gchar *mm_simple_connect_properties_get_password (MMSimpleConnectProperties *self);
|
||||
MMBearerIpFamily mm_simple_connect_properties_get_ip_type (MMSimpleConnectProperties *self);
|
||||
gboolean mm_simple_connect_properties_get_allow_roaming (MMSimpleConnectProperties *self);
|
||||
const gchar *mm_simple_connect_properties_get_number (MMSimpleConnectProperties *self);
|
||||
|
||||
#ifndef MM_DISABLE_DEPRECATED
|
||||
G_DEPRECATED
|
||||
void mm_simple_connect_properties_set_number (MMSimpleConnectProperties *self,
|
||||
const gchar *number);
|
||||
G_DEPRECATED
|
||||
const gchar *mm_simple_connect_properties_get_number (MMSimpleConnectProperties *self);
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ModemManager/libmm-glib/mmcli specific methods */
|
||||
|
||||
@@ -261,34 +261,21 @@ dial_cdma_ready (MMBaseModem *modem,
|
||||
static void
|
||||
cdma_connect_context_dial (GTask *task)
|
||||
{
|
||||
MMBroadbandBearer *self;
|
||||
MMBroadbandBearer *self;
|
||||
DetailedConnectContext *ctx;
|
||||
gchar *command;
|
||||
const gchar *number;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
number = mm_bearer_properties_get_number (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
|
||||
|
||||
/* If a number was given when creating the bearer, use that one.
|
||||
* Otherwise, use the default one, #777
|
||||
*/
|
||||
if (number)
|
||||
command = g_strconcat ("DT", number, NULL);
|
||||
else
|
||||
command = g_strdup ("DT#777");
|
||||
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
MM_PORT_SERIAL_AT (ctx->data),
|
||||
command,
|
||||
"DT#777",
|
||||
90,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)dial_cdma_ready,
|
||||
task);
|
||||
g_free (command);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -682,8 +682,6 @@ connect_auth_ready (MMBaseModem *self,
|
||||
|
||||
mm_dbg (" Password: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_password (ctx->properties)));
|
||||
|
||||
mm_dbg (" Number: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_number (ctx->properties)));
|
||||
|
||||
#undef VALIDATE_UNSPECIFIED
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user