diff options
-rw-r--r-- | plugins/Makefile.am | 2 | ||||
-rw-r--r-- | plugins/ublox/mm-broadband-modem-ublox.c | 67 | ||||
-rw-r--r-- | plugins/ublox/mm-broadband-modem-ublox.h | 49 | ||||
-rw-r--r-- | plugins/ublox/mm-plugin-ublox.c | 24 |
4 files changed, 130 insertions, 12 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 19775cf8..5c34d500 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -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) diff --git a/plugins/ublox/mm-broadband-modem-ublox.c b/plugins/ublox/mm-broadband-modem-ublox.c new file mode 100644 index 00000000..71169538 --- /dev/null +++ b/plugins/ublox/mm-broadband-modem-ublox.c @@ -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)); +} diff --git a/plugins/ublox/mm-broadband-modem-ublox.h b/plugins/ublox/mm-broadband-modem-ublox.h new file mode 100644 index 00000000..f1c6bbcf --- /dev/null +++ b/plugins/ublox/mm-broadband-modem-ublox.h @@ -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 */ diff --git a/plugins/ublox/mm-plugin-ublox.c b/plugins/ublox/mm-plugin-ublox.c index 3efd5230..13d8df97 100644 --- a/plugins/ublox/mm-plugin-ublox.c +++ b/plugins/ublox/mm-plugin-ublox.c @@ -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)); } /*****************************************************************************/ |