diff options
author | Arturs Artamonovs <dos21h@gmail.com> | 2023-03-13 22:42:11 +0000 |
---|---|---|
committer | Arturs Artamonovs <dos21h@gmail.com> | 2023-03-13 22:42:11 +0000 |
commit | a70b964dd304078d88b13c19a91530864dad0409 (patch) | |
tree | db2fd7df7bda933ddf70a623ff19e8779d636b46 /test_class.py | |
parent | 194f0c07ecbab61eb383c9d17c72fb73a4c9af80 (diff) | |
download | pyairspyhf-a70b964dd304078d88b13c19a91530864dad0409.tar.gz pyairspyhf-a70b964dd304078d88b13c19a91530864dad0409.zip |
Fixed API for AirSpyHF class.
Diffstat (limited to 'test_class.py')
-rwxr-xr-x | test_class.py | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/test_class.py b/test_class.py index 35a6fd3..b8eea64 100755 --- a/test_class.py +++ b/test_class.py @@ -8,6 +8,45 @@ import argparse airspy = AirSpyHF() -airspy.open(device_index=0) +if -1 == airspy.open(device_index=0): + print("Couldnt open device") + sys.exit(1) +print("1") +airspy.set_samplerate(192000) +print("1") +airspy.set_hf_agc(1) +print("1") +airspy.set_hf_agc_threshold(0) +print("1") +airspy.set_hf_lna(1) +print("1") +sample_count = 0 +def read_samples(transfer): + global sample_count + global wave_file + print("Python call back") + t = transfer.contents + bytes_to_write = t.sample_count * 4 * 2 + rx_buffer = t.samples + #print(f"{bytes_to_write} bytes receieved") + sample_count += t.sample_count + #for i in range(0,t.sample_count): + #d_re = t.samples[i].re + #d_im = t.samples[i].im + #data = struct.pack("<f",d_re) # FIX ?! + #wave_file.writeframesraw(data) + #data = struct.pack("<f", d_im) # FIX ?! + #wave_file.writeframesraw(data) + #print("End call back") + return 0 +print("1") +airspy.start(read_samples) +print("1") +count = 0 +while airspy.is_streaming() and count < 3: + print("Loop") + count += 1 + time.sleep(1) +airspy.stop() airspy.close()
\ No newline at end of file |