aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/cinterion/mm-shared-cinterion.c25
-rw-r--r--plugins/option/mm-broadband-modem-hso.c25
-rw-r--r--plugins/simtech/mm-shared-simtech.c21
-rw-r--r--plugins/xmm/mm-shared-xmm.c41
-rw-r--r--src/mm-iface-modem-location.c56
5 files changed, 54 insertions, 114 deletions
diff --git a/plugins/cinterion/mm-shared-cinterion.c b/plugins/cinterion/mm-shared-cinterion.c
index 9846bfa0..8ae8e88e 100644
--- a/plugins/cinterion/mm-shared-cinterion.c
+++ b/plugins/cinterion/mm-shared-cinterion.c
@@ -108,31 +108,10 @@ get_private (MMSharedCinterion *self)
/* GPS trace received */
static void
-trace_received (MMPortSerialGps *port,
- const gchar *trace,
+trace_received (MMPortSerialGps *port,
+ const gchar *trace,
MMIfaceModemLocation *self)
{
- /* 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
- if (g_str_has_prefix (trace, "$GPGGA")) {
- GString *str;
- GDateTime *now;
-
- now = g_date_time_new_now_utc ();
- str = g_string_new ("");
- g_string_append_printf (str,
- "$GPGGA,%02u%02u%02u,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47",
- g_date_time_get_hour (now),
- g_date_time_get_minute (now),
- g_date_time_get_second (now));
- mm_iface_modem_location_gps_update (self, str->str);
- g_string_free (str, TRUE);
- g_date_time_unref (now);
- return;
- }
-#endif
-
mm_iface_modem_location_gps_update (self, trace);
}
diff --git a/plugins/option/mm-broadband-modem-hso.c b/plugins/option/mm-broadband-modem-hso.c
index 70074720..3623d84d 100644
--- a/plugins/option/mm-broadband-modem-hso.c
+++ b/plugins/option/mm-broadband-modem-hso.c
@@ -629,31 +629,10 @@ enable_location_gathering (MMIfaceModemLocation *self,
/* Setup ports (Broadband modem class) */
static void
-trace_received (MMPortSerialGps *port,
- const gchar *trace,
+trace_received (MMPortSerialGps *port,
+ const gchar *trace,
MMIfaceModemLocation *self)
{
- /* 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
- if (g_str_has_prefix (trace, "$GPGGA")) {
- GString *str;
- GDateTime *now;
-
- now = g_date_time_new_now_utc ();
- str = g_string_new ("");
- g_string_append_printf (str,
- "$GPGGA,%02u%02u%02u,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47",
- g_date_time_get_hour (now),
- g_date_time_get_minute (now),
- g_date_time_get_second (now));
- mm_iface_modem_location_gps_update (self, str->str);
- g_string_free (str, TRUE);
- g_date_time_unref (now);
- return;
- }
-#endif
-
mm_iface_modem_location_gps_update (self, trace);
}
diff --git a/plugins/simtech/mm-shared-simtech.c b/plugins/simtech/mm-shared-simtech.c
index b7f98ace..aa5a66a3 100644
--- a/plugins/simtech/mm-shared-simtech.c
+++ b/plugins/simtech/mm-shared-simtech.c
@@ -114,27 +114,6 @@ trace_received (MMPortSerialGps *port,
const gchar *trace,
MMIfaceModemLocation *self)
{
- /* 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
- if (g_str_has_prefix (trace, "$GPGGA")) {
- GString *str;
- GDateTime *now;
-
- now = g_date_time_new_now_utc ();
- str = g_string_new ("");
- g_string_append_printf (str,
- "$GPGGA,%02u%02u%02u,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47",
- g_date_time_get_hour (now),
- g_date_time_get_minute (now),
- g_date_time_get_second (now));
- mm_iface_modem_location_gps_update (self, str->str);
- g_string_free (str, TRUE);
- g_date_time_unref (now);
- return;
- }
-#endif
-
mm_iface_modem_location_gps_update (self, trace);
}
diff --git a/plugins/xmm/mm-shared-xmm.c b/plugins/xmm/mm-shared-xmm.c
index 31dffe0f..2f40d787 100644
--- a/plugins/xmm/mm-shared-xmm.c
+++ b/plugins/xmm/mm-shared-xmm.c
@@ -950,47 +950,6 @@ nmea_received (MMPortSerialAt *port,
gchar *trace;
trace = g_match_info_fetch (info, 1);
-
- /* 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 (trace, "$GPGGA")) {
- prefix = "GPGGA";
- lat = "S";
- } else if (g_str_has_prefix (trace, "$GNGGA")) {
- prefix = "GNGGA";
- lat = "N";
- }
-
- if (prefix && lat) {
- GString *str;
- GDateTime *now;
-
- mm_dbg ("GGA trace detected: '%s'", trace);
- g_free (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);
- mm_iface_modem_location_gps_update (MM_IFACE_MODEM_LOCATION (self), str->str);
- g_string_free (str, TRUE);
- g_date_time_unref (now);
- return;
- }
- }
-#endif
-
mm_iface_modem_location_gps_update (MM_IFACE_MODEM_LOCATION (self), trace);
g_free (trace);
}
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index 00a74fd9..9a85c9e8 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