[Marble-commits] KDE/kdeedu/marble/src/plugins/positionprovider/gpsd

Jens-Michael Hoffmann jensmh at gmx.de
Tue Jan 5 16:53:39 CET 2010


SVN commit 1070414 by jmhoffmann:

Improve libgps version detection.
The Problem with libgps (gpsd) is that GPSD_API_MAJOR_VERSION might be a little bit misleading:

gpsd version	GPSD_API_MAJOR_VERSION
======================================
2.37		n/a
2.38		n/a
2.39		3
2.90		3
svn trunk	4

What we really want to detect here is if we are using version 2.90+.

 M  +3 -3      GpsdConnection.cpp  


--- trunk/KDE/kdeedu/marble/src/plugins/positionprovider/gpsd/GpsdConnection.cpp #1070413:1070414
@@ -20,7 +20,7 @@
 {
     gps_data_t* data = m_gpsd.open();
     if ( data ) {
-#if GPSD_API_MAJOR_VERSION == 3 && defined( WATCH_ENABLE ) 
+#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION == 3 || GPSD_API_MAJOR_VERSION == 4 ) && defined( WATCH_ENABLE ) 
         m_gpsd.stream( WATCH_ENABLE );
 #endif
         connect( &m_timer, SIGNAL( timeout() ), this, SLOT( update() ) );
@@ -32,12 +32,12 @@
 void GpsdConnection::update()
 {
     gps_data_t* data = 0;
-#if GPSD_API_MAJOR_VERSION == 3 && defined( POLICY_SET )
+#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION == 3 || GPSD_API_MAJOR_VERSION == 4 ) && defined( POLICY_SET )
     while ((data = m_gpsd.poll()) && !(data->set & POLICY_SET)) {
         data = m_gpsd.poll();
     }
 #else
-        data = m_gpsd.query( "o" );
+    data = m_gpsd.query( "o" );
 #endif
     if ( data )
         emit gpsdInfo( *data );


More information about the Marble-commits mailing list