Skip to content

Commit

Permalink
fix example code
Browse files Browse the repository at this point in the history
  • Loading branch information
pwoods25443 committed Sep 14, 2020
1 parent f168942 commit 83cd3e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ AIS RF signal decoder of from a udp stream. The default action is to apply
the current timestamp

```console
$ echo '!AIVDM,1,1,,A,15NTES0P00J>tC4@@FOhMgvD0D0M,0*49' | \\
ais-tools add-tagblock -s my-station
$ echo '!AIVDM,1,1,,A,15NTES0P00J>tC4@@FOhMgvD0D0M,0*49' | ais-tools add-tagblock -s my-station
```

outputs something like
Expand Down Expand Up @@ -92,7 +91,7 @@ Decode NMEA
```python
import json
from ais_tools.aivdm import AIVDM

from ais_tools.message import Message

nmea = [
'\\c:1599239526500,s:sdr-experiments,T:2020-09-04 18.12.06*5D\\!AIVDM,1,1,,A,B>cSnNP00FVur7UaC7WQ3wS1jCJJ,0*73',
Expand All @@ -102,9 +101,11 @@ nmea = [

decoder = AIVDM()

for msg in decoder.decode_stream(nmea):
for msg in Message.stream(nmea):
msg = decoder.decode(msg)
print(json.dumps(msg))
```

## Developing

```console
Expand Down
4 changes: 3 additions & 1 deletion sample/decode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
from ais_tools.aivdm import AIVDM
from ais_tools.message import Message


nmea = [
Expand All @@ -10,5 +11,6 @@

decoder = AIVDM()

for msg in decoder.decode_stream(nmea):
for msg in Message.stream(nmea):
msg = decoder.decode(msg)
print(json.dumps(msg))

0 comments on commit 83cd3e5

Please sign in to comment.