ublox: generate enum types for usb profile and networking mode

This commit is contained in:
Aleksander Morgado
2016-08-02 13:26:49 +02:00
parent 3b0ceabc5d
commit eade066d8a
4 changed files with 43 additions and 25 deletions

2
.gitignore vendored
View File

@@ -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

View File

@@ -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 \

View File

@@ -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 */

View File

@@ -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,