def __init__(self): gr.top_block.__init__(self, "Hdlc Frame") Qt.QWidget.__init__(self) self.setWindowTitle("Hdlc Frame") 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", "hdlc_Frame") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 self.message = message = 'a', 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ################################################## # Blocks ################################################## self.satellites_pdu_to_kiss_0 = satellites.pdu_to_kiss() self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, '', '', False, False, '') self._qtgui_edit_box_msg_0_win = sip.wrapinstance( self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_edit_box_msg_0_win) self.epy_block_0 = epy_block_0.blk() self.digital_hdlc_framer_pb_0 = digital.hdlc_framer_pb('packet_len') self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.blocks_random_pdu_0 = blocks.random_pdu(16, 64, chr(0xFF), 2) self.blocks_message_strobe_random_0 = blocks.message_strobe_random( pmt.intern("TEST"), blocks.STROBE_POISSON, 10000, 500) self.blocks_message_debug_1 = blocks.message_debug() self.blocks_message_debug_0 = blocks.message_debug() ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_random_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.satellites_pdu_to_kiss_0, 'in')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.satellites_pdu_to_kiss_0, 'out'), (self.digital_hdlc_framer_pb_0, 'in')) self.connect((self.digital_hdlc_framer_pb_0, 0), (self.digital_hdlc_deframer_bp_0, 0))
def __init__(self, freq, rate, designator): gr.hier_block2.__init__(self, "ais_rx", gr.io_signature(1,1,gr.sizeof_gr_complex), gr.io_signature(0,0,0)) self._bits_per_sec = 9600.0 self._samples_per_symbol = 5 self.coeffs = filter.firdes.low_pass(1, rate, 11000, 1000) self._filter_decimation = int(rate/(self._bits_per_sec*self._samples_per_symbol)) self.filter = filter.freq_xlating_fir_filter_ccf(self._filter_decimation, self.coeffs, freq, rate) # self.resamp = pfb.arb_resampler_ccf((self._bits_per_sec*self._samples_per_symbol)/int(rate/self._filter_decimation)) options = {} options[ "samples_per_symbol" ] = (rate/self._filter_decimation)/self._bits_per_sec options[ "clockrec_gain" ] = 0.04 options[ "omega_relative_limit" ] = 0.01 options[ "bits_per_sec" ] = self._bits_per_sec options[ "fftlen" ] = 1024 #trades off accuracy of freq estimation in presence of noise, vs. delay time. options[ "samp_rate" ] = self._bits_per_sec * self._samples_per_symbol self.demod = ais.ais_demod(options) #ais_demod takes in complex baseband and spits out 1-bit unpacked bitstream self.deframer = digital.hdlc_deframer_bp(11,64) #takes bytes, deframes, unstuffs, CRCs, and emits PDUs with frame contents self.nmea = ais.pdu_to_nmea(designator) #turns data PDUs into NMEA sentences # self.msgq = ais.pdu_to_msgq(queue) #posts PDUs to message queue for main program to parse at will # self.parse = ais.parse(queue, designator) #ais_parse.cc, calculates CRC, parses data into NMEA AIVDM message, moves data onto queue self.connect(self, self.filter, self.demod, self.deframer) self.msg_connect(self.deframer, "out", self.nmea, "print")
def test_001(self): #test complementary operation of framer & deframer #want to frame some random data that has enough consecutive bits to #stuff at least a few bits npkts = 20 src_data = [0xFE, 0xDA, 0xAC, 0x29, 0x7F, 0xA2, 0x90, 0x0F, 0xF8] frame = digital.hdlc_framer_pb("wat") corr = digital.correlate_access_code_tag_bb("01111110", 0, "frame") deframe = digital.hdlc_deframer_bp("frame", 32, 500) debug = blocks.message_debug() self.tb.connect(frame, corr, deframe) self.tb.msg_connect(deframe, "out", debug, "store") self.tb.start() msg = pmt.cons(pmt.PMT_NIL, pmt.init_u8vector(len(src_data),src_data)) for i in xrange(npkts): frame.to_basic_block()._post(pmt.intern("in"), msg) sleep(0.2) self.tb.stop() self.tb.wait() rxmsg = debug.get_message(0) result_len = pmt.blob_length(pmt.cdr(rxmsg)) msg_data = [] for j in xrange(result_len): msg_data.append(pmt.u8vector_ref(pmt.cdr(rxmsg), j)) self.assertEqual(src_data, msg_data)
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 test_001(self): #test complementary operation of framer & deframer #want to frame some random data that has enough consecutive bits to #stuff at least a few bits npkts = 20 src_data = [0xFE, 0xDA, 0xAC, 0x29, 0x7F, 0xA2, 0x90, 0x0F, 0xF8] frame = digital.hdlc_framer_pb("wat") corr = digital.correlate_access_code_tag_bb("01111110", 0, "frame") deframe = digital.hdlc_deframer_bp("frame", 32, 500) debug = blocks.message_debug() self.tb.connect(frame, corr, deframe) self.tb.msg_connect(deframe, "out", debug, "store") self.tb.start() msg = pmt.cons(pmt.PMT_NIL, pmt.init_u8vector(len(src_data), src_data)) for i in xrange(npkts): frame.to_basic_block()._post(pmt.intern("in"), msg) sleep(0.2) self.tb.stop() self.tb.wait() rxmsg = debug.get_message(0) result_len = pmt.blob_length(pmt.cdr(rxmsg)) msg_data = [] for j in xrange(result_len): msg_data.append(pmt.u8vector_ref(pmt.cdr(rxmsg), j)) self.assertEqual(src_data, msg_data)
def __init__(self, samp_rate): gr.hier_block2.__init__( self, "APRS demod", gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_out("out") self.samp_rate = samp_rate self.bit_rate = 1200 taps = firdes.low_pass(1, self.samp_rate, 1200, 200) self.afsk_shift = filter.freq_xlating_fir_filter_fcc( 1, taps, (1200 + 2200) / 2, self.samp_rate) self.afsk_demod = analog.quadrature_demod_cf( 1.0) # Don't care about gain just before binary slicer self.threashold = digital.binary_slicer_fb() self.clock_rec = igate.clock_recovery_timer_bb(self.samp_rate / self.bit_rate) self.diff_decode = digital.diff_decoder_bb(2) self.negate = digital.map_bb(([1, 0])) self.packetizer = digital.hdlc_deframer_bp(16, 1024) self.parser = igate.aprs_decode_frame() self.connect((self, 0), (self.afsk_shift, 0)) self.connect((self.afsk_shift, 0), (self.afsk_demod, 0)) self.connect((self.afsk_demod, 0), (self.threashold, 0)) self.connect((self.threashold, 0), (self.clock_rec, 0)) self.connect((self.clock_rec, 0), (self.diff_decode, 0)) self.connect((self.diff_decode, 0), (self.negate, 0)) self.connect((self.negate, 0), (self.packetizer, 0)) self.msg_connect((self.packetizer, 'out'), (self.parser, 'in')) self.msg_connect((self.parser, 'out'), (self, 'out'))
def __init__(self): gr.top_block.__init__(self, "Aprs Uhd") ################################################## # Variables ################################################## self.tuner_offset = tuner_offset = 10e3 self.samp_rate = samp_rate = 19200 self.rf_samp_rate = rf_samp_rate = 1000000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=samp_rate, decimation=rf_samp_rate, taps=None, fractional_bw=None, ) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, rf_samp_rate, 8000, 10000, firdes.WIN_HAMMING, 6.76)) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(15, 500) self.bruninga_hdlc_to_ax25_1 = bruninga.hdlc_to_ax25() self.bruninga_fsk_demod_0 = bruninga.fsk_demod(samp_rate) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_rotator_cc_0 = blocks.rotator_cc( 2 * math.pi * -tuner_offset / rf_samp_rate) self.blocks_file_source_0_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/ben-mccall/Desktop/flowgraphs/TJ_APRS_CAPTURES/1MHz_144_39MHz_recording_KN4DTQ.bin', True) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=rf_samp_rate, quad_rate=rf_samp_rate, tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.bruninga_hdlc_to_ax25_1, 'in')) self.connect((self.analog_nbfm_rx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_file_source_0_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.bruninga_fsk_demod_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.bruninga_fsk_demod_0, 0))
def __init__(self): gr.top_block.__init__(self, "Ask Rx Top Raspi") ################################################## # Variables ################################################## self.sound_card_sample_rate = sound_card_sample_rate = 44000 self.samples_per_symbol = samples_per_symbol = 19 self.symbol_rate = symbol_rate = sound_card_sample_rate / samples_per_symbol self.bits_per_symbol = bits_per_symbol = 1 self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine( 1, sound_card_sample_rate, symbol_rate, 0.5, 70) self.bit_rate = bit_rate = symbol_rate / bits_per_symbol ################################################## # Blocks ################################################## self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( samples_per_symbol, 0.5, (variable_rrc_filter_taps), 32, 0, 1.5, 1) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, sound_card_sample_rate, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.01, 0.01, 0) self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink( gr.sizeof_char * 1, bit_rate) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'burst') self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.audio_source_0 = audio.source(sound_card_sample_rate, '', True) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.audio_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_file_sink_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_threshold_ff_0, 0))
def __init__(self): gr.top_block.__init__(self, "Aprs Loopback") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 ################################################## # Blocks ################################################## self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(15, 500) self.bruninga_str_to_aprs_0 = bruninga.str_to_aprs( 'NOCALL', 'NOCALL', []) self.bruninga_hdlc_to_ax25_1 = bruninga.hdlc_to_ax25() self.bruninga_fsk_demod_0 = bruninga.fsk_demod(samp_rate) self.bruninga_ax25_fsk_mod_0 = bruninga.ax25_fsk_mod( samp_rate, 16.0 / 1200 * 1000, 5, 2200, 1200, 1200) self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_SERVER", '', '52001', 10000, False) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.1, )) self.audio_sink_0 = audio.sink(48000, 'hw:1,0', True) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.bruninga_str_to_aprs_0, 'in')) self.msg_connect((self.bruninga_str_to_aprs_0, 'out'), (self.bruninga_ax25_fsk_mod_0, 'in')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.bruninga_hdlc_to_ax25_1, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.bruninga_ax25_fsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.bruninga_ax25_fsk_mod_0, 0), (self.bruninga_fsk_demod_0, 0)) self.connect((self.bruninga_fsk_demod_0, 0), (self.digital_hdlc_deframer_bp_0, 0))
def __init__(self): gr.top_block.__init__(self, "If Psk Rx") Qt.QWidget.__init__(self) self.setWindowTitle("If Psk Rx") 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", "if_psk_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.if_decimation = if_decimation = 2 self.sound_card_sample_rate = sound_card_sample_rate = 11025 self.samples_per_symbol = samples_per_symbol = 16 / if_decimation self.symbol_rate = symbol_rate = sound_card_sample_rate / if_decimation / samples_per_symbol self.bits_per_symbol = bits_per_symbol = 2 self.rolloff = rolloff = 0.5 self.hdlc_packet_overhead = hdlc_packet_overhead = 6 * 8 self.hdlc_packet_length = hdlc_packet_length = 16 * 8 self.channel_bit_rate = channel_bit_rate = symbol_rate * bits_per_symbol self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine( 1, sound_card_sample_rate / if_decimation, symbol_rate, rolloff, 11 * samples_per_symbol) self.source_bit_rate = source_bit_rate = channel_bit_rate * hdlc_packet_length / ( hdlc_packet_overhead + hdlc_packet_length) self.if_frequency = if_frequency = sound_card_sample_rate / 4 ################################################## # Blocks ################################################## self.raspi_decoder_psk_constellation_decoder_0 = raspi_decoder.psk_constellation_decoder( bits_per_symbol=bits_per_symbol, differential=True, mod_code="gray", debug=False, ) self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f( 1024, #size source_bit_rate, #samp_rate "Received packets", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_1_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_0.enable_autoscale(True) self.qtgui_time_sink_x_1_0.enable_grid(False) self.qtgui_time_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_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_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_win = sip.wrapinstance( self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 1024, #size channel_bit_rate, #samp_rate "Decoded bits", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label("Amplitude", "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(True) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1.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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 1024, #size sound_card_sample_rate / if_decimation, #samp_rate "Frequency synchronizer state", #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(-1, 1) 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(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ["Frequency", "Phase", "Error", "", "", "", "", "", "", ""] 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_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.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size symbol_rate, #samp_rate "Symbol synchronizer state", #name 3 #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(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["Error", "Rate", "Phase", "", "", "", "", "", "", ""] 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(3): 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_sink_x_0_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc sound_card_sample_rate / if_decimation, #bw "Phase synchronized baseband signal", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_0_win = sip.wrapinstance( self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_0_win) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc sound_card_sample_rate / if_decimation, #bw "Baseband I&Q signal", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "Synchronized symbols", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(True) self.qtgui_const_sink_x_0.enable_grid(False) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.low_pass_filter_0_0 = filter.fir_filter_fff( if_decimation, firdes.low_pass(1.66, sound_card_sample_rate, symbol_rate * (1 + rolloff), sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76)) self.low_pass_filter_0 = filter.fir_filter_fff( if_decimation, firdes.low_pass(1.66, sound_card_sample_rate, symbol_rate * (1 + rolloff), sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76)) self.final_0 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc sound_card_sample_rate, #bw "IF received signal", #name True, #plotfreq True, #plotwaterfall True, #plottime False, #plotconst ) self.final_0.set_update_time(1.0 / 10) self._final_0_win = sip.wrapinstance(self.final_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._final_0_win) self.final_0.enable_rf_freq(False) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( samples_per_symbol, 2 * math.pi / 100, (variable_rrc_filter_taps), 32, 0, 3, 1) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp( hdlc_packet_length / 8, hdlc_packet_length) self.digital_costas_loop_cc_0 = digital.costas_loop_cc( 2 * math.pi / 100 * 2, 8, True) self.blocks_wavfile_source_0 = blocks.wavfile_source( "rx_signal.wav", False) self.blocks_uchar_to_float_0_0 = blocks.uchar_to_float() self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, sound_card_sample_rate, True) self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink( gr.sizeof_char * 1, source_bit_rate) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, "burst") self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.analog_sig_source_x_0_0 = analog.sig_source_f( sound_card_sample_rate, analog.GR_COS_WAVE, if_frequency, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_f( sound_card_sample_rate, analog.GR_SIN_WAVE, if_frequency, 1, 0) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_file_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_uchar_to_float_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_uchar_to_float_0_0, 0), (self.qtgui_time_sink_x_1_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.final_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.digital_costas_loop_cc_0, 1), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 1), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 3), (self.qtgui_time_sink_x_0, 2)) self.connect((self.digital_pfb_clock_sync_xxx_0, 2), (self.qtgui_time_sink_x_0, 1)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.raspi_decoder_psk_constellation_decoder_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.raspi_decoder_psk_constellation_decoder_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.raspi_decoder_psk_constellation_decoder_0, 0), (self.digital_hdlc_deframer_bp_0, 0))
def __init__(self, cyborg_version='v0.1.0', mod_order=2, mod_scheme='GMSK', rx_ant_model='COMET SMA703', rx_db_ser='na', rx_db_type='na', rx_ser_tag='30DCE50', rx_ser_uhd='30DCE50', rx_type='B200', signal_name='AIS', symbol_rate=9600): gr.top_block.__init__(self, "Ais Sigmf") Qt.QWidget.__init__(self) self.setWindowTitle("Ais Sigmf") 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", "ais_sigmf") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.cyborg_version = cyborg_version self.mod_order = mod_order self.mod_scheme = mod_scheme self.rx_ant_model = rx_ant_model self.rx_db_ser = rx_db_ser self.rx_db_type = rx_db_type self.rx_ser_tag = rx_ser_tag self.rx_ser_uhd = rx_ser_uhd self.rx_type = rx_type self.signal_name = signal_name self.symbol_rate = symbol_rate ################################################## # Variables ################################################## self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y-%m-%dT%H:%M:%S.%fZ") self.samp_rate = samp_rate = 250e3 self.fn = fn = "{:s}_{:s}".format(signal_name, ts_str) self.decim = decim = 5 self.baud = baud = 9600 self.tune = tune = 0 self.samp_per_sym = samp_per_sym = (samp_rate / decim / 50 * 48) / baud self.rx_gain = rx_gain = 55 self.rx_freq = rx_freq = 162e6 self.fsk_deviation = fsk_deviation = 10e3 self.fp = fp = "/home/zleffke/captures/ais/{:s}".format(fn) ################################################## # Blocks ################################################## self._tune_tool_bar = Qt.QToolBar(self) self._tune_tool_bar.addWidget(Qt.QLabel("tune" + ": ")) self._tune_line_edit = Qt.QLineEdit(str(self.tune)) self._tune_tool_bar.addWidget(self._tune_line_edit) self._tune_line_edit.returnPressed.connect(lambda: self.set_tune( eng_notation.str_to_num(str(self._tune_line_edit.text().toAscii())) )) self.top_grid_layout.addWidget(self._tune_tool_bar, 8, 2, 1, 2) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.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.top_grid_layout.addWidget(self._rx_gain_tool_bar, 8, 0, 1, 2) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.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_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, samp_rate / 2), 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.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_1 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate / 2, #bw "Channel", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_1.set_update_time(0.010) self.qtgui_waterfall_sink_x_0_1.enable_grid(True) self.qtgui_waterfall_sink_x_0_1.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [1, 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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_1.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_1.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_1.set_intensity_range(-140, -40) self._qtgui_waterfall_sink_x_0_1_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_1_win, 2, 0, 2, 8) for r in range(2, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate / 2, #bw "AIS", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.01) 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 = [ "red", "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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 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.pyqt_text_output_0_0 = pyqt.text_output() self._pyqt_text_output_0_0_win = self.pyqt_text_output_0_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_0_win, 4, 0, 1, 4) for r in range(4, 5): 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, 4, 4, 1, 4) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(11, 1000) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(11, 1000) 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_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '52001', 10000, False) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_message_debug_0_1 = blocks.message_debug() self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 25e3, 1, 0) self.analog_sig_source_x_0_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, tune, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -25e3, 1, 0) self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.ais_pdu_to_nmea_0_0 = ais.pdu_to_nmea('B') self.ais_pdu_to_nmea_0 = ais.pdu_to_nmea('A') self.ais_invert_0_0 = ais.invert() self.ais_invert_0 = ais.invert() ################################################## # Connections ################################################## self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.pyqt_text_output_0_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.ais_pdu_to_nmea_0, 'to_nmea')) self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.ais_pdu_to_nmea_0_0, 'to_nmea')) self.connect((self.ais_invert_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.ais_invert_0_0, 0), (self.digital_hdlc_deframer_bp_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.analog_quadrature_demod_cf_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.rational_resampler_xxx_0_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.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.digital_diff_decoder_bb_0_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, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.ais_invert_0, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.ais_invert_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_clock_recovery_mm_xx_0_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_1, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.blocks_multiply_xx_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Aprs Regenerate") Qt.QWidget.__init__(self) self.setWindowTitle("Aprs Regenerate") 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_regenerate") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 ################################################## # Blocks ################################################## self.show_text_0 = display.show_text() self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._show_text_0_win) self.satellites_nrzi_encode_0 = satellites.nrzi_encode() self.satellites_nrzi_decode_0 = satellites.nrzi_decode() self.satellites_hdlc_framer_0 = satellites.hdlc_framer(preamble_bytes=80, postamble_bytes=4) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate/40, #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(-4.5, 4.5) 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 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [2, 0, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, 0, -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(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_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=40, out_sps=2, ) self.epy_block_0 = epy_block_0.blk() self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(2*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf((1200,2200), 1) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source('/home/handiko/aprs_regenerate.wav', True) self.blocks_vco_f_0 = blocks.vco_f(48000, 2*math.pi, 0.1) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char*1, 40) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.audio_sink_0 = audio.sink(48000, '', True) self.afsk_afsk1200_0 = afsk.afsk1200(48000,4) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.epy_block_0, 'in')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.satellites_hdlc_framer_0, 'in')) self.msg_connect((self.epy_block_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.satellites_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.afsk_afsk1200_0, 0), (self.show_text_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.satellites_nrzi_encode_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.fsk_demod_0, 0)) self.connect((self.blocks_vco_f_0, 0), (self.afsk_afsk1200_0, 0)) self.connect((self.blocks_vco_f_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.satellites_nrzi_decode_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_vco_f_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_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.fsk_demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.satellites_nrzi_decode_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.satellites_nrzi_encode_0, 0), (self.blocks_repeat_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, "Xceiver") Qt.QWidget.__init__(self) self.setWindowTitle("Xceiver") 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", "XCEIVER") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.transistion = transistion = 1000 self.sync_word2 = sync_word2 = [0j, 0j, 0j, 0j, 0j, 0j, (-1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), (1+0j), (1+0j), (1 +0j), (1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), 0j, (1+0j), (-1+0j), (1+0j), (1+0j), (1+0j), (-1+0j), (1+0j), (1+0j), (1+0j), (-1+0j), (1+0j), (1+0j), (1+0j), (1+0j), (-1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (-1+0j), 0j, 0j, 0j, 0j, 0j] self.sync_word1 = sync_word1 = [0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0.] self.sideband_rx = sideband_rx = 4000 self.sideband = sideband = 4000 self.samp_rate = samp_rate = 48000 self.pilot_symbols = pilot_symbols = ((1, 1, 1, -1,),) self.pilot_carriers = pilot_carriers = ((-21, -7, 7, 21,),) self.packet_length_tag_key = packet_length_tag_key = "packet_len" self.packet_len = packet_len = 8 self.occupied_carriers = occupied_carriers = (range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27),) self.length_tag_key = length_tag_key = "packet_len" self.fft_len = fft_len = 64 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=220, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0/10) self._qtgui_sink_x_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_0_win) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(1, (filter.firdes.low_pass(1, samp_rate, sideband_rx,1000)), 5000, samp_rate) self.digital_ofdm_rx_0 = digital.ofdm_rx( fft_len=fft_len, cp_len=fft_len/4, frame_length_tag_key='frame_'+"length", packet_length_tag_key="length", occupied_carriers=occupied_carriers, pilot_carriers=pilot_carriers, pilot_symbols=pilot_symbols, sync_word1=sync_word1, sync_word2=sync_word2, bps_header=1, bps_payload=2, debug_log=False, scramble_bits=False ) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(4, 10) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((1, )) self.blocks_message_debug_1 = blocks.message_debug() self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.audio_source_0 = audio.source(48000, "", True) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_message_debug_1, 'print_pdu')) self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_ofdm_rx_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))
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, "Xceiver") Qt.QWidget.__init__(self) self.setWindowTitle("Xceiver") 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", "XCEIVER") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.transistion = transistion = 1000 self.sync_word2 = sync_word2 = [ 0j, 0j, 0j, 0j, 0j, 0j, (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), 0j, (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), 0j, 0j, 0j, 0j, 0j ] self.sync_word1 = sync_word1 = [ 0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0. ] self.sideband_rx = sideband_rx = 4000 self.sideband = sideband = 4000 self.samp_rate = samp_rate = 48000 self.pilot_symbols = pilot_symbols = (( 1, 1, 1, -1, ), ) self.pilot_carriers = pilot_carriers = (( -21, -7, 7, 21, ), ) self.packet_length_tag_key = packet_length_tag_key = "packet_len" self.packet_len = packet_len = 8 self.occupied_carriers = occupied_carriers = ( range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27), ) self.length_tag_key = length_tag_key = "packet_len" self.fft_len = fft_len = 64 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=220, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_0_win = sip.wrapinstance( self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_0_win) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc( 1, (filter.firdes.low_pass(1, samp_rate, sideband_rx, 1000)), 5000, samp_rate) self.digital_ofdm_rx_0 = digital.ofdm_rx( fft_len=fft_len, cp_len=fft_len / 4, frame_length_tag_key='frame_' + "length", packet_length_tag_key="length", occupied_carriers=occupied_carriers, pilot_carriers=pilot_carriers, pilot_symbols=pilot_symbols, sync_word1=sync_word1, sync_word2=sync_word2, bps_header=1, bps_payload=2, debug_log=False, scramble_bits=False) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(4, 10) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( 1, gr.GR_MSB_FIRST) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((1, )) self.blocks_message_debug_1 = blocks.message_debug() self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.audio_source_0 = audio.source(48000, "", True) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_message_debug_1, 'print_pdu')) self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_ofdm_rx_0, 0))
def __init__(self, addr='0.0.0.0', port='52001', rx_gain=38): gr.top_block.__init__(self, "Ais Rx") ################################################## # Parameters ################################################## self.addr = addr self.port = port self.rx_gain = rx_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250e3 self.decim = decim = 5 self.baud = baud = 9600 self.samp_per_sym = samp_per_sym = (samp_rate / decim / 50 * 48) / baud self.fsk_deviation = fsk_deviation = 10e3 self.freq = freq = 162e6 self.filter_taps = filter_taps = firdes.low_pass( 1, samp_rate, samp_rate / 2, 50000, firdes.WIN_FLATTOP, 6.76) ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_subdev_spec('A:B', 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(freq, samp_rate / 2), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.low_pass_filter_0_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.digital_map_bb_0_0 = digital.map_bb((1, 0)) self.digital_map_bb_0 = digital.map_bb((1, 0)) self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(11, 1000) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(11, 1000) 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_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, '/dev/stdout', True) self.blocks_file_sink_0.set_unbuffered(True) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 25e3, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -25e3, 1, 0) self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.ais_pdu_to_nmea_0_0 = ais.pdu_to_nmea('B') self.ais_pdu_to_nmea_0 = ais.pdu_to_nmea('A') ################################################## # Connections ################################################## self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.ais_pdu_to_nmea_0, 'to_nmea')) self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.ais_pdu_to_nmea_0_0, 'to_nmea')) self.connect((self.analog_agc2_xx_0, 0), (self.analog_quadrature_demod_cf_0_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.digital_diff_decoder_bb_0_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, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.digital_map_bb_0_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.digital_map_bb_0_0, 0), (self.digital_hdlc_deframer_bp_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_1, 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, bits_per_symbol=2, rolloff=0.5, sound_card_sample_rate=22000): gr.top_block.__init__(self, "If Psk Rx Rpi") #TODO: CHECK BOUNDARIES OF INPUT PARAMETERS ################################################## # Variables ################################################## self.if_decimation = if_decimation = 2 self.sound_card_sample_rate = sound_card_sample_rate self.samples_per_symbol = samples_per_symbol = 16 / if_decimation self.symbol_rate = symbol_rate = sound_card_sample_rate / if_decimation / samples_per_symbol self.bits_per_symbol = bits_per_symbol self.rolloff = rolloff self.hdlc_packet_overhead = hdlc_packet_overhead = 6 * 8 self.hdlc_packet_length = hdlc_packet_length = 16 * 8 self.channel_bit_rate = channel_bit_rate = symbol_rate * bits_per_symbol self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine( 1, sound_card_sample_rate / if_decimation, symbol_rate, rolloff, 11 * samples_per_symbol) self.source_bit_rate = source_bit_rate = channel_bit_rate * hdlc_packet_length / ( hdlc_packet_overhead + hdlc_packet_length) self.if_frequency = if_frequency = sound_card_sample_rate / 4 ################################################## # Blocks ################################################## self.raspi_decoder_psk_constellation_decoder_0 = raspi_decoder.psk_constellation_decoder( bits_per_symbol=bits_per_symbol, differential=True, mod_code="gray", debug=False, ) self.low_pass_filter_0_0 = filter.fir_filter_fff( if_decimation, firdes.low_pass(1.66, sound_card_sample_rate, symbol_rate * (1 + rolloff), sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76)) self.low_pass_filter_0 = filter.fir_filter_fff( if_decimation, firdes.low_pass(1.66, sound_card_sample_rate, symbol_rate * (1 + rolloff), sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76)) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( samples_per_symbol, 2 * math.pi / 100, (variable_rrc_filter_taps), 32, 0, 3, 1) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp( hdlc_packet_length / 8, hdlc_packet_length) self.digital_costas_loop_cc_0 = digital.costas_loop_cc( 2 * math.pi / 100 * 2, 8, True) self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink( gr.sizeof_char * 1, source_bit_rate) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, "burst") self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.audio_source_0 = audio.source(sound_card_sample_rate, "", True) self.analog_sig_source_x_0_0 = analog.sig_source_f( sound_card_sample_rate, analog.GR_COS_WAVE, if_frequency, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_f( sound_card_sample_rate, analog.GR_SIN_WAVE, if_frequency, 1, 0) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.audio_source_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.audio_source_0, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_file_sink_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.raspi_decoder_psk_constellation_decoder_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.raspi_decoder_psk_constellation_decoder_0, 0), (self.digital_hdlc_deframer_bp_0, 0))
def __init__(self): gr.top_block.__init__(self, "Rx Top") Qt.QWidget.__init__(self) self.setWindowTitle("Rx Top") 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", "rx_top") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sound_card_sample_rate = sound_card_sample_rate = 44000 self.samples_per_symbol = samples_per_symbol = 19 self.symbol_rate = symbol_rate = sound_card_sample_rate / samples_per_symbol self.bits_per_symbol = bits_per_symbol = 1 self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine( 1, sound_card_sample_rate, symbol_rate, 0.5, 70) self.bit_rate = bit_rate = symbol_rate / bits_per_symbol ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1_2_0 = qtgui.time_sink_f( 500, #size sound_card_sample_rate, #samp_rate "Filtered signal", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_2_0.set_update_time(0.10) self.qtgui_time_sink_x_1_2_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_2_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_2_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_2_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_2_0.enable_autoscale(True) self.qtgui_time_sink_x_1_2_0.enable_grid(False) self.qtgui_time_sink_x_1_2_0.enable_axis_labels(True) self.qtgui_time_sink_x_1_2_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_2_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_1_2_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_2_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_2_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_2_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_2_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_2_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_2_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_2_0_win = sip.wrapinstance( self.qtgui_time_sink_x_1_2_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_2_0_win) self.qtgui_time_sink_x_1_2 = qtgui.time_sink_f( 500, #size symbol_rate, #samp_rate "Synchronization phase", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_2.set_update_time(0.10) self.qtgui_time_sink_x_1_2.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_2.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_2.enable_tags(-1, True) self.qtgui_time_sink_x_1_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_2.enable_autoscale(True) self.qtgui_time_sink_x_1_2.enable_grid(False) self.qtgui_time_sink_x_1_2.enable_axis_labels(True) self.qtgui_time_sink_x_1_2.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_2.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_1_2.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_2_win = sip.wrapinstance( self.qtgui_time_sink_x_1_2.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_2_win) self.qtgui_time_sink_x_1_1 = qtgui.time_sink_f( 500, #size symbol_rate, #samp_rate "Synchronization rate", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_1.set_update_time(0.10) self.qtgui_time_sink_x_1_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_1.enable_tags(-1, True) self.qtgui_time_sink_x_1_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_1.enable_autoscale(True) self.qtgui_time_sink_x_1_1.enable_grid(False) self.qtgui_time_sink_x_1_1.enable_axis_labels(True) self.qtgui_time_sink_x_1_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_1.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_1_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_1_win) self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f( 500, #size symbol_rate, #samp_rate "Synchronization error", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1_0.enable_autoscale(True) self.qtgui_time_sink_x_1_0.enable_grid(False) self.qtgui_time_sink_x_1_0.enable_axis_labels(True) self.qtgui_time_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_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_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_win = sip.wrapinstance( self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 50, #size symbol_rate, #samp_rate "Received symbols", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(True) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1.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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_sink_x_0_1 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc sound_card_sample_rate, #bw "sync symbols", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0_1.set_update_time(1.0 / 10) self._qtgui_sink_x_0_1_win = sip.wrapinstance( self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_1_win) self.qtgui_sink_x_0_1.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc sound_card_sample_rate, #bw "received-symbol", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.fft_filter_xxx_0 = filter.fft_filter_fff( 1, (variable_rrc_filter_taps), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( samples_per_symbol, 0.5, (variable_rrc_filter_taps), 32, 0, 1.5, 1) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, sound_card_sample_rate, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.01, 0.01, 0) self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink( gr.sizeof_char * 1, bit_rate) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'burst') self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.audio_source_0 = audio.source(sound_card_sample_rate, '', True) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.audio_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.audio_source_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_tagged_file_sink_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_sink_x_0_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 1), (self.qtgui_time_sink_x_1_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 2), (self.qtgui_time_sink_x_1_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 3), (self.qtgui_time_sink_x_1_2, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.qtgui_time_sink_x_1_2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Uhd Ais 3") Qt.QWidget.__init__(self) self.setWindowTitle("Uhd Ais 3") 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", "uhd_ais_3") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250e3 self.decim = decim = 5 self.baud = baud = 9600 self.samp_per_sym = samp_per_sym = (samp_rate / decim / 50 * 48) / baud self.rx_gain = rx_gain = 45 self.fsk_deviation = fsk_deviation = 10e3 self.freq = freq = 162e6 ################################################## # Blocks ################################################## 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.top_grid_layout.addWidget(self._rx_gain_tool_bar, 8, 0, 1, 2) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, 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 "AIS-B", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.010) 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(-60, 10) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 2, 4, 2, 4) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "AIS-A", #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(-60, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 0, 4, 2, 4) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "AIS", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.01) self.qtgui_freq_sink_x_0.set_y_axis(-60, 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(1.0) 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 = [ "green", "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, 0, 0, 4, 4) self.pyqt_text_output_0_0 = pyqt.text_output() self._pyqt_text_output_0_0_win = self.pyqt_text_output_0_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_0_win, 4, 0, 4, 4) 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, 4, 4, 4, 4) self.low_pass_filter_0_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(11, 1000) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(11, 1000) 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_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * 4, True) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_message_debug_0_1 = blocks.message_debug() self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/zleffke/workspace/captures/ais/ais_20161218_250k_2.32fc', True) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 25e3 + 400, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -25e3 + 400, 1, 0) self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.ais_pdu_to_nmea_0_0 = ais.pdu_to_nmea('B') self.ais_pdu_to_nmea_0 = ais.pdu_to_nmea('A') self.ais_invert_0_0 = ais.invert() self.ais_invert_0 = ais.invert() ################################################## # Connections ################################################## self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.pyqt_text_output_0_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.ais_pdu_to_nmea_0, 'to_nmea')) self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.ais_pdu_to_nmea_0_0, 'to_nmea')) self.connect((self.ais_invert_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.ais_invert_0_0, 0), (self.digital_hdlc_deframer_bp_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.analog_quadrature_demod_cf_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.analog_agc2_xx_0_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.digital_diff_decoder_bb_0_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, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.ais_invert_0, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.ais_invert_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0))
def __init__(self, fsk_dev=5000): gr.top_block.__init__(self, "Atcs Decode 1") Qt.QWidget.__init__(self) self.setWindowTitle("Atcs Decode 1") 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", "atcs_decode_1") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.fsk_dev = fsk_dev ################################################## # Variables ################################################## self.samp_rate = samp_rate = 500e3 self.interp = interp = 48 self.decim = decim = 50 self.baud = baud = 4800 self.samps_per_symb = samps_per_symb = samp_rate / 10 / decim * interp / baud self.rx_gain = rx_gain = 60 self.rx_freq = rx_freq = 936.9375e6 self.offset = offset = -1.5e3 ################################################## # Blocks ################################################## self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel('SAMP_RATE' + ": ")) self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate)) self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit) self._samp_rate_line_edit.returnPressed.connect( lambda: self.set_samp_rate( eng_notation.str_to_num( str(self._samp_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 9, 0, 1, 1) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel('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.top_grid_layout.addWidget(self._rx_gain_tool_bar, 9, 3, 1, 1) self._rx_freq_tool_bar = Qt.QToolBar(self) self._rx_freq_tool_bar.addWidget(Qt.QLabel('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.top_grid_layout.addWidget(self._rx_freq_tool_bar, 9, 1, 1, 1) self._offset_tool_bar = Qt.QToolBar(self) self._offset_tool_bar.addWidget(Qt.QLabel('offset' + ": ")) self._offset_line_edit = Qt.QLineEdit(str(self.offset)) self._offset_tool_bar.addWidget(self._offset_line_edit) self._offset_line_edit.returnPressed.connect(lambda: self.set_offset( eng_notation.str_to_num( str(self._offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._offset_tool_bar, 9, 2, 1, 1) 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( uhd.tune_request(rx_freq, samp_rate / 2), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / 10 / decim * interp, #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(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.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4, 0, 4, 4) 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.010) 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_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "hit") 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) 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_time_raster_sink_x_0 = qtgui.time_raster_sink_b( 4800, 100, 100, ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.010) self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(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_time_raster_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_raster_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / 10 / decim * interp, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.010) self.qtgui_freq_sink_x_0.set_y_axis(-80, 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(1.0) 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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 4, 4) self.low_pass_filter_0 = filter.fir_filter_ccf( 10, firdes.low_pass(1, samp_rate, 2.7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.fosphor_glfw_sink_c_0 = fosphor.glfw_sink_c() self.fosphor_glfw_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_glfw_sink_c_0.set_frequency_range(0, samp_rate) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc( samps_per_symb, .5, 1024, math.pi / 1000) self.digital_correlate_access_code_tag_xx_0 = digital.correlate_access_code_tag_bb( '10101010', 0, 'hit') self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samps_per_symb * (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_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) 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 * offset, 1, 0) self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf( (samp_rate) / (2 * math.pi * fsk_dev / 8.0) * 0 + 1) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.blocks_message_debug_0, 'print')) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.fosphor_glfw_sink_c_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_tag_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.analog_quadrature_demod_cf_1, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))