Skip to content

Instantly share code, notes, and snippets.

@ytjohn
Created August 10, 2015 03:09
Show Gist options
  • Save ytjohn/455ce42638594bbbc866 to your computer and use it in GitHub Desktop.
Save ytjohn/455ce42638594bbbc866 to your computer and use it in GitHub Desktop.
socket read
import kiss
import aprs
k = kiss.KISS(host='10.10.0.106', port=8001)
k.logger.LOG_LEVEL = "INFO"
k.start() # inits the TNC, optionally passes KISS config flags.
def printtheframe(frame):
frame_len = len(frame)
if frame_len > 16:
frame = frame.lstrip('\x00') # This is the line that made it start working!!!
frame = frame.strip()
try:
# Decode raw APRS frame into dictionary of separate sections
decoded_frame = aprs.util.decode_frame(frame)
# Format the APRS frame (in Raw ASCII Text) as a human readable frame
formatted_aprs = aprs.util.format_aprs_frame(decoded_frame) # frame['destination'] must be removed from this function
print formatted_aprs # This is the human readable APRS output - IT WORKS!
except:
print "Error decoding frame:"
print " " + frame
k.read(callback=printtheframe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment