aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--plugins/Makefile.am34
-rw-r--r--plugins/ublox/mm-broadband-modem-ublox.c28
-rw-r--r--plugins/ublox/mm-modem-helpers-ublox.h4
4 files changed, 43 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index a7b6eb81..6f5ef58c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -170,6 +170,8 @@ Makefile.in
/plugins/test-modem-helpers-ublox*
/plugins/test-service-*
+/plugins/ublox/mm-ublox-enums-types.[ch]
+
/test/lsudev
/test/mmtty
/test/mmrules
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 5c735091..51432ce2 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -58,6 +58,12 @@ noinst_LTLIBRARIES =
# Plugins
pkglib_LTLIBRARIES =
+# Built sources
+BUILT_SOURCES =
+
+# Clean files
+CLEANFILES =
+
################################################################################
# common service test support
################################################################################
@@ -856,11 +862,39 @@ test_udev_rules_LDADD = \
################################################################################
noinst_LTLIBRARIES += libhelpers-ublox.la
+
+UBLOX_ENUMS_INPUTS = \
+ ublox/mm-modem-helpers-ublox.h \
+ $(NULL)
+
+UBLOX_ENUMS_GENERATED = \
+ ublox/mm-ublox-enums-types.h \
+ ublox/mm-ublox-enums-types.c \
+ $(NULL)
+
+ublox/mm-ublox-enums-types.h: Makefile.am $(UBLOX_ENUMS_INPUTS) $(top_srcdir)/build-aux/mm-enums-template.h
+ $(AM_V_GEN) $(GLIB_MKENUMS) \
+ --fhead "#include \"mm-modem-helpers-ublox.h\"\n#ifndef __MM_UBLOX_ENUMS_TYPES_H__\n#define __MM_UBLOX_ENUMS_TYPES_H__\n" \
+ --template $(top_srcdir)/build-aux/mm-enums-template.h \
+ --ftail "#endif /* __MM_UBLOX_ENUMS_TYPES_H__ */\n" \
+ $(UBLOX_ENUMS_INPUTS) > $@
+
+ublox/mm-ublox-enums-types.c: Makefile.am $(top_srcdir)/build-aux/mm-enums-template.c ublox/mm-ublox-enums-types.h
+ $(AM_V_GEN) $(GLIB_MKENUMS) \
+ --fhead "#include \"mm-ublox-enums-types.h\"" \
+ --template $(top_srcdir)/build-aux/mm-enums-template.c \
+ $(UBLOX_ENUMS_INPUTS) > $@
+
libhelpers_ublox_la_SOURCES = \
ublox/mm-modem-helpers-ublox.c \
ublox/mm-modem-helpers-ublox.h \
$(NULL)
+nodist_libhelpers_ublox_la_SOURCES = $(UBLOX_ENUMS_GENERATED)
+
+BUILT_SOURCES += $(UBLOX_ENUMS_GENERATED)
+CLEANFILES += $(UBLOX_ENUMS_GENERATED)
+
noinst_PROGRAMS += test-modem-helpers-ublox
test_modem_helpers_ublox_SOURCES = \
ublox/tests/test-modem-helpers-ublox.c \
diff --git a/plugins/ublox/mm-broadband-modem-ublox.c b/plugins/ublox/mm-broadband-modem-ublox.c
index f907c504..c71daa7d 100644
--- a/plugins/ublox/mm-broadband-modem-ublox.c
+++ b/plugins/ublox/mm-broadband-modem-ublox.c
@@ -28,6 +28,7 @@
#include "mm-broadband-bearer.h"
#include "mm-broadband-modem-ublox.h"
#include "mm-modem-helpers-ublox.h"
+#include "mm-ublox-enums-types.h"
static void iface_modem_init (MMIfaceModem *iface);
@@ -123,16 +124,8 @@ mode_check_ready (MMBaseModem *self,
mm_dbg ("u-blox: couldn't parse current networking mode response '%s': %s", response, error->message);
g_error_free (error);
} else {
- switch (ctx->self->priv->mode) {
- case MM_UBLOX_NETWORKING_MODE_ROUTER:
- mm_dbg ("u-blox: networking mode loaded: router");
- break;
- case MM_UBLOX_NETWORKING_MODE_BRIDGE:
- mm_dbg ("u-blox: networking mode loaded: bridge");
- break;
- default:
- g_assert_not_reached ();
- }
+ g_assert (ctx->self->priv->mode != MM_UBLOX_NETWORKING_MODE_UNKNOWN);
+ mm_dbg ("u-blox: networking mode loaded: %s", mm_ublox_networking_mode_get_string (ctx->self->priv->mode));
}
/* Assume the operation has been performed, even if it may have failed */
@@ -161,19 +154,8 @@ profile_check_ready (MMBaseModem *self,
mm_dbg ("u-blox: couldn't parse current usb profile response '%s': %s", response, error->message);
g_error_free (error);
} else {
- switch (ctx->self->priv->profile) {
- case MM_UBLOX_USB_PROFILE_RNDIS:
- mm_dbg ("u-blox: usb profile loaded: high throughput");
- break;
- case MM_UBLOX_USB_PROFILE_ECM:
- mm_dbg ("u-blox: usb profile loaded: medium/low throughput");
- break;
- case MM_UBLOX_USB_PROFILE_BACK_COMPATIBLE:
- mm_dbg ("u-blox: usb profile loaded: back-compatible");
- break;
- default:
- g_assert_not_reached ();
- }
+ g_assert (ctx->self->priv->profile != MM_UBLOX_USB_PROFILE_UNKNOWN);
+ mm_dbg ("u-blox: usb profile loaded: %s", mm_ublox_usb_profile_get_string (ctx->self->priv->profile));
}
/* Assume the operation has been performed, even if it may have failed */
diff --git a/plugins/ublox/mm-modem-helpers-ublox.h b/plugins/ublox/mm-modem-helpers-ublox.h
index b67e0e77..e8b9f22b 100644
--- a/plugins/ublox/mm-modem-helpers-ublox.h
+++ b/plugins/ublox/mm-modem-helpers-ublox.h
@@ -21,7 +21,7 @@
/*****************************************************************************/
/* UUSBCONF? response parser */
-typedef enum {
+typedef enum { /*< underscore_name=mm_ublox_usb_profile >*/
MM_UBLOX_USB_PROFILE_UNKNOWN,
MM_UBLOX_USB_PROFILE_RNDIS,
MM_UBLOX_USB_PROFILE_ECM,
@@ -35,7 +35,7 @@ gboolean mm_ublox_parse_uusbconf_response (const gchar *response,
/*****************************************************************************/
/* UBMCONF? response parser */
-typedef enum {
+typedef enum { /*< underscore_name=mm_ublox_networking_mode >*/
MM_UBLOX_NETWORKING_MODE_UNKNOWN,
MM_UBLOX_NETWORKING_MODE_ROUTER,
MM_UBLOX_NETWORKING_MODE_BRIDGE,