summaryrefslogtreecommitdiff
path: root/contrib/webgps.py
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-09-21 16:04:43 -0700
committerGary E. Miller <gem@rellim.com>2018-09-21 16:04:43 -0700
commitf1f4ba56ae183764f164130616a34c73758bec8d (patch)
treec6c636fdef41dae3a67aaac6b51cb2ec145b28dc /contrib/webgps.py
parentf2a515c9c86f8115b5055c180f1ed3c360ecf228 (diff)
downloadgpsd-f1f4ba56ae183764f164130616a34c73758bec8d.tar.gz
webgps.py: Add gpsd version check. Fix crash bug.
Diffstat (limited to 'contrib/webgps.py')
-rwxr-xr-xcontrib/webgps.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/contrib/webgps.py b/contrib/webgps.py
index 93576ad0..3a1f23bc 100755
--- a/contrib/webgps.py
+++ b/contrib/webgps.py
@@ -47,6 +47,13 @@ import time
from gps import *
+gps_version = '3.18-dev'
+if gps.__version__ != gps_version:
+ sys.stderr.write("webgps.py: ERROR: need gps module version %s, got %s\n" %
+ (gps_version, gps.__version__))
+ sys.exit(1)
+
+
TRACKMAX = 1024
STALECOUNT = 10
@@ -160,23 +167,22 @@ class SatTracks(gps):
row('Climb', self.fix.mode == MODE_3D and isfinite(self.fix.climb) and
"%f m/s" % self.fix.climb or 'N/A')
+ state = "INIT"
if not (self.valid & ONLINE_SET):
newstate = 0
state = "OFFLINE"
else:
newstate = self.fix.mode
if newstate == MODE_2D:
- state = self.status == (STATUS_DGPS_FIX and
- "2D DIFF FIX" or "2D FIX")
+ state = "2D FIX"
elif newstate == MODE_3D:
- state = self.status == (STATUS_DGPS_FIX and
- "3D DIFF FIX" or "3D FIX")
+ state = "3D FIX"
else:
state = "NO FIX"
if newstate != self.state:
self.statetimer = time.time()
self.state = newstate
- row('State', state + " (%d secs)" % (time.time() - self.statetimer))
+ row('State', "%s (%d secs)" % (state, time.time() - self.statetimer))
fh.write("""\t\t\t\t</table>
\t\t\t</td>