Changeset 584d29a for src


Ignore:
Timestamp:
Sep 24, 2017, 3:42:06 PM (9 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
0.5, debian/bullseye, debian/jessie, master
Children:
26f77a6, 2913846
Parents:
788611f
Message:

Improved error handling in gpsdpoller.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/python/gnuboat/daemon/gpsdpoller.py

    r788611f r584d29a  
    3838
    3939    def latitude(self):
    40         if self._currentValue == None or self.gpsFix() < 2:
     40        if self._currentValue is None or self.gpsFix() < 2 or 'lat' not in self._currentValue:
    4141            return 0
    4242        return self._currentValue.lat
    … …  
    4646
    4747    def longitude(self):
    48         if self._currentValue == None or self.gpsFix() < 2:
     48        if self._currentValue is None or self.gpsFix() < 2 or 'lon' not in self._currentValue:
    4949            return 0
    5050        return self._currentValue.lon
    … …  
    5454
    5555    def speedOverGround(self):
    56         if self._currentValue == None or self.gpsFix() < 2:
     56        if self._currentValue is None or self.gpsFix() < 2 or 'speed' not in self._currentValue:
    5757            return 0
    5858        return self._currentValue.speed
    5959
    6060    def courseOverGround(self):
    61         if self._currentValue == None or self.gpsFix() < 2:
     61        if self._currentValue is None or self.gpsFix() < 2 or 'track' not in self._currentValue:
    6262            return 0
    6363        return self._currentValue.track
    6464
    6565    def gpsFix(self):
    66         if self._currentValue == None or 'mode' not in self._currentValue:
     66        if self._currentValue is None or 'mode' not in self._currentValue:
    6767            return 0
    6868        return self._currentValue.mode
    6969
    7070    def status(self):
    71         if self._currentValue == None or self.gpsFix() < 2:
     71        if self._currentValue is None or self.gpsFix() < 2:
    7272            return 'V'
    7373        return 'A'
    7474
    7575    def timeUtc(self):
    76         if self._currentValue == None or self.gpsFix() < 2:
     76        if self._currentValue is None or self.gpsFix() < 2 or 'time' not in self._currentValue:
    7777            return None
    7878        currentTime = self._currentValue.time
Note: See TracChangeset for help on using the changeset viewer.