iridium: don't try to load SIM identifier or operator info

This commit is contained in:
Aleksander Morgado
2012-02-14 14:48:04 +01:00
parent 789cf58ace
commit 2a351a6910
4 changed files with 170 additions and 1 deletions

View File

@@ -249,7 +249,9 @@ libmm_plugin_iridium_la_SOURCES = \
mm-plugin-iridium.c \ mm-plugin-iridium.c \
mm-plugin-iridium.h \ mm-plugin-iridium.h \
mm-broadband-modem-iridium.c \ 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_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
libmm_plugin_iridium_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS) libmm_plugin_iridium_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)

View File

@@ -28,6 +28,7 @@
#include "mm-base-modem-at.h" #include "mm-base-modem-at.h"
#include "mm-iface-modem.h" #include "mm-iface-modem.h"
#include "mm-broadband-modem-iridium.h" #include "mm-broadband-modem-iridium.h"
#include "mm-sim-iridium.h"
static void iface_modem_init (MMIfaceModem *iface); static void iface_modem_init (MMIfaceModem *iface);
@@ -91,6 +92,29 @@ setup_flow_control (MMIfaceModem *self,
result); result);
} }
/*****************************************************************************/
/* 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 * MMBroadbandModemIridium *
@@ -117,6 +141,10 @@ mm_broadband_modem_iridium_init (MMBroadbandModemIridium *self)
static void static void
iface_modem_init (MMIfaceModem *iface) 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 */ /* RTS/CTS flow control */
iface->setup_flow_control = setup_flow_control; iface->setup_flow_control = setup_flow_control;
iface->setup_flow_control_finish = setup_flow_control_finish; iface->setup_flow_control_finish = setup_flow_control_finish;

87
plugins/mm-sim-iridium.c Normal file
View File

@@ -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;
}

52
plugins/mm-sim-iridium.h Normal file
View File

@@ -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 */