def __do_connect(self): self.__context.lock() try: self.disconnect_all() if _available_version == 1: # backwards compatibility decoder = dsd_block_ff() else: decoder = dsd_block_ff( # TODO: Add controls to choose frame and mod options at runtime — need to be able to get the enum info from gr-dsd, which may not even be currently available. frame=dsd.dsd_FRAME_AUTO_DETECT, mod=dsd.dsd_MOD_AUTO_SELECT, uvquality=self.__uvquality, errorbars=_debug_print, verbosity=2 if _debug_print else 0) self.connect(self, self.__fm_demod, self.__resampler, decoder, self) finally: self.__context.unlock()
def __do_connect(self, not_init): # TODO: figure out why tests, but not the real server, have a hanging problem if we lock always if not_init: self.__context.lock() try: self.disconnect_all() if _available_version == 1: # backwards compatibility decoder = dsd_block_ff() else: decoder = dsd_block_ff( # TODO: Add controls to choose frame and mod options at runtime — need to be able to get the enum info from gr-dsd, which may not even be currently available. frame=dsd.dsd_FRAME_AUTO_DETECT, mod=dsd.dsd_MOD_AUTO_SELECT, uvquality=self.__uvquality, errorbars=_debug_print, verbosity=2 if _debug_print else 0) self.connect( self, self.__fm_demod, self.__resampler, decoder, self) finally: if not_init: self.__context.unlock()
def __init__(self, mode, input_rate=0, context=None): assert input_rate > 0 gr.hier_block2.__init__(self, type(self).__name__, gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float)) # TODO: Retry telling the NFMDemodulator to have its output rate be pipe_rate instead of using a resampler. Something went wrong when trying that before. Same thing is done in multimon.py self.__fm_demod = NFMDemodulator( mode='NFM', input_rate=input_rate, no_audio_filter=True, # don't remove CTCSS tone tau=None) # no deemphasis assert self.__fm_demod.get_output_type().get_kind() == 'MONO' fm_audio_rate = self.__fm_demod.get_output_type().get_sample_rate() self.__output_type = SignalType(kind='MONO', sample_rate=8000) self.connect(self, self.__fm_demod, make_resampler(fm_audio_rate, _demod_rate), dsd_block_ff(), self)
def __init__(self, mode, input_rate=0, context=None): assert input_rate > 0 gr.hier_block2.__init__( self, type(self).__name__, gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float)) # TODO: Retry telling the NFMDemodulator to have its output rate be pipe_rate instead of using a resampler. Something went wrong when trying that before. Same thing is done in multimon.py self.__fm_demod = NFMDemodulator( mode='NFM', input_rate=input_rate, no_audio_filter=True, # don't remove CTCSS tone tau=None) # no deemphasis assert self.__fm_demod.get_output_type().get_kind() == 'MONO' fm_audio_rate = self.__fm_demod.get_output_type().get_sample_rate() self.__output_type = SignalType(kind='MONO', sample_rate=8000) self.connect( self, self.__fm_demod, make_resampler(fm_audio_rate, _demod_rate), dsd_block_ff(), self)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="VA3RFT") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1920000 self.offset = offset = 50000 self.gain = gain = 40 self.fsk_deviation_hz = fsk_deviation_hz = 8000 self.freq = freq = 444475000 self.corr = corr = 0 ################################################## # Blocks ################################################## _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='RX gain', converter=forms.float_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=49.6, num_steps=124, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_gain_sizer) _corr_sizer = wx.BoxSizer(wx.VERTICAL) self._corr_text_box = forms.text_box( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, label='Freq. correction', converter=forms.float_converter(), proportion=0, ) self._corr_slider = forms.slider( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, minimum=-150, maximum=150, num_steps=300, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_corr_sizer) self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=50, ref_level=-20, ref_scale=2.0, sample_rate=48000, fft_size=512, fft_rate=3, average=False, avg_alpha=None, title='Waterfall Plot', ) self.Add(self.wxgui_waterfallsink2_1.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title='Scope Plot', sample_rate=48000, v_scale=0.25, v_offset=0, t_scale=0.001, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label='Counts', ) self.Add(self.wxgui_scopesink2_0.win) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq - offset, 0) self.osmosdr_source_0.set_freq_corr(corr, 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(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.low_pass_filter_1 = filter.fir_filter_fff( 1, firdes.low_pass(1, 48000, 8000, 2000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( 40, firdes.low_pass(20, samp_rate, 3500, 2000, firdes.WIN_HAMMING, 6.76)) self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_DMR_MOTOTRBO, dsd.dsd_MOD_AUTO_SELECT, 3, True, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.audio_sink_0 = audio.sink(8000, '', True) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -offset, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.audio_sink_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.wxgui_waterfallsink2_1, 0)) self.connect((self.low_pass_filter_1, 0), (self.dsd_block_ff_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self, center_freq=867.4105, find_chan_nums=False, freq_list=[866.0375, 866.2875, 866.5375, 866.7875, 867.0375, 867.2875, 867.5375, 867.7875, 868.0375, 868.2875, 868.5375, 868.7875, 866.0625, 866.3125, 866.5625, 866.8125, 867.0625, 867.3125, 867.5625, 867.8125], noise_threshold=5, sink_rate=48000, source_rate=4000000, talkgroup=1796, tone_threshold=0.1, track_analog=True, track_digital=True, voice_threshold=0.4): gr.hier_block2.__init__( self, "Trunked Radio", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signaturev(2, 2, [gr.sizeof_float*1, gr.sizeof_char*1]), ) ################################################## # Parameters ################################################## self.center_freq = center_freq self.find_chan_nums = find_chan_nums self.freq_list = freq_list self.noise_threshold = noise_threshold self.sink_rate = sink_rate self.source_rate = source_rate self.talkgroup = talkgroup self.tone_threshold = tone_threshold self.track_analog = track_analog self.track_digital = track_digital self.voice_threshold = voice_threshold ################################################## # Variables ################################################## self.baud_rate = baud_rate = 9600 self.samp_per_sym = samp_per_sym = sink_rate / baud_rate self.fp_sel_index = fp_sel_index = 0 ################################################## # Blocks ################################################## self.edacs_handle_eot_0 = edacs.handle_eot(sink_rate, 4800, tone_threshold, noise_threshold) def _fp_sel_index_probe(): while True: val = self.edacs_handle_eot_0.get_sel_index() try: self.set_fp_sel_index(val) except AttributeError: pass time.sleep(1.0 / (100)) _fp_sel_index_thread = threading.Thread(target=_fp_sel_index_probe) _fp_sel_index_thread.daemon = True _fp_sel_index_thread.start() self.rational_resampler_xxx_1 = filter.rational_resampler_fff( interpolation=int(sink_rate / 8000), decimation=1, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=int(sink_rate / 1000), decimation=int(source_rate / 1000), taps=None, fractional_bw=None) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(sink_rate / 1000), decimation=int(source_rate / 100000), taps=None, fractional_bw=None) self.low_pass_filter_0 = filter.fir_filter_ccf( 100, firdes.low_pass( 1, source_rate, .00625e6, .002e6, firdes.WIN_HAMMING, 6.76)) self.edacs_proc_msg_0 = edacs.proc_msg(talkgroup, freq_list, center_freq, find_chan_nums, track_analog, track_digital) self.edacs_find_chan_nums_0 = edacs.find_chan_nums(freq_list, center_freq, source_rate, voice_threshold) self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_PROVOICE,dsd.dsd_MOD_AUTO_SELECT,3,False,3) self.digital_gfsk_demod_0 = digital.gfsk_demod( samples_per_symbol=int(samp_per_sym), sensitivity=1.0, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False) self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb('010101010101010101010111000100100101010101010101', 0) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(1-fp_sel_index) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1024) self.blocks_add_xx_0 = blocks.add_vff(1) self.analog_sig_source_x_1 = analog.sig_source_c(source_rate, analog.GR_COS_WAVE, 0, 1, 0, 0) self.analog_sig_source_x_0 = analog.sig_source_c(source_rate, analog.GR_COS_WAVE, 0, 1, 0, 0) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=sink_rate, audio_decim=1, deviation=7000, audio_pass=6.25e3, audio_stop=10e3, gain=2.0, tau=75e-6, ) ################################################## # Connections ################################################## self.msg_connect((self.edacs_find_chan_nums_0, 'status_out'), (self.edacs_proc_msg_0, 'chan_status_in')) self.msg_connect((self.edacs_handle_eot_0, 'status_out'), (self.edacs_proc_msg_0, 'eot_status_in')) self.msg_connect((self.edacs_proc_msg_0, 'ctrl_freq'), (self.analog_sig_source_x_0, 'freq')) self.msg_connect((self.edacs_proc_msg_0, 'voice_freq'), (self.analog_sig_source_x_1, 'freq')) self.msg_connect((self.edacs_proc_msg_0, 'chan_status_out'), (self.edacs_find_chan_nums_0, 'status_in')) self.msg_connect((self.edacs_proc_msg_0, 'eot_status_out'), (self.edacs_handle_eot_0, 'status_in')) self.connect((self.analog_fm_demod_cf_0, 0), (self.edacs_handle_eot_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_add_xx_0, 0), (self, 0)) self.connect((self.blocks_delay_0, 0), (self.edacs_find_chan_nums_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.digital_correlate_access_code_bb_0, 0)) self.connect((self.digital_correlate_access_code_bb_0, 0), (self.edacs_proc_msg_0, 0)) self.connect((self.digital_gfsk_demod_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.edacs_handle_eot_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.edacs_handle_eot_0, 0), (self.dsd_block_ff_0, 0)) self.connect((self.edacs_proc_msg_0, 0), (self, 1)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self, 0), (self.blocks_delay_0, 0)) self.connect((self, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_gfsk_demod_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_add_xx_0, 1))
def __init__(self): gr.top_block.__init__(self, "Tes Dsd") Qt.QWidget.__init__(self) self.setWindowTitle("Tes Dsd") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "tes_dsd") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.tune_fi = tune_fi = 0 self.tune_co = tune_co = 0 self.freq_t = freq_t = (856.1e6) - tune_co - tune_fi self.variable_qtgui_label_0 = variable_qtgui_label_0 = int(freq_t) self.samp_rate = samp_rate = 1.024e6 self.rfgain = rfgain = 10 ################################################## # Blocks ################################################## self._rfgain_range = Range(0, 49, 1, 10, 200) self._rfgain_win = RangeWidget(self._rfgain_range, self.set_rfgain, 'RF Gain (dB)', "counter_slider", float) self.top_grid_layout.addWidget(self._rfgain_win, 0,3,1,1) self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_formatter = None else: self._variable_qtgui_label_0_formatter = lambda x: x self._variable_qtgui_label_0_tool_bar.addWidget(Qt.QLabel('Tuning Freq (Hz)'+": ")) self._variable_qtgui_label_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_formatter(self.variable_qtgui_label_0))) self._variable_qtgui_label_0_tool_bar.addWidget(self._variable_qtgui_label_0_label) self.top_grid_layout.addWidget(self._variable_qtgui_label_0_tool_bar, 0,0,1,1) self._tune_fi_range = Range(-10e3, 10e3, 100, 0, 200) self._tune_fi_win = RangeWidget(self._tune_fi_range, self.set_tune_fi, 'Fine Tune (Hz)', "counter_slider", float) self.top_grid_layout.addWidget(self._tune_fi_win, 0,2,1,1) self._tune_co_range = Range(-1e6, 1e6, 100, 0, 200) self._tune_co_win = RangeWidget(self._tune_co_range, self.set_tune_co, 'Coarse Tune (Hz)', "counter_slider", float) self.top_grid_layout.addWidget(self._tune_co_win, 0,1,1,1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 192e3, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not False: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [6, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 1,0,1,4) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 192e3, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-120, -20) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [0.7, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2,0,1,4) self.low_pass_filter_0 = filter.fir_filter_fff(6, firdes.low_pass( 0.001, 48000, 4e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_AUTO_DETECT,dsd.dsd_MOD_AUTO_SELECT,3,True,2) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.5, )) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_sink_0 = audio.sink(8000, '', True) self.RTL_DSD_0 = RTL_DSD( device_ppm=55, freq_t=freq_t, rf_gain=rfgain, samp_rate=2.4e6, ) ################################################## # Connections ################################################## self.connect((self.RTL_DSD_0, 1), (self.dsd_block_ff_0, 0)) self.connect((self.RTL_DSD_0, 1), (self.low_pass_filter_0, 0)) self.connect((self.RTL_DSD_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.RTL_DSD_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_add_xx_0, 1))
def __init__(self): gr.top_block.__init__(self, "Lang Rx") ################################################## # Variables ################################################## plutoip=os.environ.get('PLUTO_IP') if plutoip==None : plutoip='pluto.local' plutoip='ip:' + plutoip self.SQL = SQL = 50 self.RxOffset = RxOffset = 0 self.Mute = Mute = False self.Mode = Mode = 3 self.Filt_Low = Filt_Low = 300 self.Filt_High = Filt_High = 3000 self.FFTEn = FFTEn = 0 self.AFGain = AFGain = 20 ################################################## # Blocks ################################################## self.pluto_source_0 = iio.pluto_source(plutoip, 1000000000, 528000, 2000000, 0x800, True, True, True, "slow_attack", 64.0, '', True) self.logpwrfft_x_0 = logpwrfft.logpwrfft_c( sample_rate=48000, fft_size=512, ref_scale=2, frame_rate=15, avg_alpha=0.9, average=True, ) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(11, (firdes.low_pass(1,529200,23000,2000)), RxOffset, 528000) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*512) self.blocks_multiply_const_vxx_2_1 = blocks.multiply_const_vff((Mode==5, )) self.blocks_multiply_const_vxx_2_0 = blocks.multiply_const_vff((Mode==4, )) self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((Mode<4, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff(((AFGain/100.0) * (not Mute), )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*512, '/tmp/langstonefft', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_add_xx_1_0 = blocks.add_vff(1) self.blocks_add_xx_1 = blocks.add_vff(1) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_float*512, num_inputs=1, num_outputs=2, input_index=0, output_index=FFTEn, ) self.band_pass_filter_0 = filter.fir_filter_ccc(1, firdes.complex_band_pass( 1, 48000, Filt_Low, Filt_High, 100, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0 = audio.sink(48000, "hw:CARD=Device,DEV=0", False) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(SQL-100, 0.001, 0, False) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=48000, quad_rate=48000, tau=75e-6, max_dev=5e3, ) self.blocks_multiply_const_vxx_6 = blocks.multiply_const_vff((Mode==6, )) self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_DMR_MOTOTRBO,dsd.dsd_MOD_AUTO_SELECT,3,False,0) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=6, decimation=1, taps=None, fractional_bw=None, ) self.analog_agc3_xx_0 = analog.agc3_cc(1e-2, 5e-7, 0.1, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(1000) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_real_0_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_multiply_const_vxx_2_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.blks2_selector_0, 1), (self.blocks_file_sink_0, 0)) self.connect((self.blks2_selector_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_add_xx_1_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_multiply_const_vxx_2_1, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_const_vxx_2, 0)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_add_xx_1, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_1_0, 0)) self.connect((self.blocks_multiply_const_vxx_2_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_multiply_const_vxx_6, 0)) self.connect((self.blocks_multiply_const_vxx_6, 0), (self.dsd_block_ff_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_add_xx_1, 2)) self.connect((self.blocks_multiply_const_vxx_2_1, 0), (self.blocks_add_xx_1_0, 1)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.logpwrfft_x_0, 0)) self.connect((self.logpwrfft_x_0, 0), (self.blks2_selector_0, 0)) self.connect((self.pluto_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="VA3RFT") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1920000 self.offset = offset = 50000 self.gain = gain = 40 self.fsk_deviation_hz = fsk_deviation_hz = 8000 self.freq = freq = 444475000 self.corr = corr = 0 ################################################## # Blocks ################################################## _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='RX gain', converter=forms.float_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=49.6, num_steps=124, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_gain_sizer) _corr_sizer = wx.BoxSizer(wx.VERTICAL) self._corr_text_box = forms.text_box( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, label='Freq. correction', converter=forms.float_converter(), proportion=0, ) self._corr_slider = forms.slider( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, minimum=-150, maximum=150, num_steps=300, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_corr_sizer) self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=50, ref_level=-20, ref_scale=2.0, sample_rate=48000, fft_size=512, fft_rate=3, average=False, avg_alpha=None, title='Waterfall Plot', ) self.Add(self.wxgui_waterfallsink2_1.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title='Scope Plot', sample_rate=48000, v_scale=0.25, v_offset=0, t_scale=0.001, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label='Counts', ) self.Add(self.wxgui_scopesink2_0.win) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq - offset, 0) self.osmosdr_source_0.set_freq_corr(corr, 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(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.low_pass_filter_1 = filter.fir_filter_fff(1, firdes.low_pass( 1, 48000, 8000, 2000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf(40, firdes.low_pass( 20, samp_rate, 3500, 2000, firdes.WIN_HAMMING, 6.76)) self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_DMR_MOTOTRBO,dsd.dsd_MOD_AUTO_SELECT,3,True,2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.audio_sink_0 = audio.sink(8000, '', True) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -offset, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.audio_sink_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.wxgui_waterfallsink2_1, 0)) self.connect((self.low_pass_filter_1, 0), (self.dsd_block_ff_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_multiply_xx_0, 0))