예제 #1
0
def test_cython_wrapper():
    descs, uris = plutosdr.scan_devices()
    plutosdr.set_tx(False)
    print("Devices", descs)
    print("Open", plutosdr.open(uris[0]))
    print("Set Freq to 433.92e6", plutosdr.set_center_freq(int(433.92e6)))
    print("Set Sample Rate to 2M", plutosdr.set_sample_rate(int(2.5e6)))
    print("Set bandwidth to 4M", plutosdr.set_bandwidth(int(4e6)))
    print("Set gain to 10", plutosdr.set_rf_gain(10))

    print("prepare rx", plutosdr.setup_rx())

    parent_conn, child_conn = Pipe()

    for i in range(10):
        plutosdr.receive_sync(child_conn)
        data = parent_conn.recv_bytes()
        print(np.frombuffer(data, dtype=np.int16))

    print(plutosdr.get_tx())
    print("Close", plutosdr.close())

    plutosdr.set_tx(True)

    print("Open", plutosdr.open(uris[0]))
    print("Setup tx", plutosdr.setup_tx())
    print("Set Freq to 433.92e6", plutosdr.set_center_freq(int(433.92e6)))
    print("Set Sample Rate to 2M", plutosdr.set_sample_rate(int(2.5e6)))
    print("Set bandwidth to 4M", plutosdr.set_bandwidth(int(4e6)))
    print("Set gain to 10", plutosdr.set_rf_gain(-89))

    print("Send", plutosdr.send_sync(np.zeros(4096, dtype=np.int16)))

    print("Close", plutosdr.close())
예제 #2
0
파일: PlutoSDR.py 프로젝트: jopohl/urh
    def setup_device(cls, ctrl_connection: Connection, device_identifier):
        device_identifier = device_identifier if isinstance(device_identifier, str) else ""
        try:
            device_identifier = re.search("\[.*\]", device_identifier).groups(0)
        except (IndexError, AttributeError):
            pass

        if not device_identifier:
            _, uris = plutosdr.scan_devices()
            try:
                device_identifier = uris[0]
            except IndexError:
                ctrl_connection.send("Could find a connected PlutoSDR")
                return False

        ret = plutosdr.open(device_identifier)
        ctrl_connection.send("OPEN ({}):{}".format(device_identifier, ret))
        return ret == 0
예제 #3
0
    def setup_device(cls, ctrl_connection: Connection, device_identifier):
        device_identifier = device_identifier if isinstance(device_identifier, str) else ""
        try:
            device_identifier = re.search(r"(?<=\[).+?(?=\])", device_identifier).group(0)
        except (IndexError, AttributeError):
            pass

        if not device_identifier:
            _, uris = plutosdr.scan_devices()
            try:
                device_identifier = uris[0]
            except IndexError:
                ctrl_connection.send("Could not find a connected PlutoSDR")
                return False

        ret = plutosdr.open(device_identifier)
        ctrl_connection.send("OPEN ({}):{}".format(device_identifier, ret))
        return ret == 0
예제 #4
0
파일: PlutoSDR.py 프로젝트: zxc135781/urh
 def get_device_list(cls):
     descs, uris = plutosdr.scan_devices()
     return ["{} [{}]".format(desc, uri) for desc, uri in zip(descs, uris)]
예제 #5
0
파일: PlutoSDR.py 프로젝트: jopohl/urh
 def get_device_list(cls):
     descs, uris = plutosdr.scan_devices()
     return ["{} [{}]".format(desc, uri) for desc, uri in zip(descs, uris)]