first commit

This commit is contained in:
blackflag 2016-11-09 19:25:27 +01:00
commit 5061ac5619
3 changed files with 1289 additions and 0 deletions

0
README.md Normal file
View file

1080
scanna.grc Normal file

File diff suppressed because it is too large Load diff

209
scanna.py Executable file
View file

@ -0,0 +1,209 @@
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Scanna
# Generated: Sat Nov 5 18:04:51 2016
##################################################
from gnuradio import analog
from gnuradio import audio
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
from gnuradio import wxgui
from gnuradio.eng_option import eng_option
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import forms
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import osmosdr
import wx
class scanna(grc_wxgui.top_block_gui):
def __init__(self):
grc_wxgui.top_block_gui.__init__(self, title="Scanna")
_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
##################################################
# Variables
##################################################
self.volume = volume = 1
self.variable_0 = variable_0 = 0
self.transition = transition = 8000
self.squelch_0 = squelch_0 = 0
self.samp_rate = samp_rate = 2000000
self.freq_1 = freq_1 = 446000000
self.cutoff = cutoff = 100e3
##################################################
# Blocks
##################################################
self._squelch_0_text_box = forms.text_box(
parent=self.GetWin(),
value=self.squelch_0,
callback=self.set_squelch_0,
label="Squelch (db)",
converter=forms.int_converter(),
)
self.Add(self._squelch_0_text_box)
_freq_1_sizer = wx.BoxSizer(wx.VERTICAL)
self._freq_1_text_box = forms.text_box(
parent=self.GetWin(),
sizer=_freq_1_sizer,
value=self.freq_1,
callback=self.set_freq_1,
label="Frequency",
converter=forms.float_converter(),
proportion=0,
)
self._freq_1_slider = forms.slider(
parent=self.GetWin(),
sizer=_freq_1_sizer,
value=self.freq_1,
callback=self.set_freq_1,
minimum=445800000,
maximum=446100000,
num_steps=200,
style=wx.SL_HORIZONTAL,
cast=float,
proportion=1,
)
self.Add(_freq_1_sizer)
self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
self.GetWin(),
baseband_freq=freq_1,
y_per_div=10,
y_divs=10,
ref_level=0,
ref_scale=2,
sample_rate=samp_rate,
fft_size=1024,
fft_rate=15,
average=False,
avg_alpha=None,
title="FFT Plot",
peak_hold=False,
)
self.Add(self.wxgui_fftsink2_0.win)
self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
self.rtlsdr_source_0.set_sample_rate(samp_rate)
self.rtlsdr_source_0.set_center_freq(freq_1, 0)
self.rtlsdr_source_0.set_freq_corr(0, 0)
self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
self.rtlsdr_source_0.set_gain_mode(True, 0)
self.rtlsdr_source_0.set_gain(10, 0)
self.rtlsdr_source_0.set_if_gain(20, 0)
self.rtlsdr_source_0.set_bb_gain(20, 0)
self.rtlsdr_source_0.set_antenna("", 0)
self.rtlsdr_source_0.set_bandwidth(0, 0)
self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
interpolation=24,
decimation=25,
taps=None,
fractional_bw=None,
)
self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
interpolation=500000,
decimation=2000000,
taps=None,
fractional_bw=None,
)
self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
1, 500000, freq_1, transition, firdes.WIN_HAMMING, 6.76))
self.blocks_wavfile_sink_0 = blocks.wavfile_sink("./output.wav", 1, 24000, 8)
self.audio_sink_0 = audio.sink(24000, "", True)
self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_ff(squelch_0, 1, 1, True)
self.analog_nbfm_rx_0 = analog.nbfm_rx(
audio_rate=25000,
quad_rate=500000,
tau=75e-6,
max_dev=5e3,
)
##################################################
# Connections
##################################################
self.connect((self.analog_pwr_squelch_xx_0, 0), (self.blocks_wavfile_sink_0, 0))
self.connect((self.rational_resampler_xxx_1, 0), (self.analog_pwr_squelch_xx_0, 0))
self.connect((self.analog_nbfm_rx_0, 0), (self.rational_resampler_xxx_1, 0))
self.connect((self.low_pass_filter_0, 0), (self.analog_nbfm_rx_0, 0))
self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
self.connect((self.rtlsdr_source_0, 0), (self.rational_resampler_xxx_0, 0))
self.connect((self.analog_pwr_squelch_xx_0, 0), (self.audio_sink_0, 0))
self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
def get_volume(self):
return self.volume
def set_volume(self, volume):
self.volume = volume
def get_variable_0(self):
return self.variable_0
def set_variable_0(self, variable_0):
self.variable_0 = variable_0
def get_transition(self):
return self.transition
def set_transition(self, transition):
self.transition = transition
self.low_pass_filter_0.set_taps(firdes.low_pass(1, 500000, self.freq_1, self.transition, firdes.WIN_HAMMING, 6.76))
def get_squelch_0(self):
return self.squelch_0
def set_squelch_0(self, squelch_0):
self.squelch_0 = squelch_0
self.analog_pwr_squelch_xx_0.set_threshold(self.squelch_0)
self._squelch_0_text_box.set_value(self.squelch_0)
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.rtlsdr_source_0.set_sample_rate(self.samp_rate)
self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
def get_freq_1(self):
return self.freq_1
def set_freq_1(self, freq_1):
self.freq_1 = freq_1
self.rtlsdr_source_0.set_center_freq(self.freq_1, 0)
self._freq_1_slider.set_value(self.freq_1)
self._freq_1_text_box.set_value(self.freq_1)
self.wxgui_fftsink2_0.set_baseband_freq(self.freq_1)
self.low_pass_filter_0.set_taps(firdes.low_pass(1, 500000, self.freq_1, self.transition, firdes.WIN_HAMMING, 6.76))
def get_cutoff(self):
return self.cutoff
def set_cutoff(self, cutoff):
self.cutoff = cutoff
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
tb = scanna()
tb.Start(True)
tb.Wait()