aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-08-22 14:50:28 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-08-23 18:56:22 +0200
commit0c80815ea2366bbf2dbc3b2bf4aee8aa175d435e (patch)
tree38b3f24d483e44118bf5a8fa0c4c0f4a3f860864
parentcd2174d2ef0a0fa023ac2ddfeaa7ca0abb2ea7b0 (diff)
sierra: new `MMSimSierra' object
-rw-r--r--plugins/Makefile.am2
-rw-r--r--plugins/sierra/mm-broadband-modem-sierra-icera.c2
-rw-r--r--plugins/sierra/mm-broadband-modem-sierra.c2
-rw-r--r--plugins/sierra/mm-common-sierra.c24
-rw-r--r--plugins/sierra/mm-common-sierra.h7
-rw-r--r--plugins/sierra/mm-sim-sierra.c77
-rw-r--r--plugins/sierra/mm-sim-sierra.h53
7 files changed, 167 insertions, 0 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index c2ef9574..1cc37041 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -150,6 +150,8 @@ libmm_plugin_sierra_la_SOURCES = \
sierra/mm-plugin-sierra.h \
sierra/mm-common-sierra.c \
sierra/mm-common-sierra.h \
+ sierra/mm-sim-sierra.c \
+ sierra/mm-sim-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-modem-sierra-icera.c b/plugins/sierra/mm-broadband-modem-sierra-icera.c
index a2ebd4f7..969e8d60 100644
--- a/plugins/sierra/mm-broadband-modem-sierra-icera.c
+++ b/plugins/sierra/mm-broadband-modem-sierra-icera.c
@@ -63,6 +63,8 @@ iface_modem_init (MMIfaceModem *iface)
{
iface->modem_power_up = mm_common_sierra_modem_power_up;
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;
}
static void
diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c
index 1d9de829..5b61d176 100644
--- a/plugins/sierra/mm-broadband-modem-sierra.c
+++ b/plugins/sierra/mm-broadband-modem-sierra.c
@@ -417,6 +417,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_access_technologies_finish = load_access_technologies_finish;
iface->modem_power_up = mm_common_sierra_modem_power_up;
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;
}
static void
diff --git a/plugins/sierra/mm-common-sierra.c b/plugins/sierra/mm-common-sierra.c
index 8d41580e..6394bd16 100644
--- a/plugins/sierra/mm-common-sierra.c
+++ b/plugins/sierra/mm-common-sierra.c
@@ -19,6 +19,7 @@
#include "mm-base-modem-at.h"
#include "mm-log.h"
#include "mm-modem-helpers.h"
+#include "mm-sim-sierra.h"
/*****************************************************************************/
/* Modem power up (Modem interface) */
@@ -135,3 +136,26 @@ mm_common_sierra_modem_power_up (MMIfaceModem *self,
(GAsyncReadyCallback)get_current_functionality_status_ready,
result);
}
+
+/*****************************************************************************/
+/* Create SIM (Modem interface) */
+
+MMSim *
+mm_common_sierra_create_sim_finish (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ return mm_sim_sierra_new_finish (res, error);
+}
+
+void
+mm_common_sierra_create_sim (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ /* New Sierra SIM */
+ mm_sim_sierra_new (MM_BASE_MODEM (self),
+ NULL, /* cancellable */
+ callback,
+ user_data);
+}
diff --git a/plugins/sierra/mm-common-sierra.h b/plugins/sierra/mm-common-sierra.h
index 6cbce02f..92161e6c 100644
--- a/plugins/sierra/mm-common-sierra.h
+++ b/plugins/sierra/mm-common-sierra.h
@@ -28,4 +28,11 @@ gboolean mm_common_sierra_modem_power_up_finish (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
+void mm_common_sierra_create_sim (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+MMSim *mm_common_sierra_create_sim_finish (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error);
+
#endif /* MM_COMMON_SIERRA_H */
diff --git a/plugins/sierra/mm-sim-sierra.c b/plugins/sierra/mm-sim-sierra.c
new file mode 100644
index 00000000..c649a7b7
--- /dev/null
+++ b/plugins/sierra/mm-sim-sierra.c
@@ -0,0 +1,77 @@
+/* -*- 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-sim-sierra.h"
+
+G_DEFINE_TYPE (MMSimSierra, mm_sim_sierra, MM_TYPE_SIM);
+
+/*****************************************************************************/
+
+MMSim *
+mm_sim_sierra_new_finish (GAsyncResult *res,
+ GError **error)
+{
+ GObject *source;
+ GObject *sim;
+
+ source = g_async_result_get_source_object (res);
+ sim = g_async_initable_new_finish (G_ASYNC_INITABLE (source), res, error);
+ g_object_unref (source);
+
+ if (!sim)
+ return NULL;
+
+ /* Only export valid SIMs */
+ mm_sim_export (MM_SIM (sim));
+
+ return MM_SIM (sim);
+}
+
+void
+mm_sim_sierra_new (MMBaseModem *modem,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_async_initable_new_async (MM_TYPE_SIM_SIERRA,
+ G_PRIORITY_DEFAULT,
+ cancellable,
+ callback,
+ user_data,
+ MM_SIM_MODEM, modem,
+ NULL);
+}
+
+static void
+mm_sim_sierra_init (MMSimSierra *self)
+{
+}
+
+static void
+mm_sim_sierra_class_init (MMSimSierraClass *klass)
+{
+}
diff --git a/plugins/sierra/mm-sim-sierra.h b/plugins/sierra/mm-sim-sierra.h
new file mode 100644
index 00000000..3595bd94
--- /dev/null
+++ b/plugins/sierra/mm-sim-sierra.h
@@ -0,0 +1,53 @@
+/* -*- 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_SIM_SIERRA_H
+#define MM_SIM_SIERRA_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "mm-sim.h"
+
+#define MM_TYPE_SIM_SIERRA (mm_sim_sierra_get_type ())
+#define MM_SIM_SIERRA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SIM_SIERRA, MMSimSierra))
+#define MM_SIM_SIERRA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SIM_SIERRA, MMSimSierraClass))
+#define MM_IS_SIM_SIERRA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SIM_SIERRA))
+#define MM_IS_SIM_SIERRA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SIM_SIERRA))
+#define MM_SIM_SIERRA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SIM_SIERRA, MMSimSierraClass))
+
+typedef struct _MMSimSierra MMSimSierra;
+typedef struct _MMSimSierraClass MMSimSierraClass;
+
+struct _MMSimSierra {
+ MMSim parent;
+};
+
+struct _MMSimSierraClass {
+ MMSimClass parent;
+};
+
+GType mm_sim_sierra_get_type (void);
+
+void mm_sim_sierra_new (MMBaseModem *modem,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+MMSim *mm_sim_sierra_new_finish (GAsyncResult *res,
+ GError **error);
+
+#endif /* MM_SIM_SIERRA_H */