hso: report received NMEA traces

This commit is contained in:
Aleksander Morgado
2012-03-29 09:18:03 +02:00
parent 53b500c11d
commit 614a547316
+21 -4
View File
@@ -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);
}
}
/*****************************************************************************/