def __init__(self, ip='127.0.0.1', iq_file='./rocksat_125kbd_500ksps_date_comment.dat', meta_rate=.1, port='52001', pre_bits=[ 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0 ], record_iq=0, record_rfo=0, record_snr=0, rfo_file='./rocksat_rfo_date_comment.meta', snr_file='./rocksat_snr_date_comment.meta'): gr.top_block.__init__(self, "MGS Rocksat Receiver v1.0") Qt.QWidget.__init__(self) self.setWindowTitle("MGS Rocksat Receiver v1.0") 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", "mgs_rx_hdlc_1") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.ip = ip self.iq_file = iq_file self.meta_rate = meta_rate self.port = port self.pre_bits = pre_bits self.record_iq = record_iq self.record_rfo = record_rfo self.record_snr = record_snr self.rfo_file = rfo_file self.snr_file = snr_file ################################################## # Variables ################################################## self.samp_rate = samp_rate = 500e3 self.baud = baud = 125e3 self.samps_per_symb = samps_per_symb = int(samp_rate / baud) self.rx_offset = rx_offset = 250e3 self.rx_gain = rx_gain = 25 self.rx_freq = rx_freq = 2395e6 self.mult = mult = (samp_rate) / 2 / 3.141593 self.lpf_taps = lpf_taps = firdes.low_pass(1.0, samp_rate, samp_rate / 2, 1000, firdes.WIN_HAMMING, 6.76) self.lo = lo = 1833e6 self.khz_offset = khz_offset = 0 self.alpha = alpha = 0.5 ################################################## # Blocks ################################################## self._rx_gain_range = Range(0, 86, 1, 25, 200) self._rx_gain_win = RangeWidget(self._rx_gain_range, self.set_rx_gain, 'RX Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._rx_gain_win, 0, 8, 1, 4) self._khz_offset_range = Range(-150, 150, 1, 0, 200) self._khz_offset_win = RangeWidget(self._khz_offset_range, self.set_khz_offset, 'Offset [kHz]', "counter_slider", float) self.top_grid_layout.addWidget(self._khz_offset_win, 1, 8, 1, 4) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(rx_freq, rx_offset), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 4096, #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.010) self.qtgui_waterfall_sink_x_0.enable_grid(True) 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 = ['pre-d', 'post', '', '', '', '', '', '', '', ''] colors = [0, 1, 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(-130, -60) 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, 8, 0, 8, 8) 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.10) self.qtgui_number_sink_0.set_title("") 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, -1) self.qtgui_number_sink_0.set_max(i, 1) 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(False) 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 * 4, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.0010) self.qtgui_freq_sink_x_0.set_y_axis(-120, -20) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['pre-d', 'post', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 8, 8) self.pyqt_trim_tail_0 = pyqt.trim_tail(20) self.pyqt_time_plot_1_0_0 = pyqt.time_plot('Soft Bits') self._pyqt_time_plot_1_0_0_win = self.pyqt_time_plot_1_0_0 self.top_grid_layout.addWidget(self._pyqt_time_plot_1_0_0_win, 4, 8, 1, 4) self.pyqt_time_plot_1_0 = pyqt.time_plot('Hard Bits') self._pyqt_time_plot_1_0_win = self.pyqt_time_plot_1_0 self.top_grid_layout.addWidget(self._pyqt_time_plot_1_0_win, 5, 8, 1, 4) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6, 8, 4, 4) self.pyqt_skip_head_0 = pyqt.skip_head(100) self.pyqt_head_0 = pyqt.head(1024) self.pyqt_cpower_plot_0_0 = pyqt.cpower_plot('Burst Post Length-D') self._pyqt_cpower_plot_0_0_win = self.pyqt_cpower_plot_0_0 self.top_grid_layout.addWidget(self._pyqt_cpower_plot_0_0_win, 2, 8, 1, 4) self.pyqt_const_plot_0_0 = pyqt.const_plot(label='Symbols') self._pyqt_const_plot_0_0_win = self.pyqt_const_plot_0_0 self.top_grid_layout.addWidget(self._pyqt_const_plot_0_0_win, 3, 8, 1, 4) self.mapper_demapper_soft_0 = mapper.demapper_soft( mapper.BPSK, ([0, 1])) self.mapper_demapper_msg_0_0 = mapper.demapper_msg( mapper.BPSK, ([0, 1])) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, (baud * (1 + alpha)) / 2, 1000, firdes.WIN_HAMMING, 6.76)) self.kiss_nrzi_decode_0 = kiss.nrzi_decode() self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True, max_length=1024) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, (lpf_taps), khz_offset * 1000, samp_rate) self.es_trigger_edge_f_0 = es.trigger_edge_f(-1, 256 * 16, 100, gr.sizeof_gr_complex, 500) self.es_sink_0 = es.sink(1 * [gr.sizeof_gr_complex], 4, 128, 0, 2, 0) self.es_handler_pdu_0 = es.es_make_handler_pdu( es.es_handler_print.TYPE_C32) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc( math.pi * 2 / 100, 2, False) self.digital_costas_loop_cc_0 = digital.costas_loop_cc( math.pi * 2 / 100, 2, False) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_cc( samps_per_symb * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.burst_slicer_0 = burst.slicer() self.burst_preamble_correlator_0 = burst.preamble_correlator( 4, 0.5, (pre_bits)) self.burst_length_detect_c_0 = burst.length_detect_c() (self.burst_length_detect_c_0).set_min_output_buffer(20800) self.burst_correlator_filter_0 = burst.correlator_filter( 100, 1e-4, -10) self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", ip, port, 1024, False) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream( blocks.complex_t, 'pl2') self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((10, )) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-3, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.burst_length_detect_c_0, 'cpdus'), (self.mapper_demapper_msg_0_0, 'cpdus')) self.msg_connect((self.burst_length_detect_c_0, 'cpdus'), (self.pyqt_const_plot_0_0, 'cpdus')) self.msg_connect((self.burst_length_detect_c_0, 'cpdus'), (self.pyqt_cpower_plot_0_0, 'cpdus')) self.msg_connect((self.burst_length_detect_c_0, 'cpdus'), (self.pyqt_trim_tail_0, 'pdus')) self.msg_connect((self.burst_slicer_0, 'pdus'), (self.pyqt_time_plot_1_0, 'pdus')) self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.burst_length_detect_c_0, 'cpdus')) self.msg_connect((self.es_trigger_edge_f_0, 'edge_event'), (self.es_handler_pdu_0, 'handle_event')) self.msg_connect((self.es_trigger_edge_f_0, 'which_stream'), (self.es_sink_0, 'schedule_event')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.mapper_demapper_msg_0_0, 'fpdus'), (self.burst_slicer_0, 'fpdus')) self.msg_connect((self.mapper_demapper_msg_0_0, 'fpdus'), (self.pyqt_time_plot_1_0_0, 'pdus')) self.msg_connect((self.pyqt_head_0, 'pdus'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.pyqt_skip_head_0, 'pdus'), (self.pyqt_head_0, 'pdus')) self.msg_connect((self.pyqt_trim_tail_0, 'pdus'), (self.pyqt_skip_head_0, 'pdus')) self.connect((self.analog_agc2_xx_0_0, 0), (self.digital_costas_loop_cc_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.burst_correlator_filter_0, 0), (self.es_trigger_edge_f_0, 0)) self.connect((self.burst_preamble_correlator_0, 0), (self.burst_correlator_filter_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.burst_preamble_correlator_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.es_trigger_edge_f_0, 1)) self.connect((self.digital_costas_loop_cc_0, 0), (self.mapper_demapper_soft_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.kiss_nrzi_decode_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.es_sink_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.kiss_nrzi_decode_0, 0), (self.kiss_hdlc_deframer_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.mapper_demapper_soft_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Uhd Ais 3") Qt.QWidget.__init__(self) self.setWindowTitle("Uhd Ais 3") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "uhd_ais_3") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250e3 self.decim = decim = 5 self.baud = baud = 9600 self.samp_per_sym = samp_per_sym = (samp_rate / decim / 50 * 48) / baud self.rx_gain = rx_gain = 45 self.fsk_deviation = fsk_deviation = 10e3 self.freq = freq = 162e6 ################################################## # Blocks ################################################## self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel("rx_gain" + ": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect(lambda: self.set_rx_gain( eng_notation.str_to_num( str(self._rx_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rx_gain_tool_bar, 8, 0, 1, 2) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "AIS-B", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0_0.enable_grid(True) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-60, 10) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 2, 4, 2, 4) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "AIS-A", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(True) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-60, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 0, 4, 2, 4) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "AIS", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.01) self.qtgui_freq_sink_x_0.set_y_axis(-60, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "green", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 4, 4) self.pyqt_text_output_0_0 = pyqt.text_output() self._pyqt_text_output_0_0_win = self.pyqt_text_output_0_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_0_win, 4, 0, 4, 4) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 4, 4, 4, 4) self.low_pass_filter_0_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(11, 1000) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(11, 1000) self.digital_diff_decoder_bb_0_0 = digital.diff_decoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * 4, True) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_message_debug_0_1 = blocks.message_debug() self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/zleffke/workspace/captures/ais/ais_20161218_250k_2.32fc', True) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 25e3 + 400, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -25e3 + 400, 1, 0) self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.ais_pdu_to_nmea_0_0 = ais.pdu_to_nmea('B') self.ais_pdu_to_nmea_0 = ais.pdu_to_nmea('A') self.ais_invert_0_0 = ais.invert() self.ais_invert_0 = ais.invert() ################################################## # Connections ################################################## self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.pyqt_text_output_0_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.ais_pdu_to_nmea_0, 'to_nmea')) self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.ais_pdu_to_nmea_0_0, 'to_nmea')) self.connect((self.ais_invert_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.ais_invert_0_0, 0), (self.digital_hdlc_deframer_bp_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.analog_quadrature_demod_cf_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.analog_agc2_xx_0_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.digital_diff_decoder_bb_0_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.ais_invert_0, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.ais_invert_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0))
def __init__(self, fsk_dev=10000, lpf_cutoff=10e3, lpf_trans=1e3): gr.top_block.__init__(self, "Afsk Test") Qt.QWidget.__init__(self) self.setWindowTitle("Afsk Test") 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", "afsk_test") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.fsk_dev = fsk_dev self.lpf_cutoff = lpf_cutoff self.lpf_trans = lpf_trans ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.baud = baud = 1200 self.samps_per_symb = samps_per_symb = int(samp_rate/baud) self.noise_amp = noise_amp = 0.3 self.mult = mult = (samp_rate)/2/3.141593 self.decim = decim = 2 self.bb_gain = bb_gain = .75 self.alpha = alpha = 0.5 ################################################## # Blocks ################################################## self._noise_amp_range = Range(0, 1, 0.005, 0.3, 200) self._noise_amp_win = RangeWidget(self._noise_amp_range, self.set_noise_amp, "noise_amp", "counter_slider", float) self.top_grid_layout.addWidget(self._noise_amp_win, 6,0,1,4) self._bb_gain_range = Range(0, 1, .01, .75, 200) self._bb_gain_win = RangeWidget(self._bb_gain_range, self.set_bb_gain, 'bb_gain', "counter_slider", float) self.top_grid_layout.addWidget(self._bb_gain_win, 5,0,1,4) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_f( 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 "float" == "float" or "float" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not False) 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_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 8192, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 2048, #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_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(True) self.qtgui_time_sink_x_0.enable_grid(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.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 4,4,3,4) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate/decim, #bw "RX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.10) self.qtgui_freq_sink_x_1_0.set_y_axis(-80, 10) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 0,4,4,4) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 0,0,4,4) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0; self.top_layout.addWidget(self._pyqt_text_output_0_win) self.pyqt_text_input_0 = pyqt.text_input() self._pyqt_text_input_0_win = self.pyqt_text_input_0; self.top_grid_layout.addWidget(self._pyqt_text_input_0_win, 4,0,1,4) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate/decim, lpf_cutoff, lpf_trans, firdes.WIN_HAMMING, 6.76)) self.kiss_nrzi_encode_0 = kiss.nrzi_encode() self.kiss_hdlc_framer_0 = kiss.hdlc_framer(preamble_bytes=64, postamble_bytes=16) self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True, max_length=300) self.digital_gfsk_mod_0 = digital.gfsk_mod( samples_per_symbol=samps_per_symb, sensitivity=0.06, bt=1, verbose=False, log=False, ) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samps_per_symb*(1+0.0)/decim, 0.25*0.175*0.175, 0.25, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_tag_gate_0.set_single_key("packet_len") self.blocks_socket_pdu_0_2 = blocks.socket_pdu("UDP_SERVER", '0.0.0.0', '52002', 1024, False) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((bb_gain, )) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.audio_sink_0 = audio.sink(samp_rate, '', True) self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1700, 1, 0) self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf((samp_rate/decim)/(2*math.pi*fsk_dev/8.0)) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=samp_rate, quad_rate=samp_rate, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(analog.GR_GAUSSIAN, noise_amp, 0, 8192) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.kiss_hdlc_framer_0, 'in')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.blocks_socket_pdu_0_2, 'pdus')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.kiss_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.pyqt_text_input_0, 'pdus'), (self.kiss_hdlc_framer_0, 'in')) self.connect((self.analog_agc2_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_1, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_add_xx_1, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_gfsk_mod_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.kiss_nrzi_encode_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_descrambler_bb_0, 0), (self.kiss_hdlc_deframer_0, 0)) self.connect((self.digital_gfsk_mod_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.kiss_nrzi_encode_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
def __init__(self, rx_freq=401.5e6, rx_offset=250e3): gr.top_block.__init__(self, "VCC Simple Downlink Receiver") Qt.QWidget.__init__(self) self.setWindowTitle("VCC Simple Downlink 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", "fsk_rx_uhd") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.rx_freq = rx_freq self.rx_offset = rx_offset ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250000 self.interp = interp = 24 self.decim = decim = 25 * 5 self.baud = baud = 9600 self.samps_per_symb = samps_per_symb = (samp_rate / decim * interp) / baud self.rx_gain = rx_gain = 0 self.rx_correct = rx_correct = -300 self.lpf_trans = lpf_trans = 1e3 self.lpf_cutoff = lpf_cutoff = 12.5e3 self.fsk_dev = fsk_dev = 10000 ################################################## # Blocks ################################################## self._rx_gain_range = Range(0, 86, 1, 0, 200) self._rx_gain_win = RangeWidget(self._rx_gain_range, self.set_rx_gain, 'RX Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._rx_gain_win, 4, 0, 1, 4) self._rx_correct_range = Range(-10000, 10000, 1, -300, 200) self._rx_correct_win = RangeWidget(self._rx_correct_range, self.set_rx_correct, "rx_correct", "counter_slider", float) self.top_grid_layout.addWidget(self._rx_correct_win, 5, 0, 1, 4) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(rx_freq + rx_correct, rx_offset), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('TX/RX', 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp, #bw "RX Spectrum", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 4, 4) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6, 0, 2, 4) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate / decim * interp, lpf_cutoff, lpf_trans, firdes.WIN_HAMMING, 6.76)) self.kiss_pdu_to_kiss_0 = kiss.pdu_to_kiss() self.kiss_nrzi_decode_0 = kiss.nrzi_decode() self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True, max_length=300) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samps_per_symb * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.25, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_socket_pdu_0_2_0 = blocks.socket_pdu( "TCP_SERVER", '0.0.0.0', '8001', 1024, False) self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf( (samp_rate / decim * interp) / (2 * math.pi * fsk_dev / 8.0)) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.kiss_pdu_to_kiss_0, 'in')) self.msg_connect((self.kiss_pdu_to_kiss_0, 'out'), (self.blocks_socket_pdu_0_2_0, 'pdus')) self.msg_connect((self.kiss_pdu_to_kiss_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_descrambler_bb_0, 0), (self.kiss_nrzi_decode_0, 0)) self.connect((self.kiss_nrzi_decode_0, 0), (self.kiss_hdlc_deframer_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_1_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.rational_resampler_xxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Uhd Adsb Test") Qt.QWidget.__init__(self) self.setWindowTitle("Uhd Adsb Test") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "uhd_adsb_test") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.threshold = threshold = 15 self.samp_rate = samp_rate = 4e6 self.rx_offset = rx_offset = 0 self.rx_gain = rx_gain = 12 self.lpf_cutoff = lpf_cutoff = 2e6 self.freq = freq = 915e6 ################################################## # Blocks ################################################## self._threshold_tool_bar = Qt.QToolBar(self) self._threshold_tool_bar.addWidget( Qt.QLabel('Detection Threshold' + ": ")) self._threshold_line_edit = Qt.QLineEdit(str(self.threshold)) self._threshold_tool_bar.addWidget(self._threshold_line_edit) self._threshold_line_edit.returnPressed.connect( lambda: self.set_threshold( eng_notation.str_to_num( str(self._threshold_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._threshold_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._rx_offset_tool_bar = Qt.QToolBar(self) self._rx_offset_tool_bar.addWidget(Qt.QLabel("rx_offset" + ": ")) self._rx_offset_line_edit = Qt.QLineEdit(str(self.rx_offset)) self._rx_offset_tool_bar.addWidget(self._rx_offset_line_edit) self._rx_offset_line_edit.returnPressed.connect( lambda: self.set_rx_offset( eng_notation.str_to_num( str(self._rx_offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rx_offset_tool_bar, 1, 4, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._rx_gain_range = Range(1, 76, 1, 12, 200) self._rx_gain_win = RangeWidget(self._rx_gain_range, self.set_rx_gain, "rx_gain", "counter_slider", float) self.top_grid_layout.addWidget(self._rx_gain_win, 0, 4, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._lpf_cutoff_tool_bar = Qt.QToolBar(self) self._lpf_cutoff_tool_bar.addWidget(Qt.QLabel("lpf_cutoff" + ": ")) self._lpf_cutoff_line_edit = Qt.QLineEdit(str(self.lpf_cutoff)) self._lpf_cutoff_tool_bar.addWidget(self._lpf_cutoff_line_edit) self._lpf_cutoff_line_edit.returnPressed.connect( lambda: self.set_lpf_cutoff( eng_notation.str_to_num( str(self._lpf_cutoff_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._lpf_cutoff_tool_bar, 1, 6, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_meta_to_json_0 = vcc.meta_to_json() self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(('', "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq( uhd.tune_request(freq, samp_rate / 2), 0) self.uhd_usrp_source_1.set_gain(rx_gain, 0) self.uhd_usrp_source_1.set_antenna('RX2', 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( int(samp_rate * 1 * 150e-6), #size int(samp_rate * 1), #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(1.0 / 100.0) self.qtgui_time_sink_x_0.set_y_axis(0, 250) 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, 1.25e-6, 0, "burst") 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 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 = [1, 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): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 2, 4, 1, 4) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 3, 4, 1, 4) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, lpf_cutoff, 10e3, firdes.WIN_HAMMING, 6.76)) self.fosphor_qt_sink_c_1 = fosphor.qt_sink_c() self.fosphor_qt_sink_c_1.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_qt_sink_c_1.set_frequency_range(0, samp_rate) self._fosphor_qt_sink_c_1_win = sip.wrapinstance( self.fosphor_qt_sink_c_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._fosphor_qt_sink_c_1_win, 0, 0, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length( gr.sizeof_char * 1, 'packet_len', 1.0 / 8) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '127.0.0.1', '52001', 10000, False) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, rx_offset * -1, 1, 0) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, threshold) self.analog_agc2_xx_0 = analog.agc2_cc(1e-6, 1e-3, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.adsb_framer_1 = adsb.framer(samp_rate, threshold) self.adsb_demod_0 = adsb.demod(samp_rate) self.adsb_decoder_0 = adsb.decoder("All Messages", "None", "Verbose") ################################################## # Connections ################################################## self.msg_connect((self.adsb_decoder_0, 'decoded'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.adsb_demod_0, 'demodulated'), (self.adsb_decoder_0, 'demodulated')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.vcc_meta_to_json_0, 'in')) self.msg_connect((self.vcc_meta_to_json_0, 'out'), (self.blocks_message_debug_0, 'print')) self.msg_connect((self.vcc_meta_to_json_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.vcc_meta_to_json_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.connect((self.adsb_demod_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.adsb_framer_1, 0), (self.adsb_demod_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_const_source_x_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.adsb_framer_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.fosphor_qt_sink_c_1, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self, tx_freq=401.5e6, tx_offset=250e3): gr.top_block.__init__(self, "VCC Simple Uplink Transmitter") Qt.QWidget.__init__(self) self.setWindowTitle("VCC Simple Uplink 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", "fsk_tx_uhd") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.tx_freq = tx_freq self.tx_offset = tx_offset ################################################## # Variables ################################################## self.samp_rate = samp_rate = 240000 self.baud = baud = 9600 self.tx_gain = tx_gain = 0 self.tx_correct = tx_correct = -300 self.samps_per_symb = samps_per_symb = samp_rate / baud self.interp = interp = 25 self.decim = decim = 24 self.bb_gain = bb_gain = .75 self.alpha = alpha = .5 ################################################## # Blocks ################################################## self._tx_gain_range = Range(0, 86, 1, 0, 200) self._tx_gain_win = RangeWidget(self._tx_gain_range, self.set_tx_gain, 'TX Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._tx_gain_win, 7, 0, 1, 4) self._tx_correct_range = Range(-10000, 10000, 1, -300, 200) self._tx_correct_win = RangeWidget(self._tx_correct_range, self.set_tx_correct, "tx_correct", "counter_slider", float) self.top_grid_layout.addWidget(self._tx_correct_win, 8, 0, 1, 4) self._bb_gain_range = Range(0, 1, .01, .75, 200) self._bb_gain_win = RangeWidget(self._bb_gain_range, self.set_bb_gain, 'bb_gain', "counter_slider", float) self.top_grid_layout.addWidget(self._bb_gain_win, 6, 0, 1, 4) self.uhd_usrp_sink_0_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0_0.set_samp_rate(250e3) self.uhd_usrp_sink_0_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0_0.set_center_freq( uhd.tune_request(tx_freq + tx_correct, tx_offset), 0) self.uhd_usrp_sink_0_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0_0.set_antenna('TX/RX', 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.010) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 2, 0, 4, 4) self.pyqt_text_output_0_0 = pyqt.text_output() self._pyqt_text_output_0_0_win = self.pyqt_text_output_0_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_0_win, 0, 0, 2, 4) self.kiss_nrzi_encode_0 = kiss.nrzi_encode() self.kiss_kiss_to_pdu_0 = kiss.kiss_to_pdu(True) self.kiss_hdlc_framer_0 = kiss.hdlc_framer(preamble_bytes=64, postamble_bytes=64) self.digital_scrambler_bb_0 = digital.scrambler_bb(0x21, 0x0, 16) self.digital_gmsk_mod_0 = digital.gmsk_mod( samples_per_symbol=int(samps_per_symb), bt=alpha, verbose=False, log=False, ) self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_tag_gate_0.set_single_key("packet_len") self.blocks_socket_pdu_0_2 = blocks.socket_pdu("TCP_CLIENT", '0.0.0.0', '8000', 1024, False) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc( (bb_gain, )) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.kiss_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.kiss_hdlc_framer_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.pyqt_text_output_0_0, 'pdus')) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_gmsk_mod_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.digital_scrambler_bb_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.kiss_kiss_to_pdu_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.digital_scrambler_bb_0, 0), (self.kiss_nrzi_encode_0, 0)) self.connect((self.kiss_nrzi_encode_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Supacars") Qt.QWidget.__init__(self) self.setWindowTitle("Supacars") 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", "SUPACARS") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.variable_qtgui_label_0_1 = variable_qtgui_label_0_1 = 'Parser Text Output' self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = 'Raw Text Output' self.samp_rate = samp_rate = 48000 self.rx_volume = rx_volume = 100 self.rx_gain = rx_gain = 26 self.lo_off = lo_off = 126e3 self.init_sample_rate = init_sample_rate = 500e3 self.corr_thres = corr_thres = 0.5 self.center_freq = center_freq = 131.725e6 ################################################## # Blocks ################################################## self._rx_volume_range = Range(1, 500, 1, 100, 200) self._rx_volume_win = RangeWidget(self._rx_volume_range, self.set_rx_volume, "rx_volume", "counter_slider", float) self.top_grid_layout.addWidget(self._rx_volume_win, 3, 0, 1, 2) self._rx_gain_range = Range(0, 40, 1, 26, 200) self._rx_gain_win = RangeWidget(self._rx_gain_range, self.set_rx_gain, "rx_gain", "counter_slider", float) self.top_grid_layout.addWidget(self._rx_gain_win, 1, 0, 1, 2) self._corr_thres_range = Range(0, 5, 0.01, 0.5, 200) self._corr_thres_win = RangeWidget(self._corr_thres_range, self.set_corr_thres, "corr_thres", "counter_slider", float) self.top_grid_layout.addWidget(self._corr_thres_win, 0, 0, 1, 2) self._variable_qtgui_label_0_1_tool_bar = Qt.QToolBar(self) if 0: self._variable_qtgui_label_0_1_formatter = 0 else: self._variable_qtgui_label_0_1_formatter = lambda x: x self._variable_qtgui_label_0_1_tool_bar.addWidget( Qt.QLabel('Terminal 2 ' + ": ")) self._variable_qtgui_label_0_1_label = Qt.QLabel( str( self._variable_qtgui_label_0_1_formatter( self.variable_qtgui_label_0_1))) self._variable_qtgui_label_0_1_tool_bar.addWidget( self._variable_qtgui_label_0_1_label) self.top_grid_layout.addWidget(self._variable_qtgui_label_0_1_tool_bar, 5, 1, 1, 1) self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self) if 0: self._variable_qtgui_label_0_0_formatter = 0 else: self._variable_qtgui_label_0_0_formatter = lambda x: x self._variable_qtgui_label_0_0_tool_bar.addWidget( Qt.QLabel('Terminal 1 ' + ": ")) 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.top_grid_layout.addWidget(self._variable_qtgui_label_0_0_tool_bar, 5, 0, 1, 1) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(init_sample_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(center_freq, lo_off), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('TX/RX', 0) self.supacars_acarsparser_0 = supacars.acarsparser(False, '') self.supacars_acars_0 = supacars.acars(samp_rate, corr_thres) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 48000, #size samp_rate, #samp_rate "ACARS signal", #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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 4, 0, 1, 2) self.pyqt_text_output_0_0 = pyqt.text_output() self._pyqt_text_output_0_0_win = self.pyqt_text_output_0_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_0_win, 6, 1, 1, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6, 0, 1, 1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff(samp_rate / init_sample_rate, taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(rx_volume, init_sample_rate, 5e3, 500, firdes.WIN_HAMMING, 6.76)) self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.audio_sink_0 = audio.sink(samp_rate, '', True) ################################################## # Connections ################################################## self.msg_connect((self.supacars_acars_0, 'raw_output'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.supacars_acars_0, 'parser_output'), (self.supacars_acarsparser_0, 'in')) self.msg_connect((self.supacars_acarsparser_0, 'parsed_out'), (self.pyqt_text_output_0_0, 'pdus')) self.connect((self.blocks_complex_to_mag_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.audio_sink_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.supacars_acars_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
def __init__(self): gr.top_block.__init__(self, "VCC Burst TX/RX, 9600 Baud GMSK, AX.25, w/ PTT") Qt.QWidget.__init__(self) self.setWindowTitle("VCC Burst TX/RX, 9600 Baud GMSK, AX.25, w/ PTT") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "burst_trx_gmsk9600_ax25_n210") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.tx_freq = tx_freq = 401.12e6 self.uplink_freq = uplink_freq = tx_freq self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y%m%d_%H%M%S" ) self.gs_id = gs_id = "VTGS" self.tx_tune = tx_tune = tx_freq - uplink_freq self.samp_rate = samp_rate = float(250e3) self.man_tune = man_tune = 0.0 self.fn = fn = "VCC_{:s}_{:s}".format(gs_id, ts_str) self.uplink_offset = uplink_offset = -1* tx_tune self.tx_tune_sel = tx_tune_sel = 0 self.tx_sel = tx_sel = [tx_tune, -1*man_tune] self.tx_offset = tx_offset = samp_rate/2 self.tx_gain = tx_gain = 10 self.trigger_thresh = trigger_thresh = -2 self.rx_offset = rx_offset = samp_rate/2.0 self.rx_gain = rx_gain = 20 self.rx_freq = rx_freq = 401.08e6 self.interp_2 = interp_2 = 1 self.interp = interp = 48 self.fsk_dev = fsk_dev = 10000 self.fp = fp = "/vtgs/captures/vcc/{:s}".format(fn) self.decim_2 = decim_2 = 2 self.decim = decim = int(samp_rate/2000) self.chan_filt_trans = chan_filt_trans = 1000 self.chan_filt_cutoff = chan_filt_cutoff = 24000 self.ceres_offset = ceres_offset = 40e3 self.bb_gain = bb_gain = .75 ################################################## # Blocks ################################################## self.main_tab = Qt.QTabWidget() self.main_tab_widget_0 = Qt.QWidget() self.main_tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_0) self.main_tab_grid_layout_0 = Qt.QGridLayout() self.main_tab_layout_0.addLayout(self.main_tab_grid_layout_0) self.main_tab.addTab(self.main_tab_widget_0, 'Full Band') self.main_tab_widget_1 = Qt.QWidget() self.main_tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_1) self.main_tab_grid_layout_1 = Qt.QGridLayout() self.main_tab_layout_1.addLayout(self.main_tab_grid_layout_1) self.main_tab.addTab(self.main_tab_widget_1, 'RX Channel') self.main_tab_widget_2 = Qt.QWidget() self.main_tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_2) self.main_tab_grid_layout_2 = Qt.QGridLayout() self.main_tab_layout_2.addLayout(self.main_tab_grid_layout_2) self.main_tab.addTab(self.main_tab_widget_2, 'TX Channel') self.top_grid_layout.addWidget(self.main_tab, 0, 0, 2, 8) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self._tx_tune_sel_options = (0, 1, ) self._tx_tune_sel_labels = ('Auto', 'Manual', ) self._tx_tune_sel_tool_bar = Qt.QToolBar(self) self._tx_tune_sel_tool_bar.addWidget(Qt.QLabel('TX Tune Mode'+": ")) self._tx_tune_sel_combo_box = Qt.QComboBox() self._tx_tune_sel_tool_bar.addWidget(self._tx_tune_sel_combo_box) for label in self._tx_tune_sel_labels: self._tx_tune_sel_combo_box.addItem(label) self._tx_tune_sel_callback = lambda i: Qt.QMetaObject.invokeMethod(self._tx_tune_sel_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._tx_tune_sel_options.index(i))) self._tx_tune_sel_callback(self.tx_tune_sel) self._tx_tune_sel_combo_box.currentIndexChanged.connect( lambda i: self.set_tx_tune_sel(self._tx_tune_sel_options[i])) self.main_tab_grid_layout_2.addWidget(self._tx_tune_sel_tool_bar, 3, 1, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(1, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('TX Gain'+": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect( lambda: self.set_tx_gain(eng_notation.str_to_num(str(self._tx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_gain_tool_bar, 2, 3, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(3, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._tx_freq_tool_bar = Qt.QToolBar(self) self._tx_freq_tool_bar.addWidget(Qt.QLabel('TX Freq'+": ")) self._tx_freq_line_edit = Qt.QLineEdit(str(self.tx_freq)) self._tx_freq_tool_bar.addWidget(self._tx_freq_line_edit) self._tx_freq_line_edit.returnPressed.connect( lambda: self.set_tx_freq(eng_notation.str_to_num(str(self._tx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_freq_tool_bar, 2, 0, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._trigger_thresh_tool_bar = Qt.QToolBar(self) self._trigger_thresh_tool_bar.addWidget(Qt.QLabel('Trigger Thresh'+": ")) self._trigger_thresh_line_edit = Qt.QLineEdit(str(self.trigger_thresh)) self._trigger_thresh_tool_bar.addWidget(self._trigger_thresh_line_edit) self._trigger_thresh_line_edit.returnPressed.connect( lambda: self.set_trigger_thresh(eng_notation.str_to_num(str(self._trigger_thresh_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._trigger_thresh_tool_bar, 4, 4, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel('RX Gain'+": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect( lambda: self.set_rx_gain(eng_notation.str_to_num(str(self._rx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_gain_tool_bar, 4, 2, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._rx_freq_tool_bar = Qt.QToolBar(self) self._rx_freq_tool_bar.addWidget(Qt.QLabel('RX Freq'+": ")) self._rx_freq_line_edit = Qt.QLineEdit(str(self.rx_freq)) self._rx_freq_tool_bar.addWidget(self._rx_freq_line_edit) self._rx_freq_line_edit.returnPressed.connect( lambda: self.set_rx_freq(eng_notation.str_to_num(str(self._rx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_freq_tool_bar, 4, 0, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._ceres_offset_tool_bar = Qt.QToolBar(self) self._ceres_offset_tool_bar.addWidget(Qt.QLabel('Ceres Offset'+": ")) self._ceres_offset_line_edit = Qt.QLineEdit(str(self.ceres_offset)) self._ceres_offset_tool_bar.addWidget(self._ceres_offset_line_edit) self._ceres_offset_line_edit.returnPressed.connect( lambda: self.set_ceres_offset(eng_notation.str_to_num(str(self._ceres_offset_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._ceres_offset_tool_bar, 3, 4, 1, 2) for r in range(3, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel('BB Gain'+": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect( lambda: self.set_bb_gain(eng_notation.str_to_num(str(self._bb_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._bb_gain_tool_bar, 2, 2, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 3): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx_0 = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_0_win = self.vcc_qt_hex_text_tx_0; self.main_tab_grid_layout_1.addWidget(self._vcc_qt_hex_text_tx_0_win, 5, 0, 2, 6) for r in range(5, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_win = self.vcc_qt_hex_text_tx; self.main_tab_grid_layout_2.addWidget(self._vcc_qt_hex_text_tx_win, 0, 0, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._uplink_offset_tool_bar = Qt.QToolBar(self) if None: self._uplink_offset_formatter = None else: self._uplink_offset_formatter = lambda x: eng_notation.num_to_str(x) self._uplink_offset_tool_bar.addWidget(Qt.QLabel("uplink_offset"+": ")) self._uplink_offset_label = Qt.QLabel(str(self._uplink_offset_formatter(self.uplink_offset))) self._uplink_offset_tool_bar.addWidget(self._uplink_offset_label) self.main_tab_grid_layout_2.addWidget(self._uplink_offset_tool_bar, 2, 1, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(1, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_clock_source('external', 0) self.uhd_usrp_source_1.set_time_source('external', 0) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq, rx_offset), 0) self.uhd_usrp_source_1.set_gain(rx_gain, 0) self.uhd_usrp_source_1.set_antenna('RX2', 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("addr=192.168.10.6", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_clock_source('external', 0) self.uhd_usrp_sink_0.set_time_source('external', 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(tx_freq, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.sigmf_sink_0 = gr_sigmf.sink("cf32", fp, gr_sigmf.sigmf_time_mode_absolute, False) self.sigmf_sink_0.set_global_meta("core:sample_rate", samp_rate) self.sigmf_sink_0.set_global_meta("core:description", 'VCC TM/TC v1.0.0, GMSK9600, AX.25, w/ PTT') self.sigmf_sink_0.set_global_meta("core:author", 'Zach Leffke') self.sigmf_sink_0.set_global_meta("core:license", 'MIT') self.sigmf_sink_0.set_global_meta("core:hw", '2X M2 400CP30, ARR Preamp, N210 w/ UBX') self.rffe_ctl_tag_ptt_pdu_0 = rffe_ctl.tag_ptt_pdu(samp_rate,"tx_sob","tx_eob","tx_time","TX") self.rational_resampler_xxx_4 = filter.rational_resampler_ccc( interpolation=interp/2, decimation=decim, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_3 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=interp_2, decimation=decim_2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.0010) self.qtgui_waterfall_sink_x_0_0.enable_grid(True) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-50, 50) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 2, 0, 2, 4) for r in range(2, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(True) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 1, 0, 1, 8) for r in range(1, 2): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "VCC RX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_1.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0_1.set_y_axis(-150, -40) self.qtgui_freq_sink_x_1_0_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_1.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_1.enable_grid(True) self.qtgui_freq_sink_x_1_0_1.set_fft_average(0.2) self.qtgui_freq_sink_x_1_0_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_1.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_1_0_1_win, 0, 0, 1, 8) for r in range(0, 1): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate/decim*interp/2, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 2, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "Ceres Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0.set_y_axis(-50, 50) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate*interp/decim*interp_2/decim_2, #bw "Burst RX Spectrum", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['orig', 'corr', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win, 0, 4, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0; self.main_tab_grid_layout_2.addWidget(self._pyqt_text_output_0_win, 4, 0, 1, 4) for r in range(4, 5): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_meta_text_output_0_win, 3, 6, 4, 2) for r in range(3, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(6, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_ctime_plot_0_win, 2, 4, 1, 4) for r in range(2, 3): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._man_tune_tool_bar = Qt.QToolBar(self) self._man_tune_tool_bar.addWidget(Qt.QLabel('TX Freq Offset'+": ")) self._man_tune_line_edit = Qt.QLineEdit(str(self.man_tune)) self._man_tune_tool_bar.addWidget(self._man_tune_line_edit) self._man_tune_line_edit.returnPressed.connect( lambda: self.set_man_tune(eng_notation.str_to_num(str(self._man_tune_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._man_tune_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate / decim *interp, chan_filt_cutoff, chan_filt_trans, firdes.WIN_HAMMING, 6.76)) self.gpredict_doppler_0 = gpredict.doppler("0.0.0.0", 7356, True) self.gpredict_MsgPairToVar_1 = gpredict.MsgPairToVar(self.set_uplink_freq) self.gmsk_tx_burst_hier2_0 = gmsk_tx_burst_hier2( bb_gain=bb_gain, bt=.5, delay_enable=1, pad_front=0, pad_tail=0, ptt_delay=.25, samp_rate=samp_rate, ) self.gmsk_ax25_rx_hier_0 = gmsk_ax25_rx_hier( lpf_cutoff=7.2e3, lpf_trans=1e3, quad_demod_gain=(samp_rate/decim*interp/decim_2*interp_2)/(2*math.pi*fsk_dev/8.0), samp_rate=48000, samps_per_symb=5, ) self.fsk_burst_detector_0 = fsk_burst_detector( avg_len=100.0, cons_offset=3, decim=decim, fsk_dev=fsk_dev, interp=interp, samp_rate=samp_rate, ) self.burst_rx_es_hier_0 = burst_rx_es_hier( avg_len=100, baud=9600, samp_rate=samp_rate/decim*interp, samps_per_symb=10, trigger_thresh=trigger_thresh, ) self.blocks_socket_pdu_0_2 = blocks.socket_pdu("TCP_SERVER", '10.42.0.21', '8000', 1024, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8001', 1024, True) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1 * ceres_offset, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1 * tx_sel[tx_tune_sel], 1, 0) self.analog_agc2_xx_0 = analog.agc2_cc(10, 1e-1, 65536, 1) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.gmsk_tx_burst_hier2_0, 'kiss/ax25')) self.msg_connect((self.burst_rx_es_hier_0, 'brst_corr'), (self.pyqt_ctime_plot_0, 'cpdus')) self.msg_connect((self.burst_rx_es_hier_0, 'meta'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.blocks_socket_pdu_0_2, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.vcc_qt_hex_text_tx_0, 'pdus')) self.msg_connect((self.gmsk_tx_burst_hier2_0, 'ax25'), (self.vcc_qt_hex_text_tx, 'pdus')) self.msg_connect((self.gpredict_doppler_0, 'freq'), (self.gpredict_MsgPairToVar_1, 'inpair')) self.msg_connect((self.rffe_ctl_tag_ptt_pdu_0, 'ptt'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_4, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.burst_rx_es_hier_0, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.burst_rx_es_hier_0, 1), (self.rational_resampler_xxx_3, 0)) self.connect((self.fsk_burst_detector_0, 0), (self.burst_rx_es_hier_0, 1)) self.connect((self.gmsk_ax25_rx_hier_0, 0), (self.qtgui_freq_sink_x_1, 1)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.rffe_ctl_tag_ptt_pdu_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.burst_rx_es_hier_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.fsk_burst_detector_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.rational_resampler_xxx_3, 0), (self.gmsk_ax25_rx_hier_0, 0)) self.connect((self.rational_resampler_xxx_4, 0), (self.qtgui_freq_sink_x_1_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_freq_sink_x_1_0_1, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.sigmf_sink_0, 0))
def __init__(self, cyborg_version='v0.1.0', mod_order=2, mod_scheme='GMSK', rx_ant_model='COMET SMA703', rx_db_ser='na', rx_db_type='na', rx_ser_tag='30DCE50', rx_ser_uhd='30DCE50', rx_type='B200', signal_name='AIS', symbol_rate=9600): gr.top_block.__init__(self, "Ais Sigmf") Qt.QWidget.__init__(self) self.setWindowTitle("Ais Sigmf") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "ais_sigmf") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.cyborg_version = cyborg_version self.mod_order = mod_order self.mod_scheme = mod_scheme self.rx_ant_model = rx_ant_model self.rx_db_ser = rx_db_ser self.rx_db_type = rx_db_type self.rx_ser_tag = rx_ser_tag self.rx_ser_uhd = rx_ser_uhd self.rx_type = rx_type self.signal_name = signal_name self.symbol_rate = symbol_rate ################################################## # Variables ################################################## self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y-%m-%dT%H:%M:%S.%fZ") self.samp_rate = samp_rate = 250e3 self.fn = fn = "{:s}_{:s}".format(signal_name, ts_str) self.decim = decim = 5 self.baud = baud = 9600 self.tune = tune = 0 self.samp_per_sym = samp_per_sym = (samp_rate / decim / 50 * 48) / baud self.rx_gain = rx_gain = 55 self.rx_freq = rx_freq = 162e6 self.fsk_deviation = fsk_deviation = 10e3 self.fp = fp = "/home/zleffke/captures/ais/{:s}".format(fn) ################################################## # Blocks ################################################## self._tune_tool_bar = Qt.QToolBar(self) self._tune_tool_bar.addWidget(Qt.QLabel("tune" + ": ")) self._tune_line_edit = Qt.QLineEdit(str(self.tune)) self._tune_tool_bar.addWidget(self._tune_line_edit) self._tune_line_edit.returnPressed.connect(lambda: self.set_tune( eng_notation.str_to_num(str(self._tune_line_edit.text().toAscii())) )) self.top_grid_layout.addWidget(self._tune_tool_bar, 8, 2, 1, 2) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel("rx_gain" + ": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect(lambda: self.set_rx_gain( eng_notation.str_to_num( str(self._rx_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rx_gain_tool_bar, 8, 0, 1, 2) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq( uhd.tune_request(rx_freq, samp_rate / 2), 0) self.uhd_usrp_source_1.set_gain(rx_gain, 0) self.uhd_usrp_source_1.set_antenna('RX2', 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_1 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate / 2, #bw "Channel", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_1.set_update_time(0.010) self.qtgui_waterfall_sink_x_0_1.enable_grid(True) self.qtgui_waterfall_sink_x_0_1.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_1.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_1.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_1.set_intensity_range(-140, -40) self._qtgui_waterfall_sink_x_0_1_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_1_win, 2, 0, 2, 8) for r in range(2, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate / 2, #bw "AIS", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.01) self.qtgui_freq_sink_x_0.set_y_axis(-140, -40) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "red", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 2, 8) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_text_output_0_0 = pyqt.text_output() self._pyqt_text_output_0_0_win = self.pyqt_text_output_0_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_0_win, 4, 0, 1, 4) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 4, 4, 1, 4) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(11, 1000) self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(11, 1000) self.digital_diff_decoder_bb_0_0 = digital.diff_decoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '52001', 10000, False) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_message_debug_0_1 = blocks.message_debug() self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 25e3, 1, 0) self.analog_sig_source_x_0_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, tune, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -25e3, 1, 0) self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( (samp_rate / decim) / (2 * math.pi * fsk_deviation / 8.0)) self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_cc(1e-3, 1e-1, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.ais_pdu_to_nmea_0_0 = ais.pdu_to_nmea('B') self.ais_pdu_to_nmea_0 = ais.pdu_to_nmea('A') self.ais_invert_0_0 = ais.invert() self.ais_invert_0 = ais.invert() ################################################## # Connections ################################################## self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0, 'out'), (self.pyqt_text_output_0_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_message_debug_0_1, 'print_pdu')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.ais_pdu_to_nmea_0_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.ais_pdu_to_nmea_0, 'to_nmea')) self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'), (self.ais_pdu_to_nmea_0_0, 'to_nmea')) self.connect((self.ais_invert_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.ais_invert_0_0, 0), (self.digital_hdlc_deframer_bp_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.analog_quadrature_demod_cf_0_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.digital_diff_decoder_bb_0_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.ais_invert_0, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.ais_invert_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.qtgui_waterfall_sink_x_0_1, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.blocks_multiply_xx_0_0, 0))
def __init__(self, rf_freq=401.12e6): gr.top_block.__init__(self, "Burst Trx Gmsk9600 Ax25") Qt.QWidget.__init__(self) self.setWindowTitle("Burst Trx Gmsk9600 Ax25") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "burst_trx_gmsk9600_ax25") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.rf_freq = rf_freq ################################################## # Variables ################################################## self.uplink_freq = uplink_freq = rf_freq self.tx_tune = tx_tune = rf_freq - uplink_freq self.samp_rate = samp_rate = float(250e3) self.uplink_offset = uplink_offset = -1 * tx_tune self.tx_offset = tx_offset = 0 self.tx_gain = tx_gain = 67 self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y-%m-%dT%H:%M:%S.%fZ") self.interp = interp = 24 self.decim = decim = int(samp_rate / 2000) self.bb_gain = bb_gain = 1 ################################################## # Blocks ################################################## self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel('BB Gain' + ": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect(lambda: self.set_bb_gain( eng_notation.str_to_num( str(self._bb_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._bb_gain_tool_bar, 4, 0, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_win = self.vcc_qt_hex_text_tx self.top_grid_layout.addWidget(self._vcc_qt_hex_text_tx_win, 6, 0, 2, 4) for r in range(6, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._uplink_offset_tool_bar = Qt.QToolBar(self) if None: self._uplink_offset_formatter = None else: self._uplink_offset_formatter = lambda x: eng_notation.num_to_str(x ) self._uplink_offset_tool_bar.addWidget( Qt.QLabel("uplink_offset" + ": ")) self._uplink_offset_label = Qt.QLabel( str(self._uplink_offset_formatter(self.uplink_offset))) self._uplink_offset_tool_bar.addWidget(self._uplink_offset_label) self.top_grid_layout.addWidget(self._uplink_offset_tool_bar, 0, 4, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('TX Gain' + ": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect(lambda: self.set_tx_gain( eng_notation.str_to_num( str(self._tx_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._tx_gain_tool_bar, 4, 2, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self.rffe_ctl_tag_ptt_pdu_0 = rffe_ctl.tag_ptt_pdu( samp_rate, "tx_sob", "tx_eob", "tx_time", "TX") self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 0, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6, 4, 2, 4) for r in range(6, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.gpredict_doppler_0 = gpredict.doppler("localhost", 7356, False) self.gpredict_MsgPairToVar_1 = gpredict.MsgPairToVar( self.set_uplink_freq) self.gmsk_tx_burst_hier2_0 = gmsk_tx_burst_hier2( bt=.5, delay_enable=1, pad_front=0, pad_tail=0, ptt_delay=.200, samp_rate=samp_rate, ) self.blocks_tag_debug_1 = blocks.tag_debug(gr.sizeof_gr_complex * 1, '', "") self.blocks_tag_debug_1.set_display(True) self.blocks_socket_pdu_0_2 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8000', 1024, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8001', 1024, True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (bb_gain, )) self.blocks_message_debug_0 = blocks.message_debug() self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -1 * tx_tune, 1, 0) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.gmsk_tx_burst_hier2_0, 'kiss/ax25')) self.msg_connect((self.gmsk_tx_burst_hier2_0, 'ax25'), (self.vcc_qt_hex_text_tx, 'pdus')) self.msg_connect((self.gpredict_doppler_0, 'freq'), (self.gpredict_MsgPairToVar_1, 'inpair')) self.msg_connect((self.rffe_ctl_tag_ptt_pdu_0, 'ptt'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_tag_debug_1, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.rffe_ctl_tag_ptt_pdu_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_1_0_0, 0))
def __init__(self, fsk_dev=10000, lpf_cutoff=12.5e3, lpf_trans=1e3): gr.top_block.__init__(self, "Fsk Rx Udp") Qt.QWidget.__init__(self) self.setWindowTitle("Fsk Rx Udp") 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", "fsk_rx_udp") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.fsk_dev = fsk_dev self.lpf_cutoff = lpf_cutoff self.lpf_trans = lpf_trans ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 self.baud = baud = 9600 self.thresh = thresh = -4 self.smooth_len = smooth_len = 25 self.samps_per_symb = samps_per_symb = int(samp_rate/baud) self.offset = offset = 0 self.num_items = num_items = 1024 self.mult = mult = (samp_rate)/2/3.141593 self.decay = decay = 100e-6 self.bw_factor = bw_factor = 1000 self.attack = attack = 0.001 self.alpha = alpha = 0.5 ################################################## # Blocks ################################################## self._thresh_tool_bar = Qt.QToolBar(self) self._thresh_tool_bar.addWidget(Qt.QLabel('Threshold'+": ")) self._thresh_line_edit = Qt.QLineEdit(str(self.thresh)) self._thresh_tool_bar.addWidget(self._thresh_line_edit) self._thresh_line_edit.returnPressed.connect( lambda: self.set_thresh(eng_notation.str_to_num(str(self._thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._thresh_tool_bar, 0,4,1,2) self._offset_range = Range(-10000, 10000, 1, 0, 200) self._offset_win = RangeWidget(self._offset_range, self.set_offset, "offset", "counter_slider", float) self.top_grid_layout.addWidget(self._offset_win, 3,4,1,4) self._decay_tool_bar = Qt.QToolBar(self) self._decay_tool_bar.addWidget(Qt.QLabel("decay"+": ")) self._decay_line_edit = Qt.QLineEdit(str(self.decay)) self._decay_tool_bar.addWidget(self._decay_line_edit) self._decay_line_edit.returnPressed.connect( lambda: self.set_decay(eng_notation.str_to_num(str(self._decay_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._decay_tool_bar, 1,6,1,2) self._bw_factor_tool_bar = Qt.QToolBar(self) self._bw_factor_tool_bar.addWidget(Qt.QLabel("bw_factor"+": ")) self._bw_factor_line_edit = Qt.QLineEdit(str(self.bw_factor)) self._bw_factor_tool_bar.addWidget(self._bw_factor_line_edit) self._bw_factor_line_edit.returnPressed.connect( lambda: self.set_bw_factor(eng_notation.str_to_num(str(self._bw_factor_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._bw_factor_tool_bar, 2,6,1,2) self._attack_tool_bar = Qt.QToolBar(self) self._attack_tool_bar.addWidget(Qt.QLabel("attack"+": ")) self._attack_line_edit = Qt.QLineEdit(str(self.attack)) self._attack_tool_bar.addWidget(self._attack_line_edit) self._attack_line_edit.returnPressed.connect( lambda: self.set_attack(eng_notation.str_to_num(str(self._attack_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._attack_tool_bar, 1,4,1,2) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 50, #size samp_rate, #samp_rate "trigger", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-1, 1) self.qtgui_time_sink_x_2.set_y_label('Amplitude', "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(False) self.qtgui_time_sink_x_2.enable_axis_labels(True) self.qtgui_time_sink_x_2.enable_control_panel(False) self.qtgui_time_sink_x_2.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_2.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_2_win, 8,0,2,4) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 4096, #size samp_rate, #samp_rate "Freq Error", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.010) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(True) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not False: self.qtgui_time_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 4,0,2,4) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.010) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "packet_len") self.qtgui_time_sink_x_0_0.enable_autoscale(True) 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 False: 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.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 4,4,2,4) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 4096, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.010) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "packet_len") 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) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 8,4,2,4) self.qtgui_number_sink_1 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1 ) self.qtgui_number_sink_1.set_update_time(0.10) self.qtgui_number_sink_1.set_title("Doppler") 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_1.set_min(i, -1) self.qtgui_number_sink_1.set_max(i, 1) self.qtgui_number_sink_1.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_1.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_1.set_label(i, labels[i]) self.qtgui_number_sink_1.set_unit(i, units[i]) self.qtgui_number_sink_1.set_factor(i, factor[i]) self.qtgui_number_sink_1.enable_autoscale(False) self._qtgui_number_sink_1_win = sip.wrapinstance(self.qtgui_number_sink_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_1_win, 2,4,1,2) self.qtgui_number_sink_0_0_1 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1 ) self.qtgui_number_sink_0_0_1.set_update_time(0.010) self.qtgui_number_sink_0_0_1.set_title("SNR") 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_0_1.set_min(i, 0) self.qtgui_number_sink_0_0_1.set_max(i, 100) self.qtgui_number_sink_0_0_1.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_1.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_1.set_label(i, labels[i]) self.qtgui_number_sink_0_0_1.set_unit(i, units[i]) self.qtgui_number_sink_0_0_1.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_1.enable_autoscale(False) self._qtgui_number_sink_0_0_1_win = sip.wrapinstance(self.qtgui_number_sink_0_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_1_win, 2,5,1,1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "RX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 0,0,4,4) self.pyqt_time_plot_0 = pyqt.time_plot('') self._pyqt_time_plot_0_win = self.pyqt_time_plot_0; self.top_grid_layout.addWidget(self._pyqt_time_plot_0_win, 6,0,2,4) self.pyqt_time_plot_0.line_off() self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0; self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6,4,2,4) self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True, max_length=300) self.es_trigger_edge_f_0 = es.trigger_edge_f(thresh,3500,500,gr.sizeof_float,100) self.es_sink_0 = es.sink(1*[gr.sizeof_float],8,64,0,2,0) self.es_handler_pdu_0 = es.es_make_handler_pdu(es.es_handler_print.TYPE_F32) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(samps_per_symb, .5, 512, math.pi/bw_factor) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samps_per_symb*(1+0.0), 0.25*0.175*0.175, 0.25, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex*1, '0.0.0.0', 9001, 1472, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, -100, 0) self.blocks_sub_xx_1_0 = blocks.sub_ff(1) self.blocks_sub_xx_1 = blocks.sub_ff(1) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_float*1, num_items) self.blocks_skiphead_1 = blocks.skiphead(gr.sizeof_gr_complex*1, 500) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float*1, 1) self.blocks_short_to_float_0 = blocks.short_to_float(1, 1) self.blocks_pdu_to_tagged_stream_2 = blocks.pdu_to_tagged_stream(blocks.complex_t, 'packet_len') self.blocks_pdu_remove_0_0 = blocks.pdu_remove(pmt.intern("es::event_buffer")) self.blocks_pdu_remove_0 = blocks.pdu_remove(pmt.intern("es::event_buffer")) self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_short*1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_nlog10_ff_0_0_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_nlog10_ff_0_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((mult, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((mult*-1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, )) self.blocks_moving_average_xx_2 = blocks.moving_average_ff(num_items, 1.0/num_items, 4000, 1) self.blocks_moving_average_xx_0_1_0_0 = blocks.moving_average_ff(500, 1.0/500, 4000, 1) self.blocks_moving_average_xx_0_1_0 = blocks.moving_average_ff(2000, 1.0/2000, 4000, 1) self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff(smooth_len, 1.0/smooth_len, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(smooth_len, 1.0/smooth_len, 4000, 1) self.blocks_keep_m_in_n_1 = blocks.keep_m_in_n(gr.sizeof_float, 1, num_items, 0) self.blocks_keep_m_in_n_0_1 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2000, 3500, 10) self.blocks_keep_m_in_n_0_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 500, 3500, 10) self.blocks_complex_to_mag_squared_0_0_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_argmax_xx_0 = blocks.argmax_fs(num_items) self.blocks_abs_xx_0 = blocks.abs_ff(1) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 1000, 1, offset) self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf((samp_rate)/(2*math.pi*fsk_dev/8.0)) self.analog_agc3_xx_0 = analog.agc3_cc(attack, decay, 1.0, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.blocks_pdu_remove_0_0, 'pdus')) self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.pyqt_time_plot_0, 'pdus')) self.msg_connect((self.blocks_pdu_remove_0_0, 'pdus'), (self.blocks_pdu_to_tagged_stream_2, 'pdus')) self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.blocks_pdu_remove_0, 'pdus')) self.msg_connect((self.es_trigger_edge_f_0, 'edge_event'), (self.es_handler_pdu_0, 'handle_event')) self.msg_connect((self.es_trigger_edge_f_0, 'which_stream'), (self.es_sink_0, 'schedule_event')) self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.pyqt_text_output_0, 'pdus')) self.connect((self.analog_agc3_xx_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_abs_xx_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_argmax_xx_0, 0), (self.blocks_null_sink_1, 0)) self.connect((self.blocks_argmax_xx_0, 1), (self.blocks_short_to_float_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.blocks_moving_average_xx_0_1_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0_0, 0), (self.blocks_moving_average_xx_0_1_0_0, 0)) self.connect((self.blocks_keep_m_in_n_0_0, 0), (self.blocks_complex_to_mag_squared_0_0_0, 0)) self.connect((self.blocks_keep_m_in_n_0_1, 0), (self.blocks_complex_to_mag_squared_0_0, 0)) self.connect((self.blocks_keep_m_in_n_1, 0), (self.blocks_sub_xx_1, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_moving_average_xx_0_0, 0), (self.qtgui_number_sink_1, 0)) self.connect((self.blocks_moving_average_xx_0_1_0, 0), (self.blocks_nlog10_ff_0_0, 0)) self.connect((self.blocks_moving_average_xx_0_1_0_0, 0), (self.blocks_nlog10_ff_0_0_0, 0)) self.connect((self.blocks_moving_average_xx_2, 0), (self.blocks_keep_m_in_n_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.es_trigger_edge_f_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_moving_average_xx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_2, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_moving_average_xx_2, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_nlog10_ff_0_0, 0), (self.blocks_sub_xx_1_0, 1)) self.connect((self.blocks_nlog10_ff_0_0_0, 0), (self.blocks_sub_xx_1_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_2, 0), (self.blocks_keep_m_in_n_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_2, 0), (self.blocks_skiphead_1, 0)) self.connect((self.blocks_short_to_float_0, 0), (self.blocks_sub_xx_1, 1)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_skiphead_1, 0), (self.blocks_keep_m_in_n_0_1, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_argmax_xx_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_abs_xx_0, 0)) self.connect((self.blocks_sub_xx_1, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_sub_xx_1_0, 0), (self.qtgui_number_sink_0_0_1, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.blocks_udp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_udp_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.es_trigger_edge_f_0, 1)) self.connect((self.digital_descrambler_bb_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.digital_descrambler_bb_0, 0), (self.kiss_hdlc_deframer_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.analog_quadrature_demod_cf_1, 0)) self.connect((self.digital_fll_band_edge_cc_0, 1), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.digital_fll_band_edge_cc_0, 3), (self.blocks_multiply_const_vxx_2, 0)) self.connect((self.digital_fll_band_edge_cc_0, 2), (self.blocks_null_sink_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.es_sink_0, 0))
def __init__(self, rf_freq=401.12e6): gr.top_block.__init__(self, "Burst Tx Gmsk Dev") Qt.QWidget.__init__(self) self.setWindowTitle("Burst Tx Gmsk Dev") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "burst_tx_gmsk_dev") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.rf_freq = rf_freq ################################################## # Variables ################################################## self.samp_rate = samp_rate = float(250e3) self.tx_offset = tx_offset = 0 self.tx_gain = tx_gain = 18 self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y-%m-%dT%H:%M:%S.%fZ") self.rx_offset = rx_offset = samp_rate / 2.0 self.rx_gain = rx_gain = 10 self.interp = interp = 24 self.decim = decim = int(samp_rate / 2000) self.bb_gain = bb_gain = .75 ################################################## # Blocks ################################################## self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('TX Gain' + ": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect(lambda: self.set_tx_gain( eng_notation.str_to_num( str(self._tx_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._tx_gain_tool_bar, 4, 2, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel('RX Gain' + ": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect(lambda: self.set_rx_gain( eng_notation.str_to_num( str(self._rx_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rx_gain_tool_bar, 5, 2, 1, 2) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel('BB Gain' + ": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect(lambda: self.set_bb_gain( eng_notation.str_to_num( str(self._bb_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._bb_gain_tool_bar, 4, 0, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_win = self.vcc_qt_hex_text_tx self.top_grid_layout.addWidget(self._vcc_qt_hex_text_tx_win, 6, 0, 2, 4) for r in range(6, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("addr=192.168.10.6", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_clock_source('external', 0) self.uhd_usrp_source_1.set_time_source('external', 0) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq( uhd.tune_request(rf_freq, rx_offset), 0) self.uhd_usrp_source_1.set_gain(rx_gain, 0) self.uhd_usrp_source_1.set_antenna('RX2', 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_center_freq( uhd.tune_request(rf_freq, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.rffe_ctl_tag_ptt_pdu_0 = rffe_ctl.tag_ptt_pdu( samp_rate, "tx_sob", "tx_eob", "tx_time", "TX") self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_freq_sink_x_1_0_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0_0.set_trigger_mode( qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_0_0_win, 0, 4, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 0, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_text_output_0 = pyqt.text_output() self._pyqt_text_output_0_win = self.pyqt_text_output_0 self.top_grid_layout.addWidget(self._pyqt_text_output_0_win, 6, 4, 2, 4) for r in range(6, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.gmsk_tx_burst_hier2_0 = gmsk_tx_burst_hier2( bt=.5, delay_enable=1, pad_front=0, pad_tail=0, ptt_delay=.200, samp_rate=samp_rate, ) self.blocks_tag_debug_1 = blocks.tag_debug(gr.sizeof_gr_complex * 1, '', "") self.blocks_tag_debug_1.set_display(True) self.blocks_socket_pdu_0_2 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8000', 1024, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8001', 1024, True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (bb_gain, )) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.pyqt_text_output_0, 'pdus')) self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.gmsk_tx_burst_hier2_0, 'kiss/ax25')) self.msg_connect((self.gmsk_tx_burst_hier2_0, 'ax25'), (self.vcc_qt_hex_text_tx, 'pdus')) self.msg_connect((self.rffe_ctl_tag_ptt_pdu_0, 'ptt'), (self.blocks_socket_pdu_0, 'pdus')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_tag_debug_1, 0)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.rffe_ctl_tag_ptt_pdu_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_1_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.qtgui_freq_sink_x_1_0_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.rational_resampler_xxx_0_0, 0))
def __init__(self, fsk_dev=10000, lpf_cutoff=12.5e3, lpf_trans=1e3): gr.top_block.__init__(self, "Fsk Tx Es") Qt.QWidget.__init__(self) self.setWindowTitle("Fsk Tx Es") 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", "fsk_tx_es") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.fsk_dev = fsk_dev self.lpf_cutoff = lpf_cutoff self.lpf_trans = lpf_trans ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 self.baud = baud = 9600 self.samps_per_symb = samps_per_symb = int(samp_rate/baud) self.mult = mult = (samp_rate)/2/3.141593 self.bb_gain = bb_gain = 10 self.alpha = alpha = 0.5 ################################################## # Blocks ################################################## self._bb_gain_range = Range(0, 10, .01, 10, 200) self._bb_gain_win = RangeWidget(self._bb_gain_range, self.set_bb_gain, 'bb_gain', "counter_slider", float) self.top_grid_layout.addWidget(self._bb_gain_win, 6,0,1,4) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.010) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 2,0,4,4) self.pyqt_text_output_0_0 = pyqt.text_output() self._pyqt_text_output_0_0_win = self.pyqt_text_output_0_0; self.top_grid_layout.addWidget(self._pyqt_text_output_0_0_win, 0,0,2,4) self.kiss_kiss_to_pdu_0 = kiss.kiss_to_pdu(True) self.kiss_hdlc_framer_0 = kiss.hdlc_framer(preamble_bytes=32, postamble_bytes=16) self.es_source_0 = es.source(1*[gr.sizeof_gr_complex], 1, 2, 0) self.digital_scrambler_bb_0 = digital.scrambler_bb(0x21, 0x0, 16) self.digital_gmsk_mod_0 = digital.gmsk_mod( samples_per_symbol=samps_per_symb, bt=alpha, verbose=False, log=False, ) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex*1, '0.0.0.0', 9000, 1472, True) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(blocks.complex_t, 'packet_len') self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_tag_gate_0.set_single_key("packet_len") self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, 1, 4096*3, "packet_len") (self.blocks_stream_to_tagged_stream_0).set_min_output_buffer(17000) self.blocks_socket_pdu_0_2 = blocks.socket_pdu("TCP_CLIENT", '0.0.0.0', '8000', 1024, False) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((bb_gain, )) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.kiss_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.kiss_hdlc_framer_0, 'in')) self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'), (self.pyqt_text_output_0_0, 'pdus')) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_stream_to_tagged_stream_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_gmsk_mod_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.digital_scrambler_bb_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.kiss_kiss_to_pdu_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.digital_scrambler_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0_0, 0))