mirror of
https://codeberg.org/ET-Kiel/tk102gpx.git
synced 2026-06-28 07:29:51 +02:00
Compare commits
3 commits
1712ebbded
...
6a3bef6e1a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a3bef6e1a | ||
| af5da452dd | |||
| d6b17ed839 |
2 changed files with 14 additions and 9 deletions
2
Makefile
2
Makefile
|
|
@ -9,7 +9,7 @@ all: $(patsubst %, %.gpx, $(FILES))
|
|||
./tk102gpx.py $(TIMELIMIT) $< > $@
|
||||
|
||||
nc%: tk102-%.log
|
||||
(while true; do nc -lp 1020$* -w 999; done) | tee -a $< | cat -v
|
||||
./tk102cat.py -p 1020$* | tee -a $< | cat -v
|
||||
|
||||
tail%: tk102-%.log
|
||||
./tk102gpx.py $(TIMELIMIT) -CFf $< | tee tk102-$*.txt
|
||||
|
|
|
|||
21
tk102gpx.py
21
tk102gpx.py
|
|
@ -57,18 +57,18 @@ for o,v in options:
|
|||
print(f"--serial={serial}", file=sys.stderr)
|
||||
|
||||
tk_re = re.compile(b"".join((
|
||||
b"(?P<SERIAL>23[0-9]+)?,",
|
||||
b"(?P<PHONE>\+?[^,]+)?,",
|
||||
b"(?P<SERIAL>23[0-9]+),",
|
||||
b"(?P<PHONE>[^,]+(,[^,]*)?),",
|
||||
b"GPRMC,",
|
||||
b"(?P<TIME>[0-9]{6}(\.[0-9]+)?)?,",
|
||||
b"(?P<AV>[AV])?,",
|
||||
b"(?P<LAT>[0-9]+\.[0-9]+)?,",
|
||||
b"(?P<TIME>[0-9]{6}(\.[0-9]+)?),",
|
||||
b"(?P<AV>[AV]),",
|
||||
b"(?P<LAT>[0-9]+\.[0-9]+),",
|
||||
b"(?P<NS>[NS]),",
|
||||
b"(?P<LON>[0-9]+\.[0-9]+)?,",
|
||||
b"(?P<LON>[0-9]+\.[0-9]+),",
|
||||
b"(?P<EW>[EW]),",
|
||||
b"(?P<SOG>[0-9]+\.[0-9]+)?,",
|
||||
b"(?P<COG>[0-9]+\.[0-9]+)?,",
|
||||
b"(?P<DATE>[0-9]{6})?,",
|
||||
b"(?P<DATE>[0-9]{6}),",
|
||||
b"(?P<VAR>[^,]+)?,",
|
||||
b"(?P<WHAT>[^,]*,)?",
|
||||
b"A\*(?P<GPCKS>[0-9A-F][0-9A-F]),",
|
||||
|
|
@ -122,6 +122,7 @@ class TKGPX(gpxpy.gpx.GPX):
|
|||
if not ndata:
|
||||
break
|
||||
data += ndata
|
||||
m = tk_re.search(data)
|
||||
if m is None:
|
||||
if not follow:
|
||||
break
|
||||
|
|
@ -156,7 +157,7 @@ class TKGPX(gpxpy.gpx.GPX):
|
|||
print(f"Signal is {repr(rd['SIGNAL'])} at {rd['SERIAL']}", file=sys.stderr)
|
||||
|
||||
if verbose>0 and rd["MESSAGE"]:
|
||||
print(f"MESAAGE is {repr(rd['MESSAGE'])} at {rd['SERIAL']}", file=sys.stderr)
|
||||
print(f"MESSAGE is {repr(rd['MESSAGE'])} at {rd['SERIAL']}", file=sys.stderr)
|
||||
|
||||
pd = {
|
||||
"latitude": gprmc2deg(rd["LAT"], rd["NS"]),
|
||||
|
|
@ -227,6 +228,10 @@ class TKGPX(gpxpy.gpx.GPX):
|
|||
if follow and not raw and verbose < 2:
|
||||
print(repr(point), file=sys.stderr)
|
||||
|
||||
if verbose > 1:
|
||||
sys.stdout.flush()
|
||||
print(f"Unprocessed data: {len(data)} Bytes: {repr(data)}", file=sys.stderr)
|
||||
|
||||
def strorbytes(rd, f):
|
||||
if not f in rd:
|
||||
return {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue