aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Makefile.am2
-rw-r--r--plugins/sierra/mm-broadband-bearer-sierra.c85
-rw-r--r--plugins/sierra/mm-broadband-bearer-sierra.h58
-rw-r--r--plugins/sierra/mm-broadband-modem-sierra.c59
4 files changed, 204 insertions, 0 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 1cc37041..d351308e 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -152,6 +152,8 @@ libmm_plugin_sierra_la_SOURCES = \
sierra/mm-common-sierra.h \
sierra/mm-sim-sierra.c \
sierra/mm-sim-sierra.h \
+ sierra/mm-broadband-bearer-sierra.c \
+ sierra/mm-broadband-bearer-sierra.h \
sierra/mm-broadband-modem-sierra.c \
sierra/mm-broadband-modem-sierra.h \
sierra/mm-broadband-modem-sierra-icera.c \
diff --git a/plugins/sierra/mm-broadband-bearer-sierra.c b/plugins/sierra/mm-broadband-bearer-sierra.c
new file mode 100644
index 00000000..bd7ada57
--- /dev/null
+++ b/plugins/sierra/mm-broadband-bearer-sierra.c
@@ -0,0 +1,85 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details:
+ *
+ * Copyright (C) 2008 - 2009 Novell, Inc.
+ * Copyright (C) 2009 - 2012 Red Hat, Inc.
+ * Copyright (C) 2012 Lanedo GmbH
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <ModemManager.h>
+#include <libmm-common.h>
+
+#include "mm-base-modem-at.h"
+#include "mm-broadband-bearer-sierra.h"
+#include "mm-log.h"
+#include "mm-modem-helpers.h"
+#include "mm-utils.h"
+
+G_DEFINE_TYPE (MMBroadbandBearerSierra, mm_broadband_bearer_sierra, MM_TYPE_BROADBAND_BEARER);
+
+/*****************************************************************************/
+
+MMBearer *
+mm_broadband_bearer_sierra_new_finish (GAsyncResult *res,
+ GError **error)
+{
+ GObject *bearer;
+ GObject *source;
+
+ source = g_async_result_get_source_object (res);
+ bearer = g_async_initable_new_finish (G_ASYNC_INITABLE (source), res, error);
+ g_object_unref (source);
+
+ if (!bearer)
+ return NULL;
+
+ /* Only export valid bearers */
+ mm_bearer_export (MM_BEARER (bearer));
+
+ return MM_BEARER (bearer);
+}
+
+void
+mm_broadband_bearer_sierra_new (MMBroadbandModemSierra *modem,
+ MMBearerProperties *config,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_async_initable_new_async (
+ MM_TYPE_BROADBAND_BEARER_SIERRA,
+ G_PRIORITY_DEFAULT,
+ cancellable,
+ callback,
+ user_data,
+ MM_BEARER_MODEM, modem,
+ MM_BEARER_CONFIG, config,
+ NULL);
+}
+
+static void
+mm_broadband_bearer_sierra_init (MMBroadbandBearerSierra *self)
+{
+}
+
+static void
+mm_broadband_bearer_sierra_class_init (MMBroadbandBearerSierraClass *klass)
+{
+}
diff --git a/plugins/sierra/mm-broadband-bearer-sierra.h b/plugins/sierra/mm-broadband-bearer-sierra.h
new file mode 100644
index 00000000..20ebc26d
--- /dev/null
+++ b/plugins/sierra/mm-broadband-bearer-sierra.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details:
+ *
+ * Copyright (C) 2008 - 2009 Novell, Inc.
+ * Copyright (C) 2009 - 2012 Red Hat, Inc.
+ * Copyright (C) 2012 Lanedo GmbH
+ */
+
+#ifndef MM_BROADBAND_BEARER_SIERRA_H
+#define MM_BROADBAND_BEARER_SIERRA_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <libmm-common.h>
+
+#include "mm-broadband-bearer.h"
+#include "mm-broadband-modem-sierra.h"
+
+#define MM_TYPE_BROADBAND_BEARER_SIERRA (mm_broadband_bearer_sierra_get_type ())
+#define MM_BROADBAND_BEARER_SIERRA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_BEARER_SIERRA, MMBroadbandBearerSierra))
+#define MM_BROADBAND_BEARER_SIERRA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_BEARER_SIERRA, MMBroadbandBearerSierraClass))
+#define MM_IS_BROADBAND_BEARER_SIERRA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_BEARER_SIERRA))
+#define MM_IS_BROADBAND_BEARER_SIERRA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_BEARER_SIERRA))
+#define MM_BROADBAND_BEARER_SIERRA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_BEARER_SIERRA, MMBroadbandBearerSierraClass))
+
+typedef struct _MMBroadbandBearerSierra MMBroadbandBearerSierra;
+typedef struct _MMBroadbandBearerSierraClass MMBroadbandBearerSierraClass;
+
+struct _MMBroadbandBearerSierra {
+ MMBroadbandBearer parent;
+};
+
+struct _MMBroadbandBearerSierraClass {
+ MMBroadbandBearerClass parent;
+};
+
+GType mm_broadband_bearer_sierra_get_type (void);
+
+/* Default 3GPP bearer creation implementation */
+void mm_broadband_bearer_sierra_new (MMBroadbandModemSierra *modem,
+ MMBearerProperties *config,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+MMBearer *mm_broadband_bearer_sierra_new_finish (GAsyncResult *res,
+ GError **error);
+
+#endif /* MM_BROADBAND_BEARER_SIERRA_H */
diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c
index f07c9b07..312c5e93 100644
--- a/plugins/sierra/mm-broadband-modem-sierra.c
+++ b/plugins/sierra/mm-broadband-modem-sierra.c
@@ -32,6 +32,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-3gpp.h"
#include "mm-common-sierra.h"
+#include "mm-broadband-bearer-sierra.h"
static void iface_modem_init (MMIfaceModem *iface);
@@ -384,6 +385,62 @@ set_allowed_modes (MMIfaceModem *self,
}
/*****************************************************************************/
+/* Create Bearer (Modem interface) */
+
+static MMBearer *
+modem_create_bearer_finish (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ MMBearer *bearer;
+
+ bearer = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
+ mm_dbg ("New Sierra bearer created at DBus path '%s'", mm_bearer_get_path (bearer));
+
+ return g_object_ref (bearer);
+}
+
+static void
+broadband_bearer_sierra_new_ready (GObject *source,
+ GAsyncResult *res,
+ GSimpleAsyncResult *simple)
+{
+ MMBearer *bearer = NULL;
+ GError *error = NULL;
+
+ bearer = mm_broadband_bearer_sierra_new_finish (res, &error);
+ if (!bearer)
+ g_simple_async_result_take_error (simple, error);
+ else
+ g_simple_async_result_set_op_res_gpointer (simple,
+ bearer,
+ (GDestroyNotify)g_object_unref);
+ g_simple_async_result_complete (simple);
+ g_object_unref (simple);
+}
+
+static void
+modem_create_bearer (MMIfaceModem *self,
+ MMBearerProperties *properties,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *result;
+
+ result = g_simple_async_result_new (G_OBJECT (self),
+ callback,
+ user_data,
+ modem_create_bearer);
+
+ mm_dbg ("Creating Sierra bearer...");
+ mm_broadband_bearer_sierra_new (MM_BROADBAND_MODEM_SIERRA (self),
+ properties,
+ NULL, /* cancellable */
+ (GAsyncReadyCallback)broadband_bearer_sierra_new_ready,
+ result);
+}
+
+/*****************************************************************************/
/* Setup ports (Broadband modem class) */
static void
@@ -431,6 +488,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->modem_power_up_finish = mm_common_sierra_modem_power_up_finish;
iface->create_sim = mm_common_sierra_create_sim;
iface->create_sim_finish = mm_common_sierra_create_sim_finish;
+ iface->create_bearer = modem_create_bearer;
+ iface->create_bearer_finish = modem_create_bearer_finish;
}
static void