aboutsummaryrefslogtreecommitdiff
path: root/src/mm-bearer-list.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-02-25 14:43:22 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-03-10 10:59:22 +0100
commit35e20a48c8b16ae744c4ca3082f70e8aa674c2f4 (patch)
tree2b23fb243ebc151bbac167f9165f5b1cfef6390e /src/mm-bearer-list.c
parent064e92e9b77b35f83cb522c6ea98b9016ce5db8c (diff)
api,modem: deprecate the 'MaxBearers' property
This property was never initialized with a correct value, we would always use the same value as used for MaxActiveBearers, which isn't technically right. Just suggest to ignore this property, and flag it as deprecated. In addition to deprecating the API property, we will internally no longer limit the amount of bearer objects that may be created with different connection settings. The bearer object exposed in DBus is a representation of the connection that may be setup, and so we can hold as many representations as we want as long as the amount of connected bearers doesn't exceed the maximum amount for each modem. Leaving around the disconnected modems also serves another purpose. Each bearer holds information about the amount of times a connection with it has been attempted, and the amount of data transferred through it. If we use the Simple.Connect() method to connect the modem using different bearer settings, we won't lose the information of the past connection attempts with different settings.
Diffstat (limited to 'src/mm-bearer-list.c')
-rw-r--r--src/mm-bearer-list.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/src/mm-bearer-list.c b/src/mm-bearer-list.c
index 65717132..8bf6ae05 100644
--- a/src/mm-bearer-list.c
+++ b/src/mm-bearer-list.c
@@ -34,7 +34,6 @@ G_DEFINE_TYPE (MMBearerList, mm_bearer_list, G_TYPE_OBJECT);
enum {
PROP_0,
PROP_NUM_BEARERS,
- PROP_MAX_BEARERS,
PROP_MAX_ACTIVE_BEARERS,
PROP_LAST
};
@@ -44,8 +43,6 @@ static GParamSpec *properties[PROP_LAST];
struct _MMBearerListPrivate {
/* List of bearers */
GList *bearers;
- /* Max number of bearers */
- guint max_bearers;
/* Max number of active bearers */
guint max_active_bearers;
};
@@ -53,44 +50,16 @@ struct _MMBearerListPrivate {
/*****************************************************************************/
guint
-mm_bearer_list_get_max (MMBearerList *self)
-{
- return self->priv->max_bearers;
-}
-
-guint
mm_bearer_list_get_max_active (MMBearerList *self)
{
return self->priv->max_active_bearers;
}
-guint
-mm_bearer_list_get_count (MMBearerList *self)
-{
- return g_list_length (self->priv->bearers);
-}
-
-guint
-mm_bearer_list_get_count_active (MMBearerList *self)
-{
- return 0; /* TODO */
-}
-
gboolean
mm_bearer_list_add_bearer (MMBearerList *self,
MMBaseBearer *bearer,
GError **error)
{
- /* Just in case, ensure we don't go off limits */
- if (g_list_length (self->priv->bearers) == self->priv->max_bearers) {
- g_set_error (error,
- MM_CORE_ERROR,
- MM_CORE_ERROR_TOO_MANY,
- "Cannot add new bearer: already reached maximum (%u)",
- self->priv->max_bearers);
- return FALSE;
- }
-
/* Keep our own reference */
self->priv->bearers = g_list_prepend (self->priv->bearers, g_object_ref (bearer));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_NUM_BEARERS]);
@@ -269,12 +238,10 @@ mm_bearer_list_disconnect_all_bearers (MMBearerList *self,
/*****************************************************************************/
MMBearerList *
-mm_bearer_list_new (guint max_bearers,
- guint max_active_bearers)
+mm_bearer_list_new (guint max_active_bearers)
{
/* Create the object */
return g_object_new (MM_TYPE_BEARER_LIST,
- MM_BEARER_LIST_MAX_BEARERS, max_bearers,
MM_BEARER_LIST_MAX_ACTIVE_BEARERS, max_active_bearers,
NULL);
}
@@ -291,9 +258,6 @@ set_property (GObject *object,
case PROP_NUM_BEARERS:
g_assert_not_reached ();
break;
- case PROP_MAX_BEARERS:
- self->priv->max_bearers = g_value_get_uint (value);
- break;
case PROP_MAX_ACTIVE_BEARERS:
self->priv->max_active_bearers = g_value_get_uint (value);
break;
@@ -315,9 +279,6 @@ get_property (GObject *object,
case PROP_NUM_BEARERS:
g_value_set_uint (value, g_list_length (self->priv->bearers));
break;
- case PROP_MAX_BEARERS:
- g_value_set_uint (value, self->priv->max_bearers);
- break;
case PROP_MAX_ACTIVE_BEARERS:
g_value_set_uint (value, self->priv->max_active_bearers);
break;
@@ -371,16 +332,6 @@ mm_bearer_list_class_init (MMBearerListClass *klass)
G_PARAM_READABLE);
g_object_class_install_property (object_class, PROP_NUM_BEARERS, properties[PROP_NUM_BEARERS]);
- properties[PROP_MAX_BEARERS] =
- g_param_spec_uint (MM_BEARER_LIST_MAX_BEARERS,
- "Max bearers",
- "Maximum number of bearers the list can handle",
- 1,
- G_MAXUINT,
- 1,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_MAX_BEARERS, properties[PROP_MAX_BEARERS]);
-
properties[PROP_MAX_ACTIVE_BEARERS] =
g_param_spec_uint (MM_BEARER_LIST_MAX_ACTIVE_BEARERS,
"Max active bearers",