Mercurial > lbo > hg > geohub
changeset 130:f45e9d1ad13c
gpsd: Add port argument
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Thu, 06 May 2021 07:17:29 +0000 |
parents | 14f3d37cd8e0 |
children | 7ae1dc586805 |
files | examples/gpsd/gpsd.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/gpsd/gpsd.py Wed May 05 19:38:32 2021 +0200 +++ b/examples/gpsd/gpsd.py Thu May 06 07:17:29 2021 +0000 @@ -29,11 +29,14 @@ datastream.unpack(data) if datastream.TPV['time'] in seen: return None + if datastream.TPV['lat'] == 'n/a': + return None seen.add(datastream.TPV['time']) return datastream.TPV def parse_args(): parser = argparse.ArgumentParser(description='Fetch and send gpsd data') + parser.add_argument('--gpsdport', default=2947, help='Port of GPSd') parser.add_argument('--client', default='gpsd', help='Client name.') parser.add_argument('--secret', default='', help='Secret. This protects your current location; to share it, you have to share the secret. By default, the points will be made public on your GeoHub instance.') parser.add_argument('--interval', default=5, type=int, help='Poll interval. If 0, send every point received from gpsd.') @@ -47,7 +50,7 @@ session = requests.Session() socket = gps.GPSDSocket() datastream = gps.DataStream() - socket.connect() + socket.connect(port=args.gpsdport) socket.watch() geohub_base = args.geohub.format(PROTOCOL=args.geohub_scheme, HOST=args.geohub_host)