Skip to content

Instantly share code, notes, and snippets.

@bzed
Created July 12, 2023 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bzed/b42bbfa5f920831b76f6a8712d88df34 to your computer and use it in GitHub Desktop.
Save bzed/b42bbfa5f920831b76f6a8712d88df34 to your computer and use it in GitHub Desktop.
OGN client example
#!/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