コード例 #1
0
 def setup_device(cls, ctrl_connection: Connection, device_identifier):
     ret = usrp.open(device_identifier)
     ctrl_connection.send("OPEN:" + str(ret))
     success = ret == 0
     if success:
         device_repr = usrp.get_device_representation()
         ctrl_connection.send(device_repr)
     return success
コード例 #2
0
ファイル: USRP.py プロジェクト: Cyber-Forensic/urh
 def setup_device(cls, ctrl_connection: Connection, device_identifier):
     ret = usrp.open(device_identifier)
     ctrl_connection.send("OPEN:" + str(ret))
     success = ret == 0
     if success:
         device_repr = usrp.get_device_representation()
         ctrl_connection.send(device_repr)
     return success
コード例 #3
0
ファイル: USRP.py プロジェクト: starling021/uh
    def setup_device(cls, ctrl_connection: Connection, device_identifier):
        ret = usrp.open(device_identifier)

        if device_identifier:
            ctrl_connection.send("OPEN ({}):{}".format(device_identifier, ret))
        else:
            ctrl_connection.send("OPEN:" + str(ret))

        success = ret == 0
        if success:
            device_repr = usrp.get_device_representation()
            ctrl_connection.send(device_repr)
        else:
            ctrl_connection.send(usrp.get_last_error())
        return success
コード例 #4
0
ファイル: TestUSRP.py プロジェクト: zzzsleepsin/urh
    def test_cython_wrapper(self):
        print(usrp.find_devices(""))

        usrp.set_tx(False)

        return_code = usrp.open("addr=192.168.10.2")
        print("open", return_code)

        usrp.setup_stream()
        print("Made rx_streame handler")

        print(usrp.get_device_representation())

        print("Set sample rate", usrp.set_sample_rate(2e6))
        print("Set freq", usrp.set_center_freq(433.92e6))
        print("Set bandwidth", usrp.set_bandwidth(1e6))
        print("Set gain", usrp.set_rf_gain(0.5))



        buffer = bytearray()

        num_samples = 32768 // 2

        usrp.start_stream(num_samples)
        parent_conn, child_conn = Pipe()

        for i in range(500):
            usrp.recv_stream(child_conn, num_samples)
            received_bytes = parent_conn.recv_bytes()
            #print(received_bytes)
            print(i)
            buffer.extend(received_bytes)
            #print(USRP.unpack_complex(received_bytes, len(received_bytes) // 8))

        f = open("/tmp/test.complex", "wb")
        f.write(buffer)
        f.close()

        usrp.destroy_stream()
        print("Freed rx streamer handler")

        return_code = usrp.close()
        print("close", return_code)