Merge branch 'master' of github.com:nzkarit/ADSB-out-private into refactor-april18-2

This commit is contained in:
nzkarit 2018-04-22 10:18:14 +12:00
commit 43da21d244

View File

@ -126,18 +126,19 @@ def manyPlanes(arguments):
return samples return samples
def writeOutputFile(filename, data): def writeOutputFile(filename, data):
logger.info('Writing tmp.iq8s file') tmpfile = '%s.tmp'%(filename)
SamplesFile = open('tmp.iq8s', 'wb') logger.info('Writing %s file'%(tmpfile))
SamplesFile = open(tmpfile, '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)) 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=%s of=%s bs=4k seek=63 > /dev/null 2>&1" % (tmpfile, filename))
os.system('sync') os.system('sync')
os.system('rm tmp.iq8s') os.system('rm %s'%(tmpfile))
if __name__ == "__main__": def main():
global cfg global cfg
cfg = configparser.ConfigParser() cfg = configparser.ConfigParser()
cfg.read('config.cfg') cfg.read('config.cfg')
@ -157,5 +158,30 @@ if __name__ == "__main__":
writeOutputFile(arguments.outputfilename, data) writeOutputFile(arguments.outputfilename, data)
logger.info('Complete') logger.info('Complete')
def threadingCSV(csv):
global cfg
cfg = configparser.ConfigParser()
cfg.read('config.cfg')
arguments = argParser()
arguments.csvfile = csv[0]
arguments.outputfilename = csv[1]
global logger
logging.config.fileConfig('logging.cfg')
logger = logging.getLogger(__name__)
logger.info('Starting ADSB Encoder')
logger.debug('The arguments: %s' % (arguments))
data = None
if arguments.csvfile == '':
data = singlePlane(arguments)
else:
data = manyPlanes(arguments)
writeOutputFile(arguments.outputfilename, data)
logger.info('Complete')
if __name__ == "__main__":
main()