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

Dan Williams dcbw at redhat.com
Thu Feb 4 16:10:00 UTC 2016


On Tue, 2016-02-02 at 15:30 +0100, tomas.jura1 at gmail.com wrote:
> 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;
>      }

I think like Aleksander suggested, we want the GPS refresh interval to
be related to the one set by SetGpsRefreshRate() in the D-Bus API. 
 Passing that down to plugins somehow when Setup() is started (with
appropriate adjustment so the plugins use an interval slightly smaller
than the refresh rate) would be required too, but that's not too hard.

Dan


More information about the ModemManager-devel mailing list