|
From: | teyrana |
Subject: | Re: [gpsd-dev] [RFC] python client patch - reconnect to gpsd |
Date: | Fri, 18 May 2018 17:56:40 -0400 |
No worries about the timing- I know how busy things can get!Thanks for cleaning it up! I had been worried about the higher-level design concerns you'd raised, but moving faster is also good :)We're using this code live on our vehicles now, so It's getting testing, (at least for our use cases).In addition, if you're merging it to head, I have some minor additions to suggest:1. add a missing __init__ call:diff --git a/gps/gps.py b/gps/gps.pyindex 09cf147..765958c 100755--- a/gps/gps.py+++ b/gps/gps.py@@ -171,6 +171,7 @@ class gps(gpscommon, gpsdata, gpsjson):def __init__(self, host="127.0.0.1", port=GPSD_PORT, verbose=0, mode=0, reconnect=False):gpscommon.__init__(self, host, port, verbose, reconnect)gpsdata.__init__(self)+ gpsjson.__init__(self)if mode:self.stream(mode)2. Better debugging output===============Adding the __init__ function doesn't change any function, but it does satisfy a PyCharm warning.The other line should be self explanatory.diff --git a/gps/client.py b/gps/client.pyindex acb8ce9..c8df122 100644--- a/gps/client.py+++ b/gps/client.py@@ -164,6 +164,10 @@ class json_error(BaseException):class gpsjson(object):"Basic JSON decoding."++ def __init__(self):+ self.stream_command = ""+def __iter__(self):return self@@ -189,7 +193,7 @@ class gpsjson(object):sys.stderr.write("send: stream as: {}\n".format(self.stream_command)) self.send(self.stream_command) else:- raise TypeError("Could not request a stream: Invalid streaming command!!")+ raise TypeError("Could not request a stream: Invalid streaming command!! '{}'".format(self.stream_command)) Yo teyrana!
> I've cleaned up the patch a fair bit:
> 1. gps.next() now raises 'StopIteration' on any error
> 2. gps/watch_options.py contains only the WATCH_* options
Looks good, but no way to turn on in any of the standard clients?
Like xgps?
It had a bunch of pep8 problems. I patched those.
Pushed to git head.
Sorry for the wait, trying to catch up now.
RGDS
GARY
------------------------------------------------------------ ---------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
address@hidden Tel:+1 541 382 8588
Veritas liberabit vos. -- Quid est veritas?
"If you can’t measure it, you can’t improve it." - Lord Kelvin
[Prev in Thread] | Current Thread | [Next in Thread] |