diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-14 14:48:04 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:07 +0100 |
commit | 2a351a69108584b06e3f99f0414a8b222c213bbf (patch) | |
tree | 3c80cba50bf9112aae920c4e3616e1e01d158a38 | |
parent | 789cf58acee0334990e18fb4793f3f872626e697 (diff) |
iridium: don't try to load SIM identifier or operator info
-rw-r--r-- | plugins/Makefile.am | 4 | ||||
-rw-r--r-- | plugins/mm-broadband-modem-iridium.c | 28 | ||||
-rw-r--r-- | plugins/mm-sim-iridium.c | 87 | ||||
-rw-r--r-- | plugins/mm-sim-iridium.h | 52 |
4 files changed, 170 insertions, 1 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 6b9526c6..bc905958 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -249,7 +249,9 @@ libmm_plugin_iridium_la_SOURCES = \ mm-plugin-iridium.c \ mm-plugin-iridium.h \ mm-broadband-modem-iridium.c \ - mm-broadband-modem-iridium.h + mm-broadband-modem-iridium.h \ + mm-sim-iridium.c \ + mm-sim-iridium.h libmm_plugin_iridium_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS) libmm_plugin_iridium_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS) diff --git a/plugins/mm-broadband-modem-iridium.c b/plugins/mm-broadband-modem-iridium.c index d1b92698..103e458f 100644 --- a/plugins/mm-broadband-modem-iridium.c +++ b/plugins/mm-broadband-modem-iridium.c @@ -28,6 +28,7 @@ #include "mm-base-modem-at.h" #include "mm-iface-modem.h" #include "mm-broadband-modem-iridium.h" +#include "mm-sim-iridium.h" static void iface_modem_init (MMIfaceModem *iface); @@ -92,6 +93,29 @@ setup_flow_control (MMIfaceModem *self, } /*****************************************************************************/ +/* Create SIM (Modem inteface) */ + +static MMSim * +create_sim_finish (MMIfaceModem *self, + GAsyncResult *res, + GError **error) +{ + return mm_sim_new_finish (res, error); +} + +static void +create_sim (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + /* New Iridium SIM */ + mm_sim_iridium_new (MM_BASE_MODEM (self), + NULL, /* cancellable */ + callback, + user_data); +} + +/*****************************************************************************/ MMBroadbandModemIridium * mm_broadband_modem_iridium_new (const gchar *device, @@ -117,6 +141,10 @@ mm_broadband_modem_iridium_init (MMBroadbandModemIridium *self) static void iface_modem_init (MMIfaceModem *iface) { + /* Create Iridium-specific SIM */ + iface->create_sim = create_sim; + iface->create_sim_finish = create_sim_finish; + /* RTS/CTS flow control */ iface->setup_flow_control = setup_flow_control; iface->setup_flow_control_finish = setup_flow_control_finish; diff --git a/plugins/mm-sim-iridium.c b/plugins/mm-sim-iridium.c new file mode 100644 index 00000000..519b6f90 --- /dev/null +++ b/plugins/mm-sim-iridium.c @@ -0,0 +1,87 @@ +/* -*- 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) 2011 - 2012 Ammonit Measurement GmbH. + * Author: Aleksander Morgado <aleksander@lanedo.com> + */ + +#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-iridium.h" + +G_DEFINE_TYPE (MMSimIridium, mm_sim_iridium, MM_TYPE_SIM); + +/*****************************************************************************/ + +MMSim * +mm_sim_iridium_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_iridium_new (MMBaseModem *modem, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (MM_TYPE_SIM_IRIDIUM, + G_PRIORITY_DEFAULT, + cancellable, + callback, + user_data, + MM_SIM_MODEM, modem, + NULL); +} + +static void +mm_sim_iridium_init (MMSimIridium *self) +{ +} + +static void +mm_sim_iridium_class_init (MMSimIridiumClass *klass) +{ + MMSimClass *sim_class = MM_SIM_CLASS (klass); + + /* Skip querying the SIM card info, not supported by Iridium modems */ + sim_class->load_sim_identifier = NULL; + sim_class->load_sim_identifier_finish = NULL; + sim_class->load_imsi = NULL; + sim_class->load_imsi_finish = NULL; + sim_class->load_operator_identifier = NULL; + sim_class->load_operator_identifier_finish = NULL; + sim_class->load_operator_name = NULL; + sim_class->load_operator_name_finish = NULL; +} diff --git a/plugins/mm-sim-iridium.h b/plugins/mm-sim-iridium.h new file mode 100644 index 00000000..0150cb1e --- /dev/null +++ b/plugins/mm-sim-iridium.h @@ -0,0 +1,52 @@ +/* -*- 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) 2011 - 2012 Ammonit Measurement GmbH. + * Author: Aleksander Morgado <aleksander@lanedo.com> + */ + +#ifndef MM_SIM_IRIDIUM_H +#define MM_SIM_IRIDIUM_H + +#include <glib.h> +#include <glib-object.h> + +#include "mm-sim.h" + +#define MM_TYPE_SIM_IRIDIUM (mm_sim_iridium_get_type ()) +#define MM_SIM_IRIDIUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SIM_IRIDIUM, MMSimIridium)) +#define MM_SIM_IRIDIUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SIM_IRIDIUM, MMSimIridiumClass)) +#define MM_IS_SIM_IRIDIUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SIM_IRIDIUM)) +#define MM_IS_SIM_IRIDIUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SIM_IRIDIUM)) +#define MM_SIM_IRIDIUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SIM_IRIDIUM, MMSimIridiumClass)) + +typedef struct _MMSimIridium MMSimIridium; +typedef struct _MMSimIridiumClass MMSimIridiumClass; + +struct _MMSimIridium { + MMSim parent; +}; + +struct _MMSimIridiumClass { + MMSimClass parent; +}; + +GType mm_sim_iridium_get_type (void); + +void mm_sim_iridium_new (MMBaseModem *modem, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +MMSim *mm_sim_iridium_new_finish (GAsyncResult *res, + GError **error); + +#endif /* MM_SIM_IRIDIUM_H */ |