diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-09-09 02:32:31 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-09-09 02:32:31 +0000 |
commit | 4c994fe985d90676fa4cca10dd0376fa5b112b97 (patch) | |
tree | 5c6b085f684b9a61b434f4e8d14d62aea2b79d3e /devtools | |
parent | 91159304586eb62c4c94e3ed28337fe9b6ee9b44 (diff) | |
download | gpsd-4c994fe985d90676fa4cca10dd0376fa5b112b97.tar.gz |
Cycle analysis via JSON now works.
Diffstat (limited to 'devtools')
-rwxr-xr-x | devtools/cycle_analyzer | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/devtools/cycle_analyzer b/devtools/cycle_analyzer index 52482e73..c72f50f3 100755 --- a/devtools/cycle_analyzer +++ b/devtools/cycle_analyzer @@ -96,9 +96,9 @@ def extract_from_json(filename, lineno, line): return [] try: sentence = json.loads(line) - if "tag" not in sentence or sentence["tag"] not in ("RMC","GLL","GGA","GBS","PASHR") or "time" not in sentence: + if u"time" not in sentence: return [] - return [event(sentence["tag"], sentence["time"])] + return [event(sentence[u"tag"].encode("iso-8859-1"), "%.2f" % sentence[u"time"])] except ValueError, e: print line.rstrip() print e @@ -115,10 +115,13 @@ def extract_timestamped_sentences(fp): lineno += 1 if line.startswith("#"): continue + if line[0] not in ("$", "!", "{"): + print "%s: unknown sentence type." % fp.name + return [] if not parse_json and line.startswith("$"): sequence += extract_from_nmea(fp.name, lineno, line) - elif json and line.startswith("{"): - sequence + extract_from_json(fp.name, lineno, line) + elif parse_json and line.startswith("{"): + sequence += extract_from_json(fp.name, lineno, line) return sequence def analyze(fp, stages): |