def test_and_bb(self): src1_data = [1, 2, 2, 3, 0x04, 0x50] src2_data = [8, 2, 2, 1, 0x08, 0x05] src3_data = [8, 2, 1, 1, 0x08, 0x05] expected_result = [0, 2, 0, 1, 0x00, 0x00] op = blocks.and_bb() self.help_bb((src1_data, src2_data, src3_data), expected_result, op)
def test_and_bb(self): src1_data = (1, 2, 2, 3, 0x04, 0x50) src2_data = (8, 2, 2, 1, 0x08, 0x05) src3_data = (8, 2, 1, 1, 0x08, 0x05) expected_result = (0, 2, 0, 1, 0x00, 0x00) op = blocks.and_bb() self.help_bb((src1_data, src2_data, src3_data), expected_result, op)
def test_and_bb (self): src1_data = (1, 2, 2, 3, 0x04, 0x50) src2_data = (8, 2, 2, 1, 0x08, 0x05) src3_data = (8, 2, 1, 1, 0x08, 0x05) expected_result = (0, 2, 0, 1, 0x00, 0x00) op = blocks.and_bb () self.help_bb ((src1_data, src2_data, src3_data), expected_result, op)
def __init__(self, samp_rate_in, samp_rate_out, center_freq, tune_freq0, tune_freq1, tune_freq2, channel_width, transition_width, threshold, fsk_deviation, fskSquelch, iq_filename, dig_out_filename): gr.top_block.__init__(self) ################################################## # Variables ################################################## self.cutoff_freq = channel_width / 2 self.firdes_taps = firdes.low_pass(1, samp_rate_in, self.cutoff_freq, transition_width) self.nfilts = 32 self.symbol_rate = 16000 self.samples_per_symbol = int(samp_rate_out / self.symbol_rate) self.rrc_taps = firdes.root_raised_cosine(self.nfilts, samp_rate_out, self.symbol_rate, 0.35, self.nfilts) ################################################## # Blocks ################################################## self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, iq_filename, False) # flow for channel 0 self.blocks_tuning_filter_0 = filter.freq_xlating_fir_filter_ccc( int(samp_rate_in / samp_rate_out), (self.firdes_taps), tune_freq0 - center_freq, samp_rate_in) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( fskSquelch, 1, 1, False) self.blocks_quadrature_demod_0 = analog.quadrature_demod_cf( samp_rate_out / (2 * pi * fsk_deviation / 2)) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (self.rrc_taps), self.nfilts, self.nfilts / 2, 1.5, self.samples_per_symbol) self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1 * threshold, )) self.blocks_digital_binary_slicer_fb_0 = digital.binary_slicer_fb() # flow for channel 1 self.blocks_tuning_filter_1 = filter.freq_xlating_fir_filter_ccc( int(samp_rate_in / samp_rate_out), (self.firdes_taps), tune_freq1 - center_freq, samp_rate_in) self.analog_pwr_squelch_xx_1 = analog.pwr_squelch_cc( fskSquelch, 1, 1, False) self.blocks_quadrature_demod_1 = analog.quadrature_demod_cf( samp_rate_out / (2 * pi * fsk_deviation / 2)) self.digital_pfb_clock_sync_xxx_1 = digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (self.rrc_taps), self.nfilts, self.nfilts / 2, 1.5, self.samples_per_symbol) self.blocks_add_const_vxx_1 = blocks.add_const_vff((-1 * threshold, )) self.blocks_digital_binary_slicer_fb_1 = digital.binary_slicer_fb() # flow for channel 2 self.blocks_tuning_filter_2 = filter.freq_xlating_fir_filter_ccc( int(samp_rate_in / samp_rate_out), (self.firdes_taps), tune_freq2 - center_freq, samp_rate_in) self.analog_pwr_squelch_xx_2 = analog.pwr_squelch_cc( fskSquelch, 1, 1, False) self.blocks_quadrature_demod_2 = analog.quadrature_demod_cf( samp_rate_out / (2 * pi * fsk_deviation / 2)) include_pfb = False self.digital_pfb_clock_sync_xxx_2 = digital.pfb_clock_sync_fff( self.samples_per_symbol, 62.8e-3, (self.rrc_taps), self.nfilts, self.nfilts / 2, 1.5, self.samples_per_symbol) self.blocks_add_const_vxx_2 = blocks.add_const_vff((-1 * threshold, )) self.blocks_digital_binary_slicer_fb_2 = digital.binary_slicer_fb() # these are high during idle times, so we need to combine the three channel outputs logically with an and function self.blocks_and_xx_0 = blocks.and_bb() # swapped message sink for file sink #self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, dig_out_filename, False) #self.blocks_file_sink_0.set_unbuffered(False) self.sink_queue = gr.msg_queue() self.blocks_message_sink_0 = blocks.message_sink( gr.sizeof_char * 1, self.sink_queue, False) ################################################## # Connections ################################################## # channel 0 self.connect((self.blocks_file_source_0, 0), (self.blocks_tuning_filter_0, 0)) self.connect((self.blocks_tuning_filter_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.blocks_quadrature_demod_0, 0)) self.connect((self.blocks_quadrature_demod_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_add_const_vxx_0, 0)) #self.connect((self.blocks_quadrature_demod_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_digital_binary_slicer_fb_0, 0)) # channel 1 self.connect((self.blocks_file_source_0, 0), (self.blocks_tuning_filter_1, 0)) self.connect((self.blocks_tuning_filter_1, 0), (self.analog_pwr_squelch_xx_1, 0)) self.connect((self.analog_pwr_squelch_xx_1, 0), (self.blocks_quadrature_demod_1, 0)) self.connect((self.blocks_quadrature_demod_1, 0), (self.digital_pfb_clock_sync_xxx_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_1, 0), (self.blocks_add_const_vxx_1, 0)) #self.connect((self.blocks_quadrature_demod_1, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_digital_binary_slicer_fb_1, 0)) # channel 2 self.connect((self.blocks_file_source_0, 0), (self.blocks_tuning_filter_2, 0)) self.connect((self.blocks_tuning_filter_2, 0), (self.analog_pwr_squelch_xx_2, 0)) self.connect((self.analog_pwr_squelch_xx_2, 0), (self.blocks_quadrature_demod_2, 0)) self.connect((self.blocks_quadrature_demod_2, 0), (self.digital_pfb_clock_sync_xxx_2, 0)) self.connect((self.digital_pfb_clock_sync_xxx_2, 0), (self.blocks_add_const_vxx_2, 0)) #self.connect((self.blocks_quadrature_demod_2, 0), (self.blocks_add_const_vxx_2, 0)) self.connect((self.blocks_add_const_vxx_2, 0), (self.blocks_digital_binary_slicer_fb_2, 0)) # and gate self.connect((self.blocks_digital_binary_slicer_fb_0, 0), (self.blocks_and_xx_0, 0)) self.connect((self.blocks_digital_binary_slicer_fb_1, 0), (self.blocks_and_xx_0, 1)) self.connect((self.blocks_digital_binary_slicer_fb_2, 0), (self.blocks_and_xx_0, 2)) #self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0, 0)) # output to message sink self.connect((self.blocks_and_xx_0, 0), (self.blocks_message_sink_0, 0))
def __init__(self): gr.top_block.__init__(self, "And or xor") Qt.QWidget.__init__(self) self.setWindowTitle("And or xor") 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", "logicalsignal") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( 128, #size samp_rate, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0_0.set_y_label('XOR', "") self.qtgui_time_sink_x_0_0_0.enable_tags(True) self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 128, #size samp_rate, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('OR', "") self.qtgui_time_sink_x_0_0.enable_tags(True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(False) 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) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_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) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 128, #size samp_rate, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('AND', "") self.qtgui_time_sink_x_0.enable_tags(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.blocks_xor_xx_0_0 = blocks.xor_bb() self.blocks_xor_xx_0 = blocks.xor_bb() self.blocks_uchar_to_float_0_0_0_0 = blocks.uchar_to_float() self.blocks_uchar_to_float_0_0_0 = blocks.uchar_to_float() self.blocks_uchar_to_float_0_0 = blocks.uchar_to_float() self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate, True) self.blocks_or_xx_0 = blocks.or_bb() self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char * 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char * 1) self.blocks_and_xx_0 = blocks.and_bb() self.analog_sig_source_x_1 = analog.sig_source_b( samp_rate, analog.GR_SQR_WAVE, 4000, 1, 0, 0) self.analog_sig_source_x_0 = analog.sig_source_b( samp_rate, analog.GR_SQR_WAVE, 1000, 1, 0, 0) self.analog_const_source_x_0 = analog.sig_source_b( 0, analog.GR_CONST_WAVE, 0, 0, 1) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_xor_xx_0, 1)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_and_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_or_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_xor_xx_0_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_xor_xx_0, 0)) self.connect((self.blocks_and_xx_0, 0), (self.blocks_uchar_to_float_0_0_0_0, 0)) self.connect((self.blocks_null_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_or_xx_0, 0), (self.blocks_uchar_to_float_0_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_0_0_0, 0)) self.connect((self.blocks_uchar_to_float_0_0, 0), (self.qtgui_time_sink_x_0_0_0, 1)) self.connect((self.blocks_uchar_to_float_0_0_0, 0), (self.qtgui_time_sink_x_0_0, 1)) self.connect((self.blocks_uchar_to_float_0_0_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_xor_xx_0, 0), (self.blocks_and_xx_0, 1)) self.connect((self.blocks_xor_xx_0, 0), (self.blocks_or_xx_0, 1)) self.connect((self.blocks_xor_xx_0, 0), (self.blocks_xor_xx_0_0, 1)) self.connect((self.blocks_xor_xx_0_0, 0), (self.blocks_uchar_to_float_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Not titled yet") Qt.QWidget.__init__(self) self.setWindowTitle("Not titled yet") 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", "clock_recovery") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.xlate_freq = xlate_freq = -223 self.trans_width = trans_width = 20e3 self.samp_rate = samp_rate = 2048e3 self.samp_per_sym = samp_per_sym = 10 self.filter_freq = filter_freq = 80e3 self.decimation = decimation = 1 ################################################## # Blocks ################################################## self._xlate_freq_range = Range(-10000, +10000, 1, -223, 200) self._xlate_freq_win = RangeWidget(self._xlate_freq_range, self.set_xlate_freq, 'Translating Frequency', "counter_slider", float) self.top_grid_layout.addWidget(self._xlate_freq_win) self._trans_width_range = Range(1e3, 100e3, 1e3, 20e3, 200) self._trans_width_win = RangeWidget(self._trans_width_range, self.set_trans_width, 'Transition Width', "counter_slider", float) self.top_grid_layout.addWidget(self._trans_width_win) self._filter_freq_range = Range(20e3, 500e3, 1e3, 80e3, 200) self._filter_freq_win = RangeWidget(self._filter_freq_range, self.set_filter_freq, 'Filter Frequency', "counter_slider", float) self.top_grid_layout.addWidget(self._filter_freq_win) self.qtgui_time_sink_x_3 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_3.set_update_time(0.10) self.qtgui_time_sink_x_3.set_y_axis(-1, 1) self.qtgui_time_sink_x_3.set_y_label('Amplitude', "") self.qtgui_time_sink_x_3.enable_tags(True) self.qtgui_time_sink_x_3.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_3.enable_autoscale(False) self.qtgui_time_sink_x_3.enable_grid(False) self.qtgui_time_sink_x_3.enable_axis_labels(True) self.qtgui_time_sink_x_3.enable_control_panel(True) self.qtgui_time_sink_x_3.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_3.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_3.set_line_label(i, labels[i]) self.qtgui_time_sink_x_3.set_line_width(i, widths[i]) self.qtgui_time_sink_x_3.set_line_color(i, colors[i]) self.qtgui_time_sink_x_3.set_line_style(i, styles[i]) self.qtgui_time_sink_x_3.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_3.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_3_win = sip.wrapinstance( self.qtgui_time_sink_x_3.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_3_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate 'Xlated 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(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw 'Xlated Signal', #name 1) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( decimation, firdes.low_pass(1, samp_rate, filter_freq, trans_width, firdes.WIN_HAMMING, 6.76), xlate_freq, samp_rate) 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_uchar_to_float_1 = blocks.uchar_to_float() self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_threshold_ff_0 = blocks.threshold_ff(0.1, 0.1, 0) self.blocks_peak_detector_xb_0 = blocks.peak_detector_fb( 0.25, 0.40, 10, 0.001) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_ff(1 / 255) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(1 / 255) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_char * 1, '/Users/bodokaiser/Repositories/github.com/bodokaiser/arduino-rtlsdr/reverse-engineering/data/10111_11111.cu8', True, 0, 0) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_char * 1, 1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_char_to_short_0 = blocks.char_to_short(1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_burst_tagger_0 = blocks.burst_tagger(gr.sizeof_float) self.blocks_burst_tagger_0.set_true_tag('burst', True) self.blocks_burst_tagger_0.set_false_tag('burst', False) self.blocks_and_xx_0 = blocks.and_bb() self.blocks_add_const_vxx_1 = blocks.add_const_ff(-0.5) self.blocks_add_const_vxx_0 = blocks.add_const_ff(-0.5) ################################################## # Connections ################################################## self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_and_xx_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_burst_tagger_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.blocks_burst_tagger_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_3, 0)) self.connect((self.blocks_char_to_short_0, 0), (self.blocks_burst_tagger_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_deinterleave_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.blocks_deinterleave_0, 1), (self.blocks_uchar_to_float_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_deinterleave_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_peak_detector_xb_0, 0), (self.blocks_char_to_short_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_burst_tagger_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_peak_detector_xb_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_uchar_to_float_1, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_and_xx_0, 1)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.blocks_and_xx_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_squared_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_time_sink_x_0, 0))