def __init__(self, varicode_decode=True, differential_decode=True): gr.hier_block2.__init__( self, "Coherent PSK31 Demodulator", gr.io_signature(1, 1, gr.sizeof_gr_complex * 1), gr.io_signature(1, 1, gr.sizeof_char * 1), ) our_blocks = [self] constellation = digital.constellation_bpsk().base() our_blocks.append(digital.constellation_decoder_cb(constellation)) if differential_decode: # PSK31 defines 0 as a phase change, opposite the usual # differential encoding which is: out = (next - prev) % 2 our_blocks.extend([ digital.diff_decoder_bb(2), blocks.not_bb(), blocks.and_const_bb(1), ]) if varicode_decode: our_blocks.append(varicode_decode_bb()) our_blocks.append(self) self.connect(*our_blocks)
def __init__(self): gr.hier_block2.__init__( self, "AX.25 Packet Deformatter", gr.io_signature(1, 1, gr.sizeof_char * 1), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_out("out") ################################################## # Blocks ################################################## self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(8, 512) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_and_const_xx_0 = blocks.and_const_bb(0x01) self.amateur_AX25_Packet_Decoder_0 = amateur.AX25_Packet_Decoder() ################################################## # Connections ################################################## self.msg_connect((self.amateur_AX25_Packet_Decoder_0, 'out'), (self, 'out')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.amateur_AX25_Packet_Decoder_0, 'in')) self.connect((self.blocks_and_const_xx_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self, 0), (self.digital_diff_decoder_bb_0, 0))
def __init__(self, samp_per_sym=4): gr.hier_block2.__init__( self, "PSK31 Modulator", gr.io_signature(1, 1, gr.sizeof_char*1), gr.io_signature(1, 1, gr.sizeof_gr_complex*1), ) self.samp_per_sym = samp_per_sym self.connect( self, # PSK31 defines 0 as a phase change, opposite the usual # differential encoding which is: out = (next - prev) % 2 blocks.not_bb(), blocks.and_const_bb(1), digital.diff_encoder_bb(2), blocks.char_to_float(1, 1), blocks.add_const_vff((-0.5, )), blocks.multiply_const_vff((2, )), interp_fir_filter_fff(samp_per_sym, self._envelope_taps()), blocks.float_to_complex(1), self, )
def test_and_const_bb (self): src_data = (1, 2, 3, 0x50, 0x11) expected_result = (0, 2, 2, 0x00, 0x00) src = blocks.vector_source_b(src_data) op = blocks.and_const_bb (0xAA) dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(dst.data(), expected_result)
def test_and_const_bb(self): src_data = [1, 2, 3, 0x50, 0x11] expected_result = [0, 2, 2, 0x00, 0x00] src = blocks.vector_source_b(src_data) op = blocks.and_const_bb(0xAA) dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(dst.data(), expected_result)
def __init__(self): gr.hier_block2.__init__(self, "BitErrors", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(1, 1, gr.sizeof_int)) intdump_decim = min(int(N_BITS / 10), 100000) self.connect(self, blocks.skiphead(gr.sizeof_char, SKIP), blocks.not_bb(), blocks.and_const_bb(1), blocks.uchar_to_float(), blocks.integrate_ff(intdump_decim), blocks.multiply_const_ff(1.0 / intdump_decim), self)
def __init__(self, EbN0): gr.top_block.__init__(self, "BER Simulation") ################################################## # Variables ################################################## self.N_BITS = N_BITS = 1e5 self.EbN0 = EbN0 self.sps = sps = 5 self.samp_rate = samp_rate = 32000 self.noise_voltage = noise_voltage = 1.0 / math.sqrt( 1 / float(sps) * 10 ** (float(EbN0) / 10) ) self.intdump_decim = intdump_decim = min(int(N_BITS / 10), 100000) self.const = const = digital.constellation_bpsk().base() self.alpha = alpha = 0.35 self.SKIP = SKIP = 1000 self.RAND_SEED = RAND_SEED = 42 ################################################## # Blocks ################################################## self.lilacsat1_ber_bpsk_0 = lilacsat1_ber_bpsk( bfo=12000, callsign="", ip="::", latitude=0, longitude=0, port=7355, recstart="", ) self.digital_scrambler_bb_0 = digital.scrambler_bb(0x21, 0x0, 16) self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0x00, 16) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=const, differential=False, samples_per_symbol=sps, pre_diff_code=True, excess_bw=alpha, verbose=False, log=False, ) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise_voltage, frequency_offset=0.0, epsilon=1.0, taps=(0, 0, (1 + 1j) / numpy.sqrt(2),), noise_seed=RAND_SEED, block_tags=False, ) self.blocks_vector_source_x_0 = blocks.vector_source_b([1], True, 1, []) self.blocks_vector_sink_x_0 = blocks.vector_sink_f(1, 1024) self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_char * 1, SKIP) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_multiply_const_vxx_1 = blocks.multiply_const_cc(0.1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(1.0 / intdump_decim) self.blocks_integrate_xx_0 = blocks.integrate_ff(intdump_decim, 1) self.blocks_head_0 = blocks.head(gr.sizeof_char * 1, int(N_BITS)) self.blocks_and_const_xx_0 = blocks.and_const_bb(1) ################################################## # Connections ################################################## self.connect((self.blocks_and_const_xx_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.blocks_head_0, 0), (self.digital_scrambler_bb_0, 0)) self.connect( (self.blocks_integrate_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0) ) self.connect( (self.blocks_multiply_const_vxx_0, 0), (self.blocks_vector_sink_x_0, 0) ) self.connect( (self.blocks_multiply_const_vxx_1, 0), (self.lilacsat1_ber_bpsk_0, 0) ) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect( (self.blocks_pack_k_bits_bb_0, 0), (self.digital_constellation_modulator_0, 0), ) self.connect((self.blocks_skiphead_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_head_0, 0)) self.connect( (self.channels_channel_model_0, 0), (self.blocks_multiply_const_vxx_1, 0) ) self.connect( (self.digital_constellation_modulator_0, 0), (self.channels_channel_model_0, 0), ) self.connect((self.digital_descrambler_bb_0, 0), (self.blocks_skiphead_0, 0)) self.connect( (self.digital_diff_decoder_bb_0, 0), (self.digital_descrambler_bb_0, 0) ) self.connect( (self.digital_diff_encoder_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0) ) self.connect( (self.digital_scrambler_bb_0, 0), (self.digital_diff_encoder_bb_0, 0) ) self.connect( (self.lilacsat1_ber_bpsk_0, 0), (self.digital_diff_decoder_bb_0, 0) )
def __init__(self, inc_samp_rate): gr.hier_block2.__init__(self, "fsk_demod", gr.io_signature(1, 1, gr.sizeof_float), # Input signature gr.io_signature(1, 1, gr.sizeof_char) # Output signature ) self.inc_samp_rate = inc_samp_rate self.sps = sps = 4 self.baud_rate = baud_rate = 1200 self.samp_rate = samp_rate = sps * baud_rate * 4 self.mark = mark = 2200 self.space = space = 1200 self.center = center = int((mark + space) / 2) ################################################## # Blocks ################################################## # Stage 1: Force resampling to 19.2ksps self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=samp_rate, decimation=self.inc_samp_rate, taps=None, fractional_bw=None, ) # Stage 2: Bandpass Filter self.bpf_width = bpf_width = 800 self.bpf_trans = bpf_trans = 200 self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass( 1, samp_rate, 1700-bpf_width, 1700+bpf_width, bpf_trans, firdes.WIN_RECTANGULAR, 6.76)) # Stage 3: Tone Detection self.window_len = window_len = self.samp_rate/self.baud_rate*2 self.window = window = signal.windows.cosine(window_len) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_fcf(4, (window), mark, samp_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcf(4, (window), space, samp_rate) self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) # Stage 4: AGC self.decay = decay = 0.00022 self.attack = attack = 0.8 self.bruninga_direwolf_agc_0_0 = bruninga.direwolf_agc(attack, decay) self.bruninga_direwolf_agc_0 = bruninga.direwolf_agc(attack, decay) self.blocks_sub_xx_1 = blocks.sub_ff(1) # Stage 5: Clock Recovery self.gain_mu = gain_mu = 0.45 self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(self.sps*(1+0.0), 0.25*gain_mu*gain_mu, 0.5, gain_mu, 0.05) # Stage 6: Differential Decoding self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_and_const_xx_0 = blocks.and_const_bb(1) # Stage 7: Output self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() ################################################## # Connections ################################################## self.connect((self, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.blocks_complex_to_mag_0_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.bruninga_direwolf_agc_0, 0)) self.connect((self.blocks_complex_to_mag_0_0, 0), (self.bruninga_direwolf_agc_0_0, 0)) self.connect((self.bruninga_direwolf_agc_0_0, 0), (self.blocks_sub_xx_1, 1)) self.connect((self.bruninga_direwolf_agc_0, 0), (self.blocks_sub_xx_1, 0)) self.connect((self.blocks_sub_xx_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0))
def __init__(self, EbN0, viterbi=False): gr.top_block.__init__(self) self.sps = 5 alpha = 0.35 const = digital.constellation_bpsk().base() modulator = digital.generic_mod( constellation=const, differential=False, samples_per_symbol=self.sps, pre_diff_code=True, excess_bw=alpha, verbose=False, log=False, ) channel = channels.channel_model( noise_voltage=self.EbN0_to_noise_voltage(EbN0, viterbi), frequency_offset=0, epsilon=1.0, taps=(0, 0, (1+1j)/numpy.sqrt(2), ), noise_seed=RAND_SEED, block_tags=False ) self.sink = blocks.vector_sink_f() biterrors = BitErrors() dut = lilacsat1_ber_viterbi() if viterbi else lilacsat1_ber_bpsk() pack = blocks.pack_k_bits_bb(8) descrambler = digital.descrambler_bb(0x21, 0x00, 16) self.connect(blocks.vector_source_b([1], repeat=True), blocks.head(gr.sizeof_char, int(N_BITS)), digital.scrambler_bb(0x21, 0x00, 16), digital.diff_encoder_bb(2), pack) self.connect(modulator, channel, blocks.multiply_const_cc(0.1), # we set some amplitude to test the agc # signal amplitude 1 seems very important dut, digital.diff_decoder_bb(2), descrambler) self.connect(biterrors, self.sink) if viterbi: deinterleave_viterbi = blocks.deinterleave(gr.sizeof_char) interleave_viterbi = blocks.interleave(gr.sizeof_char) self.connect(pack, fec.encode_ccsds_27_bb(), deinterleave_viterbi) self.connect((deinterleave_viterbi, 0), (interleave_viterbi, 1)) self.connect((deinterleave_viterbi, 1), blocks.not_bb(), blocks.and_const_bb(1), (interleave_viterbi, 0)) self.connect(interleave_viterbi, blocks.pack_k_bits_bb(8), modulator) descrambler2 = digital.descrambler_bb(0x21, 0x00, 16) self.connect((dut, 1), digital.diff_decoder_bb(2), descrambler2) or2 = blocks.or_bb() self.connect(descrambler, or2) self.connect(descrambler2, (or2, 1)) self.connect(or2, biterrors) #self.sinkviterbi1 = blocks.vector_sink_b() #self.sinkviterbi2 = blocks.vector_sink_b() #self.connect(descrambler, self.sinkviterbi1) #self.connect(descrambler2, self.sinkviterbi2) else: self.connect(pack, modulator) self.connect(descrambler, biterrors)
def __init__( self, EbN0=0, esprit_decimation=128, fc=436e6, mx=4, my=4, n=1, phi=50, rs_decimation=8, theta=30, ): gr.top_block.__init__(self, "BER Simulation") ################################################## # Parameters ################################################## self.EbN0 = EbN0 self.esprit_decimation = esprit_decimation self.fc = fc self.mx = mx self.my = my self.n = n self.phi = phi self.rs_decimation = rs_decimation self.theta = theta ################################################## # Variables ################################################## self.sps = sps = 5 self.N_BITS = N_BITS = 1e5 self.samp_rate = samp_rate = 32000 self.noise_voltage = noise_voltage = 1.0 / math.sqrt( 1 / float(sps) * 10**(float(EbN0) / 10)) self.intdump_decim = intdump_decim = min(int(N_BITS / 10), 100000) self.const = const = digital.constellation_bpsk().base() self.alpha = alpha = 0.35 self.SKIP = SKIP = 1000 self.RAND_SEED = RAND_SEED = 42 ################################################## # Blocks ################################################## self.lilacsat1_ber_bpsk_0 = lilacsat1_ber_bpsk( bfo=12000, callsign="", ip="::", latitude=0, longitude=0, port=7355, recstart="", ) self.digital_scrambler_bb_0 = digital.scrambler_bb(0x21, 0x0, 16) self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0x00, 16) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=const, differential=False, samples_per_symbol=sps, pre_diff_code=True, excess_bw=alpha, verbose=False, log=False, ) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise_voltage, frequency_offset=0.0, epsilon=1.0, taps=( 0, 0, (1 + 1j) / numpy.sqrt(2), ), noise_seed=RAND_SEED, block_tags=False, ) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, mx * my) self.blocks_vector_source_x_0 = blocks.vector_source_b([1], True, 1, []) self.blocks_vector_sink_x_0_0_0 = blocks.vector_sink_f(1, 1024) self.blocks_vector_sink_x_0_0 = blocks.vector_sink_f(1, 1024) self.blocks_vector_sink_x_0 = blocks.vector_sink_f(1, 1024) self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, mx * my) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_char * 1, SKIP) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_multiply_const_vxx_1 = blocks.multiply_const_cc(0.1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff( 1.0 / intdump_decim) self.blocks_integrate_xx_0 = blocks.integrate_ff(intdump_decim, 1) self.blocks_head_0 = blocks.head(gr.sizeof_char * 1, int(N_BITS)) self.blocks_and_const_xx_0 = blocks.and_const_bb(1) self.beamforming_randomsampler_py_cc_0_0 = beamforming.randomsampler_py_cc( mx * my, rs_decimation) self.beamforming_phasedarray_py_cc_0 = beamforming.phasedarray_py_cc( mx, my, theta, phi, fc, 0) self.beamforming_doaesprit_py_cf_0 = beamforming.doaesprit_py_cf( 128, mx, my, fc, n) self.beamforming_beamformer_py_cc_0 = beamforming.beamformer_py_cc( mx, my, fc, 0, 0, 8 * 128) ################################################## # Connections ################################################## self.connect( (self.beamforming_beamformer_py_cc_0, 0), (self.blocks_multiply_const_vxx_1, 0), ) self.connect( (self.beamforming_doaesprit_py_cf_0, 0), (self.beamforming_beamformer_py_cc_0, 1), ) self.connect( (self.beamforming_doaesprit_py_cf_0, 1), (self.beamforming_beamformer_py_cc_0, 2), ) self.connect((self.beamforming_doaesprit_py_cf_0, 0), (self.blocks_vector_sink_x_0_0, 0)) self.connect( (self.beamforming_doaesprit_py_cf_0, 1), (self.blocks_vector_sink_x_0_0_0, 0), ) self.connect( (self.beamforming_phasedarray_py_cc_0, 0), (self.blocks_vector_to_stream_0, 0), ) self.connect( (self.beamforming_randomsampler_py_cc_0_0, 0), (self.beamforming_doaesprit_py_cf_0, 0), ) self.connect((self.blocks_and_const_xx_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.blocks_head_0, 0), (self.digital_scrambler_bb_0, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_vector_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.lilacsat1_ber_bpsk_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect( (self.blocks_pack_k_bits_bb_0, 0), (self.digital_constellation_modulator_0, 0), ) self.connect((self.blocks_skiphead_0, 0), (self.blocks_not_xx_0, 0)) self.connect( (self.blocks_stream_to_vector_0, 0), (self.beamforming_beamformer_py_cc_0, 0), ) self.connect( (self.blocks_stream_to_vector_0, 0), (self.beamforming_randomsampler_py_cc_0_0, 0), ) self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_head_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect( (self.digital_constellation_modulator_0, 0), (self.beamforming_phasedarray_py_cc_0, 0), ) self.connect((self.digital_descrambler_bb_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_diff_encoder_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.digital_scrambler_bb_0, 0), (self.digital_diff_encoder_bb_0, 0)) self.connect((self.lilacsat1_ber_bpsk_0, 0), (self.digital_diff_decoder_bb_0, 0))
def __init__(self): gr.top_block.__init__(self, "Aprs Rx Test") Qt.QWidget.__init__(self) self.setWindowTitle("Aprs Rx Test") 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_rx_test") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 self.sps = sps = int(samp_rate / 1200) self.gain_mu = gain_mu = 0.175 ################################################## # Blocks ################################################## 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_time_sink_x_0 = qtgui.time_sink_f( 2048, #size 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(True) 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.fsk_demod_0 = fsk_demod( baud=1200, fsk_hi_tone=2200, fsk_lo_tone=1200, in_sps=sps, out_sps=2, ) self.fft_filter_xxx_0 = filter.fft_filter_fff(1, (firdes.band_pass( 1, samp_rate, 1000, 2400, 300, firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.epy_block_0 = epy_block_0.blk() self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(32, 500) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( 2 * (1 + 0.0), 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/handiko/aprs_test.wav', True) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_not_xx_0 = blocks.not_bb() self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.1, )) self.blocks_and_const_xx_0 = blocks.and_const_bb(1) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_sink_0 = audio.sink(int(samp_rate), '', True) self.analog_fastnoise_source_x_0 = analog.fastnoise_source_f( analog.GR_UNIFORM, 0.1, 0, 8192) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.epy_block_0, 'hdlc in')) self.msg_connect((self.epy_block_0, 'ax25 out'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.fsk_demod_0, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self.digital_hdlc_deframer_bp_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.show_text_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.fsk_demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "TEXT TXRX") Qt.QWidget.__init__(self) self.setWindowTitle("TEXT TXRX") 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", "text_simulation") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.tail_len = tail_len = 5 self.sps = sps = 10 self.ptype = ptype = 'rect' self.bps = bps = 1 self.alpha = alpha = 0.2 self.tag = tag = gr.tag_utils.python_to_tag( (0, pmt.intern("Z"), pmt.intern("0x5a"), pmt.intern("Vsrc"))) self.samp_rate = samp_rate = 320e3 self.pttaps2 = pttaps2 = pam.pamhRt(sps, ptype, [tail_len, alpha]) self.pttaps = pttaps = pam.pamampt(sps, ptype, [tail_len, alpha]) self.polarity = polarity = 1 self.noise = noise = 0 self.gain = gain = 1 self.delay = delay = 0 self.b_eds = b_eds = 0 self.M = M = 2**bps self.FB = FB = 32000 ################################################## # Blocks ################################################## # Create the options list self._polarity_options = ( 0, 1, ) # Create the labels list self._polarity_labels = ( 'unipolar', 'polar', ) # Create the combo box # Create the radio buttons self._polarity_group_box = Qt.QGroupBox('polarity' + ": ") self._polarity_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._polarity_button_group = variable_chooser_button_group() self._polarity_group_box.setLayout(self._polarity_box) for i, _label in enumerate(self._polarity_labels): radio_button = Qt.QRadioButton(_label) self._polarity_box.addWidget(radio_button) self._polarity_button_group.addButton(radio_button, i) self._polarity_callback = lambda i: Qt.QMetaObject.invokeMethod( self._polarity_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._polarity_options.index(i))) self._polarity_callback(self.polarity) self._polarity_button_group.buttonClicked[int].connect( lambda i: self.set_polarity(self._polarity_options[i])) self.top_grid_layout.addWidget(self._polarity_group_box) self._noise_range = Range(0, 2, 0.01, 0, 200) self._noise_win = RangeWidget(self._noise_range, self.set_noise, 'noise', "counter_slider", float) self.top_grid_layout.addWidget(self._noise_win) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "RX_TD", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0_0.enable_tags(True) self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] 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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "TX_TD", #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(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) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] 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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0_0_0_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "RX_FD", #name 1) self.qtgui_freq_sink_x_0_0_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0_0_0.set_trigger_mode( qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0_0_0.enable_control_panel(False) self.qtgui_freq_sink_x_0_0_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 range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "TX_FD", #name 1) 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(False) 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) 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 range(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) # Create the options list self._ptype_options = ( 'rect', 'tri', 'sinc', 'rcf', 'rrcf', ) # Create the labels list self._ptype_labels = ( 'rect', 'tri', 'sinc', 'rcf', 'rrcf', ) # Create the combo box # Create the radio buttons self._ptype_group_box = Qt.QGroupBox('ptype' + ": ") self._ptype_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ptype_button_group = variable_chooser_button_group() self._ptype_group_box.setLayout(self._ptype_box) for i, _label in enumerate(self._ptype_labels): radio_button = Qt.QRadioButton(_label) self._ptype_box.addWidget(radio_button) self._ptype_button_group.addButton(radio_button, i) self._ptype_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ptype_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ptype_options.index(i))) self._ptype_callback(self.ptype) self._ptype_button_group.buttonClicked[int].connect( lambda i: self.set_ptype(self._ptype_options[i])) self.top_grid_layout.addWidget(self._ptype_group_box) self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff( sps, pttaps) self.interp_fir_filter_xxx_0.declare_sample_delay(0) self.fir_filter_xxx_1 = filter.fir_filter_fff(sps, [1]) self.fir_filter_xxx_1.declare_sample_delay(0) self.fir_filter_xxx_0_0 = filter.fir_filter_fff(1, pttaps2) self.fir_filter_xxx_0_0.declare_sample_delay(0) self.blocks_vector_source_x_0 = blocks.vector_source_b( list(ord(i) for i in "Zombie"), True, 1, [tag]) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( bps, b_eds) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( bps, b_eds) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(gain) self.blocks_float_to_char_0 = blocks.float_to_char( 1, polarity * 0.5 + (1 - polarity) * 1) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char * 1, '/dev/pts/0', False) self.blocks_file_sink_0_0.set_unbuffered(False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, '/dev/pts/1', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_delay_0_1 = blocks.delay(gr.sizeof_char * 1, delay) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float * 1, delay) self.blocks_char_to_float_0 = blocks.char_to_float( 1, polarity * 0.5 + (1 - polarity) * 1) self.blocks_and_const_xx_0_0 = blocks.and_const_bb(255) self.blocks_and_const_xx_0 = blocks.and_const_bb(255) self.blocks_add_xx_0 = blocks.add_vff(1) self.blocks_add_const_vxx_0_0 = blocks.add_const_ff(polarity * (M - 1) + (1 - polarity) * 0) self.blocks_add_const_vxx_0 = blocks.add_const_ff(-polarity * (M - 1) + (1 - polarity) * 0) self.analog_fastnoise_source_x_0 = analog.fastnoise_source_f( analog.GR_GAUSSIAN, noise, 0, 8192) ################################################## # Connections ################################################## self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_add_const_vxx_0_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.fir_filter_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.blocks_and_const_xx_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.fir_filter_xxx_1, 0)) self.connect((self.blocks_delay_0_1, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.blocks_delay_0_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.interp_fir_filter_xxx_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.blocks_and_const_xx_0_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.fir_filter_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.fir_filter_xxx_1, 0), (self.qtgui_freq_sink_x_0_0_0_0, 0)) self.connect((self.fir_filter_xxx_1, 0), (self.qtgui_time_sink_x_0_0_0, 0)) self.connect((self.interp_fir_filter_xxx_0, 0), (self.blocks_add_xx_0, 0))
def __init__(self, baudrate=9600, costas_loop_bw=2*math.pi/200, excess_bw=0.5, fll_loop_bw=2*math.pi/350, max_cfo=4e3, rf_samp_rate=2.4e6, symbol_Sync_loop_bw=2*math.pi/100): gr.hier_block2.__init__(self, "bpsk_ax25_demod", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature gr.io_signaturev(3, 3, [gr.sizeof_gr_complex*1, gr.sizeof_gr_complex*1, gr.sizeof_gr_complex*1]) ) # Output signature self.message_port_register_hier_out("out") ################################################## # Parameters ################################################## self.baudrate = baudrate self.costas_loop_bw = costas_loop_bw self.excess_bw = excess_bw self.fll_loop_bw = fll_loop_bw self.max_cfo = max_cfo self.rf_samp_rate = rf_samp_rate self.symbol_Sync_loop_bw = symbol_Sync_loop_bw ################################################## # Variables ################################################## self.samp_rate = samp_rate = 9600*20 self.sps = sps = int(samp_rate/baudrate) self.nfilts = nfilts = 64 self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 11*sps*nfilts) self.bpsk_constellation = bpsk_constellation = digital.constellation_bpsk().base() ################################################## # Blocks ################################################## self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf( samp_rate/rf_samp_rate, taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.low_pass_filter_0_0_0 = filter.interp_fir_filter_ccf(1, firdes.low_pass( 1, samp_rate, ((1.0 + excess_bw) * baudrate/2.0) + min(baudrate, abs(1000*1.2)), baudrate / 10.0, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0 = filter.interp_fir_filter_ccf(1, firdes.low_pass( 1, samp_rate, (max_cfo+baudrate/2), baudrate / 10.0, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.interp_fir_filter_ccf(1, firdes.low_pass( 1, samp_rate, (max_cfo+baudrate/2), baudrate / 10.0, firdes.WIN_HAMMING, 6.76)) self.hsl_rms_agc_0 = hsl.rms_agc(alpha=1e-2, reference=0.5, ) self.hsl_kiss_encoder_0 = hsl.kiss_encoder() self.digital_symbol_sync_xx_0_0 = digital.symbol_sync_cc(digital.TED_SIGNUM_TIMES_SLOPE_ML, sps, symbol_Sync_loop_bw, 1/math.sqrt(2.0), 1, 2*math.pi/100, 1, digital.constellation_bpsk().base(), digital.IR_PFB_MF, nfilts, (rrc_taps)) self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(15, 500) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(15, 500) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(sps, excess_bw, 300, fll_loop_bw) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16) self.digital_costas_loop_cc_0 = digital.costas_loop_cc(costas_loop_bw, 2, False) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(bpsk_constellation) self.blocks_not_xx_0_0_0 = blocks.not_bb() self.blocks_message_debug_0 = blocks.message_debug() self.blocks_and_const_xx_0_0_0 = blocks.and_const_bb(1) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.hsl_kiss_encoder_0, 'packet')) self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.hsl_kiss_encoder_0, 'packet')) self.msg_connect((self.hsl_kiss_encoder_0, 'encoded_packet'), (self, 'out')) self.connect((self.blocks_and_const_xx_0_0_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.blocks_and_const_xx_0_0_0, 0), (self.digital_hdlc_deframer_bp_0_0, 0)) self.connect((self.blocks_not_xx_0_0_0, 0), (self.blocks_and_const_xx_0_0_0, 0)) self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_symbol_sync_xx_0_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self, 1)) self.connect((self.digital_descrambler_bb_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_not_xx_0_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.low_pass_filter_0_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self, 2)) self.connect((self.digital_symbol_sync_xx_0_0, 0), (self.digital_constellation_decoder_cb_0, 0)) self.connect((self.digital_symbol_sync_xx_0_0, 0), (self, 0)) self.connect((self.hsl_rms_agc_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.hsl_rms_agc_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.low_pass_filter_0_0_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
def __init__(self): gr.top_block.__init__(self, "Adds") Qt.QWidget.__init__(self) self.setWindowTitle("Adds") 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", "addsignal") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 44100 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 2 #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(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) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] 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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(2): 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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate, True) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char * 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char * 1) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_and_const_xx_0 = blocks.and_const_bb(1) self.analog_sig_source_x_0 = analog.sig_source_f( samp_rate, analog.GR_SQR_WAVE, 22.7273, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_float_to_char_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.blocks_null_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_null_sink_0, 0))
def __init__(self, baud_rate=1200, mark_freq=1200, offset=50e3, postamble_len=4, preamble_len=.1, rf_samp_rate=2.4e6, space_freq=2200): gr.hier_block2.__init__( self, "afsk_ax25_mod", gr.io_signature(0, 0, 0), # Input signature gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature self.message_port_register_hier_in("packets") ################################################## # Parameters ################################################## self.baud_rate = baud_rate self.mark_freq = mark_freq self.offset = offset self.postamble_len = postamble_len self.preamble_len = preamble_len self.rf_samp_rate = rf_samp_rate self.space_freq = space_freq ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.sps = sps = samp_rate / baud_rate ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(rf_samp_rate), decimation=int(samp_rate), taps=None, fractional_bw=None, ) self.hsl_ptt_cc_0 = hsl.ptt_cc() self.digital_hdlc_framer_pb_0 = digital.hdlc_framer_pb('packet_len') self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(2) self.digital_chunks_to_symbols_xx_1 = digital.chunks_to_symbols_bf( ([mark_freq, space_freq]), 1) self.blocks_vector_source_x_0_0 = blocks.vector_source_b([0x7e], True, 1, []) self.blocks_vector_source_x_0 = blocks.vector_source_b([0x7e], True, 1, []) self.blocks_vco_f_0 = blocks.vco_f(samp_rate, 2 * math.pi, .95) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux( gr.sizeof_char * 1, 'packet_len', 0) self.blocks_stream_to_tagged_stream_0_0 = blocks.stream_to_tagged_stream( gr.sizeof_char, 1, postamble_len * 8, "packet_len") self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream( gr.sizeof_char, 1, int(baud_rate * preamble_len), "packet_len") self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char * 1, sps) self.blocks_packed_to_unpacked_xx_0_0 = blocks.packed_to_unpacked_bb( 1, gr.GR_LSB_FIRST) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( 1, gr.GR_LSB_FIRST) self.blocks_not_xx_0_0_0_0 = blocks.not_bb() self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_and_const_xx_0_0_0_0 = blocks.and_const_bb(1) self.analog_sig_source_x_0 = analog.sig_source_c( rf_samp_rate, analog.GR_COS_WAVE, offset, 1, 0) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=samp_rate, quad_rate=samp_rate, tau=75e-6, max_dev=5e3, fh=-1.0, ) ################################################## # Connections ################################################## self.msg_connect((self, 'packets'), (self.digital_hdlc_framer_pb_0, 'in')) self.connect((self.analog_nbfm_tx_0, 0), (self.hsl_ptt_cc_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_and_const_xx_0_0_0_0, 0), (self.digital_diff_encoder_bb_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self, 0)) self.connect((self.blocks_not_xx_0_0_0_0, 0), (self.blocks_and_const_xx_0_0_0_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.blocks_stream_to_tagged_stream_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0_0, 0), (self.blocks_stream_to_tagged_stream_0_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.digital_chunks_to_symbols_xx_1, 0)) self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.blocks_tagged_stream_mux_0, 2)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.blocks_not_xx_0_0_0_0, 0)) self.connect((self.blocks_vco_f_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blocks_vco_f_0, 0), (self.hsl_ptt_cc_0, 1)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.blocks_vector_source_x_0_0, 0), (self.blocks_packed_to_unpacked_xx_0_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_1, 0), (self.blocks_vco_f_0, 0)) self.connect((self.digital_diff_encoder_bb_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.digital_hdlc_framer_pb_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.hsl_ptt_cc_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 1))
def __init__(self): gr.top_block.__init__(self, "APRS - AFSK Decoder (Test)") Qt.QWidget.__init__(self) self.setWindowTitle("APRS - AFSK Decoder (Test)") 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_AFSK_Complete") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.space = space = 2400 self.samp_rate = samp_rate = 24e3 self.out_sps = out_sps = 2 self.mark = mark = 1200 self.baud = baud = 1200 ################################################## # Blocks ################################################## self.tab = Qt.QTabWidget() self.tab_widget_0 = Qt.QWidget() self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0) self.tab_grid_layout_0 = Qt.QGridLayout() self.tab_layout_0.addLayout(self.tab_grid_layout_0) self.tab.addTab(self.tab_widget_0, 'Input Signal') self.tab_widget_1 = Qt.QWidget() self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1) self.tab_grid_layout_1 = Qt.QGridLayout() self.tab_layout_1.addLayout(self.tab_grid_layout_1) self.tab.addTab(self.tab_widget_1, 'Demodulator Output') self.top_layout.addWidget(self.tab) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( 256, #size baud, #samp_rate 'Clock Sync Output', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0.set_y_axis(-5, 5) self.qtgui_time_sink_x_0_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "red", "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_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_0_0_win, 1, 0, 1, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 512, #size baud * out_sps, #samp_rate 'Demodulator Output', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-5, 5) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_0_win, 0, 0, 1, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate 'Input Waveform', #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(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 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.tab_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_win, 0, 0, 1, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw 'Input Spectrum', #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-120, -20) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(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 "float" == "float" or "float" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [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.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 1, 0, 1, 1) self.fft_filter_xxx_0 = filter.fft_filter_fff(1, (firdes.band_pass( 10, samp_rate, 1e3, 2.6e3, 100, firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.epy_block_0 = epy_block_0.blk() self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( out_sps * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_and_const_xx_0 = blocks.and_const_bb(1) self.audio_source_0 = audio.source(int(samp_rate), '', True) self.AFSK_Demod_0 = AFSK_Demod( baud=baud, fsk_hi_tone=space, fsk_lo_tone=mark, in_sps=int(samp_rate / baud), out_sps=out_sps, ) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.epy_block_0, 'hdlc in')) self.msg_connect((self.epy_block_0, 'ax25 out'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.AFSK_Demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.AFSK_Demod_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.audio_source_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.AFSK_Demod_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.qtgui_time_sink_x_0, 0))
def __init__(self, bit_endianess=1, bits_to_use_per_byte_mask=255, gain=1): gr.top_block.__init__(self, "Byte to Float Symbols") Qt.QWidget.__init__(self) self.setWindowTitle("Byte to Float Symbols") 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", "byte2sym") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Parameters ################################################## self.bit_endianess = bit_endianess self.bits_to_use_per_byte_mask = bits_to_use_per_byte_mask self.gain = gain ################################################## # Variables ################################################## self.bits_per_symbol = bits_per_symbol = 1 self.tag = tag = gr.tag_utils.python_to_tag( (0, pmt.intern("Z"), pmt.intern("0x5a"), pmt.intern("Vsrc"))) self.samp_rate = samp_rate = 32000 self.polar = polar = 1 self.invert = invert = 0 self.baud_delay = baud_delay = 0 self.M = M = 2**bits_per_symbol ################################################## # Blocks ################################################## # Create the options list self._polar_options = ( 1, 1, ) # Create the labels list self._polar_labels = ( 'unipolar', 'polar', ) # Create the combo box self._polar_tool_bar = Qt.QToolBar(self) self._polar_tool_bar.addWidget(Qt.QLabel('polar' + ": ")) self._polar_combo_box = Qt.QComboBox() self._polar_tool_bar.addWidget(self._polar_combo_box) for _label in self._polar_labels: self._polar_combo_box.addItem(_label) self._polar_callback = lambda i: Qt.QMetaObject.invokeMethod( self._polar_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._polar_options.index(i))) self._polar_callback(self.polar) self._polar_combo_box.currentIndexChanged.connect( lambda i: self.set_polar(self._polar_options[i])) # Create the radio buttons self.top_grid_layout.addWidget(self._polar_tool_bar) # Create the options list self._invert_options = ( 0, 1, ) # Create the labels list self._invert_labels = ( 'No Invert', 'Invert', ) # Create the combo box self._invert_tool_bar = Qt.QToolBar(self) self._invert_tool_bar.addWidget(Qt.QLabel('Invert Bits' + ": ")) self._invert_combo_box = Qt.QComboBox() self._invert_tool_bar.addWidget(self._invert_combo_box) for _label in self._invert_labels: self._invert_combo_box.addItem(_label) self._invert_callback = lambda i: Qt.QMetaObject.invokeMethod( self._invert_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._invert_options.index(i))) self._invert_callback(self.invert) self._invert_combo_box.currentIndexChanged.connect( lambda i: self.set_invert(self._invert_options[i])) # Create the radio buttons self.top_grid_layout.addWidget(self._invert_tool_bar) self._bits_per_symbol_range = Range(1, 256, 1, 1, 256) self._bits_per_symbol_win = RangeWidget(self._bits_per_symbol_range, self.set_bits_per_symbol, 'Bits per symbol', "counter_slider", int) self.top_grid_layout.addWidget(self._bits_per_symbol_win) self._baud_delay_range = Range(0, 8, 1, 0, 8) self._baud_delay_win = RangeWidget(self._baud_delay_range, self.set_baud_delay, 'Baud delay', "counter_slider", int) self.top_grid_layout.addWidget(self._baud_delay_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #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(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "Z") self.qtgui_time_sink_x_0.enable_autoscale(True) 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(True) self.qtgui_time_sink_x_0.enable_stem_plot(False) 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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.digital_map_bb_1_0 = digital.map_bb( invert * list(2**8 - 1 - i for i in range(2**8)) + (1 - invert) * list(range(2**8))) self.digital_map_bb_1 = digital.map_bb( invert * list(2**8 - 1 - i for i in range(2**8)) + (1 - invert) * list(range(2**8))) self.blocks_vector_source_x_0 = blocks.vector_source_b( list(ord(i) for i in 'Zombie'), True, 1, [tag]) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( bits_per_symbol, gr.GR_LSB_FIRST) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( bits_per_symbol, gr.GR_LSB_FIRST) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(gain) self.blocks_float_to_char_0 = blocks.float_to_char( 1, polar * 0.5 + (1 - polar)) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, '/dev/pts/1', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_delay_0 = blocks.delay(gr.sizeof_char * 1, baud_delay) self.blocks_char_to_float_0 = blocks.char_to_float( 1, polar * 0.5 + (1 - polar)) self.blocks_and_const_xx_0_0 = blocks.and_const_bb( bits_to_use_per_byte_mask) self.blocks_and_const_xx_0 = blocks.and_const_bb( bits_to_use_per_byte_mask) self.blocks_add_const_vxx_1 = blocks.add_const_ff(polar * (M - 1) - (1 - polar) * 0) self.blocks_add_const_vxx_0 = blocks.add_const_ff(-polar * (M - 1) + (1 - polar) * 0) ################################################## # Connections ################################################## self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self.digital_map_bb_1, 0)) self.connect((self.blocks_and_const_xx_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_delay_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_map_bb_1_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.digital_map_bb_1, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.digital_map_bb_1_0, 0), (self.blocks_and_const_xx_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "APRS Symbol Recovery") Qt.QWidget.__init__(self) self.setWindowTitle("APRS Symbol Recovery") 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_symbol_recov") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.ch_rate = ch_rate = 48e3 self.bb_rate = bb_rate = 192e3 self.afsk_spec = afsk_spec = [1200, 1200, 2200] self.thresh = thresh = -50*2 self.samp_rate = samp_rate = 2.88e6 self.rfgain = rfgain = 10 self.out_sps = out_sps = 2 self.in_sps = in_sps = int(ch_rate) / afsk_spec[0] self.gain_mu = gain_mu = 0.175 self.freq = freq = 144.39e6 self.dev_ppm = dev_ppm = 52 self.bb_decim = bb_decim = int(bb_rate)/int(ch_rate) self.afgain = afgain = -7 ################################################## # Blocks ################################################## self._rfgain_range = Range(0, 49, 1, 10, 100) 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.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_0 = qtgui.time_sink_f( 1024, #size 1200, #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(-4.2, 4.2) 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(True) self.qtgui_time_sink_x_0.enable_axis_labels(False) self.qtgui_time_sink_x_0.enable_control_panel(False) if not False: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [2, 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_grid_layout.addWidget(self._qtgui_time_sink_x_0_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 = ["blue", "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.pfb_decimator_ccf_0_0 = pfb.decimator_ccf( int(samp_rate / ch_rate), (), 0, 100, True, True) self.pfb_decimator_ccf_0_0.declare_sample_delay(0) self.pfb_decimator_ccf_0 = pfb.decimator_ccf( int(samp_rate / bb_rate), (), 0, 100, True, True) self.pfb_decimator_ccf_0.declare_sample_delay(0) 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, 0) self.osmosdr_source_0.set_freq_corr(dev_ppm, 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(rfgain, 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.hdlc_to_ax25 = hdlc_to_ax25.blk() self.fsk_demod_0 = fsk_demod( baud=afsk_spec[0], fsk_hi_tone=afsk_spec[2], fsk_lo_tone=afsk_spec[1], in_sps=in_sps, out_sps=out_sps, ) self.fft_filter_xxx_1 = filter.fft_filter_fff(1, (firdes.band_pass(1,ch_rate,400,5e3,400,firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_1.declare_sample_delay(0) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(out_sps*(1+0.0), 0.25*gain_mu*gain_mu, 0.5, gain_mu, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_not_xx_0 = blocks.not_bb() self.blocks_and_const_xx_0 = blocks.and_const_bb(1) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(ch_rate/(2*math.pi*12e3/8.0)) self.afsk_afsk1200_0 = afsk.afsk1200(int(ch_rate),4) self._afgain_range = Range(-20, -1, 0.1, -7, 100) 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) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.hdlc_to_ax25, 'hdlc in')) self.msg_connect((self.hdlc_to_ax25, 'ax25 out'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.hdlc_to_ax25, 'ax25 out'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.afsk_afsk1200_0, 0), (self.show_text_2, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.fft_filter_xxx_1, 0)) self.connect((self.blocks_and_const_xx_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.show_text_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.fft_filter_xxx_1, 0), (self.afsk_afsk1200_0, 0)) self.connect((self.fft_filter_xxx_1, 0), (self.fsk_demod_0, 0)) self.connect((self.fsk_demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.pfb_decimator_ccf_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.pfb_decimator_ccf_0_0, 0)) self.connect((self.pfb_decimator_ccf_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pfb_decimator_ccf_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.pfb_decimator_ccf_0_0, 0), (self.analog_quadrature_demod_cf_0, 0))