Fix build after libgps API change

PR:		156489
Submitted by:	Christoph Moench-Tegeder <cmt@burggraben.net>
Approved by:	maintainer timeout
This commit is contained in:
Tilman Keskinoz 2011-05-14 15:09:40 +00:00
parent b4e2f6d31c
commit 4d3b808ff8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=274101

View file

@ -0,0 +1,47 @@
Index: src/CDeviceGPSD.cpp
===================================================================
--- src/CDeviceGPSD.cpp (revision 2719)
+++ src/CDeviceGPSD.cpp (working copy)
@@ -138,6 +138,7 @@
log_mutex( new QMutex() ),
pipe_fd( _pipe_fd )
{
+ gpsdata = NULL;
}
@@ -149,7 +150,14 @@
void CGPSDThread::run()
{
+#if GPSD_API_MAJOR_VERSION >= 5
+ int socket;
+
+ if( gpsdata = new gps_data_t )
+ socket = gps_open( "localhost", DEFAULT_GPSD_PORT, gpsdata );
+#else
gpsdata = gps_open( "localhost", DEFAULT_GPSD_PORT );
+#endif
if( !gpsdata )
{
// TODO: message box (from other thread)
@@ -187,13 +195,20 @@
} // if
else if( FD_ISSET( gpsdata->gps_fd, &fds ) )
{
+#if GPSD_API_MAJOR_VERSION >= 5
+ gps_read( gpsdata );
+#else
gps_poll( gpsdata );
+#endif
if( !decodeData() ) break;
} // else if
} // else if
} // while
gps_close( gpsdata );
+#if GPSD_API_MAJOR_VERSION >= 5
+ delete gpsdata;
+#endif
qDebug() << "thread done";
}