ublox: new broadband modem object

This commit is contained in:
Aleksander Morgado
2016-10-12 11:29:51 +02:00
parent f22c088cee
commit 40f3725ef9
4 changed files with 130 additions and 12 deletions
+2
View File
@@ -859,6 +859,8 @@ pkglib_LTLIBRARIES += libmm-plugin-ublox.la
libmm_plugin_ublox_la_SOURCES = \
ublox/mm-plugin-ublox.c \
ublox/mm-plugin-ublox.h \
ublox/mm-broadband-modem-ublox.h \
ublox/mm-broadband-modem-ublox.c \
$(NULL)
libmm_plugin_ublox_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
libmm_plugin_ublox_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
+67
View File
@@ -0,0 +1,67 @@
/* -*- 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) 2016 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include "ModemManager.h"
#include "mm-log.h"
#include "mm-broadband-modem-ublox.h"
G_DEFINE_TYPE (MMBroadbandModemUblox, mm_broadband_modem_ublox, MM_TYPE_BROADBAND_MODEM)
struct _MMBroadbandModemUbloxPrivate {
gpointer unused;
};
/*****************************************************************************/
MMBroadbandModemUblox *
mm_broadband_modem_ublox_new (const gchar *device,
const gchar **drivers,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id)
{
return g_object_new (MM_TYPE_BROADBAND_MODEM_UBLOX,
MM_BASE_MODEM_DEVICE, device,
MM_BASE_MODEM_DRIVERS, drivers,
MM_BASE_MODEM_PLUGIN, plugin,
MM_BASE_MODEM_VENDOR_ID, vendor_id,
MM_BASE_MODEM_PRODUCT_ID, product_id,
NULL);
}
static void
mm_broadband_modem_ublox_init (MMBroadbandModemUblox *self)
{
/* Initialize private data */
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
MM_TYPE_BROADBAND_MODEM_UBLOX,
MMBroadbandModemUbloxPrivate);
}
static void
mm_broadband_modem_ublox_class_init (MMBroadbandModemUbloxClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMBroadbandModemUbloxPrivate));
}
+49
View File
@@ -0,0 +1,49 @@
/* -*- 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) 2016 Aleksander Morgado <aleksander@aleksander.es>
*/
#ifndef MM_BROADBAND_MODEM_UBLOX_H
#define MM_BROADBAND_MODEM_UBLOX_H
#include "mm-broadband-modem.h"
#define MM_TYPE_BROADBAND_MODEM_UBLOX (mm_broadband_modem_ublox_get_type ())
#define MM_BROADBAND_MODEM_UBLOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_UBLOX, MMBroadbandModemUblox))
#define MM_BROADBAND_MODEM_UBLOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_UBLOX, MMBroadbandModemUbloxClass))
#define MM_IS_BROADBAND_MODEM_UBLOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_UBLOX))
#define MM_IS_BROADBAND_MODEM_UBLOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_UBLOX))
#define MM_BROADBAND_MODEM_UBLOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_UBLOX, MMBroadbandModemUbloxClass))
typedef struct _MMBroadbandModemUblox MMBroadbandModemUblox;
typedef struct _MMBroadbandModemUbloxClass MMBroadbandModemUbloxClass;
typedef struct _MMBroadbandModemUbloxPrivate MMBroadbandModemUbloxPrivate;
struct _MMBroadbandModemUblox {
MMBroadbandModem parent;
MMBroadbandModemUbloxPrivate *priv;
};
struct _MMBroadbandModemUbloxClass{
MMBroadbandModemClass parent;
};
GType mm_broadband_modem_ublox_get_type (void);
MMBroadbandModemUblox *mm_broadband_modem_ublox_new (const gchar *device,
const gchar **drivers,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id);
#endif /* MM_BROADBAND_MODEM_UBLOX_H */
+12 -12
View File
@@ -20,7 +20,7 @@
#include <libmm-glib.h>
#include "mm-log.h"
#include "mm-broadband-modem.h"
#include "mm-broadband-modem-ublox.h"
#include "mm-plugin-ublox.h"
G_DEFINE_TYPE (MMPluginUblox, mm_plugin_ublox, MM_TYPE_PLUGIN)
@@ -31,19 +31,19 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
/*****************************************************************************/
static MMBaseModem *
create_modem (MMPlugin *self,
const gchar *sysfs_path,
create_modem (MMPlugin *self,
const gchar *sysfs_path,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
drivers,
mm_plugin_get_name (self),
vendor,
product));
return MM_BASE_MODEM (mm_broadband_modem_ublox_new (sysfs_path,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
/*****************************************************************************/