Comments on what things are doing and also doing the DD step in the script
This commit is contained in:
+8
-6
@@ -6,6 +6,7 @@ from location import *
|
|||||||
from conversions import *
|
from conversions import *
|
||||||
from parity import *
|
from parity import *
|
||||||
from HackRF import HackRF
|
from HackRF import HackRF
|
||||||
|
import os
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ import numpy
|
|||||||
|
|
||||||
def df17_pos_rep_encode(ca, icao, tc, ss, nicsb, alt, time, lat, lon, surface):
|
def df17_pos_rep_encode(ca, icao, tc, ss, nicsb, alt, time, lat, lon, surface):
|
||||||
|
|
||||||
format = 17
|
format = 17 #The format type of an ADSB message
|
||||||
|
|
||||||
enc_alt = encode_alt_modes(alt, surface)
|
enc_alt = encode_alt_modes(alt, surface)
|
||||||
#print "Alt(%r): %X " % (surface, enc_alt)
|
#print "Alt(%r): %X " % (surface, enc_alt)
|
||||||
@@ -141,10 +142,10 @@ if __name__ == "__main__":
|
|||||||
lon = float(argv[3])
|
lon = float(argv[3])
|
||||||
alt = float(argv[4])
|
alt = float(argv[4])
|
||||||
|
|
||||||
ca = 5
|
ca = 5 # Capability
|
||||||
tc = 11
|
tc = 11 # Type Code see: https://adsb-decode-guide.readthedocs.io/en/latest/content/introduction.html#ads-b-message-types
|
||||||
ss = 0
|
ss = 0 # Surveillance status
|
||||||
nicsb = 0
|
nicsb = 0 # NIC supplement-B
|
||||||
time = 0
|
time = 0
|
||||||
surface = False
|
surface = False
|
||||||
|
|
||||||
@@ -161,5 +162,6 @@ if __name__ == "__main__":
|
|||||||
hackrf = HackRF()
|
hackrf = HackRF()
|
||||||
samples_array = hackrf.hackrf_raw_IQ_format(df17_array)
|
samples_array = hackrf.hackrf_raw_IQ_format(df17_array)
|
||||||
|
|
||||||
SamplesFile = open("Samples.iq8s", "wb")
|
SamplesFile = open("Samples.iq8s", "wb") # TODO make this a function and take the file name. Also have the option to run dd on it.
|
||||||
SamplesFile.write(samples_array)
|
SamplesFile.write(samples_array)
|
||||||
|
os.system("dd if=Samples.iq8s of=Samples_256K.iq8s bs=4k seek=63") # TODO make this a flag, also make it take the file name
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class HackRF:
|
|||||||
ppm: this is some data in ppm (pulse position modulation) which you want to convert into raw IQ format
|
ppm: this is some data in ppm (pulse position modulation) which you want to convert into raw IQ format
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bytearray containig the IQ data
|
bytearray: containing the IQ data
|
||||||
"""
|
"""
|
||||||
|
|
||||||
signal = []
|
signal = []
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ def encode_alt_modes(alt, bit13):
|
|||||||
latz = 15
|
latz = 15
|
||||||
|
|
||||||
def nz(ctype):
|
def nz(ctype):
|
||||||
|
"""
|
||||||
|
Number of geographic latitude zones between equator and a pole. It is set to NZ = 15 for Mode-S CPR encoding
|
||||||
|
https://adsb-decode-guide.readthedocs.io/en/latest/content/cpr.html
|
||||||
|
"""
|
||||||
return 4 * latz - ctype
|
return 4 * latz - ctype
|
||||||
|
|
||||||
def dlat(ctype, surface):
|
def dlat(ctype, surface):
|
||||||
@@ -68,6 +72,8 @@ def dlon(declat_in, ctype, surface):
|
|||||||
return tmp / nlcalc
|
return tmp / nlcalc
|
||||||
|
|
||||||
#encode CPR position
|
#encode CPR position
|
||||||
|
# https://adsb-decode-guide.readthedocs.io/en/latest/content/cpr.html
|
||||||
|
# compact position reporting
|
||||||
def cpr_encode(lat, lon, ctype, surface):
|
def cpr_encode(lat, lon, ctype, surface):
|
||||||
if surface is True:
|
if surface is True:
|
||||||
scalar = 2.**19
|
scalar = 2.**19
|
||||||
|
|||||||
Reference in New Issue
Block a user