[PATCH 1/7] GPS refresh is configurable using GPS_INTERVAL environment variable

tomas.jura1 at gmail.com tomas.jura1 at gmail.com
Tue Feb 2 14:30:19 UTC 2016


From: Tomas Jura <tomas_jura1 at gmail.com>

---
 plugins/mbm/mm-broadband-modem-mbm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/mbm/mm-broadband-modem-mbm.c b/plugins/mbm/mm-broadband-modem-mbm.c
index dc480f8..bfd26da 100644
--- a/plugins/mbm/mm-broadband-modem-mbm.c
+++ b/plugins/mbm/mm-broadband-modem-mbm.c
@@ -45,7 +45,7 @@
 #include "mm-iface-modem-location.h"
 
 /* sets the interval in seconds on how often the card emits the NMEA sentences */
-#define MBM_GPS_NMEA_INTERVAL   "5"
+#define MBM_GPS_NMEA_INTERVAL   5
 
 static void iface_modem_init (MMIfaceModem *iface);
 static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
@@ -1432,15 +1432,19 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *self,
     }
 
     if (start_gps) {
+        gchar *s_gps_interval = getenv("GPS_INTERVAL");
+        gchar *buf = g_strdup_printf("AT*E2GPSCTL=1,%d,0",
+                                     s_gps_interval ? CLAMP(atoi(s_gps_interval),1,60) : MBM_GPS_NMEA_INTERVAL );
         mm_base_modem_at_command_full (MM_BASE_MODEM (self),
                                        mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
-                                       "AT*E2GPSCTL=1," MBM_GPS_NMEA_INTERVAL ",0",
+                                       buf,
                                        3,
                                        FALSE,
                                        FALSE, /* raw */
                                        NULL, /* cancellable */
                                        (GAsyncReadyCallback)gps_enabled_ready,
                                        ctx);
+        g_free(buf);
         return;
     }
 
-- 
2.7.0



More information about the ModemManager-devel mailing list