Implement MMModemNovatelCdma class for Novatel CDMA devices.
Rename MMModemNovatel to MMModemNovatelGsm.
This commit is contained in:
@@ -83,8 +83,10 @@ libmm_plugin_sierra_la_LDFLAGS = -module -avoid-version
|
||||
# Novatel
|
||||
|
||||
libmm_plugin_novatel_la_SOURCES = \
|
||||
mm-modem-novatel.c \
|
||||
mm-modem-novatel.h \
|
||||
mm-modem-novatel-cdma.c \
|
||||
mm-modem-novatel-cdma.h \
|
||||
mm-modem-novatel-gsm.c \
|
||||
mm-modem-novatel-gsm.h \
|
||||
mm-plugin-novatel.c \
|
||||
mm-plugin-novatel.h
|
||||
|
||||
|
73
plugins/mm-modem-novatel-cdma.c
Normal file
73
plugins/mm-modem-novatel-cdma.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "mm-modem-novatel-cdma.h"
|
||||
#include "mm-errors.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
static gpointer mm_modem_novatel_cdma_parent_class = NULL;
|
||||
|
||||
MMModem *
|
||||
mm_modem_novatel_cdma_new (const char *data_device,
|
||||
const char *driver)
|
||||
{
|
||||
g_return_val_if_fail (data_device != NULL, NULL);
|
||||
g_return_val_if_fail (driver != NULL, NULL);
|
||||
|
||||
return MM_MODEM (g_object_new (MM_TYPE_MODEM_NOVATEL_CDMA,
|
||||
MM_SERIAL_DEVICE, data_device,
|
||||
MM_SERIAL_CARRIER_DETECT, FALSE,
|
||||
MM_MODEM_DRIVER, driver,
|
||||
MM_MODEM_TYPE, MM_MODEM_TYPE_CDMA,
|
||||
NULL));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
modem_init (MMModem *modem_class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_modem_novatel_cdma_init (MMModemNovatelCdma *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_modem_novatel_cdma_class_init (MMModemNovatelCdmaClass *klass)
|
||||
{
|
||||
mm_modem_novatel_cdma_parent_class = g_type_class_peek_parent (klass);
|
||||
}
|
||||
|
||||
GType
|
||||
mm_modem_novatel_cdma_get_type (void)
|
||||
{
|
||||
static GType modem_novatel_cdma_type = 0;
|
||||
|
||||
if (G_UNLIKELY (modem_novatel_cdma_type == 0)) {
|
||||
static const GTypeInfo modem_novatel_cdma_type_info = {
|
||||
sizeof (MMModemNovatelCdmaClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) mm_modem_novatel_cdma_class_init,
|
||||
(GClassFinalizeFunc) NULL,
|
||||
NULL, /* class_data */
|
||||
sizeof (MMModemNovatelCdma),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) mm_modem_novatel_cdma_init,
|
||||
};
|
||||
|
||||
static const GInterfaceInfo modem_iface_info = {
|
||||
(GInterfaceInitFunc) modem_init
|
||||
};
|
||||
|
||||
modem_novatel_cdma_type = g_type_register_static (MM_TYPE_GENERIC_CDMA, "MMModemNovatelCdma", &modem_novatel_cdma_type_info, 0);
|
||||
g_type_add_interface_static (modem_novatel_cdma_type, MM_TYPE_MODEM, &modem_iface_info);
|
||||
}
|
||||
|
||||
return modem_novatel_cdma_type;
|
||||
}
|
28
plugins/mm-modem-novatel-cdma.h
Normal file
28
plugins/mm-modem-novatel-cdma.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_MODEM_NOVATEL_CDMA_H
|
||||
#define MM_MODEM_NOVATEL_CDMA_H
|
||||
|
||||
#include "mm-generic-cdma.h"
|
||||
|
||||
#define MM_TYPE_MODEM_NOVATEL_CDMA (mm_modem_novatel_cdma_get_type ())
|
||||
#define MM_MODEM_NOVATEL_CDMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_NOVATEL_CDMA, MMModemNovatelCdma))
|
||||
#define MM_MODEM_NOVATEL_CDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_MODEM_NOVATEL_CDMA, MMModemNovatelCdmaClass))
|
||||
#define MM_IS_MODEM_NOVATEL_CDMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_NOVATEL_CDMA))
|
||||
#define MM_IS_MODEM_NOVATEL_CDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_MODEM_NOVATEL_CDMA))
|
||||
#define MM_MODEM_NOVATEL_CDMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_MODEM_NOVATEL_CDMA, MMModemNovatelCdmaClass))
|
||||
|
||||
typedef struct {
|
||||
MMGenericCdma parent;
|
||||
} MMModemNovatelCdma;
|
||||
|
||||
typedef struct {
|
||||
MMGenericCdmaClass parent;
|
||||
} MMModemNovatelCdmaClass;
|
||||
|
||||
GType mm_modem_novatel_cdma_get_type (void);
|
||||
|
||||
MMModem *mm_modem_novatel_cdma_new (const char *data_device,
|
||||
const char *driver);
|
||||
|
||||
#endif /* MM_MODEM_NOVATEL_CDMA_H */
|
@@ -4,20 +4,20 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "mm-modem-novatel.h"
|
||||
#include "mm-modem-novatel-gsm.h"
|
||||
#include "mm-errors.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
static gpointer mm_modem_novatel_parent_class = NULL;
|
||||
static gpointer mm_modem_novatel_gsm_parent_class = NULL;
|
||||
|
||||
MMModem *
|
||||
mm_modem_novatel_new (const char *data_device,
|
||||
const char *driver)
|
||||
mm_modem_novatel_gsm_new (const char *data_device,
|
||||
const char *driver)
|
||||
{
|
||||
g_return_val_if_fail (data_device != NULL, NULL);
|
||||
g_return_val_if_fail (driver != NULL, NULL);
|
||||
|
||||
return MM_MODEM (g_object_new (MM_TYPE_MODEM_NOVATEL,
|
||||
return MM_MODEM (g_object_new (MM_TYPE_MODEM_NOVATEL_GSM,
|
||||
MM_SERIAL_DEVICE, data_device,
|
||||
MM_MODEM_DRIVER, driver,
|
||||
MM_MODEM_TYPE, MM_MODEM_TYPE_GSM,
|
||||
@@ -131,41 +131,43 @@ modem_init (MMModem *modem_class)
|
||||
}
|
||||
|
||||
static void
|
||||
mm_modem_novatel_init (MMModemNovatel *self)
|
||||
mm_modem_novatel_gsm_init (MMModemNovatelGsm *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_modem_novatel_class_init (MMModemNovatelClass *klass)
|
||||
mm_modem_novatel_gsm_class_init (MMModemNovatelGsmClass *klass)
|
||||
{
|
||||
mm_modem_novatel_parent_class = g_type_class_peek_parent (klass);
|
||||
mm_modem_novatel_gsm_parent_class = g_type_class_peek_parent (klass);
|
||||
}
|
||||
|
||||
GType
|
||||
mm_modem_novatel_get_type (void)
|
||||
mm_modem_novatel_gsm_get_type (void)
|
||||
{
|
||||
static GType modem_novatel_type = 0;
|
||||
static GType modem_novatel_gsm_type = 0;
|
||||
|
||||
if (G_UNLIKELY (modem_novatel_type == 0)) {
|
||||
static const GTypeInfo modem_novatel_type_info = {
|
||||
sizeof (MMModemNovatelClass),
|
||||
if (G_UNLIKELY (modem_novatel_gsm_type == 0)) {
|
||||
static const GTypeInfo modem_novatel_gsm_type_info = {
|
||||
sizeof (MMModemNovatelGsmClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) mm_modem_novatel_class_init,
|
||||
(GClassInitFunc) mm_modem_novatel_gsm_class_init,
|
||||
(GClassFinalizeFunc) NULL,
|
||||
NULL, /* class_data */
|
||||
sizeof (MMModemNovatel),
|
||||
sizeof (MMModemNovatelGsm),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) mm_modem_novatel_init,
|
||||
(GInstanceInitFunc) mm_modem_novatel_gsm_init,
|
||||
};
|
||||
|
||||
static const GInterfaceInfo modem_iface_info = {
|
||||
(GInterfaceInitFunc) modem_init
|
||||
};
|
||||
|
||||
modem_novatel_type = g_type_register_static (MM_TYPE_GENERIC_GSM, "MMModemNovatel", &modem_novatel_type_info, 0);
|
||||
g_type_add_interface_static (modem_novatel_type, MM_TYPE_MODEM, &modem_iface_info);
|
||||
modem_novatel_gsm_type = g_type_register_static (MM_TYPE_GENERIC_GSM, "MMModemNovatelGsm",
|
||||
&modem_novatel_gsm_type_info, 0);
|
||||
|
||||
g_type_add_interface_static (modem_novatel_gsm_type, MM_TYPE_MODEM, &modem_iface_info);
|
||||
}
|
||||
|
||||
return modem_novatel_type;
|
||||
return modem_novatel_gsm_type;
|
||||
}
|
28
plugins/mm-modem-novatel-gsm.h
Normal file
28
plugins/mm-modem-novatel-gsm.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_MODEM_NOVATEL_GSM_H
|
||||
#define MM_MODEM_NOVATEL_GSM_H
|
||||
|
||||
#include "mm-generic-gsm.h"
|
||||
|
||||
#define MM_TYPE_MODEM_NOVATEL_GSM (mm_modem_novatel_gsm_get_type ())
|
||||
#define MM_MODEM_NOVATEL_GSM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_NOVATEL_GSM, MMModemNovatelGsm))
|
||||
#define MM_MODEM_NOVATEL_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_MODEM_NOVATEL_GSM, MMModemNovatelGsmClass))
|
||||
#define MM_IS_MODEM_NOVATEL_GSM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_NOVATEL_GSM))
|
||||
#define MM_IS_MODEM_NOVATEL_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_MODEM_NOVATEL_GSM))
|
||||
#define MM_MODEM_NOVATEL_GSM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_MODEM_NOVATEL_GSM, MMModemNovatelGsmClass))
|
||||
|
||||
typedef struct {
|
||||
MMGenericGsm parent;
|
||||
} MMModemNovatelGsm;
|
||||
|
||||
typedef struct {
|
||||
MMGenericGsmClass parent;
|
||||
} MMModemNovatelGsmClass;
|
||||
|
||||
GType mm_modem_novatel_gsm_get_type (void);
|
||||
|
||||
MMModem *mm_modem_novatel_gsm_new (const char *data_device,
|
||||
const char *driver);
|
||||
|
||||
#endif /* MM_MODEM_NOVATEL_GSM_H */
|
@@ -1,28 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_MODEM_NOVATEL_H
|
||||
#define MM_MODEM_NOVATEL_H
|
||||
|
||||
#include "mm-generic-gsm.h"
|
||||
|
||||
#define MM_TYPE_MODEM_NOVATEL (mm_modem_novatel_get_type ())
|
||||
#define MM_MODEM_NOVATEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_NOVATEL, MMModemNovatel))
|
||||
#define MM_MODEM_NOVATEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_MODEM_NOVATEL, MMModemNovatelClass))
|
||||
#define MM_IS_MODEM_NOVATEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_NOVATEL))
|
||||
#define MM_IS_MODEM_NOVATEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_MODEM_NOVATEL))
|
||||
#define MM_MODEM_NOVATEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_MODEM_NOVATEL, MMModemNovatelClass))
|
||||
|
||||
typedef struct {
|
||||
MMGenericGsm parent;
|
||||
} MMModemNovatel;
|
||||
|
||||
typedef struct {
|
||||
MMGenericGsmClass parent;
|
||||
} MMModemNovatelClass;
|
||||
|
||||
GType mm_modem_novatel_get_type (void);
|
||||
|
||||
MMModem *mm_modem_novatel_new (const char *data_device,
|
||||
const char *driver);
|
||||
|
||||
#endif /* MM_MODEM_NOVATEL_H */
|
@@ -3,8 +3,8 @@
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
#include "mm-plugin-novatel.h"
|
||||
#include "mm-modem-novatel.h"
|
||||
#include "mm-generic-cdma.h"
|
||||
#include "mm-modem-novatel-cdma.h"
|
||||
#include "mm-modem-novatel-gsm.h"
|
||||
|
||||
static void plugin_init (MMPlugin *plugin_class);
|
||||
|
||||
@@ -141,11 +141,9 @@ create_modem (MMPlugin *plugin, LibHalContext *hal_ctx, const char *udi)
|
||||
g_return_val_if_fail (driver != NULL, NULL);
|
||||
|
||||
if (is_novatel_gsm)
|
||||
modem = MM_MODEM (mm_modem_novatel_new (data_device, driver));
|
||||
else {
|
||||
modem = MM_MODEM (mm_generic_cdma_new (data_device, driver));
|
||||
g_object_set (G_OBJECT (modem), MM_SERIAL_CARRIER_DETECT, FALSE, NULL);
|
||||
}
|
||||
modem = MM_MODEM (mm_modem_novatel_gsm_new (data_device, driver));
|
||||
else
|
||||
modem = MM_MODEM (mm_modem_novatel_cdma_new (data_device, driver));
|
||||
|
||||
libhal_free_string (data_device);
|
||||
libhal_free_string (driver);
|
||||
|
Reference in New Issue
Block a user