summaryrefslogtreecommitdiff
path: root/src/mm-base-bearer.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-11-13 12:31:47 +0100
committerDan Williams <dcbw@redhat.com>2018-12-07 16:20:53 +0000
commit9c3ac2fb6023b87d065221f845969b0f06e26363 (patch)
tree7fa54627a1848d38bb04f13aeb762c9a0cd1e996 /src/mm-base-bearer.c
parentdc154cf005bbcb2f0bd1123093f6ac3c402c4de8 (diff)
api,modem-3gpp: new 'InitialEpsBearer' property
This property contains the DBus path of a Bearer object of type MM_BEARER_TYPE_DEFAULT_ATTACH, which is automatically exposed by the modem when registered in the LTE network. Unlike standard bearer objects created by the user, this bearer won't allow any connection/disconnection request, as its status is bound to the LTE registration exclusively. The bearer settings exposed by the object include the APN details that have been used during the initial packet network attach, which may be defined by modem settings (e.g. if previously configured in the firmware which APN to use for the given SIM card operator) or by the network itself (e.g. if none configured, or if a network override is required as when roaming). The bearer object will be created as soon as the LTE attach status details are known, and only while the modem is enabled. The implementation allows modems to update the LTE attach status details during runtime, so the bearer object with the settings may be recreated during runtime as well.
Diffstat (limited to 'src/mm-base-bearer.c')
-rw-r--r--src/mm-base-bearer.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/mm-base-bearer.c b/src/mm-base-bearer.c
index b2e07e19..6b7e1e5d 100644
--- a/src/mm-base-bearer.c
+++ b/src/mm-base-bearer.c
@@ -764,8 +764,18 @@ mm_base_bearer_connect (MMBaseBearer *self,
{
GTask *task;
- g_assert (MM_BASE_BEARER_GET_CLASS (self)->connect != NULL);
- g_assert (MM_BASE_BEARER_GET_CLASS (self)->connect_finish != NULL);
+ if (!MM_BASE_BEARER_GET_CLASS (self)->connect) {
+ g_assert (!MM_BASE_BEARER_GET_CLASS (self)->connect_finish);
+ g_task_report_new_error (
+ self,
+ callback,
+ user_data,
+ mm_base_bearer_connect,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Bearer doesn't allow explicit connection requests");
+ return;
+ }
/* If already connecting, return error, don't allow a second request. */
if (self->priv->status == MM_BEARER_STATUS_CONNECTING) {
@@ -975,11 +985,19 @@ mm_base_bearer_disconnect (MMBaseBearer *self,
{
GTask *task;
- g_assert (MM_BASE_BEARER_GET_CLASS (self)->disconnect != NULL);
- g_assert (MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish != NULL);
-
task = g_task_new (self, NULL, callback, user_data);
+ if (!MM_BASE_BEARER_GET_CLASS (self)->disconnect) {
+ g_assert (!MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish);
+ g_task_return_new_error (
+ task,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Bearer doesn't allow explicit disconnection requests");
+ g_object_unref (task);
+ return;
+ }
+
/* If already disconnected, done */
if (self->priv->status == MM_BEARER_STATUS_DISCONNECTED) {
g_task_return_boolean (task, TRUE);