예제 #1
0
    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):
        gr.top_block.__init__(self, "Message_Example")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Message_Example")
        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", "messaging")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        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.msg_block()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_message_debug_0 = blocks.message_debug()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.epy_block_0, 'msg_out'), (self.blocks_message_debug_0, 'print'))    
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'), (self.epy_block_0, 'msg_in'))    
        self.connect((self.blocks_null_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_null_sink_0, 0))    
예제 #3
0
    def __init__(self):
        gr.top_block.__init__(self, "Sim")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Sim")
        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", "sim")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.sf = sf = 8
        self.samp_rate = samp_rate = 250000
        self.cr = cr = 0
        self.bw = bw = 250000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_edit_box_msg_1 = qtgui.edit_box_msg(qtgui.STRING, '',
                                                       'got:', False, True,
                                                       'msg')
        self._qtgui_edit_box_msg_1_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_1_win, 1, 0, 1,
                                       1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, '123456',
                                                       'Send:', False, True,
                                                       'msg')
        self._qtgui_edit_box_msg_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_win, 0, 0, 1,
                                       1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.lora_whitening_0 = lora.whitening()
        self.lora_sync_0 = lora.sync(samp_rate, bw, sf, False)
        self.lora_sync_0.set_min_output_buffer(300)
        self.lora_modulate_1 = lora.modulate(sf, samp_rate, bw)
        self.lora_modulate_1.set_min_output_buffer(4000000)
        self.lora_interleaver_0 = lora.interleaver(cr, sf)
        self.lora_header_decoder_0 = lora.header_decoder(False, cr, 121, True)
        self.lora_header_0 = lora.header(False, False, cr)
        self.lora_hamming_enc_0 = lora.hamming_enc(cr, sf)
        self.lora_hamming_dec_0 = lora.hamming_dec()
        self.lora_gray_enc_0 = lora.gray_enc()
        self.lora_gray_decode_0 = lora.gray_decode(sf)
        self.lora_fft_demod_0 = lora.fft_demod(samp_rate, bw, sf, False)
        self.lora_fft_demod_0.set_min_output_buffer(300)
        self.lora_dewhitening_0 = lora.dewhitening()
        self.lora_deinterleaver_0 = lora.deinterleaver(sf)
        self.lora_crc_verif_0 = lora.crc_verif()
        self.lora_add_crc_0 = lora.add_crc(True)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                   samp_rate, True)
        self.blocks_throttle_0_0.set_min_output_buffer(4000000)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.lora_crc_verif_0, 'msg'),
                         (self.qtgui_edit_box_msg_1, 'val'))
        self.msg_connect((self.lora_header_decoder_0, 'CRC'),
                         (self.lora_crc_verif_0, 'CRC'))
        self.msg_connect((self.lora_header_decoder_0, 'pay_len'),
                         (self.lora_crc_verif_0, 'pay_len'))
        self.msg_connect((self.lora_header_decoder_0, 'pay_len'),
                         (self.lora_dewhitening_0, 'pay_len'))
        self.msg_connect((self.lora_header_decoder_0, 'CR'),
                         (self.lora_fft_demod_0, 'CR'))
        self.msg_connect((self.lora_header_decoder_0, 'CR'),
                         (self.lora_hamming_dec_0, 'CR'))
        self.msg_connect((self.lora_header_decoder_0, 'err'),
                         (self.lora_sync_0, 'err'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_deinterleaver_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_dewhitening_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_fft_demod_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_hamming_dec_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_header_decoder_0, 'new_frame'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.lora_add_crc_0, 'msg'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.lora_header_0, 'msg'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.lora_interleaver_0, 'msg'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.lora_modulate_1, 'msg'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.lora_whitening_0, 'msg'))
        self.connect((self.blocks_throttle_0_0, 0), (self.lora_sync_0, 0))
        self.connect((self.lora_add_crc_0, 0), (self.lora_hamming_enc_0, 0))
        self.connect((self.lora_deinterleaver_0, 0),
                     (self.lora_hamming_dec_0, 0))
        self.connect((self.lora_dewhitening_0, 0), (self.lora_crc_verif_0, 0))
        self.connect((self.lora_fft_demod_0, 0), (self.lora_gray_enc_0, 0))
        self.connect((self.lora_gray_decode_0, 0), (self.lora_modulate_1, 0))
        self.connect((self.lora_gray_enc_0, 0), (self.lora_deinterleaver_0, 0))
        self.connect((self.lora_hamming_dec_0, 0),
                     (self.lora_header_decoder_0, 0))
        self.connect((self.lora_hamming_enc_0, 0),
                     (self.lora_interleaver_0, 0))
        self.connect((self.lora_header_0, 0), (self.lora_add_crc_0, 0))
        self.connect((self.lora_header_decoder_0, 0),
                     (self.lora_dewhitening_0, 0))
        self.connect((self.lora_interleaver_0, 0),
                     (self.lora_gray_decode_0, 0))
        self.connect((self.lora_modulate_1, 0), (self.blocks_throttle_0_0, 0))
        self.connect((self.lora_sync_0, 0), (self.lora_fft_demod_0, 0))
        self.connect((self.lora_whitening_0, 0), (self.lora_header_0, 0))
예제 #4
0
    def __init__(self):
        gr.top_block.__init__(self, "Frame Sync")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Frame Sync")
        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", "frame_sync")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.header_format = header_format = digital.header_format_default(
            digital.packet_utils.default_access_code, 0)
        self.header_const = header_const = digital.constellation_calcdist(
            (digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base()

        ##################################################
        # 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.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_TAG,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, 'packet_len_2')
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        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, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [0, -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(2 * 1):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            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_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, 'test',
                                                       '123123123', 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.message_to_packet_0 = message_to_packet(
            header_const=header_const,
            header_format=header_format,
            length_tag_name="packet_len",
        )
        self.digital_correlate_access_code_xx_ts_0 = digital.correlate_access_code_bb_ts(
            digital.packet_utils.default_access_code, 0, 'packet_len_2')
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
            (header_const.points()), 1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate,
                                                 True)
        self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(
            blocks.byte_t, 'packet_len_2')
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_char * 1, False)
        self.blocks_repack_bits_bb_1 = blocks.repack_bits_bb(
            1, 8, 'packet_len_2', False, gr.GR_MSB_FIRST)
        self.blocks_message_debug_0 = blocks.message_debug()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'),
                         (self.blocks_message_debug_0, 'print'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.message_to_packet_0, 'msg in'))
        self.connect((self.blocks_repack_bits_bb_1, 0),
                     (self.blocks_tagged_stream_to_pdu_0, 0))
        self.connect((self.blocks_repack_bits_bb_1, 0), (self.show_text_0, 0))
        self.connect((self.blocks_tag_gate_0, 0),
                     (self.digital_correlate_access_code_xx_ts_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_tag_gate_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_correlate_access_code_xx_ts_0, 0),
                     (self.blocks_repack_bits_bb_1, 0))
        self.connect((self.digital_correlate_access_code_xx_ts_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.message_to_packet_0, 0),
                     (self.blocks_throttle_0, 0))
예제 #5
0
    def __init__(self,
                 header_format=digital.header_format_default(
                     digital.packet_utils.default_access_code, 0),
                 length_tag_name='packet_len'):
        gr.top_block.__init__(self, "Fsk Msg")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Fsk Msg")
        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", "fsk_msg")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.header_format = header_format
        self.length_tag_name = length_tag_name

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        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.msg_block()
        self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb(
            header_format, length_tag_name)
        self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(
            blocks.byte_t, 'packet_len')
        self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(
            gr.sizeof_char * 1, length_tag_name, 0)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_message_debug_0 = blocks.message_debug()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'),
                         (self.blocks_message_debug_0, 'print'))
        self.msg_connect((self.epy_block_0, 'msg_out'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.epy_block_0, 'msg_in'))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_tagged_stream_mux_0, 1))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.digital_protocol_formatter_bb_0, 0))
        self.connect((self.blocks_tagged_stream_mux_0, 0),
                     (self.blocks_tagged_stream_to_pdu_0, 0))
        self.connect((self.digital_protocol_formatter_bb_0, 0),
                     (self.blocks_tagged_stream_mux_0, 0))
예제 #6
0
    def __init__(self):
        gr.top_block.__init__(self, "TFG")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("TFG")
        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", "SDR_QT")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.profileID = profileID = 0xDCBA
        self.profile = profile = ""
        self.payload = payload = "EJEMPLO"
        self.nseq = nseq = ""
        self.label_payload = label_payload = ""
        self.label_nwk_src = label_nwk_src = ""
        self.label_nwk_dst = label_nwk_dst = ""
        self.gain = gain = 30
        self.freq = freq = 2480000000
        self.enviar = enviar = False
        self.endpoint_src = endpoint_src = ""
        self.endpoint_dst = endpoint_dst = ""
        self.clusterID = clusterID = 0xABCD
        self.cluster = cluster = ""
        self.NWK_add_src = NWK_add_src = 0xABCD
        self.NWK_add_dst = NWK_add_dst = 0xDCBA
        self.Endpoint_src = Endpoint_src = 10
        self.Endpoint_dst = Endpoint_dst = 20

        ##################################################
        # 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, 'Transmision')
        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, 'Recepcion')
        self.top_layout.addWidget(self.Tab)
        self._NWK_add_src_tool_bar = Qt.QToolBar(self)
        self._NWK_add_src_tool_bar.addWidget(Qt.QLabel("Direccion NWK origen"+": "))
        self._NWK_add_src_line_edit = Qt.QLineEdit(str(self.NWK_add_src))
        self._NWK_add_src_tool_bar.addWidget(self._NWK_add_src_line_edit)
        self._NWK_add_src_line_edit.returnPressed.connect(
        	lambda: self.set_NWK_add_src(int(str(self._NWK_add_src_line_edit.text().toAscii()))))
        self.Tab_grid_layout_0 .addWidget(self._NWK_add_src_tool_bar,  1,0,1,1)
        self.tfg_translation_block_0 = tfg.translation_block()
        self.tfg_NWK_stack_0 = tfg.NWK_stack(True, False)
        self.tfg_Aplication_0 = tfg.Aplication()
        self.tfg_APS_stack_0 = tfg.APS_stack(True, False)
        self._profileID_tool_bar = Qt.QToolBar(self)
        self._profileID_tool_bar.addWidget(Qt.QLabel("ID de perfil"+": "))
        self._profileID_line_edit = Qt.QLineEdit(str(self.profileID))
        self._profileID_tool_bar.addWidget(self._profileID_line_edit)
        self._profileID_line_edit.returnPressed.connect(
        	lambda: self.set_profileID(int(str(self._profileID_line_edit.text().toAscii()))))
        self.Tab_grid_layout_0 .addWidget(self._profileID_tool_bar,  3,2,1,1)
        self._profile_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._profile_formatter = None
        else:
          self._profile_formatter = lambda x: x
        
        self._profile_tool_bar.addWidget(Qt.QLabel('ID de perfil'+": "))
        self._profile_label = Qt.QLabel(str(self._profile_formatter(self.profile)))
        self._profile_tool_bar.addWidget(self._profile_label)
        self.Tab_grid_layout_1 .addWidget(self._profile_tool_bar,  3,2,1,1)
          
        self.perfl_r = qtgui.edit_box_msg(qtgui.INT, '', '', True, True, "perfil")
        self._perfl_r_win = sip.wrapinstance(self.perfl_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._perfl_r_win,  3,3,1,1)
        self.payload_r = qtgui.edit_box_msg(qtgui.STRING, '', '', True, True, "payload")
        self._payload_r_win = sip.wrapinstance(self.payload_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._payload_r_win,  0,1,1,3)
        self._payload_tool_bar = Qt.QToolBar(self)
        self._payload_tool_bar.addWidget(Qt.QLabel('Carga del mensaje'+": "))
        self._payload_line_edit = Qt.QLineEdit(str(self.payload))
        self._payload_tool_bar.addWidget(self._payload_line_edit)
        self._payload_line_edit.returnPressed.connect(
        	lambda: self.set_payload(str(str(self._payload_line_edit.text().toAscii()))))
        self.Tab_grid_layout_0 .addWidget(self._payload_tool_bar,  0,0,1,3)
        self.nseq_r = qtgui.edit_box_msg(qtgui.INT, '', '', True, True, "nseq")
        self._nseq_r_win = sip.wrapinstance(self.nseq_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._nseq_r_win,  4,1,1,1)
        self._nseq_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._nseq_formatter = None
        else:
          self._nseq_formatter = lambda x: x
        
        self._nseq_tool_bar.addWidget(Qt.QLabel('Numero de secuencia'+": "))
        self._nseq_label = Qt.QLabel(str(self._nseq_formatter(self.nseq)))
        self._nseq_tool_bar.addWidget(self._nseq_label)
        self.Tab_grid_layout_1 .addWidget(self._nseq_tool_bar,  4,0,1,1)
          
        self._label_payload_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._label_payload_formatter = None
        else:
          self._label_payload_formatter = lambda x: x
        
        self._label_payload_tool_bar.addWidget(Qt.QLabel('Carga'+": "))
        self._label_payload_label = Qt.QLabel(str(self._label_payload_formatter(self.label_payload)))
        self._label_payload_tool_bar.addWidget(self._label_payload_label)
        self.Tab_grid_layout_1 .addWidget(self._label_payload_tool_bar,  0,0,1,1)
          
        self._label_nwk_src_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._label_nwk_src_formatter = None
        else:
          self._label_nwk_src_formatter = lambda x: x
        
        self._label_nwk_src_tool_bar.addWidget(Qt.QLabel('Direccion NWK origen'+": "))
        self._label_nwk_src_label = Qt.QLabel(str(self._label_nwk_src_formatter(self.label_nwk_src)))
        self._label_nwk_src_tool_bar.addWidget(self._label_nwk_src_label)
        self.Tab_grid_layout_1 .addWidget(self._label_nwk_src_tool_bar,  1,0,1,1)
          
        self._label_nwk_dst_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._label_nwk_dst_formatter = None
        else:
          self._label_nwk_dst_formatter = lambda x: x
        
        self._label_nwk_dst_tool_bar.addWidget(Qt.QLabel('Direccion NWK destino'+": "))
        self._label_nwk_dst_label = Qt.QLabel(str(self._label_nwk_dst_formatter(self.label_nwk_dst)))
        self._label_nwk_dst_tool_bar.addWidget(self._label_nwk_dst_label)
        self.Tab_grid_layout_1 .addWidget(self._label_nwk_dst_tool_bar,  1,2,1,1)
          
        self.ieee802_15_4_oqpsk_phy_0 = ieee802_15_4_oqpsk_phy()
        self.ieee802_15_4_mac_0 = ieee802_15_4.mac(False)
        self._gain_range = Range(1, 100, 1, 30, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'Ganancia TX', "counter_slider", int)
        self.top_grid_layout.addWidget(self._gain_win, 0,0,1,1)
        self._freq_options = [1000000 * (2400 + 5 * (i - 10)) for i in range(11, 27)]
        self._freq_labels = ["11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27"]
        self._freq_tool_bar = Qt.QToolBar(self)
        self._freq_tool_bar.addWidget(Qt.QLabel('Canal'+": "))
        self._freq_combo_box = Qt.QComboBox()
        self._freq_tool_bar.addWidget(self._freq_combo_box)
        for label in self._freq_labels: self._freq_combo_box.addItem(label)
        self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod(self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i)))
        self._freq_callback(self.freq)
        self._freq_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_freq(self._freq_options[i]))
        self.top_grid_layout.addWidget(self._freq_tool_bar, 0,1,1,1)
        self.foo_wireshark_connector_0 = foo.wireshark_connector(195, False)
        self.foo_packet_pad_0 = foo.packet_pad(False, True, 10, 2000, 2000)
        _enviar_push_button = Qt.QPushButton('Enviar')
        self._enviar_choices = {'Pressed': True, 'Released': False}
        _enviar_push_button.pressed.connect(lambda: self.tfg_Aplication_0.send())
        _enviar_push_button.released.connect(lambda: self.set_enviar(self._enviar_choices['Released']))
        self.Tab_grid_layout_0 .addWidget(_enviar_push_button,  7,0,1,3)
        self.endpoint_src_r = qtgui.edit_box_msg(qtgui.INT, '', '', True, True, "endpoint_src")
        self._endpoint_src_r_win = sip.wrapinstance(self.endpoint_src_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._endpoint_src_r_win,  2,1,1,1)
        self._endpoint_src_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._endpoint_src_formatter = None
        else:
          self._endpoint_src_formatter = lambda x: x
        
        self._endpoint_src_tool_bar.addWidget(Qt.QLabel('Enpoint origen'+": "))
        self._endpoint_src_label = Qt.QLabel(str(self._endpoint_src_formatter(self.endpoint_src)))
        self._endpoint_src_tool_bar.addWidget(self._endpoint_src_label)
        self.Tab_grid_layout_1 .addWidget(self._endpoint_src_tool_bar,  2,0,1,1)
          
        self.endpoint_dst_r = qtgui.edit_box_msg(qtgui.INT, '', '', True, True, "endpoint_dst")
        self._endpoint_dst_r_win = sip.wrapinstance(self.endpoint_dst_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._endpoint_dst_r_win,  2,3,1,1)
        self._endpoint_dst_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._endpoint_dst_formatter = None
        else:
          self._endpoint_dst_formatter = lambda x: x
        
        self._endpoint_dst_tool_bar.addWidget(Qt.QLabel('Endpoint destino'+": "))
        self._endpoint_dst_label = Qt.QLabel(str(self._endpoint_dst_formatter(self.endpoint_dst)))
        self._endpoint_dst_tool_bar.addWidget(self._endpoint_dst_label)
        self.Tab_grid_layout_1 .addWidget(self._endpoint_dst_tool_bar,  2,2,1,1)
          
        self.cluster_r = qtgui.edit_box_msg(qtgui.INT, '', '', True, True, "cluster")
        self._cluster_r_win = sip.wrapinstance(self.cluster_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._cluster_r_win,  3,1,1,1)
        self._clusterID_tool_bar = Qt.QToolBar(self)
        self._clusterID_tool_bar.addWidget(Qt.QLabel("ID de cluster"+": "))
        self._clusterID_line_edit = Qt.QLineEdit(str(self.clusterID))
        self._clusterID_tool_bar.addWidget(self._clusterID_line_edit)
        self._clusterID_line_edit.returnPressed.connect(
        	lambda: self.set_clusterID(int(str(self._clusterID_line_edit.text().toAscii()))))
        self.Tab_grid_layout_0 .addWidget(self._clusterID_tool_bar,  3,0,1,1)
        self._cluster_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._cluster_formatter = None
        else:
          self._cluster_formatter = lambda x: x
        
        self._cluster_tool_bar.addWidget(Qt.QLabel('ID de cluster'+": "))
        self._cluster_label = Qt.QLabel(str(self._cluster_formatter(self.cluster)))
        self._cluster_tool_bar.addWidget(self._cluster_label)
        self.Tab_grid_layout_1 .addWidget(self._cluster_tool_bar,  3,0,1,1)
          
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/tmp/sensor.pcap', False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.NWK_add_src_r = qtgui.edit_box_msg(qtgui.INT, '', '', True, True, "NWK_add_src")
        self._NWK_add_src_r_win = sip.wrapinstance(self.NWK_add_src_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._NWK_add_src_r_win,  1,1,1,1)
        self.NWK_add_dst_r = qtgui.edit_box_msg(qtgui.INT, '', '', True, True, "NWK_add_dst")
        self._NWK_add_dst_r_win = sip.wrapinstance(self.NWK_add_dst_r.pyqwidget(), Qt.QWidget)
        self.Tab_grid_layout_1 .addWidget(self._NWK_add_dst_r_win,  1,3,1,1)
        self._NWK_add_dst_tool_bar = Qt.QToolBar(self)
        self._NWK_add_dst_tool_bar.addWidget(Qt.QLabel("Direccion NWK destino"+": "))
        self._NWK_add_dst_line_edit = Qt.QLineEdit(str(self.NWK_add_dst))
        self._NWK_add_dst_tool_bar.addWidget(self._NWK_add_dst_line_edit)
        self._NWK_add_dst_line_edit.returnPressed.connect(
        	lambda: self.set_NWK_add_dst(int(str(self._NWK_add_dst_line_edit.text().toAscii()))))
        self.Tab_grid_layout_0 .addWidget(self._NWK_add_dst_tool_bar,  1,2,1,1)
        self._Endpoint_src_tool_bar = Qt.QToolBar(self)
        self._Endpoint_src_tool_bar.addWidget(Qt.QLabel("Endpoint origen"+": "))
        self._Endpoint_src_line_edit = Qt.QLineEdit(str(self.Endpoint_src))
        self._Endpoint_src_tool_bar.addWidget(self._Endpoint_src_line_edit)
        self._Endpoint_src_line_edit.returnPressed.connect(
        	lambda: self.set_Endpoint_src(int(str(self._Endpoint_src_line_edit.text().toAscii()))))
        self.Tab_grid_layout_0 .addWidget(self._Endpoint_src_tool_bar,  2,0,1,1)
        self._Endpoint_dst_tool_bar = Qt.QToolBar(self)
        self._Endpoint_dst_tool_bar.addWidget(Qt.QLabel("Endpoint destino"+": "))
        self._Endpoint_dst_line_edit = Qt.QLineEdit(str(self.Endpoint_dst))
        self._Endpoint_dst_tool_bar.addWidget(self._Endpoint_dst_line_edit)
        self._Endpoint_dst_line_edit.returnPressed.connect(
        	lambda: self.set_Endpoint_dst(int(str(self._Endpoint_dst_line_edit.text().toAscii()))))
        self.Tab_grid_layout_0 .addWidget(self._Endpoint_dst_tool_bar,  2,2,1,1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ieee802_15_4_mac_0, 'pdu out'), (self.foo_wireshark_connector_0, 'in'))    
        self.msg_connect((self.ieee802_15_4_mac_0, 'pdu out'), (self.ieee802_15_4_oqpsk_phy_0, 'txin'))    
        self.msg_connect((self.ieee802_15_4_mac_0, 'app out'), (self.tfg_translation_block_0, 'in(bastibl)'))    
        self.msg_connect((self.ieee802_15_4_oqpsk_phy_0, 'rxout'), (self.foo_wireshark_connector_0, 'in'))    
        self.msg_connect((self.ieee802_15_4_oqpsk_phy_0, 'rxout'), (self.ieee802_15_4_mac_0, 'pdu in'))    
        self.msg_connect((self.tfg_APS_stack_0, 'out(ZCL)'), (self.tfg_Aplication_0, 'in'))    
        self.msg_connect((self.tfg_APS_stack_0, 'out(NWK)'), (self.tfg_NWK_stack_0, 'in(APS)'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.NWK_add_dst_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.NWK_add_src_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.cluster_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.endpoint_dst_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.endpoint_src_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.nseq_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.payload_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.perfl_r, 'val'))    
        self.msg_connect((self.tfg_Aplication_0, 'out'), (self.tfg_APS_stack_0, 'in(ZCL)'))    
        self.msg_connect((self.tfg_NWK_stack_0, 'out(APS)'), (self.tfg_APS_stack_0, 'in(NWK)'))    
        self.msg_connect((self.tfg_NWK_stack_0, 'out(MAC)'), (self.tfg_translation_block_0, 'in(david)'))    
        self.msg_connect((self.tfg_translation_block_0, 'out(bastibl)'), (self.ieee802_15_4_mac_0, 'app in'))    
        self.msg_connect((self.tfg_translation_block_0, 'out(david)'), (self.tfg_NWK_stack_0, 'in(MAC)'))    
        self.connect((self.foo_packet_pad_0, 0), (self.ieee802_15_4_oqpsk_phy_0, 0))    
        self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.ieee802_15_4_oqpsk_phy_0, 0), (self.foo_packet_pad_0, 0))    
예제 #7
0
    def __init__(self):
        gr.top_block.__init__(self, "Lora Transmitter")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lora Transmitter")
        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", "lora_transmitter")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.bw = bw = 250000
        self.sf = sf = 8
        self.samp_rate = samp_rate = bw
        self.cr = cr = 0
        self.center_freq = center_freq = 915e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("", "addr=192.168.10.2")),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=[],
            ),
            '',
        )
        self.uhd_usrp_sink_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_sink_0.set_gain(20, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_sink_0.set_bandwidth(bw, 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        # No synchronization enforced.
        self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, 'hello world', '', False, True, 'msg')
        self._qtgui_edit_box_msg_0_win = sip.wrapinstance(self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_win)
        self.lora_whitening_0 = lora.whitening()
        self.lora_modulate_1 = lora.modulate(sf, samp_rate, bw)
        self.lora_modulate_1.set_min_output_buffer(4000000)
        self.lora_interleaver_0 = lora.interleaver(cr, sf)
        self.lora_header_0 = lora.header(False, True, cr)
        self.lora_hamming_enc_0 = lora.hamming_enc(cr, sf)
        self.lora_gray_decode_0 = lora.gray_decode(sf)
        self.lora_add_crc_0 = lora.add_crc(True)
        self.lora_RH_RF95_header_0 = lora.RH_RF95_header(32, 32, 32, 32)



        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.lora_RH_RF95_header_0, 'msg'), (self.lora_add_crc_0, 'msg'))
        self.msg_connect((self.lora_RH_RF95_header_0, 'msg'), (self.lora_header_0, 'msg'))
        self.msg_connect((self.lora_RH_RF95_header_0, 'msg'), (self.lora_interleaver_0, 'msg'))
        self.msg_connect((self.lora_RH_RF95_header_0, 'msg'), (self.lora_modulate_1, 'msg'))
        self.msg_connect((self.lora_RH_RF95_header_0, 'msg'), (self.lora_whitening_0, 'msg'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'), (self.lora_RH_RF95_header_0, 'msg'))
        self.connect((self.lora_add_crc_0, 0), (self.lora_hamming_enc_0, 0))
        self.connect((self.lora_gray_decode_0, 0), (self.lora_modulate_1, 0))
        self.connect((self.lora_hamming_enc_0, 0), (self.lora_interleaver_0, 0))
        self.connect((self.lora_header_0, 0), (self.lora_add_crc_0, 0))
        self.connect((self.lora_interleaver_0, 0), (self.lora_gray_decode_0, 0))
        self.connect((self.lora_modulate_1, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.lora_whitening_0, 0), (self.lora_header_0, 0))
예제 #8
0
    def __init__(self):
        gr.top_block.__init__(self, "Morse Code Generator")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Morse Code Generator")
        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", "MorseGen")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.speed = speed = 12
        self.repeat = repeat = 1200
        self.baud = baud = speed / 1.2
        self.samp_rate = samp_rate = baud * repeat
        self.freq = freq = 800

        ##################################################
        # Blocks
        ##################################################
        self._freq_range = Range(300, 20000, 100, 800, 200)
        self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'freq',
                                     "dial", float)
        self.top_grid_layout.addWidget(self._freq_win)
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(
            0.25, 1)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=(int)(48000 / samp_rate),
            decimation=1,
            taps=None,
            fractional_bw=None)
        self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, "",
                                                       'Input', False, False,
                                                       "text")
        self._qtgui_edit_box_msg_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_win)
        self.epy_block_0_0 = epy_block_0_0.mc_sync_block()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char * 1, repeat)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.audio_sink_0 = audio.sink(48000, 'hw:CARD=Device,DEV=0', True)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, freq, 0.5, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.epy_block_0_0, 'clear_input'),
                         (self.qtgui_edit_box_msg_0, 'val'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.epy_block_0_0, 'msg_in'))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_repeat_0, 0),
                     (self.blocks_uchar_to_float_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.single_pole_iir_filter_xx_0, 0))
        self.connect((self.epy_block_0_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.single_pole_iir_filter_xx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
예제 #9
0
    def __init__(self):
        gr.top_block.__init__(self, "Lora Transceiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lora Transceiver")
        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", "lora_transceiver")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.bw = bw = 250000
        self.sf = sf = 8
        self.samp_rate = samp_rate = bw
        self.cr = cr = 3
        self.center_freq = center_freq = 868e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=[],
            ),
            '',
        )
        self.uhd_usrp_sink_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_sink_0.set_gain(0, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_sink_0.set_bandwidth(bw, 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        # No synchronization enforced.
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            40,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(1 / 1e10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_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 range(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, 0,
                                       0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, '', '',
                                                       False, True, 'msg')
        self._qtgui_edit_box_msg_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_win)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_gain(5, 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('RX2', 0)
        self.osmosdr_source_0.set_bandwidth(bw, 0)
        self.lora_whitening_0 = lora.whitening()
        self.lora_sync_0 = lora.sync(samp_rate, bw, sf, False)
        self.lora_modulate_1 = lora.modulate(sf, samp_rate, bw)
        self.lora_interleaver_0 = lora.interleaver(cr, sf)
        self.lora_header_decoder_0 = lora.header_decoder(True, cr, 11, False)
        self.lora_hamming_enc_0 = lora.hamming_enc(cr, sf, True, False)
        self.lora_gray_encode_0 = lora.gray_encode()
        self.lora_gray_decode_0 = lora.gray_decode(sf)
        self.lora_fft_demod_0 = lora.fft_demod(samp_rate, bw, sf, False)
        self.lora_dewhitening_0 = lora.dewhitening()
        self.lora_deinterleaver_0 = lora.deinterleaver(sf)
        self.lora_crc_verif_0 = lora.crc_verif()
        self.lora_FEC_0 = lora.FEC()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.lora_header_decoder_0, 'CR'),
                         (self.lora_FEC_0, 'CR'))
        self.msg_connect((self.lora_header_decoder_0, 'pay_len'),
                         (self.lora_crc_verif_0, 'pay_len'))
        self.msg_connect((self.lora_header_decoder_0, 'CRC'),
                         (self.lora_crc_verif_0, 'CRC'))
        self.msg_connect((self.lora_header_decoder_0, 'pay_len'),
                         (self.lora_dewhitening_0, 'pay_len'))
        self.msg_connect((self.lora_header_decoder_0, 'CR'),
                         (self.lora_fft_demod_0, 'CR'))
        self.msg_connect((self.lora_header_decoder_0, 'err'),
                         (self.lora_sync_0, 'err'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_FEC_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_deinterleaver_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_dewhitening_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_fft_demod_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_header_decoder_0, 'new_frame'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.lora_whitening_0, 'msg'))
        self.connect((self.lora_FEC_0, 0), (self.lora_header_decoder_0, 0))
        self.connect((self.lora_deinterleaver_0, 0), (self.lora_FEC_0, 0))
        self.connect((self.lora_dewhitening_0, 0), (self.lora_crc_verif_0, 0))
        self.connect((self.lora_fft_demod_0, 0), (self.lora_gray_encode_0, 0))
        self.connect((self.lora_gray_decode_0, 0), (self.lora_modulate_1, 0))
        self.connect((self.lora_gray_encode_0, 0),
                     (self.lora_deinterleaver_0, 0))
        self.connect((self.lora_hamming_enc_0, 0),
                     (self.lora_interleaver_0, 0))
        self.connect((self.lora_header_decoder_0, 0),
                     (self.lora_dewhitening_0, 0))
        self.connect((self.lora_interleaver_0, 0),
                     (self.lora_gray_decode_0, 0))
        self.connect((self.lora_modulate_1, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.lora_modulate_1, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.lora_sync_0, 0), (self.lora_fft_demod_0, 0))
        self.connect((self.lora_whitening_0, 0), (self.lora_hamming_enc_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.lora_sync_0, 0))
예제 #10
0
    def __init__(self,
                 hdr_format=digital.header_format_default(
                     digital.packet_utils.default_access_code, 0)):
        gr.top_block.__init__(self, "Audio modem FSK loop back test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Audio modem FSK loop back 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", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.hdr_format = hdr_format

        ##################################################
        # Variables
        ##################################################
        self.nfilts = nfilts = 32
        self.SPS = SPS = 147
        self.RX_decimation = RX_decimation = 49
        self.EBW = EBW = .05
        self.samp_rate = samp_rate = 44.1E3
        self.fsk_deviation_hz = fsk_deviation_hz = 100
        self.carrier_freq = carrier_freq = 1.75E3

        self.RRC_filter_taps = RRC_filter_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0, EBW, 5 * SPS * nfilts / RX_decimation)

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=RX_decimation,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate / RX_decimation,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / RX_decimation,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        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_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        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.msg_block()
        self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb(
            hdr_format, 'len_key')
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff(
            SPS / RX_decimation, 6.28 / 400.0 * 2 / 70, (RRC_filter_taps),
            nfilts, nfilts / 2, 2, 1)
        self.digital_correlate_access_code_xx_ts_1_0_0 = digital.correlate_access_code_bb_ts(
            digital.packet_utils.default_access_code, 2, 'len_key2')
        self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bf(
            ((2 * 3.14 * carrier_freq - 2 * 3.14 * fsk_deviation_hz,
              2 * 3.14 * carrier_freq + 2 * 3.14 * fsk_deviation_hz)), 1)
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.blocks_vector_source_x_0 = blocks.vector_source_b((1, 0), True, 1,
                                                               [])
        self.blocks_vco_f_0 = blocks.vco_f(samp_rate, 1, 1)
        self.blocks_tagged_stream_to_pdu_0_0 = blocks.tagged_stream_to_pdu(
            blocks.byte_t, 'len_key2')
        self.blocks_tagged_stream_mux_1 = blocks.tagged_stream_mux(
            gr.sizeof_char * 1, 'len_key', 0)
        self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(
            gr.sizeof_char * 1, 'len_key', 0)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, 200, 'len_key')
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float * 1, SPS - 1)
        self.blocks_repack_bits_bb_0_0_0_0 = blocks.repack_bits_bb(
            1, 8, 'len_key2', False, gr.GR_MSB_FIRST)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(
            8, 1, 'len_key', False, gr.GR_MSB_FIRST)
        self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'len_key')
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_message_debug_0_0 = blocks.message_debug()
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.audio_source_0 = audio.source(44100, '', True)
        self.audio_sink_0 = audio.sink(44100, '', True)
        self.analog_sig_source_x_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -carrier_freq, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(
            samp_rate / (2 * math.pi * fsk_deviation_hz / 8.0) /
            (RX_decimation))
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(-60, .01, 0, True)
        self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(1024, 1.0)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0, 'pdus'),
                         (self.blocks_message_debug_0_0, 'print'))
        self.msg_connect((self.epy_block_0, 'msg_out'),
                         (self.blocks_pdu_to_tagged_stream_1, 'pdus'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.epy_block_0, 'msg_in'))
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_feedforward_agc_cc_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0),
                     (self.analog_feedforward_agc_cc_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.audio_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_1, 0),
                     (self.blocks_tagged_stream_mux_0, 1))
        self.connect((self.blocks_pdu_to_tagged_stream_1, 0),
                     (self.digital_protocol_formatter_bb_0, 0))
        self.connect((self.blocks_repack_bits_bb_0, 0),
                     (self.blocks_tagged_stream_mux_1, 1))
        self.connect((self.blocks_repack_bits_bb_0_0_0_0, 0),
                     (self.blocks_tagged_stream_to_pdu_0_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_vco_f_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.blocks_tagged_stream_mux_1, 0))
        self.connect((self.blocks_tagged_stream_mux_0, 0),
                     (self.blocks_repack_bits_bb_0, 0))
        self.connect((self.blocks_tagged_stream_mux_1, 0),
                     (self.digital_chunks_to_symbols_xx_0_0, 0))
        self.connect((self.blocks_vco_f_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.digital_correlate_access_code_xx_ts_1_0_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0_0, 0),
                     (self.blocks_repeat_0, 0))
        self.connect((self.digital_correlate_access_code_xx_ts_1_0_0, 0),
                     (self.blocks_repack_bits_bb_0_0_0_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
        self.connect((self.digital_protocol_formatter_bb_0, 0),
                     (self.blocks_tagged_stream_mux_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.analog_pwr_squelch_xx_0, 0))
예제 #11
0
    def __init__(self):
        gr.top_block.__init__(self, "Test Qtgui Msg")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Test Qtgui Msg")
        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", "test_qtgui_msg")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not 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, 2,
                                       0, 1, 2)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not False:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [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, 1, 0, 1,
                                       2)
        self.qtgui_edit_box_msg_0_0_0 = qtgui.edit_box_msg(
            qtgui.INT_VEC, '', '', False, False, '')
        self._qtgui_edit_box_msg_0_0_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_0_0_win, 3,
                                       0, 1, 1)
        self.qtgui_edit_box_msg_0_0 = qtgui.edit_box_msg(
            qtgui.INT_VEC, '', '', False, False, '')
        self._qtgui_edit_box_msg_0_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_0_win, 3, 1,
                                       1, 1)
        self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.FLOAT, '',
                                                       'Frequency', True, True,
                                                       'freq')
        self._qtgui_edit_box_msg_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_win, 0, 0, 1,
                                       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, 1000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.qtgui_freq_sink_x_0, 'freq'))
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.qtgui_waterfall_sink_x_0, 'freq'))
        self.msg_connect((self.qtgui_edit_box_msg_0_0, 'msg'),
                         (self.qtgui_edit_box_msg_0_0_0, 'val'))
        self.msg_connect((self.qtgui_edit_box_msg_0_0_0, 'msg'),
                         (self.blocks_message_debug_0, 'print'))
        self.msg_connect((self.qtgui_edit_box_msg_0_0_0, 'msg'),
                         (self.qtgui_edit_box_msg_0_0, 'val'))
        self.msg_connect((self.qtgui_freq_sink_x_0, 'freq'),
                         (self.qtgui_edit_box_msg_0, 'val'))
        self.msg_connect((self.qtgui_freq_sink_x_0, 'freq'),
                         (self.qtgui_freq_sink_x_0, 'freq'))
        self.msg_connect((self.qtgui_waterfall_sink_x_0, 'freq'),
                         (self.qtgui_edit_box_msg_0, 'val'))
        self.msg_connect((self.qtgui_waterfall_sink_x_0, 'freq'),
                         (self.qtgui_waterfall_sink_x_0, 'freq'))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Master")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Master")
        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", "master")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.n_points = n_points = 5000
        self.downsample = downsample = 50
        self.transition = transition = 2e5
        self.slope_samples = slope_samples = 100
        self.samp_rate1 = samp_rate1 = 48000
        self.samp_rate = samp_rate = 1e6
        self.rx_gain = rx_gain = 50
        self.rtl_samp_rate = rtl_samp_rate = 1e6
        self.pi = pi = 3.1415926535
        self.freq_correction_default = freq_correction_default = -0.16
        self.freq = freq = 2.1e9
        self.down_width = down_width = n_points / downsample
        self.cutoff = cutoff = 1e5
        self.calibrate = calibrate = 1
        self.c = c = 299792458
        self.audio_gain = audio_gain = 0.5

        ##################################################
        # 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, 'Aligned DOA')
        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, 'X-Corr')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Messages')
        self.top_layout.addWidget(self.tab)
        self._freq_range = Range(80e6, 2.2e9, 100e3, 2.1e9, 200)
        self._freq_win = RangeWidget(self._freq_range, self.set_freq,
                                     'Frequency (Hz)', "counter_slider", float)
        self.top_grid_layout.addWidget(self._freq_win, 0, 0, 1, 2)
        self._audio_gain_range = Range(0, 1, 0.1, 0.5, 100)
        self._audio_gain_win = RangeWidget(self._audio_gain_range,
                                           self.set_audio_gain, 'Audio Gain',
                                           "counter_slider", float)
        self.top_layout.addWidget(self._audio_gain_win)
        self.zeromq_pull_source_0_1 = zeromq.pull_source(
            gr.sizeof_float, 1, 'tcp://10.42.0.51:9997', 100, False, -1)
        self.zeromq_pull_source_0_0_0 = zeromq.pull_source(
            gr.sizeof_gr_complex, 1, 'tcp://10.42.0.51:9998', 100, False, -1)
        self.zeromq_pull_source_0_0 = zeromq.pull_source(
            gr.sizeof_gr_complex, 1, 'tcp://10.42.0.51:9992', 10000, False, -1)
        self.zeromq_pull_source_0 = zeromq.pull_source(
            gr.sizeof_gr_complex, 1, 'tcp://10.42.0.51:9991', 10000, False, -1)
        self.xmlrpc_client0 = xmlrpclib.Server('http://10.42.0.51:30000')
        self.xmlrpc_client = xmlrpclib.Server('http://10.42.0.51:30000')
        self._rx_gain_range = Range(0, 70, 1, 50, 200)
        self._rx_gain_win = RangeWidget(self._rx_gain_range, self.set_rx_gain,
                                        'RF Gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._rx_gain_win, 1, 0, 1, 2)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            409,  #samp_rate
            "Capon DOA Angle",  #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(-3.2, 3.2)

        self.qtgui_time_sink_x_0.set_y_label('Angle', "radians")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_win, 3, 0,
                                         1, 3)
        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_NONE, 1)
        self.qtgui_number_sink_0.set_update_time(0.01)
        self.qtgui_number_sink_0.set_title("Degree")

        labels = ['', '', '', '', '', '', '', '', '', '']
        units = ['', '', '', '', '', '', '', '', '', '']
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, -180)
            self.qtgui_number_sink_0.set_max(i, 180)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(True)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            freq,  #fc
            1e6,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(0.05)
        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_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.qtgui_edit_box_msg_0_1 = qtgui.edit_box_msg(
            qtgui.STRING, 'reset_buffer', 'Reset Alignment Buffer', False,
            False, 'recalc')
        self._qtgui_edit_box_msg_0_1_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0_1.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_edit_box_msg_0_1_win)
        self.qtgui_edit_box_msg_0_0 = qtgui.edit_box_msg(
            qtgui.FLOAT, '0', 'Reset Sample Drift Correction', True, False,
            'reset_sum')
        self._qtgui_edit_box_msg_0_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_edit_box_msg_0_0_win)
        self.doa_capon_ccf_0_0 = doa.capon_ccf(down_width)
        _calibrate_check_box = Qt.QCheckBox('Enable Calibration')
        self._calibrate_choices = {True: 1, False: 0}
        self._calibrate_choices_inv = dict(
            (v, k) for k, v in self._calibrate_choices.iteritems())
        self._calibrate_callback = lambda i: Qt.QMetaObject.invokeMethod(
            _calibrate_check_box, "setChecked",
            Qt.Q_ARG("bool", self._calibrate_choices_inv[i]))
        self._calibrate_callback(self.calibrate)
        _calibrate_check_box.stateChanged.connect(
            lambda i: self.set_calibrate(self._calibrate_choices[bool(i)]))
        self.top_layout.addWidget(_calibrate_check_box)
        self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, down_width)
        self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, down_width)
        self.blocks_multiply_const_vxx_3 = blocks.multiply_const_vff(
            (180 / pi, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (audio_gain, ))
        self.blocks_keep_one_in_n_3 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, 50)
        self.blocks_keep_one_in_n_2 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, 50)
        self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_float * 1,
                                                   '/home/coding/Desktop/5',
                                                   False)
        self.blocks_file_sink_1.set_unbuffered(False)
        self.audio_sink_0 = audio.sink(48000, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_keep_one_in_n_2, 0),
                     (self.blocks_stream_to_vector_0_1, 0))
        self.connect((self.blocks_keep_one_in_n_3, 0),
                     (self.blocks_stream_to_vector_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_3, 0),
                     (self.qtgui_number_sink_0, 0))
        self.connect((self.blocks_stream_to_vector_0_0_0, 0),
                     (self.doa_capon_ccf_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1, 0),
                     (self.doa_capon_ccf_0_0, 1))
        self.connect((self.doa_capon_ccf_0_0, 0), (self.blocks_file_sink_1, 0))
        self.connect((self.doa_capon_ccf_0_0, 0),
                     (self.blocks_multiply_const_vxx_3, 0))
        self.connect((self.doa_capon_ccf_0_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.zeromq_pull_source_0, 0),
                     (self.blocks_keep_one_in_n_3, 0))
        self.connect((self.zeromq_pull_source_0_0, 0),
                     (self.blocks_keep_one_in_n_2, 0))
        self.connect((self.zeromq_pull_source_0_0_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.zeromq_pull_source_0_1, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
예제 #13
0
    def __init__(self):
        gr.top_block.__init__(self, "Lora Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lora Receiver")
        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", "lora_receiver")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.bw = bw = 250000
        self.sf = sf = 8
        self.samp_rate = samp_rate = bw
        self.center_freq = center_freq = 915e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_1 = uhd.usrp_source(
            ",".join(("", "addr=192.168.10.3")),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=[],
            ),
        )
        self.uhd_usrp_source_1.set_center_freq(center_freq, 0)
        self.uhd_usrp_source_1.set_rx_agc(False, 0)
        self.uhd_usrp_source_1.set_gain(10.0, 0)
        self.uhd_usrp_source_1.set_antenna('RX2', 0)
        self.uhd_usrp_source_1.set_bandwidth(bw, 0)
        self.uhd_usrp_source_1.set_samp_rate(samp_rate)
        # No synchronization enforced.
        self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c(
            512,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            center_freq,  #fc
            bw,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0_0.set_update_time(1 / bw / 100)
        self.qtgui_waterfall_sink_x_0_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0_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 range(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win)
        self.qtgui_edit_box_msg_1 = qtgui.edit_box_msg(qtgui.STRING, '',
                                                       'Received:', False,
                                                       True, 'msg')
        self._qtgui_edit_box_msg_1_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_1_win)
        self.lora_sync_0 = lora.sync(samp_rate, bw, sf, False)
        self.lora_header_decoder_0 = lora.header_decoder(False, 4, 15, True)
        self.lora_hamming_dec_0 = lora.hamming_dec()
        self.lora_gray_enc_0 = lora.gray_enc()
        self.lora_fft_demod_0 = lora.fft_demod(samp_rate, bw, sf, False)
        self.lora_dewhitening_0 = lora.dewhitening()
        self.lora_deinterleaver_0 = lora.deinterleaver(sf)
        self.lora_crc_verif_0 = lora.crc_verif()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.lora_crc_verif_0, 'msg'),
                         (self.qtgui_edit_box_msg_1, 'val'))
        self.msg_connect((self.lora_header_decoder_0, 'pay_len'),
                         (self.lora_crc_verif_0, 'pay_len'))
        self.msg_connect((self.lora_header_decoder_0, 'CRC'),
                         (self.lora_crc_verif_0, 'CRC'))
        self.msg_connect((self.lora_header_decoder_0, 'pay_len'),
                         (self.lora_dewhitening_0, 'pay_len'))
        self.msg_connect((self.lora_header_decoder_0, 'CR'),
                         (self.lora_fft_demod_0, 'CR'))
        self.msg_connect((self.lora_header_decoder_0, 'CR'),
                         (self.lora_hamming_dec_0, 'CR'))
        self.msg_connect((self.lora_header_decoder_0, 'err'),
                         (self.lora_sync_0, 'err'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_deinterleaver_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_dewhitening_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_fft_demod_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_hamming_dec_0, 'new_frame'))
        self.msg_connect((self.lora_sync_0, 'new_frame'),
                         (self.lora_header_decoder_0, 'new_frame'))
        self.connect((self.lora_deinterleaver_0, 0),
                     (self.lora_hamming_dec_0, 0))
        self.connect((self.lora_dewhitening_0, 0), (self.lora_crc_verif_0, 0))
        self.connect((self.lora_fft_demod_0, 0), (self.lora_gray_enc_0, 0))
        self.connect((self.lora_gray_enc_0, 0), (self.lora_deinterleaver_0, 0))
        self.connect((self.lora_hamming_dec_0, 0),
                     (self.lora_header_decoder_0, 0))
        self.connect((self.lora_header_decoder_0, 0),
                     (self.lora_dewhitening_0, 0))
        self.connect((self.lora_sync_0, 0), (self.lora_fft_demod_0, 0))
        self.connect((self.uhd_usrp_source_1, 0), (self.lora_sync_0, 0))
        self.connect((self.uhd_usrp_source_1, 0),
                     (self.qtgui_waterfall_sink_x_0_0, 0))
예제 #14
0
    def __init__(
            self,
            configFile="~/.config/gr-amateur/AX25_Modem-HackRF-RTLSDR.ini",
            logLevel="debug"):
        gr.top_block.__init__(self, "AX.25 - AFSK1200 Modem GUI")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("AX.25 - AFSK1200 Modem GUI")
        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", "AX25_Modem_GUI")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Parameters
        ##################################################
        self.configFile = configFile
        self.logLevel = logLevel

        ##################################################
        # Variables
        ##################################################
        self._rx_fs_config = ConfigParser.ConfigParser()
        self._rx_fs_config.read(configFile)
        try:
            rx_fs = self._rx_fs_config.getfloat('Receive', 'fs')
        except:
            rx_fs = 1.92e6
        self.rx_fs = rx_fs
        self.logLvl = logLvl = {
            "info": logging.INFO,
            "debug": logging.DEBUG,
            "warning": logging.WARNING,
            "warn": logging.WARN,
            "error": logging.ERROR
        }.get(logLevel.lower(), logging.INFO)
        self._afsk_bitRate_config = ConfigParser.ConfigParser()
        self._afsk_bitRate_config.read(configFile)
        try:
            afsk_bitRate = self._afsk_bitRate_config.getfloat(
                'AFSK', 'bitRate')
        except:
            afsk_bitRate = 1200.0
        self.afsk_bitRate = afsk_bitRate
        self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = ""
        self.variable_qtgui_label_0 = variable_qtgui_label_0 = ""
        self._rx_freq_config = ConfigParser.ConfigParser()
        self._rx_freq_config.read(configFile)
        try:
            rx_freq = self._rx_freq_config.getfloat('Receive', 'freq')
        except:
            rx_freq = 144.39e6
        self.rx_freq = rx_freq
        self._rx_deviceArgs_config = ConfigParser.ConfigParser()
        self._rx_deviceArgs_config.read(configFile)
        try:
            rx_deviceArgs = self._rx_deviceArgs_config.get(
                'Receive', 'deviceArgs')
        except:
            rx_deviceArgs = ""
        self.rx_deviceArgs = rx_deviceArgs
        self.rootLogger = rootLogger = amateur.setupLogging(level=logLvl)
        self._debug_txCtrl_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_txCtrl_zmqAddr_config.read(configFile)
        try:
            debug_txCtrl_zmqAddr = self._debug_txCtrl_zmqAddr_config.get(
                'Debug', 'txCtrl_zmqAddr')
        except:
            debug_txCtrl_zmqAddr = "tcp://127.0.0.1:18737"
        self.debug_txCtrl_zmqAddr = debug_txCtrl_zmqAddr
        self._debug_syms_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_syms_zmqAddr_config.read(configFile)
        try:
            debug_syms_zmqAddr = self._debug_syms_zmqAddr_config.get(
                'Debug', 'syms_zmqAddr')
        except:
            debug_syms_zmqAddr = "tcp://127.0.0.1:18732"
        self.debug_syms_zmqAddr = debug_syms_zmqAddr
        self._debug_stats_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_stats_zmqAddr_config.read(configFile)
        try:
            debug_stats_zmqAddr = self._debug_stats_zmqAddr_config.get(
                'Debug', 'stats_zmqAddr')
        except:
            debug_stats_zmqAddr = "tcp://127.0.0.1:18735"
        self.debug_stats_zmqAddr = debug_stats_zmqAddr
        self._debug_snr_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_snr_zmqAddr_config.read(configFile)
        try:
            debug_snr_zmqAddr = self._debug_snr_zmqAddr_config.get(
                'Debug', 'snr_zmqAddr')
        except:
            debug_snr_zmqAddr = "tcp://127.0.0.1:18731"
        self.debug_snr_zmqAddr = debug_snr_zmqAddr
        self._debug_sent_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_sent_zmqAddr_config.read(configFile)
        try:
            debug_sent_zmqAddr = self._debug_sent_zmqAddr_config.get(
                'Debug', 'sent_zmqAddr')
        except:
            debug_sent_zmqAddr = "tcp://127.0.0.1:18734"
        self.debug_sent_zmqAddr = debug_sent_zmqAddr
        self._debug_rxCtrl_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_rxCtrl_zmqAddr_config.read(configFile)
        try:
            debug_rxCtrl_zmqAddr = self._debug_rxCtrl_zmqAddr_config.get(
                'Debug', 'rxCtrl_zmqAddr')
        except:
            debug_rxCtrl_zmqAddr = "tcp://127.0.0.1:18738"
        self.debug_rxCtrl_zmqAddr = debug_rxCtrl_zmqAddr
        self._debug_recv_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_recv_zmqAddr_config.read(configFile)
        try:
            debug_recv_zmqAddr = self._debug_recv_zmqAddr_config.get(
                'Debug', 'recv_zmqAddr')
        except:
            debug_recv_zmqAddr = "tcp://127.0.0.1:18733"
        self.debug_recv_zmqAddr = debug_recv_zmqAddr
        self._debug_cs_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_cs_zmqAddr_config.read(configFile)
        try:
            debug_cs_zmqAddr = self._debug_cs_zmqAddr_config.get(
                'Debug', 'cs_zmqAddr')
        except:
            debug_cs_zmqAddr = "tcp://127.0.0.1:18736"
        self.debug_cs_zmqAddr = debug_cs_zmqAddr
        self._debug_bb_zmqAddr_config = ConfigParser.ConfigParser()
        self._debug_bb_zmqAddr_config.read(configFile)
        try:
            debug_bb_zmqAddr = self._debug_bb_zmqAddr_config.get(
                'Debug', 'bb_zmqAddr')
        except:
            debug_bb_zmqAddr = "tcp://127.0.0.1:18730"
        self.debug_bb_zmqAddr = debug_bb_zmqAddr
        self.Fs_bb = Fs_bb = min([rx_fs / afsk_bitRate, 20]) * afsk_bitRate

        ##################################################
        # Blocks
        ##################################################
        self.statTab = Qt.QTabWidget()
        self.statTab_widget_0 = Qt.QWidget()
        self.statTab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.statTab_widget_0)
        self.statTab_grid_layout_0 = Qt.QGridLayout()
        self.statTab_layout_0.addLayout(self.statTab_grid_layout_0)
        self.statTab.addTab(self.statTab_widget_0, 'Statistics')
        self.top_grid_layout.addWidget(self.statTab, 0, 6, 3, 2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(0, 3)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(6, 8)]
        self.plotTab = Qt.QTabWidget()
        self.plotTab_widget_0 = Qt.QWidget()
        self.plotTab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.plotTab_widget_0)
        self.plotTab_grid_layout_0 = Qt.QGridLayout()
        self.plotTab_layout_0.addLayout(self.plotTab_grid_layout_0)
        self.plotTab.addTab(self.plotTab_widget_0, 'Spectrum')
        self.plotTab_widget_1 = Qt.QWidget()
        self.plotTab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.plotTab_widget_1)
        self.plotTab_grid_layout_1 = Qt.QGridLayout()
        self.plotTab_layout_1.addLayout(self.plotTab_grid_layout_1)
        self.plotTab.addTab(self.plotTab_widget_1, 'Time')
        self.top_grid_layout.addWidget(self.plotTab, 0, 0, 8, 6)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(0, 8)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 6)]
        self.msgTab = Qt.QTabWidget()
        self.msgTab_widget_0 = Qt.QWidget()
        self.msgTab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                             self.msgTab_widget_0)
        self.msgTab_grid_layout_0 = Qt.QGridLayout()
        self.msgTab_layout_0.addLayout(self.msgTab_grid_layout_0)
        self.msgTab.addTab(self.msgTab_widget_0, 'Messages')
        self.msgTab_widget_1 = Qt.QWidget()
        self.msgTab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                             self.msgTab_widget_1)
        self.msgTab_grid_layout_1 = Qt.QGridLayout()
        self.msgTab_layout_1.addLayout(self.msgTab_grid_layout_1)
        self.msgTab.addTab(self.msgTab_widget_1, 'Console')
        self.msgTab_widget_2 = Qt.QWidget()
        self.msgTab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                             self.msgTab_widget_2)
        self.msgTab_grid_layout_2 = Qt.QGridLayout()
        self.msgTab_layout_2.addLayout(self.msgTab_grid_layout_2)
        self.msgTab.addTab(self.msgTab_widget_2, 'Beacon')
        self.top_grid_layout.addWidget(self.msgTab, 8, 0, 8, 8)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(8, 16)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 8)]
        self.ctrlTab = Qt.QTabWidget()
        self.ctrlTab_widget_0 = Qt.QWidget()
        self.ctrlTab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.ctrlTab_widget_0)
        self.ctrlTab_grid_layout_0 = Qt.QGridLayout()
        self.ctrlTab_layout_0.addLayout(self.ctrlTab_grid_layout_0)
        self.ctrlTab.addTab(self.ctrlTab_widget_0, 'Control')
        self.top_grid_layout.addWidget(self.ctrlTab, 3, 6, 5, 2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(3, 8)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(6, 8)]
        self.zeromq_sub_source_0_0_0_0 = zeromq.sub_source(
            gr.sizeof_char, 1, debug_cs_zmqAddr, 5, False, -1)
        self.zeromq_sub_source_0_0_0 = zeromq.sub_source(
            gr.sizeof_float, 1, debug_syms_zmqAddr, 10, False, -1)
        self.zeromq_sub_source_0_0 = zeromq.sub_source(gr.sizeof_float, 1,
                                                       debug_snr_zmqAddr, 10,
                                                       False, -1)
        self.zeromq_sub_source_0 = zeromq.sub_source(gr.sizeof_gr_complex, 1,
                                                     debug_bb_zmqAddr, 10,
                                                     False, -1)
        self.zeromq_sub_msg_source_0_0_0 = zeromq.sub_msg_source(
            debug_stats_zmqAddr, 10)
        self.zeromq_sub_msg_source_0_0 = zeromq.sub_msg_source(
            debug_sent_zmqAddr, 10)
        self.zeromq_sub_msg_source_0 = zeromq.sub_msg_source(
            debug_recv_zmqAddr, 10)
        self.zeromq_pub_msg_sink_0_0_0_0 = zeromq.pub_msg_sink(
            debug_rxCtrl_zmqAddr, 10)
        self.zeromq_pub_msg_sink_0_0_0 = zeromq.pub_msg_sink(
            debug_txCtrl_zmqAddr, 10)
        self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_0_formatter = None
        else:
            self._variable_qtgui_label_0_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_0_tool_bar.addWidget(
            Qt.QLabel("Transmit" + ": "))
        self._variable_qtgui_label_0_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_0_formatter(
                    self.variable_qtgui_label_0_0)))
        self._variable_qtgui_label_0_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_0_label)
        self.msgTab_grid_layout_0.addWidget(
            self._variable_qtgui_label_0_0_tool_bar, 0, 0, 1, 4)
        [self.msgTab_grid_layout_0.setRowStretch(r, 1) for r in range(0, 1)]
        [self.msgTab_grid_layout_0.setColumnStretch(c, 1) for c in range(0, 4)]
        self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_formatter = None
        else:
            self._variable_qtgui_label_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_tool_bar.addWidget(
            Qt.QLabel("Receive" + ": "))
        self._variable_qtgui_label_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_formatter(
                    self.variable_qtgui_label_0)))
        self._variable_qtgui_label_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_label)
        self.msgTab_grid_layout_0.addWidget(
            self._variable_qtgui_label_0_tool_bar, 0, 4, 1, 4)
        [self.msgTab_grid_layout_0.setRowStretch(r, 1) for r in range(0, 1)]
        [self.msgTab_grid_layout_0.setColumnStretch(c, 1) for c in range(4, 8)]
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            4096,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            rx_freq,  #fc
            Fs_bb,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.025)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not False:
            self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [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(-100, 0)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.plotTab_grid_layout_0.addWidget(
            self._qtgui_waterfall_sink_x_0_win, 3, 0, 5, 8)
        [self.plotTab_grid_layout_0.setRowStretch(r, 1) for r in range(3, 8)]
        [
            self.plotTab_grid_layout_0.setColumnStretch(c, 1)
            for c in range(0, 8)
        ]
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            int(afsk_bitRate * 2),  #size
            afsk_bitRate,  #samp_rate
            "Symbols",  #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.25, 1.25)

        self.qtgui_time_sink_x_0_0.set_y_label("", "")

        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)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_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_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.plotTab_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_0_win,
                                             4, 0, 4, 8)
        [self.plotTab_grid_layout_1.setRowStretch(r, 1) for r in range(4, 8)]
        [
            self.plotTab_grid_layout_1.setColumnStretch(c, 1)
            for c in range(0, 8)
        ]
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            int(Fs_bb * 2),  #size
            Fs_bb,  #samp_rate
            "SNR",  #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(-10, 30)

        self.qtgui_time_sink_x_0.set_y_label("", "")

        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)
        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.plotTab_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_win, 0,
                                             0, 4, 8)
        [self.plotTab_grid_layout_1.setRowStretch(r, 1) for r in range(0, 4)]
        [
            self.plotTab_grid_layout_1.setColumnStretch(c, 1)
            for c in range(0, 8)
        ]
        self.qtgui_number_sink_0_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                       qtgui.NUM_GRAPH_HORIZ,
                                                       2)
        self.qtgui_number_sink_0_0.set_update_time(0.10)
        self.qtgui_number_sink_0_0.set_title("")

        labels = [
            "{:8s}".format("SNR"), "{:8s}".format("CS"), '', '', '', '', '',
            '', '', ''
        ]
        units = ["dB", '', '', '', '', '', '', '', '', '']
        colors = [("blue", "red"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(2):
            self.qtgui_number_sink_0_0.set_min(i, -5)
            self.qtgui_number_sink_0_0.set_max(i, 20)
            self.qtgui_number_sink_0_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0_0.set_label(i, labels[i])
            self.qtgui_number_sink_0_0.set_unit(i, units[i])
            self.qtgui_number_sink_0_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0_0.enable_autoscale(False)
        self._qtgui_number_sink_0_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0_0.pyqwidget(), Qt.QWidget)
        self.statTab_grid_layout_0.addWidget(self._qtgui_number_sink_0_0_win,
                                             0, 0, 1, 4)
        [self.statTab_grid_layout_0.setRowStretch(r, 1) for r in range(0, 1)]
        [
            self.statTab_grid_layout_0.setColumnStretch(c, 1)
            for c in range(0, 4)
        ]
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            4096,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            rx_freq,  #fc
            Fs_bb,  #bw
            "Spectrum",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.1)
        self.qtgui_freq_sink_x_0.set_y_axis(-100, 0)
        self.qtgui_freq_sink_x_0.set_y_label("", "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 = [
            "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(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.plotTab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0,
                                             0, 3, 8)
        [self.plotTab_grid_layout_0.setRowStretch(r, 1) for r in range(0, 3)]
        [
            self.plotTab_grid_layout_0.setColumnStretch(c, 1)
            for c in range(0, 8)
        ]
        self.qtgui_edit_box_msg_0_1 = qtgui.edit_box_msg(
            qtgui.FLOAT, '', "TX - Gain", True, True, "gain")
        self._qtgui_edit_box_msg_0_1_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0_1.pyqwidget(), Qt.QWidget)
        self.ctrlTab_grid_layout_0.addWidget(self._qtgui_edit_box_msg_0_1_win,
                                             2, 0, 1, 1)
        [self.ctrlTab_grid_layout_0.setRowStretch(r, 1) for r in range(2, 3)]
        [
            self.ctrlTab_grid_layout_0.setColumnStretch(c, 1)
            for c in range(0, 1)
        ]
        self.qtgui_edit_box_msg_0_0_0 = qtgui.edit_box_msg(
            qtgui.FLOAT, '', "RX - Gain", True, True, "gain")
        self._qtgui_edit_box_msg_0_0_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0_0_0.pyqwidget(), Qt.QWidget)
        self.ctrlTab_grid_layout_0.addWidget(
            self._qtgui_edit_box_msg_0_0_0_win, 3, 0, 1, 1)
        [self.ctrlTab_grid_layout_0.setRowStretch(r, 1) for r in range(3, 4)]
        [
            self.ctrlTab_grid_layout_0.setColumnStretch(c, 1)
            for c in range(0, 1)
        ]
        self.qtgui_edit_box_msg_0_0 = qtgui.edit_box_msg(
            qtgui.FLOAT, '', "RX - Frequency", True, True, "freq")
        self._qtgui_edit_box_msg_0_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0_0.pyqwidget(), Qt.QWidget)
        self.ctrlTab_grid_layout_0.addWidget(self._qtgui_edit_box_msg_0_0_win,
                                             1, 0, 1, 1)
        [self.ctrlTab_grid_layout_0.setRowStretch(r, 1) for r in range(1, 2)]
        [
            self.ctrlTab_grid_layout_0.setColumnStretch(c, 1)
            for c in range(0, 1)
        ]
        self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.FLOAT, '',
                                                       "TX - Frequency", True,
                                                       True, "freq")
        self._qtgui_edit_box_msg_0_win = sip.wrapinstance(
            self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget)
        self.ctrlTab_grid_layout_0.addWidget(self._qtgui_edit_box_msg_0_win, 0,
                                             0, 1, 1)
        [self.ctrlTab_grid_layout_0.setRowStretch(r, 1) for r in range(0, 1)]
        [
            self.ctrlTab_grid_layout_0.setColumnStretch(c, 1)
            for c in range(0, 1)
        ]
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.amateur_AX25_Packet_Decoder_0 = amateur.AX25_Packet_Decoder()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'),
                         (self.zeromq_pub_msg_sink_0_0_0, 'in'))
        self.msg_connect((self.qtgui_edit_box_msg_0_0, 'msg'),
                         (self.qtgui_freq_sink_x_0, 'freq'))
        self.msg_connect((self.qtgui_edit_box_msg_0_0, 'msg'),
                         (self.qtgui_waterfall_sink_x_0, 'freq'))
        self.msg_connect((self.qtgui_edit_box_msg_0_0, 'msg'),
                         (self.zeromq_pub_msg_sink_0_0_0_0, 'in'))
        self.msg_connect((self.qtgui_edit_box_msg_0_0_0, 'msg'),
                         (self.zeromq_pub_msg_sink_0_0_0_0, 'in'))
        self.msg_connect((self.qtgui_edit_box_msg_0_1, 'msg'),
                         (self.zeromq_pub_msg_sink_0_0_0, 'in'))
        self.msg_connect((self.zeromq_sub_msg_source_0, 'out'),
                         (self.amateur_AX25_Packet_Decoder_0, 'in'))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.qtgui_number_sink_0_0, 1))
        self.connect((self.zeromq_sub_source_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.zeromq_sub_source_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.zeromq_sub_source_0_0, 0),
                     (self.qtgui_number_sink_0_0, 0))
        self.connect((self.zeromq_sub_source_0_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.zeromq_sub_source_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.zeromq_sub_source_0_0_0_0, 0),
                     (self.blocks_uchar_to_float_0, 0))