Created
July 12, 2023 10:47
-
-
Save bzed/b42bbfa5f920831b76f6a8712d88df34 to your computer and use it in GitHub Desktop.
OGN client example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from ogn.client import AprsClient | |
from ogn.parser import parse, ParseError | |
def process_beacon(raw_message): | |
try: | |
f = False | |
#for i in ['FNT08DFBC', 'WALS:', 'FNT082300', 'DBG:', 'guggenth:', 'FNT065063']: | |
for i in ['FNT065063']: | |
if i in raw_message: | |
f = True | |
continue | |
if not f: | |
return | |
beacon = parse(raw_message) | |
print(beacon) | |
return | |
print('Received {aprs_type}: {raw_message}'.format(**beacon)) | |
except ParseError as e: | |
print('Error, {}'.format(e.message)) | |
except NotImplementedError as e: | |
print('{}: {}'.format(e, raw_message)) | |
client = AprsClient(aprs_user='N0CALL') | |
client.connect() | |
try: | |
client.run(callback=process_beacon, autoreconnect=True) | |
except KeyboardInterrupt: | |
print('\nStop ogn gateway') | |
client.disconnect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment