コード例 #1
0
ファイル: HackRFTests.py プロジェクト: eelmasllari/urh
 def test_hackrf_class_send(self):
     hfc = HackRF(1e6, 433.92e6, 20, 1e6)
     hfc.open()
     hfc.start_tx_mode(np.fromfile("/tmp/hackrf.complex",
                                   dtype=np.complex64),
                       repeats=1)
     while not hfc.sending_finished:
         print("Repeat: {0} Current Sample: {1}".format(
             hfc.current_sending_repeat + 1, hfc.current_sent_sample))
         time.sleep(1)
     hfc.stop_tx_mode("Test finished")
     hfc.close()
コード例 #2
0
ファイル: HackRFTests.py プロジェクト: eelmasllari/urh
 def test_hackrf_class_recv(self):
     hfc = HackRF(1e6, 433.92e6, 20, 1e6)
     hfc.open()
     hfc.start_rx_mode()
     i = 0
     TIME_TOTAL = 5
     while i < TIME_TOTAL:
         print("{0}/{1}".format(i + 1, TIME_TOTAL))
         time.sleep(1)
         i += 1
     print("{0:,}".format(hfc.current_recv_index))
     #print(hfc.received_data)
     #hfc.unpack_complex(len(hfc.byte_buffer)//2).tofile("/tmp/hackrf.complex")
     hfc.received_data.tofile("/tmp/hackrf.complex")
     print("Wrote Data")
     hfc.stop_rx_mode("Finished test")
     hfc.close()
コード例 #3
0
ファイル: HackRFTests.py プロジェクト: eelmasllari/urh
    def test_hackrf_class_send_recv(self):
        while True:
            t = time.time()
            hfc = HackRF(1e6, 433.92e6, 20, 1e6)
            hfc.open()
            print("opening time:", time.time() - t)
            hfc.start_rx_mode()
            i = 0
            t = time.time()
            while i < 1:
                #print("{0}/{1}".format(i+1, 5))
                time.sleep(1)
                i += 1
            print("{0:,}".format(hfc.current_recv_index))
            rcv_data = hfc.received_data
            print("Rcv done {0}".format(time.time() - t))

            t = time.time()
            hfc.stop_rx_mode("Finished test")
            print("             Time stopping rx mode: {0}".format(
                1000 * (time.time() - t)))
            hfc.open(init=False)
            print("             Reopen device: {0}".format(1000 *
                                                           (time.time() - t)))
            hfc.start_tx_mode(rcv_data, repeats=1)
            print("             Switch time:", 1000 * (time.time() - t), "ms")
            t = time.time()
            while not hfc.sending_finished:
                #print("Repeat: {0} Current Sample: {1}".format(hfc.current_sending_repeat + 1, hfc.current_sent_sample))
                time.sleep(0.01)
            print("Send time", time.time() - t)
            t = time.time()
            hfc.stop_tx_mode("Test finished")
            #hfc.close()
            print("Close time", time.time() - t)
            hfc.close()