def airspy_receive(data_connection, ctrl_connection, freq, sample_rate, gain, if_gain, baseband_gain): if not AirSpy.initialize_airspy(freq, sample_rate, gain, if_gain, baseband_gain, ctrl_connection, is_tx=False): return False airspy.start_rx(data_connection.send_bytes) exit_requested = False while not exit_requested: time.sleep(0.5) while ctrl_connection.poll(): result = AirSpy.process_command(ctrl_connection.recv(), ctrl_connection, is_tx=False) if result == AirSpy.Command.STOP.name: exit_requested = True break AirSpy.shutdown_airspy(ctrl_connection) data_connection.close() ctrl_connection.close()
def test_cython_wrapper(self): result = airspy.open() print("Open:", airspy.error_name(result), result) sample_rates = airspy.get_sample_rates() print("Samples rates:", sample_rates) result = airspy.set_sample_rate(10**6) print("Set sample rate", airspy.error_name(result), result) result = airspy.set_center_frequency(int(433.92e6)) print("Set center frequency", airspy.error_name(result), result) result = airspy.set_if_rx_gain(5) print("Set lna gain", airspy.error_name(result), result) result = airspy.set_rf_gain(8) print("Set mixer gain", airspy.error_name(result), result) result = airspy.set_baseband_gain(10) print("Set vga gain", airspy.error_name(result), result) parent_conn, child_conn = Pipe() result = airspy.start_rx(child_conn.send_bytes) print("Set start rx", airspy.error_name(result), result) time.sleep(0.01) print(np.fromstring(parent_conn.recv_bytes(8*65536), dtype=np.complex64)) print("Closing") parent_conn.close() child_conn.close() result = airspy.stop_rx() print("Set stop rx", airspy.error_name(result), result) result = airspy.close() print("Close:", airspy.error_name(result), result)
def enter_async_receive_mode(cls, data_connection: Connection): airspy.start_rx(data_connection.send_bytes)
def enter_async_receive_mode(cls, data_connection: Connection, ctrl_connection: Connection): ret = airspy.start_rx(data_connection.send_bytes) ctrl_connection.send("Start RX MODE:" + str(ret)) return ret