Adding a pause between message pairs. Currently set to make one pair a second

This commit is contained in:
nzkarit 2018-05-23 22:53:38 +12:00
parent 6a9cf210bb
commit 46a3ca9dd2
4 changed files with 85 additions and 69 deletions

View File

@ -61,10 +61,8 @@ def argParser():
parser.add_argument('-o', '--out', '--output', action='store', type=str, default=cfg.get('general', 'outputfilename'), dest='outputfilename', help='The iq8s output filename. This is the file which you will feed into the hackRF. Default: %(default)s')
parser.add_argument('-r', '--repeats', action='store', dest='repeats', type=int, default=cfg.getint('general', 'repeats'), help='How many repeats of the data to perform. Default: %(default)s')
parser.add_argument('--csv', '--csvfile', '--in', '--input', action='store', type=str, default=cfg.get('general', 'csvfile'), dest='csvfile', help='Import a CSV file with the plane data in it. Default: %(default)s')
parser.add_argument('--intermessagegap', action='store', type=int, default=cfg.get('general', 'intermessagegap'), dest='intermessagegap', help='When repeating or reading a CSV the number of microseconds between messages. Default: %(default)s')
# TODO Make it so it can do a static checksum
# TODO Get pause between messages
# TODO Get pause between repeats
# TODO Do a pause function
return parser.parse_args()
def singlePlane(arguments):
@ -81,6 +79,9 @@ def singlePlane(arguments):
hackrf = HackRF()
samples_array = hackrf.hackrf_raw_IQ_format(df17_array)
samples = samples+samples_array
gap_array = ppm.addGap(arguments.intermessagegap)
samples_array = hackrf.hackrf_raw_IQ_format(gap_array)
samples = samples+samples_array
return samples
def manyPlanes(arguments):
@ -129,6 +130,9 @@ def manyPlanes(arguments):
hackrf = HackRF()
samples_array = hackrf.hackrf_raw_IQ_format(df17_array)
samples = samples+samples_array
gap_array = ppm.addGap(arguments.intermessagegap)
samples_array = hackrf.hackrf_raw_IQ_format(gap_array)
samples = samples+samples_array
return samples
def writeOutputFile(filename, data):
@ -188,6 +192,3 @@ def threadingCSV(csv):
if __name__ == "__main__":
main()

0
FR24csv.py Normal file → Executable file
View File

13
PPM.py
View File

@ -46,3 +46,16 @@ class PPM:
#print '[{}]'.format(', '.join(hex(x) for x in ppm))
return bytearray(ppm)
def addGap(self, gap):
"""
This function will add dead air as a gap between messages
Args:
gap: The number of microseconds to have as a gap
Returns:
The bytearray of the PPM data
"""
ppm = [ ]
for i in range(gap): # pause
ppm.append( 0 )
return bytearray(ppm)

View File

@ -2,6 +2,8 @@
outputfilename = Samples_256K.iq8s
repeats = 1
csvfile =
# Currently in PPM.py one message is 48 dead air, 8 preamble, 112 message, 100 dead air, 8 preamble, 112 message, 48 dead air leaves us with 99564 microseconds to make a second
intermessagegap = 99564
[plane]
icao = 0x75008F