def readBTData(self): bufferSize = 1024 #FIXME: #add try data = self.fh.recv(bufferSize) if len(data) > 0: data = self.olddata + data lines = data.splitlines(1) for line in lines: if line.find("\r\n") != -1 : line = line.strip() self.olddata = "" #log the line if self.logging: self.logfh.write('%s\n' % line) #print line try: gps = GPSString(line) # PCtime = gps.stripisotime() # try: # gps.date = PCtime.date() # except: # gps.date = datetime.datetime.utcnow().date() try: gps.parse() except gps.FailedChecksum: sys.stderr.write( "Failed Checksum: " + gps.checksum() + " :: " + gps.msg + '\n') continue print gps.quality if gps.hdop <= self.maxDopAllowed: if gps.id in (1,3): self.renderArea.tilegrid.moveTo(gps.latitude, gps.longitude) self.renderArea.update() if gps.id == 5: print gps.visibleSVs else: print "The received location is not precise enough to use." print "Hdop = %s"%gps.hdop except: print line pass # else we need to keep the line to add to data else : self.olddata = line
def readLog(self): count = 0 line = self.fh.readline() while line.find("$GPGGA") == -1: line = self.fh.readline() if not line: self.fh.seek(0) count = count + 1 if count > 1: #self.timer.stop() return gps = GPSString(line) PCtime = gps.stripisotime() try: gps.date = PCtime.date() except: gps.date = datetime.datetime.utcnow().date() try: gps.parse() self.renderArea.tilegrid.moveTo(gps.latitude, gps.longitude) self.renderArea.update() except gps.FailedChecksum: sys.stderr.write( "Failed Checksum: " + gps.checksum() + " :: " + gps.msg + '\n') pass
def readBTData(self): bufferSize = 1024 #FIXME: #add try data = self.fh.recv(bufferSize) if len(data) > 0: data = self.olddata + data lines = data.splitlines(1) for line in lines: if line.find("\r\n") != -1: line = line.strip() self.olddata = "" #log the line if self.logging: self.logfh.write('%s\n' % line) #print line try: gps = GPSString(line) PCtime = gps.stripisotime() try: gps.date = PCtime.date() except: gps.date = datetime.datetime.utcnow().date() try: gps.parse() except gps.FailedChecksum: sys.stderr.write("Failed Checksum: " + str(gps.checksum()) + " :: " + gps.msg + '\n') continue print gps.quality if gps.hdop < 6: if gps.id == 3: self.speed_panel.setText( self.tr("%.1f km/h" % gps.kmph)) self.renderArea.tilegrid.setBearing(gps.cog) if gps.id in (1, 3): self.renderArea.tilegrid.moveTo( gps.latitude, gps.longitude, False) self.updateLabelLatLon(gps.latitude, gps.longitude) self.renderArea.update() #print "bearing:" + gps.cog + ", knots:" + gps.knots else: print "The received location is not precise enough to use." print "Hdop = %s" % gps.hdop except Exception, er: #print er print line pass # else we need to keep the line to add to data else: self.olddata = line
def readLog(self): count = 0 line = self.fh.readline() while line.find("$GPRMC") == -1: line = self.fh.readline() if not line: self.fh.seek(0) count = count + 1 if count > 1: #self.timer.stop() return try: gps = GPSString(line) PCtime = gps.stripisotime() try: gps.date = PCtime.date() except: gps.date = datetime.datetime.utcnow().date() try: gps.parse() except gps.FailedChecksum: sys.stderr.write( "Failed Checksum: " + gps.checksum() + " :: " + gps.msg + '\n') pass if gps.id == 3: self.renderArea.tilegrid.setBearing(gps.cog) self.renderArea.tilegrid.moveTo(gps.latitude, gps.longitude, False) self.updateLabelLatLon(gps.latitude, gps.longitude) self.speed_panel.setText(self.tr("%.1f <small>km/h</small>" % gps.kmph)) self.renderArea.update() print "bearing:" + gps.cog + ", knots:" + gps.knots except: pass
def readBTData(self): bufferSize = 1024 #FIXME: #add try data = self.fh.recv(bufferSize) if len(data) > 0: data = self.olddata + data lines = data.splitlines(1) for line in lines: if line.find("\r\n") != -1 : line = line.strip() self.olddata = "" #log the line if self.logging: self.logfh.write('%s\n' % line) #print line try: gps = GPSString(line) PCtime = gps.stripisotime() try: gps.date = PCtime.date() except: gps.date = datetime.datetime.utcnow().date() try: gps.parse() except gps.FailedChecksum: sys.stderr.write( "Failed Checksum: " + str(gps.checksum()) + " :: " + gps.msg + '\n') continue print gps.quality if gps.hdop < 6 : if gps.id == 3: self.speed_panel.setText(self.tr("%.1f km/h" % gps.kmph)) self.renderArea.tilegrid.setBearing(gps.cog) if gps.id in (1 , 3): self.renderArea.tilegrid.moveTo(gps.latitude, gps.longitude, False) self.updateLabelLatLon(gps.latitude, gps.longitude) self.renderArea.update() #print "bearing:" + gps.cog + ", knots:" + gps.knots else: print "The received location is not precise enough to use." print "Hdop = %s"%gps.hdop except Exception, er: #print er print line pass # else we need to keep the line to add to data else : self.olddata = line
def readLog(self): count = 0 line = self.logfh.readline() while line.find("$GPRMC") == -1: line = self.logfh.readline() if not line: self.logfh.seek(0) count = count + 1 if count > 1: #self.timer.stop() return try: gps = GPSString(line) PCtime = gps.stripisotime() try: gps.date = PCtime.date() except: gps.date = datetime.datetime.utcnow().date() try: gps.parse() except gps.FailedChecksum: sys.stderr.write("Failed Checksum: " + gps.checksum() + " :: " + gps.msg + '\n') pass if gps.fixstatus == 1: if gps.id == 3: #self.renderArea.tilegrid.setBearing(gps.cog) self.speed_panel.setText( self.tr("%.1f <small>km/h</small>" % gps.kmph)) self.renderArea.tilegrid.moveTo(gps.latitude, gps.longitude, True) self.updateLabelLatLon(gps.latitude, gps.longitude) self.renderArea.update() print "bearing:" + gps.cog + ", knots:" + gps.knots except: pass