aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-03-14 08:07:27 +0100
committerAleksander Morgado <aleksander@gnu.org>2019-04-09 12:24:39 +0000
commitcaa1f8fdc1ad8c489a5584a4a0c50b1d0ff62f2a (patch)
tree9897e1fef814b9528ff72ddb4698136c5d27f3cf
parentb77aa7ab0eaae2aca4e2f01f8328f1015260356d (diff)
iface-modem-location: define first and last location sources
Much clearer to understand when looping through them.
-rw-r--r--include/ModemManager-enums.h5
-rw-r--r--src/Makefile.am1
-rw-r--r--src/mm-iface-modem-location.c8
3 files changed, 10 insertions, 4 deletions
diff --git a/include/ModemManager-enums.h b/include/ModemManager-enums.h
index 7a8162cb..2f6eeeff 100644
--- a/include/ModemManager-enums.h
+++ b/include/ModemManager-enums.h
@@ -940,6 +940,11 @@ typedef enum { /*< underscore_name=mm_modem_location_source >*/
MM_MODEM_LOCATION_SOURCE_CDMA_BS = 1 << 3,
MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED = 1 << 4,
MM_MODEM_LOCATION_SOURCE_AGPS_MSA = 1 << 5,
+#if defined (MM_COMPILATION)
+ /* MM internal methods, not part of the API */
+ MM_MODEM_LOCATION_SOURCE_FIRST = MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI, /*< skip >*/
+ MM_MODEM_LOCATION_SOURCE_LAST = MM_MODEM_LOCATION_SOURCE_AGPS_MSA, /*< skip >*/
+#endif
} MMModemLocationSource;
/**
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d7bc2e8..8f46d2c5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -267,6 +267,7 @@ CLEANFILES += $(DAEMON_ENUMS_GENERATED)
ModemManager_CPPFLAGS = \
-DPLUGINDIR=\"$(pkglibdir)\" \
+ -DMM_COMPILATION \
$(NULL)
ModemManager_LDADD = \
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index f3ae281d..779d2dc1 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -622,7 +622,7 @@ setup_gathering_step (GTask *task)
return;
}
- while (ctx->current <= MM_MODEM_LOCATION_SOURCE_AGPS_MSA) {
+ while (ctx->current <= MM_MODEM_LOCATION_SOURCE_LAST) {
gchar *source_str;
if (ctx->to_enable & ctx->current) {
@@ -720,8 +720,8 @@ setup_gathering (MMIfaceModemLocation *self,
ctx->to_disable = MM_MODEM_LOCATION_SOURCE_NONE;
/* Loop through all known bits in the bitmask to enable/disable specific location sources */
- for (source = MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI;
- source <= MM_MODEM_LOCATION_SOURCE_AGPS_MSA;
+ for (source = MM_MODEM_LOCATION_SOURCE_FIRST;
+ source <= MM_MODEM_LOCATION_SOURCE_LAST;
source = source << 1) {
/* skip unsupported sources */
if (!(mm_gdbus_modem_location_get_capabilities (ctx->skeleton) & source))
@@ -778,7 +778,7 @@ setup_gathering (MMIfaceModemLocation *self,
}
/* Start enabling/disabling location sources */
- ctx->current = MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI;
+ ctx->current = MM_MODEM_LOCATION_SOURCE_FIRST;
setup_gathering_step (task);
}