mirror of
https://github.com/jopohl/urh.git
synced 2026-03-25 09:27:04 +01:00
Merge pull request #165 from mehdideveloper/localtestbed
added SDRPlay and AirSpy
This commit is contained in:
@@ -74,7 +74,7 @@ class BackendHandler(object):
|
||||
3) Manage the selection of devices backend
|
||||
|
||||
"""
|
||||
DEVICE_NAMES = ("Bladerf", "HackRF", "USRP", "RTL-SDR", "FUNcube-Dongle")
|
||||
DEVICE_NAMES = ("Bladerf", "HackRF", "USRP", "RTL-SDR", "FUNcube-Dongle", "SDRPlay", "AirSpy")
|
||||
|
||||
def __init__(self, testing_mode=False):
|
||||
self.testing_mode = testing_mode # Ensure we get some device backends for unit tests
|
||||
|
||||
1656
src/urh/dev/gr/scripts/airspy_recv.grc
Normal file
1656
src/urh/dev/gr/scripts/airspy_recv.grc
Normal file
File diff suppressed because it is too large
Load Diff
109
src/urh/dev/gr/scripts/airspy_recv.py
Normal file
109
src/urh/dev/gr/scripts/airspy_recv.py
Normal file
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python2
|
||||
##################################################
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Top Block
|
||||
# Generated: Fri Aug 21 15:56:13 2015
|
||||
##################################################
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
import tempfile
|
||||
import os
|
||||
import sys
|
||||
try:
|
||||
with open(os.path.join(tempfile.gettempdir(), "gnuradio_path.txt"), "r") as f:
|
||||
gnuradio_path = f.read().strip()
|
||||
|
||||
os.environ["PATH"] = os.path.join(gnuradio_path, "bin")
|
||||
sys.path.append(os.path.join(gnuradio_path, "lib", "site-packages"))
|
||||
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
from gnuradio import gr
|
||||
from gnuradio.eng_option import eng_option
|
||||
from grc_gnuradio import blks2 as grc_blks2
|
||||
from InputHandlerThread import InputHandlerThread
|
||||
import osmosdr
|
||||
from gnuradio import zeromq
|
||||
|
||||
class top_block(gr.top_block):
|
||||
def __init__(self, samp_rate, freq, gain, bw, port):
|
||||
gr.top_block.__init__(self, "Top Block")
|
||||
|
||||
##################################################
|
||||
# Variables
|
||||
##################################################
|
||||
self.samp_rate = samp_rate
|
||||
self.gain = gain
|
||||
self.freq = freq
|
||||
self.bw = bw
|
||||
|
||||
##################################################
|
||||
# Blocks
|
||||
##################################################
|
||||
self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "airspy")
|
||||
self.osmosdr_source_0.set_sample_rate(samp_rate)
|
||||
self.osmosdr_source_0.set_center_freq(freq, 0)
|
||||
self.osmosdr_source_0.set_freq_corr(0, 0)
|
||||
self.osmosdr_source_0.set_dc_offset_mode(0, 0)
|
||||
self.osmosdr_source_0.set_iq_balance_mode(0, 0)
|
||||
self.osmosdr_source_0.set_gain_mode(False, 0)
|
||||
self.osmosdr_source_0.set_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_if_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_bb_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_antenna("", 0)
|
||||
self.osmosdr_source_0.set_bandwidth(bw, 0)
|
||||
|
||||
self.zeromq_push_sink_0 = zeromq.push_sink(gr.sizeof_gr_complex, 1, 'tcp://127.0.0.1:' + str(port), 100, False)
|
||||
|
||||
##################################################
|
||||
# Connections
|
||||
##################################################
|
||||
self.connect((self.osmosdr_source_0, 0), (self.zeromq_push_sink_0, 0))
|
||||
|
||||
def get_samp_rate(self):
|
||||
return self.samp_rate
|
||||
|
||||
def set_samp_rate(self, samp_rate):
|
||||
self.samp_rate = samp_rate
|
||||
self.osmosdr_source_0.set_sample_rate(self.samp_rate)
|
||||
|
||||
def get_gain(self):
|
||||
return self.gain
|
||||
|
||||
def set_gain(self, gain):
|
||||
self.gain = gain
|
||||
self.osmosdr_source_0.set_gain(self.gain, 0)
|
||||
self.osmosdr_source_0.set_if_gain(self.gain, 0)
|
||||
self.osmosdr_source_0.set_bb_gain(self.gain, 0)
|
||||
|
||||
def get_freq(self):
|
||||
return self.freq
|
||||
|
||||
def set_freq(self, freq):
|
||||
self.freq = freq
|
||||
self.osmosdr_source_0.set_center_freq(self.freq, 0)
|
||||
|
||||
def get_bw(self):
|
||||
return self.bw
|
||||
|
||||
def set_bw(self, bw):
|
||||
self.bw = bw
|
||||
self.osmosdr_source_0.set_bandwidth(self.bw, 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
|
||||
parser.add_option("-s", "--samplerate", dest="samplerate", help="Sample Rate", default=100000)
|
||||
parser.add_option("-f", "--freq", dest="freq", help="Frequency", default=433000)
|
||||
parser.add_option("-g", "--gain", dest="gain", help="Gain", default=30)
|
||||
parser.add_option("-b", "--bandwidth", dest="bw", help="Bandwidth", default=200000)
|
||||
parser.add_option("-p", "--port", dest="port", help="Port", default=1337)
|
||||
(options, args) = parser.parse_args()
|
||||
tb = top_block(float(options.samplerate), float(options.freq), int(options.gain),
|
||||
float(options.bw), int(options.port))
|
||||
iht = InputHandlerThread(tb)
|
||||
iht.start()
|
||||
tb.start()
|
||||
tb.wait()
|
||||
1656
src/urh/dev/gr/scripts/sdrplay_recv.grc
Normal file
1656
src/urh/dev/gr/scripts/sdrplay_recv.grc
Normal file
File diff suppressed because it is too large
Load Diff
109
src/urh/dev/gr/scripts/sdrplay_recv.py
Normal file
109
src/urh/dev/gr/scripts/sdrplay_recv.py
Normal file
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python2
|
||||
##################################################
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Top Block
|
||||
# Generated: Fri Aug 21 15:56:13 2015
|
||||
##################################################
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
import tempfile
|
||||
import os
|
||||
import sys
|
||||
try:
|
||||
with open(os.path.join(tempfile.gettempdir(), "gnuradio_path.txt"), "r") as f:
|
||||
gnuradio_path = f.read().strip()
|
||||
|
||||
os.environ["PATH"] = os.path.join(gnuradio_path, "bin")
|
||||
sys.path.append(os.path.join(gnuradio_path, "lib", "site-packages"))
|
||||
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
from gnuradio import gr
|
||||
from gnuradio.eng_option import eng_option
|
||||
from grc_gnuradio import blks2 as grc_blks2
|
||||
from InputHandlerThread import InputHandlerThread
|
||||
import osmosdr
|
||||
from gnuradio import zeromq
|
||||
|
||||
class top_block(gr.top_block):
|
||||
def __init__(self, samp_rate, freq, gain, bw, port):
|
||||
gr.top_block.__init__(self, "Top Block")
|
||||
|
||||
##################################################
|
||||
# Variables
|
||||
##################################################
|
||||
self.samp_rate = samp_rate
|
||||
self.gain = gain
|
||||
self.freq = freq
|
||||
self.bw = bw
|
||||
|
||||
##################################################
|
||||
# Blocks
|
||||
##################################################
|
||||
self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "sdrplay")
|
||||
self.osmosdr_source_0.set_sample_rate(samp_rate)
|
||||
self.osmosdr_source_0.set_center_freq(freq, 0)
|
||||
self.osmosdr_source_0.set_freq_corr(0, 0)
|
||||
self.osmosdr_source_0.set_dc_offset_mode(0, 0)
|
||||
self.osmosdr_source_0.set_iq_balance_mode(0, 0)
|
||||
self.osmosdr_source_0.set_gain_mode(False, 0)
|
||||
self.osmosdr_source_0.set_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_if_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_bb_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_antenna("", 0)
|
||||
self.osmosdr_source_0.set_bandwidth(bw, 0)
|
||||
|
||||
self.zeromq_push_sink_0 = zeromq.push_sink(gr.sizeof_gr_complex, 1, 'tcp://127.0.0.1:' + str(port), 100, False)
|
||||
|
||||
##################################################
|
||||
# Connections
|
||||
##################################################
|
||||
self.connect((self.osmosdr_source_0, 0), (self.zeromq_push_sink_0, 0))
|
||||
|
||||
def get_samp_rate(self):
|
||||
return self.samp_rate
|
||||
|
||||
def set_samp_rate(self, samp_rate):
|
||||
self.samp_rate = samp_rate
|
||||
self.osmosdr_source_0.set_sample_rate(self.samp_rate)
|
||||
|
||||
def get_gain(self):
|
||||
return self.gain
|
||||
|
||||
def set_gain(self, gain):
|
||||
self.gain = gain
|
||||
self.osmosdr_source_0.set_gain(self.gain, 0)
|
||||
self.osmosdr_source_0.set_if_gain(self.gain, 0)
|
||||
self.osmosdr_source_0.set_bb_gain(self.gain, 0)
|
||||
|
||||
def get_freq(self):
|
||||
return self.freq
|
||||
|
||||
def set_freq(self, freq):
|
||||
self.freq = freq
|
||||
self.osmosdr_source_0.set_center_freq(self.freq, 0)
|
||||
|
||||
def get_bw(self):
|
||||
return self.bw
|
||||
|
||||
def set_bw(self, bw):
|
||||
self.bw = bw
|
||||
self.osmosdr_source_0.set_bandwidth(self.bw, 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
|
||||
parser.add_option("-s", "--samplerate", dest="samplerate", help="Sample Rate", default=100000)
|
||||
parser.add_option("-f", "--freq", dest="freq", help="Frequency", default=433000)
|
||||
parser.add_option("-g", "--gain", dest="gain", help="Gain", default=30)
|
||||
parser.add_option("-b", "--bandwidth", dest="bw", help="Bandwidth", default=200000)
|
||||
parser.add_option("-p", "--port", dest="port", help="Port", default=1337)
|
||||
(options, args) = parser.parse_args()
|
||||
tb = top_block(float(options.samplerate), float(options.freq), int(options.gain),
|
||||
float(options.bw), int(options.port))
|
||||
iht = InputHandlerThread(tb)
|
||||
iht.start()
|
||||
tb.start()
|
||||
tb.wait()
|
||||
99
src/urh/dev/gr/scripts/top_block.py
Executable file
99
src/urh/dev/gr/scripts/top_block.py
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
##################################################
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Top Block
|
||||
# Generated: Sun Feb 26 20:51:15 2017
|
||||
##################################################
|
||||
|
||||
from gnuradio import eng_notation
|
||||
from gnuradio import gr
|
||||
from gnuradio.eng_option import eng_option
|
||||
from gnuradio.filter import firdes
|
||||
from grc_gnuradio import blks2 as grc_blks2
|
||||
from optparse import OptionParser
|
||||
import osmosdr
|
||||
import time
|
||||
|
||||
|
||||
class top_block(gr.top_block):
|
||||
|
||||
def __init__(self):
|
||||
gr.top_block.__init__(self, "Top Block")
|
||||
|
||||
##################################################
|
||||
# Variables
|
||||
##################################################
|
||||
self.samp_rate = samp_rate = 2e6
|
||||
self.gain = gain = 10
|
||||
self.freq = freq = 433e6
|
||||
self.bw = bw = 250000
|
||||
|
||||
##################################################
|
||||
# Blocks
|
||||
##################################################
|
||||
self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + 'sdrplay=0' )
|
||||
self.osmosdr_source_0.set_sample_rate(samp_rate)
|
||||
self.osmosdr_source_0.set_center_freq(freq, 0)
|
||||
self.osmosdr_source_0.set_freq_corr(0, 0)
|
||||
self.osmosdr_source_0.set_dc_offset_mode(0, 0)
|
||||
self.osmosdr_source_0.set_iq_balance_mode(0, 0)
|
||||
self.osmosdr_source_0.set_gain_mode(False, 0)
|
||||
self.osmosdr_source_0.set_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_if_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_bb_gain(gain, 0)
|
||||
self.osmosdr_source_0.set_antenna('', 0)
|
||||
self.osmosdr_source_0.set_bandwidth(bw, 0)
|
||||
|
||||
self.blks2_tcp_sink_0 = grc_blks2.tcp_sink(
|
||||
itemsize=gr.sizeof_gr_complex*1,
|
||||
addr='127.0.0.1',
|
||||
port=1337,
|
||||
server=True,
|
||||
)
|
||||
|
||||
##################################################
|
||||
# Connections
|
||||
##################################################
|
||||
self.connect((self.osmosdr_source_0, 0), (self.blks2_tcp_sink_0, 0))
|
||||
|
||||
def get_samp_rate(self):
|
||||
return self.samp_rate
|
||||
|
||||
def set_samp_rate(self, samp_rate):
|
||||
self.samp_rate = samp_rate
|
||||
self.osmosdr_source_0.set_sample_rate(self.samp_rate)
|
||||
|
||||
def get_gain(self):
|
||||
return self.gain
|
||||
|
||||
def set_gain(self, gain):
|
||||
self.gain = gain
|
||||
self.osmosdr_source_0.set_gain(self.gain, 0)
|
||||
self.osmosdr_source_0.set_if_gain(self.gain, 0)
|
||||
self.osmosdr_source_0.set_bb_gain(self.gain, 0)
|
||||
|
||||
def get_freq(self):
|
||||
return self.freq
|
||||
|
||||
def set_freq(self, freq):
|
||||
self.freq = freq
|
||||
self.osmosdr_source_0.set_center_freq(self.freq, 0)
|
||||
|
||||
def get_bw(self):
|
||||
return self.bw
|
||||
|
||||
def set_bw(self, bw):
|
||||
self.bw = bw
|
||||
self.osmosdr_source_0.set_bandwidth(self.bw, 0)
|
||||
|
||||
|
||||
def main(top_block_cls=top_block, options=None):
|
||||
|
||||
tb = top_block_cls()
|
||||
tb.start()
|
||||
tb.wait()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user