Getting logging working in the classes. Well one is enough for now
This commit is contained in:
parent
3170515490
commit
85b91a0719
@ -85,8 +85,8 @@ def singlePlane(arguments):
|
|||||||
|
|
||||||
def manyPlanes(arguments):
|
def manyPlanes(arguments):
|
||||||
logger.info('Processing CSV file')
|
logger.info('Processing CSV file')
|
||||||
logger.info('Repeating the message %s times' % (arguments.repeats))
|
|
||||||
samples = bytearray()
|
samples = bytearray()
|
||||||
|
logger.info('Repeating the message %s times' % (arguments.repeats))
|
||||||
for i in range(0, arguments.repeats):
|
for i in range(0, arguments.repeats):
|
||||||
with open(arguments.csvfile, newline='') as csvfile:
|
with open(arguments.csvfile, newline='') as csvfile:
|
||||||
reader = csv.DictReader(csvfile, delimiter=',')
|
reader = csv.DictReader(csvfile, delimiter=',')
|
||||||
@ -126,11 +126,13 @@ def manyPlanes(arguments):
|
|||||||
return samples
|
return samples
|
||||||
|
|
||||||
def writeOutputFile(filename, data):
|
def writeOutputFile(filename, data):
|
||||||
|
logger.info('Writing tmp.iq8s file')
|
||||||
SamplesFile = open('tmp.iq8s', 'wb')
|
SamplesFile = open('tmp.iq8s', 'wb')
|
||||||
SamplesFile.write(data)
|
SamplesFile.write(data)
|
||||||
SamplesFile.close()
|
SamplesFile.close()
|
||||||
os.system('sync')
|
os.system('sync')
|
||||||
os.system('rm %s' % (filename))
|
os.system('rm %s' % (filename))
|
||||||
|
logger.info('dd for file: %s' % (filename))
|
||||||
os.system("dd if=tmp.iq8s of=%s bs=4k seek=63 > /dev/null 2>&1" % (filename))
|
os.system("dd if=tmp.iq8s of=%s bs=4k seek=63 > /dev/null 2>&1" % (filename))
|
||||||
os.system('sync')
|
os.system('sync')
|
||||||
os.system('rm tmp.iq8s')
|
os.system('rm tmp.iq8s')
|
||||||
@ -153,6 +155,7 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
data = manyPlanes(arguments)
|
data = manyPlanes(arguments)
|
||||||
writeOutputFile(arguments.outputfilename, data)
|
writeOutputFile(arguments.outputfilename, data)
|
||||||
|
logger.info('Complete')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import numpy
|
import numpy
|
||||||
|
import logging
|
||||||
###############################################################
|
###############################################################
|
||||||
# Further work on fork
|
# Further work on fork
|
||||||
# Copyright (C) 2017 David Robinson
|
# Copyright (C) 2017 David Robinson
|
||||||
@ -6,6 +7,10 @@ class HackRF:
|
|||||||
"""The HackRF class has functions from converting data into a format into which the hackrf can process
|
"""The HackRF class has functions from converting data into a format into which the hackrf can process
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
logger = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
def hackrf_raw_IQ_format(self, ppm):
|
def hackrf_raw_IQ_format(self, ppm):
|
||||||
"""
|
"""
|
||||||
@ -15,7 +20,8 @@ class HackRF:
|
|||||||
Returns:
|
Returns:
|
||||||
bytearray: containing the IQ data
|
bytearray: containing the IQ data
|
||||||
"""
|
"""
|
||||||
|
print(self.logger)
|
||||||
|
self.logger.debug('Creating hackRF bytearray from the ppm stuff')
|
||||||
signal = []
|
signal = []
|
||||||
bits = numpy.unpackbits(numpy.asarray(ppm, dtype=numpy.uint8))
|
bits = numpy.unpackbits(numpy.asarray(ppm, dtype=numpy.uint8))
|
||||||
for bit in bits:
|
for bit in bits:
|
||||||
|
Loading…
Reference in New Issue
Block a user