summaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-location.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-02-07 15:24:38 +0100
committerAleksander Morgado <aleksander@aleksander.es>2020-02-07 14:42:16 +0000
commit00dc961cad885880b935becf9fc4dea6eff61160 (patch)
treef16d3086cdc6b0156b0ed7d8aa0bffc2377d5ee4 /src/mm-iface-modem-location.c
parenta61caff747546441474b1a1fc50c664a13a1378f (diff)
downloadModemManager-00dc961cad885880b935becf9fc4dea6eff61160.tar.gz
iface-modem-location: common helper code to test raw gps
Diffstat (limited to 'src/mm-iface-modem-location.c')
-rw-r--r--src/mm-iface-modem-location.c56
1 files changed, 50 insertions, 6 deletions
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index 00a74fd98..9a85c9e8e 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -253,14 +253,14 @@ notify_gps_location_update (MMIfaceModemLocation *self,
NULL));
}
-void
-mm_iface_modem_location_gps_update (MMIfaceModemLocation *self,
- const gchar *nmea_trace)
+static void
+location_gps_update_nmea (MMIfaceModemLocation *self,
+ const gchar *nmea_trace)
{
MmGdbusModemLocation *skeleton;
- LocationContext *ctx;
- gboolean update_nmea = FALSE;
- gboolean update_raw = FALSE;
+ LocationContext *ctx;
+ gboolean update_nmea = FALSE;
+ gboolean update_raw = FALSE;
ctx = get_location_context (self);
g_object_get (self,
@@ -298,6 +298,50 @@ mm_iface_modem_location_gps_update (MMIfaceModemLocation *self,
g_object_unref (skeleton);
}
+void
+mm_iface_modem_location_gps_update (MMIfaceModemLocation *self,
+ const gchar *nmea_trace)
+{
+ /* Helper to debug GPS location related issues. Don't depend on a real GPS
+ * fix for debugging, just use some random values to update */
+#if 0
+ {
+ const gchar *prefix = NULL;
+ const gchar *lat = NULL;
+
+ /* lat N/S just to test which one is used */
+ if (g_str_has_prefix (nmea_trace, "$GPGGA")) {
+ prefix = "GPGGA";
+ lat = "S";
+ } else if (g_str_has_prefix (nmea_trace, "$GNGGA")) {
+ prefix = "GNGGA";
+ lat = "N";
+ }
+
+ if (prefix && lat) {
+ g_autoptr(GString) str = NULL;
+ g_autoptr(GDateTime) now = NULL;
+
+ mm_dbg ("GGA trace detected: '%s'", nmea_trace);
+
+ now = g_date_time_new_now_utc ();
+ str = g_string_new ("");
+ g_string_append_printf (str,
+ "$%s,%02u%02u%02u,4807.038,%s,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47",
+ prefix,
+ g_date_time_get_hour (now),
+ g_date_time_get_minute (now),
+ g_date_time_get_second (now),
+ lat);
+ location_gps_update_nmea (self, str->str);
+ return;
+ }
+ }
+#endif
+
+ location_gps_update_nmea (self, nmea_trace);
+}
+
/*****************************************************************************/
static void