def go(): if len(sys.argv) <= 1: print "You must enter a test mode!" printUsage() sys.exit() funcs = { 'radio' : audioTest, 'status' : testDeviceStatusQueries, 'raw-pipe' : testRawPipeMode, 'callback' : testCallback, 'traces' : testSweeps, 'int-traces' : interruptedSweeping, 'gps' : testGpsSweeps, 'reset' : resetDevice, 'iq' : testIqStreaming } if sys.argv[1] in funcs: logSetup.initLogging() sh = SignalHound() # sh.preset() # testDeviceStatusQueries(sh) # testRawPipeMode(sh) if len(sys.argv) == 2: funcs[sys.argv[1]](sh) if len(sys.argv) == 3: funcs[sys.argv[1]](sh, float(sys.argv[2])) # testCallback(sh) sh.closeDevice() else: print "Error! You must enter a valid test-mode!" printUsage()
def callbackTestFunc(bufPtr, bufLen): global START_TIME #hacking about for determining callback interval times. I shouldn't be using global, but fukkit. now = time.time() print "Callback!", bufPtr, bufLen print bufPtr[0] arr = SignalHound.decodeRawSweep(bufPtr, bufLen) print "NP Array = ", arr.shape, arr print "Elapsed Time = ", now-START_TIME START_TIME = now