def __init__(self, bb_gain=20, destination="localhost", filter_width=20000, freq=0, freq_corr=0, gpredict_port=4532, if_gain=20, offset=50e3, port=7355, rf_gain=40): gr.top_block.__init__(self, "FM/FSK receiver for an RTL-SDR device") ################################################## # Parameters ################################################## self.bb_gain = bb_gain self.destination = destination self.filter_width = filter_width self.freq = freq self.freq_corr = freq_corr self.gpredict_port = gpredict_port self.if_gain = if_gain self.offset = offset self.port = port self.rf_gain = rf_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.4e6 self.doppler_freq = doppler_freq = freq ################################################## # Blocks ################################################## self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "rtl" ) 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(freq_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(rf_gain, 0) self.osmosdr_source_0.set_if_gain(if_gain, 0) self.osmosdr_source_0.set_bb_gain(bb_gain, 0) self.osmosdr_source_0.set_antenna("", 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.gpredict_doppler_0 = gpredict.doppler(self.set_doppler_freq, "localhost", 4532, False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(50, (firdes.low_pass(1, samp_rate, filter_width/2.0, filter_width/20.0)), doppler_freq-freq+offset, samp_rate) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short*1, destination, port, 1472, True) self.blocks_float_to_short_0 = blocks.float_to_short(1, 32767) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.2) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Meteor QPSK LRPT") ################################################## # Variables ################################################## self.freq = freq = 137900000 self.symb_rate = symb_rate = 72000 self.samp_rate = samp_rate = 128000 self.doppler_freq = doppler_freq = freq self.sps = sps = (samp_rate * 1.0) / (symb_rate * 1.0) self.samp_rate_rtlsdr = samp_rate_rtlsdr = 1536000 self.pll_alpha = pll_alpha = float(sys.argv[2]) self.doppler_shift = doppler_shift = doppler_freq - freq self.decim = decim = 8 self.clock_alpha = clock_alpha = .001 self.bitstream_name = bitstream_name = sys.argv[1] + '.s' ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, samp_rate, symb_rate, 0.6, 361)) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=int(samp_rate_rtlsdr / samp_rate), taps=None, fractional_bw=None, ) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.osmosdr_source_0.set_sample_rate(samp_rate_rtlsdr) 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(2, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(True, 0) self.osmosdr_source_0.set_gain(44, 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.gpredict_doppler_0 = gpredict.doppler(self.set_doppler_freq, "localhost", 4532, True) self.digital_costas_loop_cc_0 = digital.costas_loop_cc( pll_alpha, 4, False) self.digital_constellation_soft_decoder_cf_1 = digital.constellation_soft_decoder_cf( digital.constellation_calcdist( ([-1 - 1j, -1 + 1j, 1 + 1j, 1 - 1j]), ([0, 1, 3, 2]), 4, 1).base()) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_cc( sps, clock_alpha**2 / 4.0, 0.5, clock_alpha, 0.005) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_char_0 = blocks.float_to_char(1, 127) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, bitstream_name, False) self.blocks_file_sink_0.set_unbuffered(False) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, doppler_shift, 1, 0) self.analog_rail_ff_0 = analog.rail_ff(-1, 1) self.analog_agc_xx_0 = analog.agc_cc(1000e-4, 0.5, 1.0) self.analog_agc_xx_0.set_max_gain(4000) ################################################## # Connections ################################################## self.connect((self.analog_agc_xx_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.analog_rail_ff_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_float_to_char_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc_xx_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_constellation_soft_decoder_cf_1, 0)) self.connect((self.digital_constellation_soft_decoder_cf_1, 0), (self.analog_rail_ff_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.digital_costas_loop_cc_0, 0))
def __init__(self): gr.top_block.__init__(self, "OPS-SAT UHF RX") Qt.QWidget.__init__(self) self.setWindowTitle("OPS-SAT UHF RX") qtgui.util.check_set_qss() 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", "os_uhf_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.signal_freq = signal_freq = 437.2e6 self.true_freq = true_freq = signal_freq self.samp_rate = samp_rate = 200e3 self.offset_freq = offset_freq = -40e3 self.doppler_freq = doppler_freq = true_freq - signal_freq self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass( 1.0, samp_rate, 25000, 1000, firdes.WIN_HAMMING, 6.76) self.samp_rate_down = samp_rate_down = 57.6e3 self.freq_tuned = freq_tuned = offset_freq - doppler_freq self.Squelch = Squelch = -130 ################################################## # Blocks ################################################## self._Squelch_range = Range(-180, -50, 1, -130, 200) self._Squelch_win = RangeWidget(self._Squelch_range, self.set_Squelch, "Squelch", "counter_slider", float) self.top_grid_layout.addWidget(self._Squelch_win) self.zeromq_pub_sink_0 = zeromq.pub_sink(gr.sizeof_gr_complex, 1, 'tcp://127.0.0.1:5555', 100, False, -1) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(samp_rate_down), decimation=int(samp_rate), taps=None, fractional_bw=None, ) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) 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.1) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: 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 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] 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(2): 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) self.gpredict_doppler_1 = gpredict.doppler(self.set_true_freq, "localhost", 4532, False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, (variable_low_pass_filter_taps_0), -freq_tuned, samp_rate) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/osops/tom/dev/workspace/osat_437.16M_200k_beacon_mode6.cf32', True) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(Squelch, 1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -freq_tuned, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.analog_simple_squelch_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.analog_simple_squelch_cc_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_simple_squelch_cc_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.zeromq_pub_sink_0, 0))
def __init__(self, bb_gain=20, destination='localhost', filter_width=20000, freq=145e6, freq_corr=0, gpredict_port=4532, if_gain=20, offset=40e3, port=7355, rf_gain=40): gr.top_block.__init__( self, "FM/FSK receiver for a FUNcube Dongle Pro+ device") ################################################## # Parameters ################################################## self.bb_gain = bb_gain self.destination = destination self.filter_width = filter_width self.freq = freq self.freq_corr = freq_corr self.gpredict_port = gpredict_port self.if_gain = if_gain self.offset = offset self.port = port self.rf_gain = rf_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 192e3 self.doppler_freq = doppler_freq = freq ################################################## # Blocks ################################################## self.gpredict_doppler_0 = gpredict.doppler('localhost', gpredict_port, False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 4, firdes.low_pass(1, samp_rate, filter_width / 2.0, filter_width / 20.0), doppler_freq - freq + offset, samp_rate) self.fcdproplus_fcdproplus_0 = fcdproplus.fcdproplus('', 1) self.fcdproplus_fcdproplus_0.set_lna(0) self.fcdproplus_fcdproplus_0.set_mixer_gain(0) self.fcdproplus_fcdproplus_0.set_if_gain(0) self.fcdproplus_fcdproplus_0.set_freq_corr(0) self.fcdproplus_fcdproplus_0.set_freq(freq - offset) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1, destination, port, 1472, True) self.blocks_float_to_short_0 = blocks.float_to_short(1, 32767) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.2) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.fcdproplus_fcdproplus_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0))
def __init__(self, freq=145.95e6, gain=38): gr.top_block.__init__(self, "MOVE II") ################################################## # Parameters ################################################## self.freq = freq self.gain = gain ################################################## # Variables ################################################## self.doppler_freq = doppler_freq = freq self.samp_rate_rtlsdr = samp_rate_rtlsdr = 1536000 self.samp_rate = samp_rate = 128000 self.filename = filename = "iq_{0}_f{1}_g{2}".format( time.strftime("%Y-%m-%d_%H-%M-%S"), int(freq), gain) self.doppler_shift = doppler_shift = doppler_freq - freq self.decim = decim = 8 ################################################## # Blocks ################################################## self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink( samp_rate, 0.0, 5, 2048, filename + ".wf", 1) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=int(samp_rate_rtlsdr / samp_rate), taps=None, fractional_bw=None, ) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.osmosdr_source_0.set_sample_rate(samp_rate_rtlsdr) 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(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.gpredict_doppler_0 = gpredict.doppler(self.set_doppler_freq, "0.0.0.0", 4532, True) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', 12345, 1472, False) self.blocks_streams_to_vector_0 = blocks.streams_to_vector( gr.sizeof_gr_complex * 1, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_gr_complex * 2, filename + ".raw_dpl", False) self.blocks_file_sink_0_0.set_unbuffered(False) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, doppler_shift, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_streams_to_vector_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.satnogs_waterfall_sink_0, 0)) self.connect((self.blocks_streams_to_vector_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_streams_to_vector_0, 0))
def __init__(self): gr.top_block.__init__(self, "APRS S-Gate") Qt.QWidget.__init__(self) self.setWindowTitle("APRS S-Gate") 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", "aprs_satgate") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.freq = freq = 145.825e6 self.variable_qtgui_label_0 = variable_qtgui_label_0 = int(freq) self.samp_rate = samp_rate = 2.4e6 self.rrc_taps = rrc_taps = firdes.root_raised_cosine(4, 48000, 1200, 0.35, 16*48000/1200) self.rfgain = rfgain = 35 self.audio_mute = audio_mute = True self.afgain = afgain = -7 ################################################## # Blocks ################################################## self._rfgain_range = Range(0, 49, 1, 35, 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, 3,0,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('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, 4,0,1,1) self.show_text_2 = display.show_text() self._show_text_2_win = sip.wrapinstance(self.show_text_2.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._show_text_2_win, 2,2,2,1) self.show_text_0 = display.show_text() self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._show_text_0_win, 2,0,1,2) 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(False) 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(-105, -20) 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, 0,2,1,1) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 2048, #size 1200, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-4, 4) self.qtgui_time_sink_x_2.set_y_label('Amplitude', "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(True) self.qtgui_time_sink_x_2.enable_axis_labels(False) self.qtgui_time_sink_x_2.enable_control_panel(False) if not False: self.qtgui_time_sink_x_2.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 2, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "blue", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [0.7, 0.7, 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_time_sink_x_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_2_win, 1,0,1,3) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 144.39e6, #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, -10) 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(False) 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 = ["red", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [0.8, 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, 0,0,1,2) self.igate_aprs_pkt_gen_0 = igate.aprs_pkt_gen(120, 'YD1SDL-10', 'APGRC', 'WIDE2-2', 240, 3, '!0745.80S/11022.51E` Temporary / Experimental APRS I/S-Gate') self.igate_aprs_is_sink_0 = igate.aprs_is_sink('rotate.aprs.net', 14580, 'YD1SDL-10', 24505) self.igate_aprs_demod_0 = igate.aprs_demod(48000) self.gpredict_doppler_0 = gpredict.doppler(self.set_freq, "localhost", 4532, True) self.fft_filter_xxx_3 = filter.fft_filter_fff(1, (firdes.band_pass(0.5,48e3,1e3,2400,1e2,firdes.WIN_HAMMING)), 1) self.fft_filter_xxx_3.declare_sample_delay(0) self.fft_filter_xxx_2 = filter.fft_filter_fff(2, (firdes.band_pass(0.25,48e3,400,2500,500,firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_2.declare_sample_delay(0) self.fft_filter_xxx_1 = filter.fft_filter_fff(1, (rrc_taps), 1) self.fft_filter_xxx_1.declare_sample_delay(0) self.fft_filter_xxx_0 = filter.fft_filter_ccc(1, (firdes.low_pass(1,48e3,1e3,1e2,firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff(48000 / 1200, 6.28 / 1000, (rrc_taps), 39, 20, 1.5, 1) self.blocks_wavfile_sink_0 = blocks.wavfile_sink('IO86-wav-dump.wav', 1, 24000, 16) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_rotator_cc_0 = blocks.rotator_cc(-1700 / 48e3 * 2 * math.pi) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float*1, 10) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(int(10e3*math.pi), 1.0/(10e3*math.pi), 4000) self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1) _audio_mute_check_box = Qt.QCheckBox('Audio Mute') self._audio_mute_choices = {True: True, False: False} self._audio_mute_choices_inv = dict((v,k) for k,v in self._audio_mute_choices.iteritems()) self._audio_mute_callback = lambda i: Qt.QMetaObject.invokeMethod(_audio_mute_check_box, "setChecked", Qt.Q_ARG("bool", self._audio_mute_choices_inv[i])) self._audio_mute_callback(self.audio_mute) _audio_mute_check_box.stateChanged.connect(lambda i: self.set_audio_mute(self._audio_mute_choices[bool(i)])) self.top_grid_layout.addWidget(_audio_mute_check_box, 4,1,1,1) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(48e3 / (2*math.pi*1200/8.0)) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.afsk_aprs2inet_1 = afsk.aprs2inet(12000, 4) self.afsk_afsk1200_0 = afsk.afsk1200(48000,4) self._afgain_range = Range(-20, -1, 0.1, -7, 200) self._afgain_win = RangeWidget(self._afgain_range, self.set_afgain, 'AF Gain (dB)', "counter_slider", float) self.top_grid_layout.addWidget(self._afgain_win, 3,1,1,1) self.RTL_APRS_RX_0 = RTL_APRS_RX( device_ppm=58, freq=freq, rf_gain=rfgain, samp_rate=samp_rate, ) ################################################## # Connections ################################################## self.msg_connect((self.igate_aprs_demod_0, 'out'), (self.igate_aprs_is_sink_0, 'in')) self.msg_connect((self.igate_aprs_pkt_gen_0, 'out'), (self.igate_aprs_is_sink_0, 'in')) self.connect((self.RTL_APRS_RX_0, 1), (self.fft_filter_xxx_2, 0)) self.connect((self.RTL_APRS_RX_0, 1), (self.fft_filter_xxx_3, 0)) self.connect((self.RTL_APRS_RX_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.RTL_APRS_RX_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.afsk_afsk1200_0, 0), (self.show_text_2, 0)) self.connect((self.afsk_aprs2inet_1, 0), (self.show_text_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_float_to_complex_0_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_repeat_0, 0), (self.afsk_aprs2inet_1, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.fft_filter_xxx_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.fft_filter_xxx_1, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.fft_filter_xxx_2, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.fft_filter_xxx_3, 0), (self.afsk_afsk1200_0, 0)) self.connect((self.fft_filter_xxx_3, 0), (self.blocks_float_to_complex_0_0, 0)) self.connect((self.fft_filter_xxx_3, 0), (self.igate_aprs_demod_0, 0))
def __init__(self, bb_gain=20, destination='localhost', freq=0, freq_corr=0, gpredict_port=4532, if_gain=20, offset=50e3, port=7355, rf_gain=40): gr.top_block.__init__(self, "SSB receiver for an RTL-SDR device") ################################################## # Parameters ################################################## self.bb_gain = bb_gain self.destination = destination self.freq = freq self.freq_corr = freq_corr self.gpredict_port = gpredict_port self.if_gain = if_gain self.offset = offset self.port = port self.rf_gain = rf_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.4e6 self.doppler_freq = doppler_freq = freq ################################################## # Blocks ################################################## self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + 'rtl') self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) 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(freq_corr, 0) self.osmosdr_source_0.set_gain(rf_gain, 0) self.osmosdr_source_0.set_if_gain(if_gain, 0) self.osmosdr_source_0.set_bb_gain(bb_gain, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.gpredict_doppler_0 = gpredict.doppler('localhost', gpredict_port, False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 50, firdes.low_pass(1, samp_rate, 1500, 500), doppler_freq - freq + offset, samp_rate) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1, destination, port, 1472, True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_short_0 = blocks.float_to_short(1, 32767) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_sig_source_x_0 = analog.sig_source_c( 48000, analog.GR_COS_WAVE, 1500, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() 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", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.down_samprate = down_samprate = 120e3 self.down_bw = down_bw = 20e3 self.up_symbolrate = up_symbolrate = 10e3 self.lpf_taps = lpf_taps = firdes.low_pass(1.0, down_samprate, down_bw / 2, down_bw / 8, firdes.WIN_HAMMING, 6.76) self.vfo = vfo = 30e3 self.up_samprate = up_samprate = down_samprate self.up_mod_index = up_mod_index = 2 self.up_gain = up_gain = 60 self.up_freq = up_freq = 436.5e6 self.up_bw = up_bw = up_symbolrate * 4 self.sc_id = sc_id = 1 self.lpf_ntaps = lpf_ntaps = len(lpf_taps) self.fcorr = fcorr = 0 self.down_symbolrate = down_symbolrate = 20e3 self.down_gain = down_gain = 23 self.down_freq = down_freq = 436.5e6 self.down_decim = down_decim = 3 ################################################## # Blocks ################################################## self._fcorr_range = Range(-15e3, 15e3, 100, 0, 200) self._fcorr_win = RangeWidget(self._fcorr_range, self.set_fcorr, "fcorr", "counter_slider", float) self.top_layout.addWidget(self._fcorr_win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(down_samprate) self.uhd_usrp_source_0.set_center_freq(down_freq - vfo, 0) self.uhd_usrp_source_0.set_gain(down_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_source_0.set_bandwidth(down_samprate / 2, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(up_samprate) self.uhd_usrp_sink_0.set_center_freq(up_freq + fcorr, 0) self.uhd_usrp_sink_0.set_gain(up_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(up_samprate / 2, 0) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype down_freq - vfo, #fc down_samprate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.1) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: 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 = [0, 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, -60) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size down_samprate / 1024, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] 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_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc down_samprate / down_decim, #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(-140, -40) 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(1.0) 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 = [1, 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.3, 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_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.kcsa_vitfilt27_bb_0_0 = kcsa.vitfilt27_bb() self.kcsa_vitfilt27_bb_0 = kcsa.vitfilt27_bb() self.kcsa_kiss_server_0 = kcsa.kiss_server('127.0.0.1', 2610, 1024, 25, 10) self.kcsa_halfduplex_tc_0 = kcsa.halfduplex_tc(1, 0, True, 128, 4) self.kcsa_fec_decode_b_0_0_0 = kcsa.fec_decode_b( 223, False, False, True, False) self.kcsa_fec_decode_b_0_0 = kcsa.fec_decode_b(223, False, False, True, False) self.gpredict_doppler_0 = gpredict.doppler(self.set_fcorr, "localhost", 4532, True) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( down_decim, (lpf_taps), vfo + fcorr, down_samprate) self.fir_filter_xxx_0 = filter.fir_filter_fff(1024, (np.ones(1024) / 1024)) self.fir_filter_xxx_0.declare_sample_delay(0) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=int(down_samprate / down_decim / down_symbolrate), gain_mu=0.175, mu=0.5, omega_relative_limit=0.02, freq_error=0.01, verbose=False, log=False, ) self.digital_gfsk_mod_0 = digital.gfsk_mod( samples_per_symbol=int(up_samprate / up_symbolrate), sensitivity=math.pi * up_mod_index / int(up_samprate / up_symbolrate), bt=0.5, verbose=False, log=False, ) self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_gr_complex * 1, '', "") self.blocks_tag_debug_0.set_display(True) self.blocks_rms_xx_0 = blocks.rms_cf(0.0001) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_char * 1, 1) ################################################## # Connections ################################################## self.msg_connect((self.kcsa_fec_decode_b_0_0, 'out'), (self.kcsa_kiss_server_0, 'in')) self.msg_connect((self.kcsa_fec_decode_b_0_0_0, 'out'), (self.kcsa_kiss_server_0, 'in')) self.msg_connect((self.kcsa_kiss_server_0, 'out'), (self.kcsa_halfduplex_tc_0, 'pdu')) self.connect((self.blocks_delay_0, 0), (self.kcsa_vitfilt27_bb_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.blocks_rms_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.digital_gfsk_mod_0, 0), (self.blocks_tag_debug_0, 0)) self.connect((self.digital_gfsk_mod_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blocks_delay_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.kcsa_vitfilt27_bb_0_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_rms_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.kcsa_halfduplex_tc_0, 0), (self.digital_gfsk_mod_0, 0)) self.connect((self.kcsa_vitfilt27_bb_0, 0), (self.kcsa_fec_decode_b_0_0, 0)) self.connect((self.kcsa_vitfilt27_bb_0_0, 0), (self.kcsa_fec_decode_b_0_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self, bb_gain=20, destination="localhost", freq=145e6, freq_corr=0, gpredict_port=4532, if_gain=20, offset=30e3, port=7355, rf_gain=40): gr.top_block.__init__(self, "SSB receiver for a FUNcube Dongle Pro+ device") ################################################## # Parameters ################################################## self.bb_gain = bb_gain self.destination = destination self.freq = freq self.freq_corr = freq_corr self.gpredict_port = gpredict_port self.if_gain = if_gain self.offset = offset self.port = port self.rf_gain = rf_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 192e3 self.doppler_freq = doppler_freq = freq ################################################## # Blocks ################################################## self.gpredict_doppler_0 = gpredict.doppler(self.set_doppler_freq, "localhost", 4532, False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 4, (firdes.low_pass(1, samp_rate, 1500, 500)), doppler_freq - freq + offset, samp_rate) self.fcdproplus_fcdproplus_0 = fcdproplus.fcdproplus("", 1) self.fcdproplus_fcdproplus_0.set_lna(0) self.fcdproplus_fcdproplus_0.set_mixer_gain(0) self.fcdproplus_fcdproplus_0.set_if_gain(0) self.fcdproplus_fcdproplus_0.set_freq_corr(0) self.fcdproplus_fcdproplus_0.set_freq(freq - offset) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1, destination, port, 1472, True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_short_0 = blocks.float_to_short(1, 32767) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_sig_source_x_0 = analog.sig_source_c( 48000, analog.GR_COS_WAVE, 1500, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.fcdproplus_fcdproplus_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_multiply_xx_0, 1))
def __init__(self): gr.top_block.__init__(self, "VCC Burst TX/RX, 9600 Baud GMSK, AX.25, w/ PTT") Qt.QWidget.__init__(self) self.setWindowTitle("VCC Burst TX/RX, 9600 Baud GMSK, AX.25, w/ PTT") qtgui.util.check_set_qss() 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", "burst_trx_gmsk9600_ax25_n210") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.tx_freq = tx_freq = 401.12e6 self.uplink_freq = uplink_freq = tx_freq self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y%m%d_%H%M%S" ) self.gs_id = gs_id = "VTGS" self.tx_tune = tx_tune = tx_freq - uplink_freq self.samp_rate = samp_rate = float(250e3) self.man_tune = man_tune = 0.0 self.fn = fn = "VCC_{:s}_{:s}".format(gs_id, ts_str) self.uplink_offset = uplink_offset = -1* tx_tune self.tx_tune_sel = tx_tune_sel = 0 self.tx_sel = tx_sel = [tx_tune, -1*man_tune] self.tx_offset = tx_offset = samp_rate/2 self.tx_gain = tx_gain = 10 self.trigger_thresh = trigger_thresh = -2 self.rx_offset = rx_offset = samp_rate/2.0 self.rx_gain = rx_gain = 20 self.rx_freq = rx_freq = 401.08e6 self.interp_2 = interp_2 = 1 self.interp = interp = 48 self.fsk_dev = fsk_dev = 10000 self.fp = fp = "/vtgs/captures/vcc/{:s}".format(fn) self.decim_2 = decim_2 = 2 self.decim = decim = int(samp_rate/2000) self.chan_filt_trans = chan_filt_trans = 1000 self.chan_filt_cutoff = chan_filt_cutoff = 24000 self.ceres_offset = ceres_offset = 40e3 self.bb_gain = bb_gain = .75 ################################################## # Blocks ################################################## self.main_tab = Qt.QTabWidget() self.main_tab_widget_0 = Qt.QWidget() self.main_tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_0) self.main_tab_grid_layout_0 = Qt.QGridLayout() self.main_tab_layout_0.addLayout(self.main_tab_grid_layout_0) self.main_tab.addTab(self.main_tab_widget_0, 'Full Band') self.main_tab_widget_1 = Qt.QWidget() self.main_tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_1) self.main_tab_grid_layout_1 = Qt.QGridLayout() self.main_tab_layout_1.addLayout(self.main_tab_grid_layout_1) self.main_tab.addTab(self.main_tab_widget_1, 'RX Channel') self.main_tab_widget_2 = Qt.QWidget() self.main_tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_2) self.main_tab_grid_layout_2 = Qt.QGridLayout() self.main_tab_layout_2.addLayout(self.main_tab_grid_layout_2) self.main_tab.addTab(self.main_tab_widget_2, 'TX Channel') self.top_grid_layout.addWidget(self.main_tab, 0, 0, 2, 8) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self._tx_tune_sel_options = (0, 1, ) self._tx_tune_sel_labels = ('Auto', 'Manual', ) self._tx_tune_sel_tool_bar = Qt.QToolBar(self) self._tx_tune_sel_tool_bar.addWidget(Qt.QLabel('TX Tune Mode'+": ")) self._tx_tune_sel_combo_box = Qt.QComboBox() self._tx_tune_sel_tool_bar.addWidget(self._tx_tune_sel_combo_box) for label in self._tx_tune_sel_labels: self._tx_tune_sel_combo_box.addItem(label) self._tx_tune_sel_callback = lambda i: Qt.QMetaObject.invokeMethod(self._tx_tune_sel_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._tx_tune_sel_options.index(i))) self._tx_tune_sel_callback(self.tx_tune_sel) self._tx_tune_sel_combo_box.currentIndexChanged.connect( lambda i: self.set_tx_tune_sel(self._tx_tune_sel_options[i])) self.main_tab_grid_layout_2.addWidget(self._tx_tune_sel_tool_bar, 3, 1, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(1, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('TX Gain'+": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect( lambda: self.set_tx_gain(eng_notation.str_to_num(str(self._tx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_gain_tool_bar, 2, 3, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(3, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._tx_freq_tool_bar = Qt.QToolBar(self) self._tx_freq_tool_bar.addWidget(Qt.QLabel('TX Freq'+": ")) self._tx_freq_line_edit = Qt.QLineEdit(str(self.tx_freq)) self._tx_freq_tool_bar.addWidget(self._tx_freq_line_edit) self._tx_freq_line_edit.returnPressed.connect( lambda: self.set_tx_freq(eng_notation.str_to_num(str(self._tx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_freq_tool_bar, 2, 0, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._trigger_thresh_tool_bar = Qt.QToolBar(self) self._trigger_thresh_tool_bar.addWidget(Qt.QLabel('Trigger Thresh'+": ")) self._trigger_thresh_line_edit = Qt.QLineEdit(str(self.trigger_thresh)) self._trigger_thresh_tool_bar.addWidget(self._trigger_thresh_line_edit) self._trigger_thresh_line_edit.returnPressed.connect( lambda: self.set_trigger_thresh(eng_notation.str_to_num(str(self._trigger_thresh_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._trigger_thresh_tool_bar, 4, 4, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel('RX Gain'+": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect( lambda: self.set_rx_gain(eng_notation.str_to_num(str(self._rx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_gain_tool_bar, 4, 2, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._rx_freq_tool_bar = Qt.QToolBar(self) self._rx_freq_tool_bar.addWidget(Qt.QLabel('RX Freq'+": ")) self._rx_freq_line_edit = Qt.QLineEdit(str(self.rx_freq)) self._rx_freq_tool_bar.addWidget(self._rx_freq_line_edit) self._rx_freq_line_edit.returnPressed.connect( lambda: self.set_rx_freq(eng_notation.str_to_num(str(self._rx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_freq_tool_bar, 4, 0, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._ceres_offset_tool_bar = Qt.QToolBar(self) self._ceres_offset_tool_bar.addWidget(Qt.QLabel('Ceres Offset'+": ")) self._ceres_offset_line_edit = Qt.QLineEdit(str(self.ceres_offset)) self._ceres_offset_tool_bar.addWidget(self._ceres_offset_line_edit) self._ceres_offset_line_edit.returnPressed.connect( lambda: self.set_ceres_offset(eng_notation.str_to_num(str(self._ceres_offset_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._ceres_offset_tool_bar, 3, 4, 1, 2) for r in range(3, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel('BB Gain'+": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect( lambda: self.set_bb_gain(eng_notation.str_to_num(str(self._bb_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._bb_gain_tool_bar, 2, 2, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 3): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx_0 = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_0_win = self.vcc_qt_hex_text_tx_0; self.main_tab_grid_layout_1.addWidget(self._vcc_qt_hex_text_tx_0_win, 5, 0, 2, 6) for r in range(5, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_win = self.vcc_qt_hex_text_tx; self.main_tab_grid_layout_2.addWidget(self._vcc_qt_hex_text_tx_win, 0, 0, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._uplink_offset_tool_bar = Qt.QToolBar(self) if None: self._uplink_offset_formatter = None else: self._uplink_offset_formatter = lambda x: eng_notation.num_to_str(x) self._uplink_offset_tool_bar.addWidget(Qt.QLabel("uplink_offset"+": ")) self._uplink_offset_label = Qt.QLabel(str(self._uplink_offset_formatter(self.uplink_offset))) self._uplink_offset_tool_bar.addWidget(self._uplink_offset_label) self.main_tab_grid_layout_2.addWidget(self._uplink_offset_tool_bar, 2, 1, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(1, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_clock_source('external', 0) self.uhd_usrp_source_1.set_time_source('external', 0) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq, rx_offset), 0) self.uhd_usrp_source_1.set_gain(rx_gain, 0) self.uhd_usrp_source_1.set_antenna('RX2', 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("addr=192.168.10.6", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_clock_source('external', 0) self.uhd_usrp_sink_0.set_time_source('external', 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(tx_freq, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.sigmf_sink_0 = gr_sigmf.sink("cf32", fp, gr_sigmf.sigmf_time_mode_absolute, False) self.sigmf_sink_0.set_global_meta("core:sample_rate", samp_rate) self.sigmf_sink_0.set_global_meta("core:description", 'VCC TM/TC v1.0.0, GMSK9600, AX.25, w/ PTT') self.sigmf_sink_0.set_global_meta("core:author", 'Zach Leffke') self.sigmf_sink_0.set_global_meta("core:license", 'MIT') self.sigmf_sink_0.set_global_meta("core:hw", '2X M2 400CP30, ARR Preamp, N210 w/ UBX') self.rffe_ctl_tag_ptt_pdu_0 = rffe_ctl.tag_ptt_pdu(samp_rate,"tx_sob","tx_eob","tx_time","TX") self.rational_resampler_xxx_4 = filter.rational_resampler_ccc( interpolation=interp/2, decimation=decim, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_3 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=interp_2, decimation=decim_2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.0010) self.qtgui_waterfall_sink_x_0_0.enable_grid(True) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-50, 50) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 2, 0, 2, 4) for r in range(2, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(True) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: 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 = [0, 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.main_tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 1, 0, 1, 8) for r in range(1, 2): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "VCC RX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_1.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0_1.set_y_axis(-150, -40) self.qtgui_freq_sink_x_1_0_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_1.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_1.enable_grid(True) self.qtgui_freq_sink_x_1_0_1.set_fft_average(0.2) self.qtgui_freq_sink_x_1_0_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_1.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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_freq_sink_x_1_0_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_1_0_1_win, 0, 0, 1, 8) for r in range(0, 1): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate/decim*interp/2, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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_freq_sink_x_1_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 2, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "Ceres Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0.set_y_axis(-50, 50) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate*interp/decim*interp_2/decim_2, #bw "Burst RX Spectrum", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['orig', 'corr', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] 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(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win, 0, 4, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0; self.main_tab_grid_layout_2.addWidget(self._pyqt_text_output_0_win, 4, 0, 1, 4) for r in range(4, 5): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_meta_text_output_0_win, 3, 6, 4, 2) for r in range(3, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(6, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_ctime_plot_0_win, 2, 4, 1, 4) for r in range(2, 3): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._man_tune_tool_bar = Qt.QToolBar(self) self._man_tune_tool_bar.addWidget(Qt.QLabel('TX Freq Offset'+": ")) self._man_tune_line_edit = Qt.QLineEdit(str(self.man_tune)) self._man_tune_tool_bar.addWidget(self._man_tune_line_edit) self._man_tune_line_edit.returnPressed.connect( lambda: self.set_man_tune(eng_notation.str_to_num(str(self._man_tune_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._man_tune_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate / decim *interp, chan_filt_cutoff, chan_filt_trans, firdes.WIN_HAMMING, 6.76)) self.gpredict_doppler_0 = gpredict.doppler("0.0.0.0", 7356, True) self.gpredict_MsgPairToVar_1 = gpredict.MsgPairToVar(self.set_uplink_freq) self.gmsk_tx_burst_hier2_0 = gmsk_tx_burst_hier2( bb_gain=bb_gain, bt=.5, delay_enable=1, pad_front=0, pad_tail=0, ptt_delay=.25, samp_rate=samp_rate, ) self.gmsk_ax25_rx_hier_0 = gmsk_ax25_rx_hier( lpf_cutoff=7.2e3, lpf_trans=1e3, quad_demod_gain=(samp_rate/decim*interp/decim_2*interp_2)/(2*math.pi*fsk_dev/8.0), samp_rate=48000, samps_per_symb=5, ) self.fsk_burst_detector_0 = fsk_burst_detector( avg_len=100.0, cons_offset=3, decim=decim, fsk_dev=fsk_dev, interp=interp, samp_rate=samp_rate, ) self.burst_rx_es_hier_0 = burst_rx_es_hier( avg_len=100, baud=9600, samp_rate=samp_rate/decim*interp, samps_per_symb=10, trigger_thresh=trigger_thresh, ) self.blocks_socket_pdu_0_2 = blocks.socket_pdu("TCP_SERVER", '10.42.0.21', '8000', 1024, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8001', 1024, True) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1 * ceres_offset, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1 * tx_sel[tx_tune_sel], 1, 0) self.analog_agc2_xx_0 = analog.agc2_cc(10, 1e-1, 65536, 1) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.gmsk_tx_burst_hier2_0, 'kiss/ax25')) self.msg_connect((self.burst_rx_es_hier_0, 'brst_corr'), (self.pyqt_ctime_plot_0, 'cpdus')) self.msg_connect((self.burst_rx_es_hier_0, 'meta'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.blocks_socket_pdu_0_2, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.vcc_qt_hex_text_tx_0, 'pdus')) self.msg_connect((self.gmsk_tx_burst_hier2_0, 'ax25'), (self.vcc_qt_hex_text_tx, 'pdus')) self.msg_connect((self.gpredict_doppler_0, 'freq'), (self.gpredict_MsgPairToVar_1, 'inpair')) self.msg_connect((self.rffe_ctl_tag_ptt_pdu_0, 'ptt'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_4, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.burst_rx_es_hier_0, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.burst_rx_es_hier_0, 1), (self.rational_resampler_xxx_3, 0)) self.connect((self.fsk_burst_detector_0, 0), (self.burst_rx_es_hier_0, 1)) self.connect((self.gmsk_ax25_rx_hier_0, 0), (self.qtgui_freq_sink_x_1, 1)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.rffe_ctl_tag_ptt_pdu_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.burst_rx_es_hier_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.fsk_burst_detector_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.rational_resampler_xxx_3, 0), (self.gmsk_ax25_rx_hier_0, 0)) self.connect((self.rational_resampler_xxx_4, 0), (self.qtgui_freq_sink_x_1_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_freq_sink_x_1_0_1, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.sigmf_sink_0, 0))
def __init__(self, rf_freq=401.12e6): gr.top_block.__init__(self, "Burst Trx Gmsk9600 Ax25") Qt.QWidget.__init__(self) self.setWindowTitle("Burst Trx Gmsk9600 Ax25") qtgui.util.check_set_qss() 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", "burst_trx_gmsk9600_ax25") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.rf_freq = rf_freq ################################################## # Variables ################################################## self.uplink_freq = uplink_freq = rf_freq self.tx_tune = tx_tune = rf_freq - uplink_freq self.samp_rate = samp_rate = float(250e3) self.uplink_offset = uplink_offset = -1 * tx_tune self.tx_offset = tx_offset = 0 self.tx_gain = tx_gain = 67 self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y-%m-%dT%H:%M:%S.%fZ") self.interp = interp = 24 self.decim = decim = int(samp_rate / 2000) self.bb_gain = bb_gain = 1 ################################################## # Blocks ################################################## self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel('BB Gain' + ": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect(lambda: self.set_bb_gain( eng_notation.str_to_num( str(self._bb_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._bb_gain_tool_bar, 4, 0, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_win = self.vcc_qt_hex_text_tx self.top_grid_layout.addWidget(self._vcc_qt_hex_text_tx_win, 6, 0, 2, 4) for r in range(6, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._uplink_offset_tool_bar = Qt.QToolBar(self) if None: self._uplink_offset_formatter = None else: self._uplink_offset_formatter = lambda x: eng_notation.num_to_str(x ) self._uplink_offset_tool_bar.addWidget( Qt.QLabel("uplink_offset" + ": ")) self._uplink_offset_label = Qt.QLabel( str(self._uplink_offset_formatter(self.uplink_offset))) self._uplink_offset_tool_bar.addWidget(self._uplink_offset_label) self.top_grid_layout.addWidget(self._uplink_offset_tool_bar, 0, 4, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('TX Gain' + ": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect(lambda: self.set_tx_gain( eng_notation.str_to_num( str(self._tx_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._tx_gain_tool_bar, 4, 2, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self.rffe_ctl_tag_ptt_pdu_0 = rffe_ctl.tag_ptt_pdu( samp_rate, "tx_sob", "tx_eob", "tx_time", "TX") self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] 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_freq_sink_x_1_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 0, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6, 4, 2, 4) for r in range(6, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.gpredict_doppler_0 = gpredict.doppler("localhost", 7356, False) self.gpredict_MsgPairToVar_1 = gpredict.MsgPairToVar( self.set_uplink_freq) self.gmsk_tx_burst_hier2_0 = gmsk_tx_burst_hier2( bt=.5, delay_enable=1, pad_front=0, pad_tail=0, ptt_delay=.200, samp_rate=samp_rate, ) self.blocks_tag_debug_1 = blocks.tag_debug(gr.sizeof_gr_complex * 1, '', "") self.blocks_tag_debug_1.set_display(True) self.blocks_socket_pdu_0_2 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8000', 1024, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8001', 1024, True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (bb_gain, )) self.blocks_message_debug_0 = blocks.message_debug() self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -1 * tx_tune, 1, 0) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.gmsk_tx_burst_hier2_0, 'kiss/ax25')) self.msg_connect((self.gmsk_tx_burst_hier2_0, 'ax25'), (self.vcc_qt_hex_text_tx, 'pdus')) self.msg_connect((self.gpredict_doppler_0, 'freq'), (self.gpredict_MsgPairToVar_1, 'inpair')) self.msg_connect((self.rffe_ctl_tag_ptt_pdu_0, 'ptt'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_tag_debug_1, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.rffe_ctl_tag_ptt_pdu_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_1_0_0, 0))
def __init__(self, bb_gain=20, destination="localhost", freq=0, freq_corr=0, gpredict_port=4532, if_gain=40, offset=50e3, port=7355, rf_gain=40): gr.top_block.__init__(self, "SSB receiver for an Airspy device") ################################################## # Parameters ################################################## self.bb_gain = bb_gain self.destination = destination self.freq = freq self.freq_corr = freq_corr self.gpredict_port = gpredict_port self.if_gain = if_gain self.offset = offset self.port = port self.rf_gain = rf_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.5e6 self.doppler_freq = doppler_freq = freq ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=24, decimation=25, taps=None, fractional_bw=None, ) 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(freq_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(rf_gain, 0) self.osmosdr_source_0.set_if_gain(if_gain, 0) self.osmosdr_source_0.set_bb_gain(bb_gain, 0) self.osmosdr_source_0.set_antenna("", 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.gpredict_doppler_0 = gpredict.doppler(self.set_doppler_freq, "localhost", 4532, False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 50, (firdes.low_pass(1, samp_rate, 1500, 500)), doppler_freq - freq + offset, samp_rate) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1, destination, port, 1472, True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_short_0 = blocks.float_to_short(1, 32767) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_sig_source_x_0 = analog.sig_source_c( 48000, analog.GR_COS_WAVE, 1500, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 1))
def __init__(self, callsign='', gpredict_port=4532, latitude=0, longitude=0): gr.top_block.__init__(self, "LilacSat-2 decoder for FUNcube Dongle Pro+") ################################################## # Parameters ################################################## self.callsign = callsign self.gpredict_port = gpredict_port self.latitude = latitude self.longitude = longitude ################################################## # Variables ################################################## self.sub_sps = sub_sps = 32 self.sub_nfilts = sub_nfilts = 16 self.sub_alpha = sub_alpha = 0.35 self.sps = sps = 5 self.nfilts = nfilts = 16 self.freq = freq = 437.2e6 self.alpha = alpha = 0.35 self.variable_constellation_0 = variable_constellation_0 = digital.constellation_calcdist(([-1, 1]), ([0, 1]), 2, 1).base() self.threshold = threshold = 4 self.sub_rrc_taps = sub_rrc_taps = firdes.root_raised_cosine(sub_nfilts, sub_nfilts, 1.0/float(sub_sps), sub_alpha, 11*sub_sps*sub_nfilts) self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), alpha, 11*sps*nfilts) self.rf_samp_rate = rf_samp_rate = 192000 self.offset = offset = 30e3 self.if_samp_rate = if_samp_rate = 48000 self.doppler_freq = doppler_freq = freq self.af_samp_rate = af_samp_rate = 9600 ################################################## # Blocks ################################################## self.sync_to_pdu_0_1_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_1 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_0_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sync_to_pdu_0 = sync_to_pdu( packlen=(114+32)*8, sync="00011010110011111111110000011101", threshold=threshold, ) self.sids_submit_0 = sids.submit('http://tlm.pe0sat.nl/tlmdb/frame_db.php', 40908, callsign, longitude, latitude, '') self.sids_print_timestamp_0 = sids.print_timestamp('%Y-%m-%d %H:%M:%S') self.low_pass_filter_3_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, if_samp_rate, 8e3, 2e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass( 1, af_samp_rate, 200, 50, firdes.WIN_HAMMING, 6.76)) self.libfec_decode_rs_0_0_0 = libfec.decode_rs(True, 0) self.libfec_decode_rs_0_0 = libfec.decode_rs(True, 0) self.libfec_decode_rs_0 = libfec.decode_rs(True, 0) self.kiss_kiss_to_pdu_0_1 = kiss.kiss_to_pdu(False) self.kiss_kiss_to_pdu_0_0 = kiss.kiss_to_pdu(False) self.kiss_kiss_to_pdu_0 = kiss.kiss_to_pdu(False) self.gpredict_doppler_0 = gpredict.doppler(self.set_doppler_freq, "localhost", 4532, False) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(rf_samp_rate/if_samp_rate, (filter.firdes.low_pass(1,rf_samp_rate,10000,2000)), doppler_freq - freq + offset, rf_samp_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(rf_samp_rate/if_samp_rate, (filter.firdes.low_pass(1,rf_samp_rate,5000,2000)), doppler_freq - freq + offset + 25e3, rf_samp_rate) self.fcdproplus_fcdproplus_0 = fcdproplus.fcdproplus('',1) self.fcdproplus_fcdproplus_0.set_lna(0) self.fcdproplus_fcdproplus_0.set_mixer_gain(0) self.fcdproplus_fcdproplus_0.set_if_gain(0) self.fcdproplus_fcdproplus_0.set_freq_corr(0) self.fcdproplus_fcdproplus_0.set_freq(freq-offset) self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_fff(sub_sps, 0.0628, (sub_rrc_taps), sub_nfilts, sub_nfilts/2, 0.01, 1) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, 0.100, (rrc_taps), nfilts, nfilts/2, 1.5, 2) self.digital_lms_dd_equalizer_cc_0_0 = digital.lms_dd_equalizer_cc(2, 0.3, 2, variable_constellation_0) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(sps, 0.350, 100, 0.1) self.digital_diff_decoder_bb_0_0 = digital.diff_decoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc(0.4, 2, False) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(10, 0.25*0.175*0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_1 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True) self.ccsds_viterbi_0_1 = ccsds_viterbi() self.ccsds_viterbi_0_0_0 = ccsds_viterbi() self.ccsds_viterbi_0_0 = ccsds_viterbi() self.ccsds_viterbi_0 = ccsds_viterbi() self.ccsds_descrambler_0_0_0 = ccsds_descrambler() self.ccsds_descrambler_0_0 = ccsds_descrambler() self.ccsds_descrambler_0 = ccsds_descrambler() self.blocks_pdu_to_tagged_stream_0_1 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_message_debug_0 = blocks.message_debug() self.blocks_delay_0_0_0 = blocks.delay(gr.sizeof_float*1, 1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float*1, 1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.5) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=af_samp_rate, quad_rate=if_samp_rate, tau=75e-6, max_dev=3.5e3, ) self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(1024, 2) ################################################## # Connections ################################################## self.msg_connect((self.ccsds_descrambler_0, 'out'), (self.libfec_decode_rs_0, 'in')) self.msg_connect((self.ccsds_descrambler_0_0, 'out'), (self.libfec_decode_rs_0_0, 'in')) self.msg_connect((self.ccsds_descrambler_0_0_0, 'out'), (self.libfec_decode_rs_0_0_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_0, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_0, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_1, 'out'), (self.sids_print_timestamp_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0_1, 'out'), (self.sids_submit_0, 'in')) self.msg_connect((self.libfec_decode_rs_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.libfec_decode_rs_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.libfec_decode_rs_0_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_1, 'pdus')) self.msg_connect((self.sids_print_timestamp_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.sync_to_pdu_0, 'out'), (self.ccsds_descrambler_0, 'in')) self.msg_connect((self.sync_to_pdu_0_0, 'out'), (self.ccsds_descrambler_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_0_0, 'out'), (self.ccsds_descrambler_0_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_1, 'out'), (self.ccsds_descrambler_0_0, 'in')) self.msg_connect((self.sync_to_pdu_0_1_0, 'out'), (self.ccsds_descrambler_0_0_0, 'in')) self.connect((self.analog_feedforward_agc_cc_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.ccsds_viterbi_0_1, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ccsds_viterbi_0_0_0, 0)) self.connect((self.blocks_delay_0_0_0, 0), (self.ccsds_viterbi_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.kiss_kiss_to_pdu_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.kiss_kiss_to_pdu_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_1, 0), (self.kiss_kiss_to_pdu_0_1, 0)) self.connect((self.ccsds_viterbi_0, 0), (self.sync_to_pdu_0_1_0, 0)) self.connect((self.ccsds_viterbi_0_0, 0), (self.sync_to_pdu_0_0_0, 0)) self.connect((self.ccsds_viterbi_0_0_0, 0), (self.digital_diff_decoder_bb_0_0, 0)) self.connect((self.ccsds_viterbi_0_1, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.digital_binary_slicer_fb_1, 0), (self.sync_to_pdu_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_delay_0_0_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.ccsds_viterbi_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.digital_lms_dd_equalizer_cc_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.sync_to_pdu_0_1, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.sync_to_pdu_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_lms_dd_equalizer_cc_0_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_binary_slicer_fb_1, 0)) self.connect((self.fcdproplus_fcdproplus_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.fcdproplus_fcdproplus_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.analog_feedforward_agc_cc_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.low_pass_filter_3_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.low_pass_filter_3_0_0, 0), (self.analog_nbfm_rx_0, 0))
def __init__(self): gr.top_block.__init__(self, "TGS FM Transciever") Qt.QWidget.__init__(self) self.setWindowTitle("TGS FM Transciever") 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", "fm_transciever") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.rx_center_freq = rx_center_freq = 100e6 self.doppler_freq = doppler_freq = rx_center_freq self.tx_ptt = tx_ptt = 1 self.tx_gain = tx_gain = 30 self.tx_freq = tx_freq = 100e6 self.samp_rate = samp_rate = 250e3 self.rx_switch = rx_switch = 1 self.rx_mode = rx_mode = 1 self.rx_gain = rx_gain = 30 self.doppler_shift = doppler_shift = int(doppler_freq - rx_center_freq) self.doppler_mode = doppler_mode = 0 self.audio_rate = audio_rate = 48e3 self.audio_interp = audio_interp = 4 ################################################## # Blocks ################################################## self.wrapper = Qt.QTabWidget() self.wrapper_widget_0 = Qt.QWidget() self.wrapper_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.wrapper_widget_0) self.wrapper_grid_layout_0 = Qt.QGridLayout() self.wrapper_layout_0.addLayout(self.wrapper_grid_layout_0) self.wrapper.addTab(self.wrapper_widget_0, 'RX') self.wrapper_widget_1 = Qt.QWidget() self.wrapper_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.wrapper_widget_1) self.wrapper_grid_layout_1 = Qt.QGridLayout() self.wrapper_layout_1.addLayout(self.wrapper_grid_layout_1) self.wrapper.addTab(self.wrapper_widget_1, 'TX') self.top_layout.addWidget(self.wrapper) _tx_ptt_push_button = Qt.QPushButton('PTT') self._tx_ptt_choices = {'Pressed': 0, 'Released': 1} _tx_ptt_push_button.pressed.connect( lambda: self.set_tx_ptt(self._tx_ptt_choices['Pressed'])) _tx_ptt_push_button.released.connect( lambda: self.set_tx_ptt(self._tx_ptt_choices['Released'])) self.wrapper_grid_layout_1.addWidget(_tx_ptt_push_button, 1, 0, 1, 4) self._tx_gain_range = Range(0, 90, 1, 30, 200) self._tx_gain_win = RangeWidget(self._tx_gain_range, self.set_tx_gain, 'TX Gain', "counter_slider", float) self.wrapper_grid_layout_1.addWidget(self._tx_gain_win, 0, 2, 1, 2) self._tx_freq_tool_bar = Qt.QToolBar(self) self._tx_freq_tool_bar.addWidget(Qt.QLabel('TX Freq' + ": ")) self._tx_freq_line_edit = Qt.QLineEdit(str(self.tx_freq)) self._tx_freq_tool_bar.addWidget(self._tx_freq_line_edit) self._tx_freq_line_edit.returnPressed.connect(lambda: self.set_tx_freq( eng_notation.str_to_num( str(self._tx_freq_line_edit.text().toAscii())))) self.wrapper_grid_layout_1.addWidget(self._tx_freq_tool_bar, 0, 0, 1, 2) _rx_switch_check_box = Qt.QCheckBox('RX Switch') self._rx_switch_choices = {True: 0, False: 1} self._rx_switch_choices_inv = dict( (v, k) for k, v in self._rx_switch_choices.iteritems()) self._rx_switch_callback = lambda i: Qt.QMetaObject.invokeMethod( _rx_switch_check_box, "setChecked", Qt.Q_ARG("bool", self._rx_switch_choices_inv[i])) self._rx_switch_callback(self.rx_switch) _rx_switch_check_box.stateChanged.connect( lambda i: self.set_rx_switch(self._rx_switch_choices[bool(i)])) self.wrapper_grid_layout_0.addWidget(_rx_switch_check_box, 1, 0, 1, 2) self._rx_mode_options = ( 0, 1, ) self._rx_mode_labels = ( 'NBFM RX', 'WBFM RX', ) self._rx_mode_tool_bar = Qt.QToolBar(self) self._rx_mode_tool_bar.addWidget(Qt.QLabel('RX Mode' + ": ")) self._rx_mode_combo_box = Qt.QComboBox() self._rx_mode_tool_bar.addWidget(self._rx_mode_combo_box) for label in self._rx_mode_labels: self._rx_mode_combo_box.addItem(label) self._rx_mode_callback = lambda i: Qt.QMetaObject.invokeMethod( self._rx_mode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._rx_mode_options.index(i))) self._rx_mode_callback(self.rx_mode) self._rx_mode_combo_box.currentIndexChanged.connect( lambda i: self.set_rx_mode(self._rx_mode_options[i])) self.wrapper_grid_layout_0.addWidget(self._rx_mode_tool_bar, 1, 2, 1, 2) self._rx_gain_range = Range(0, 90, 1, 30, 200) self._rx_gain_win = RangeWidget(self._rx_gain_range, self.set_rx_gain, 'RX gain', "counter_slider", float) self.wrapper_grid_layout_0.addWidget(self._rx_gain_win, 0, 2, 1, 2) self._rx_center_freq_tool_bar = Qt.QToolBar(self) self._rx_center_freq_tool_bar.addWidget(Qt.QLabel('RX Freq' + ": ")) self._rx_center_freq_line_edit = Qt.QLineEdit(str(self.rx_center_freq)) self._rx_center_freq_tool_bar.addWidget(self._rx_center_freq_line_edit) self._rx_center_freq_line_edit.returnPressed.connect( lambda: self.set_rx_center_freq( eng_notation.str_to_num( str(self._rx_center_freq_line_edit.text().toAscii())))) self.wrapper_grid_layout_0.addWidget(self._rx_center_freq_tool_bar, 0, 0, 1, 2) self._doppler_shift_tool_bar = Qt.QToolBar(self) if None: self._doppler_shift_formatter = None else: self._doppler_shift_formatter = lambda x: x self._doppler_shift_tool_bar.addWidget( Qt.QLabel('Doppler Shift' + ": ")) self._doppler_shift_label = Qt.QLabel( str(self._doppler_shift_formatter(self.doppler_shift))) self._doppler_shift_tool_bar.addWidget(self._doppler_shift_label) self.top_layout.addWidget(self._doppler_shift_tool_bar) _doppler_mode_check_box = Qt.QCheckBox('Doppler correction') self._doppler_mode_choices = {True: 1, False: 0} self._doppler_mode_choices_inv = dict( (v, k) for k, v in self._doppler_mode_choices.iteritems()) self._doppler_mode_callback = lambda i: Qt.QMetaObject.invokeMethod( _doppler_mode_check_box, "setChecked", Qt.Q_ARG("bool", self._doppler_mode_choices_inv[i])) self._doppler_mode_callback(self.doppler_mode) _doppler_mode_check_box.stateChanged.connect( lambda i: self.set_doppler_mode(self._doppler_mode_choices[bool(i)] )) self.top_layout.addWidget(_doppler_mode_check_box) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(rx_center_freq, 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(tx_freq, 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=int(samp_rate), decimation=int(audio_interp * audio_rate), taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(audio_rate * audio_interp), decimation=int(samp_rate), taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "RX Waterfall", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0_0.enable_grid(False) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.wrapper_grid_layout_0.addWidget( self._qtgui_waterfall_sink_x_0_0_win, 2, 2, 1, 2) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "TX Waterfall", #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 True: 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 = [0, 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.wrapper_grid_layout_1.addWidget( self._qtgui_waterfall_sink_x_0_win, 2, 2, 1, 2) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "RX FFT", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(True) self.qtgui_freq_sink_x_0_0.enable_grid(True) self.qtgui_freq_sink_x_0_0.set_fft_average(0.1) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] 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_freq_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.wrapper_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_0_win, 2, 0, 1, 2) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "TX FFT", #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(-140, 10) 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(True) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.1) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: 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 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] 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_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.wrapper_grid_layout_1.addWidget(self._qtgui_freq_sink_x_0_win, 2, 0, 1, 2) self.gpredict_doppler_0_0 = gpredict.doppler(self.set_doppler_freq, "localhost", 4532, True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blks2_valve_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex * 1, open=bool(rx_switch)) self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float * 1, open=bool(tx_ptt)) self.blks2_selector_1_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex * 1, num_inputs=2, num_outputs=1, input_index=doppler_mode, output_index=0, ) self.blks2_selector_1 = grc_blks2.selector( item_size=gr.sizeof_float * 1, num_inputs=2, num_outputs=1, input_index=rx_mode, output_index=0, ) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex * 1, num_inputs=1, num_outputs=2, input_index=0, output_index=rx_mode, ) self.audio_source_0 = audio.source(int(audio_rate), '', True) self.audio_sink_0 = audio.sink(int(audio_rate), '', True) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=audio_interp * audio_rate, audio_decimation=audio_interp, ) self.analog_sig_source_x_1 = analog.sig_source_c( int(audio_rate * audio_interp), analog.GR_COS_WAVE, doppler_shift, 1, 0) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=int(audio_rate), quad_rate=int(audio_rate * audio_interp), tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=int(audio_rate), quad_rate=int(audio_rate * audio_interp), tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_rx_0, 0), (self.blks2_selector_1, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_wfm_rcv_0, 0), (self.blks2_selector_1, 1)) self.connect((self.audio_source_0, 0), (self.blks2_valve_0, 0)) self.connect((self.blks2_selector_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.blks2_selector_0, 1), (self.analog_wfm_rcv_0, 0)) self.connect((self.blks2_selector_1, 0), (self.audio_sink_0, 0)) self.connect((self.blks2_selector_1_0, 0), (self.blks2_selector_0, 0)) self.connect((self.blks2_valve_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blks2_valve_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.blks2_valve_0_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.blks2_valve_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blks2_selector_1_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.blks2_selector_1_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blks2_valve_0_0, 0))
def __init__(self, bb_gain=20, destination='localhost', filter_width=20000, freq=0, freq_corr=0, gpredict_port=4532, if_gain=20, offset=50e3, port=7355, rf_gain=40): gr.top_block.__init__(self, "FM/FSK receiver for an Airspy device") ################################################## # Parameters ################################################## self.bb_gain = bb_gain self.destination = destination self.filter_width = filter_width self.freq = freq self.freq_corr = freq_corr self.gpredict_port = gpredict_port self.if_gain = if_gain self.offset = offset self.port = port self.rf_gain = rf_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.5e6 self.doppler_freq = doppler_freq = freq ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=24, decimation=25, taps=None, fractional_bw=None) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + 'rtl') self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) 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(freq_corr, 0) self.osmosdr_source_0.set_gain(rf_gain, 0) self.osmosdr_source_0.set_if_gain(if_gain, 0) self.osmosdr_source_0.set_bb_gain(bb_gain, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.gpredict_doppler_0 = gpredict.doppler('localhost', gpredict_port, False) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 50, firdes.low_pass(1, samp_rate, filter_width / 2.0, filter_width / 20.0), doppler_freq - freq + offset, samp_rate) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1, destination, port, 1472, True) self.blocks_float_to_short_0 = blocks.float_to_short(1, 32767) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.2) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0))