# read dumphfdl json and make axudp aprs frames # dumphfdl --soapysdr driver=rtlsdr --device-settings direct_samp=2 --sample-rate 250000 --system-table /temp/dumphfdl-master/etc/systable.conf --output decoded:json:udp:address=127.0.0.1,port=7007 --output decoded:text:file:path=/dev/stdout 8942 8977 8885 8948 import json, socket, wx from math import trunc, fabs MYCALL="NOCALL-11" AXUDP=("127.0.0.1",9002) PORT=7007 #PIPE="hfdl.pipe" SYMBOL="/'" metainfo=True longcalls=True def frame(data): print(data) lat=0.0 long=0.0 id="" err=False try: # obj = json.loads(data.decode()) obj = json.loads(data) print(obj) except: print("json decode error") else: # if ("hfdl" in obj) and ("lpdu" in obj["hfdl"]) and ("hfnpdu" in obj["hfdl"]["lpdu"]): hms={} try: lat=obj["hfdl"]["lpdu"]["hfnpdu"]["pos"]["lat"] print("lat:",lat) long=obj["hfdl"]["lpdu"]["hfnpdu"]["pos"]["lon"] print("long:",long) id=obj["hfdl"]["lpdu"]["hfnpdu"]["flight_id"] print("id:",id) if "utc_time" in obj["hfdl"]["lpdu"]["hfnpdu"]: utc=obj["hfdl"]["lpdu"]["hfnpdu"]["utc_time"] elif "time" in obj["hfdl"]["lpdu"]["hfnpdu"]: utc=obj["hfdl"]["lpdu"]["hfnpdu"]["time"] else: print ("no time") print("utc:",utc) print("err:",err) if obj["hfdl"]["lpdu"]["err"]: err=true if obj["hfdl"]["lpdu"]["hfnpdu"]["err"]: err=true hms["h"]=utc["hour"] hms["m"]=utc["min"] hms["s"]=utc["sec"] print("got hms") except: print("no lat/long/time/id") icao="" try: icao=obj["hfdl"]["lpdu"]["ac_info"]["icao"] print("icao",icao) except: pass srcid=0 srctyp="" try: srcid=obj["hfdl"]["lpdu"]["src"]["id"] print("srcid",srcid) srctyp=obj["hfdl"]["lpdu"]["src"]["type"] print("type",srctyp) except: pass dstname="" try: dstname=obj["hfdl"]["lpdu"]["hfnpdu"]["gs"]["name"] print("dstname",dstname) except: pass hrdstr="" try: hfreq=obj["hfdl"]["lpdu"]["hfnpdu"]["freq_data"] # print("mh",hfreq) for gsh in hfreq: # print("hdr: ",gsh) if "heard_on_freqs" in gsh: hi=gsh["heard_on_freqs"] # print("hi: ",hi) for fri in hi: # print(" khz:", fri["freq"]) if hrdstr: hrdstr+="," hrdstr+=str(int(fri["freq"])) print("heard:",hrdstr) except: pass hz=0 try: hz=obj["hfdl"]["freq"] print("hz",hz) except: pass baud=0 try: baud=obj["hfdl"]["bit_rate"] print("baud",baud) except: pass snr=0.0 afc=0.0 try: sigl=obj["hfdl"]["sig_level"] noisl=obj["hfdl"]["noise_level"] snr=sigl-noisl afc=obj["hfdl"]["freq_skew"] print("s/n",snr) print("afc:",afc) except: pass #frame ready to send if not err and lat and long and id and (abs(lat)<90.0) and (abs(long)<180.0): axmeta={} sa=MYCALL sa+=">APHFDL:" s="" i=0 while (i