61 lines
2 KiB
Text
61 lines
2 KiB
Text
$NetBSD: patch-aa,v 1.4 2011/04/12 17:14:53 drochner Exp $
|
|
|
|
--- src/GPS/qgpsdevice.cpp.orig 2011-02-10 12:00:35.000000000 +0000
|
|
+++ src/GPS/qgpsdevice.cpp
|
|
@@ -959,10 +959,9 @@ void QGPSDDevice::run()
|
|
// exec();
|
|
QEventLoop l;
|
|
|
|
- Server = new gpsmm();
|
|
errno = 0;
|
|
- gpsdata = Server->open(M_PREFS->getGpsdHost().toAscii().data(),QString::number(M_PREFS->getGpsdPort()).toAscii().data());
|
|
- if (!gpsdata) {
|
|
+ Server = new gpsmm(M_PREFS->getGpsdHost().toAscii().data(),QString::number(M_PREFS->getGpsdPort()).toAscii().data());
|
|
+ if (!Server) {
|
|
#ifndef Q_OS_WIN32
|
|
QString msg( (errno<0) ? gps_errstr(errno) : strerror(errno) );
|
|
#else
|
|
@@ -978,7 +977,7 @@ void QGPSDDevice::run()
|
|
|
|
forever {
|
|
#if GPSD_API_MAJOR_VERSION > 3
|
|
- if (Server->waiting())
|
|
+ if (Server->waiting(0))
|
|
#endif
|
|
onDataAvailable();
|
|
l.processEvents();
|
|
@@ -994,7 +993,7 @@ void QGPSDDevice::onDataAvailable()
|
|
if (!gpsdata)
|
|
return;
|
|
#else
|
|
- if ( Server->waiting() )
|
|
+ if ( Server->waiting(0) )
|
|
{
|
|
errno = 0;
|
|
gpsdata = Server->read();
|
|
@@ -1026,14 +1025,22 @@ void QGPSDDevice::onDataAvailable()
|
|
setFixStatus(StatusActive);
|
|
setLatitude(gpsdata->fix.latitude);
|
|
setLongitude(gpsdata->fix.longitude);
|
|
+ if (gpsdata->fix.latitude < 0)
|
|
+ setLatCardinal(CardinalSouth);
|
|
+ else
|
|
+ setLatCardinal(CardinalNorth);
|
|
+ if (gpsdata->fix.longitude < 0)
|
|
+ setLongCardinal(CardinalWest);
|
|
+ else
|
|
+ setLongCardinal(CardinalEast);
|
|
double Alt = gpsdata->fix.altitude;
|
|
- if (!__isnan(Alt))
|
|
+ if (!std::isnan(Alt))
|
|
setAltitude(Alt);
|
|
double Speed = gpsdata->fix.speed;
|
|
- if (!__isnan(Speed))
|
|
+ if (!std::isnan(Speed))
|
|
setSpeed(Speed);
|
|
double Heading = gpsdata->fix.track;
|
|
- if (!__isnan(Heading))
|
|
+ if (!std::isnan(Heading))
|
|
setHeading(Heading);
|
|
if (gpsdata->fix.time)
|
|
cur_datetime = QDateTime::fromTime_t(gpsdata->fix.time);
|