summaryrefslogtreecommitdiff
path: root/geography/merkaartor/patches/patch-aa
blob: f2efc1a836530161378cccfa2cbcb52cf3bf01e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$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);