marble
Go to the documentation of this file.
21 using namespace Marble;
29 #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 5 )
30 m_gpsd(
"localhost", DEFAULT_GPSD_PORT ),
34 m_oldLocale = setlocale( LC_NUMERIC, NULL );
35 setlocale( LC_NUMERIC,
"C" );
36 connect( &m_timer, SIGNAL(timeout()),
this, SLOT(update()) );
41 setlocale( LC_NUMERIC, m_oldLocale );
48 #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 5 )
51 gps_data_t* data = m_gpsd.open();
52 success = ( data != 0 );
54 #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 3 ) && defined( WATCH_ENABLE )
56 success = (m_gpsd.stream( WATCH_ENABLE ) != NULL);
69 m_error = tr(
"Internal gpsd error (cannot get service entry)");
72 m_error = tr(
"Internal gpsd error (cannot get host entry)");
75 m_error = tr(
"Internal gpsd error (cannot get protocol entry)");
78 m_error = tr(
"Internal gpsd error (unable to create socket)");
81 m_error = tr(
"Internal gpsd error (unable to set socket option)");
84 m_error = tr(
"No GPS device found by gpsd.");
87 m_error = tr(
"Unknown error when opening gpsd connection");
94 mDebug() <<
"Connection to gpsd failed, no position info available: " << m_error;
98 void GpsdConnection::update()
100 #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 4 ) && defined( PACKET_SET )
101 gps_data_t *data = 0;
106 #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 5 )
107 while ( m_gpsd.waiting( 0 ) && watchdog.elapsed() <
gpsWaitTimeout ) {
108 gps_data_t *currentData = m_gpsd.read();
110 while ( m_gpsd.waiting() && watchdog.elapsed() <
gpsWaitTimeout ) {
111 gps_data_t *currentData = m_gpsd.poll();
114 if( currentData && currentData->set & PACKET_SET ) {
123 #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION == 3 ) && defined( PACKET_SET )
124 gps_data_t *data = m_gpsd.poll();
126 gps_data_t* data = m_gpsd.query(
"o" );
133 mDebug() <<
"Lost connection to gpsd, trying to re-open.";
144 #include "GpsdConnection.moc"
void gpsdInfo(gps_data_t data)
void statusChanged(PositionProviderStatus status) const
const int gpsUpdateInterval
GpsdConnection(QObject *parent=0)
QDebug mDebug()
a function to replace qDebug() in Marble library code
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:50 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.