sierra: new `MMSimSierra' object

This commit is contained in:
Aleksander Morgado
2012-08-23 18:56:22 +02:00
parent cd2174d2ef
commit 0c80815ea2
7 changed files with 167 additions and 0 deletions
+2
View File
@@ -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 \
@@ -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
@@ -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
+24
View File
@@ -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);
}
+7
View File
@@ -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 */
+77
View File
@@ -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)
{
}
+53
View File
@@ -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 */