api,simple: new 'multiplex' setting in bearer properties

Both the Simple.Connect() and Modem.CreateBearer() are updated to
allow a new 'multiplex' setting in the properties provided by the user
in both of these methods.

The new setting expects a MMBearerMultiplexSupport enum indicating
what kind of multiplex needs the user has:
 * none: if multiplex must not be used.
 * requested: if multiplex should be used if available.
 * required: if multiplex must be used.

The underlying implementations will take care of accepting or
rejecting the setting depending on the system and modem capabilities.
This commit is contained in:
Aleksander Morgado
2021-02-17 15:49:01 +01:00
parent 71bad1d862
commit 064e92e9b7
14 changed files with 201 additions and 24 deletions

View File

@@ -183,6 +183,15 @@ connect (MMBaseBearer *self,
GTask *task;
MMBaseModem *modem = NULL;
task = g_task_new (self, cancellable, callback, user_data);
if (mm_bearer_properties_get_multiplex (mm_base_bearer_peek_config (self)) == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
"Multiplex support not available");
g_object_unref (task);
return;
}
g_object_get (self,
MM_BASE_BEARER_MODEM, &modem,
NULL);
@@ -194,8 +203,6 @@ connect (MMBaseBearer *self,
/* In this context, we only keep the stuff we'll need later */
ctx = g_new0 (ConnectContext, 1);
ctx->primary = mm_base_modem_get_port_primary (modem);
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task, ctx, (GDestroyNotify) connect_context_free);
/* Bearer service type set to 9600bps (V.110), which behaves better than the