From 614a5473164418e6392e80e7f3d14777e39a6d0e Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 27 Mar 2012 17:16:13 +0200 Subject: [PATCH] hso: report received NMEA traces --- plugins/option/mm-broadband-modem-hso.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/plugins/option/mm-broadband-modem-hso.c b/plugins/option/mm-broadband-modem-hso.c index 7a31cd84..a679acd4 100644 --- a/plugins/option/mm-broadband-modem-hso.c +++ b/plugins/option/mm-broadband-modem-hso.c @@ -482,10 +482,19 @@ enable_location_gathering (MMIfaceModemLocation *self, /*****************************************************************************/ /* Setup ports (Broadband modem class) */ +static void +trace_received (MMGpsSerialPort *port, + const gchar *trace, + MMIfaceModemLocation *self) +{ + mm_iface_modem_location_gps_update (self, trace); +} + static void setup_ports (MMBroadbandModem *self) { MMAtSerialPort *gps_control_port; + MMGpsSerialPort *gps_data_port; /* Call parent's setup ports first always */ MM_BROADBAND_MODEM_CLASS (mm_broadband_modem_hso_parent_class)->setup_ports (self); @@ -503,15 +512,23 @@ setup_ports (MMBroadbandModem *self) MM_AT_SERIAL_PORT_REMOVE_ECHO, FALSE, NULL); - /* It may happen that the modem was started with GPS already enabled, or - * maybe ModemManager got rebooted and it was left enabled before. We'll make - * sure that it is disabled when we initialize the modem */ gps_control_port = mm_base_modem_peek_port_gps_control (MM_BASE_MODEM (self)); - if (gps_control_port) + gps_data_port = mm_base_modem_peek_port_gps (MM_BASE_MODEM (self)); + if (gps_control_port && gps_data_port) { + /* It may happen that the modem was started with GPS already enabled, or + * maybe ModemManager got rebooted and it was left enabled before. We'll make + * sure that it is disabled when we initialize the modem */ mm_base_modem_at_command_full (MM_BASE_MODEM (self), gps_control_port, "_OGPS=0", 3, FALSE, NULL, NULL, NULL); + + /* Add handler for the NMEA traces */ + mm_gps_serial_port_add_trace_handler (gps_data_port, + (MMGpsSerialTraceFn)trace_received, + self, + NULL); + } } /*****************************************************************************/