def test_002_es_source (self): tb = gr.top_block(); # create the arbiter shared memory space arb = es.es_make_arbiter(); # create the source event queue queue = es.queue(); # create the source block and set a max stream length on it src = es.source( arb, queue, [gr.sizeof_float] ); src.set_max(20); # add a singular event vec = es.pmt_float_vector([1,2,3,4]); e1 = es.event_create_gen_vector_f( 3, vec ); h1 = es.es_handler_insert_vector(); h1p = es.make_handler_pmt( h1 ); #e1 = es.es_make_event_gen_vector_f(arb, [1,2,3,4]); #e1.set_time(13) #print dir(es) #e1 = es.event_create( "test_event", 13, 4 ); #e1 = es.event_create( "test_event", 13, 4 ); queue.register_event_type( es.event_type( e1 ) ); queue.bind_handler( es.event_type( e1 ), h1p ); queue.add_event(e1); # set up a vector sink for printing snk = gr.vector_sink_f(); tb.connect(src, snk); # run the graph to completion and print output stream tb.run(); print snk.data();
def test_002_es_source(self): tb = gr.top_block() # create the arbiter shared memory space arb = es.es_make_arbiter() # create the source event queue queue = es.queue() # create the source block and set a max stream length on it src = es.source(arb, queue, [gr.sizeof_float]) src.set_max(20) # add a singular event vec = es.pmt_float_vector([1, 2, 3, 4]) e1 = es.event_create_gen_vector_f(3, vec) h1 = es.es_handler_insert_vector() h1p = es.make_handler_pmt(h1) # e1 = es.es_make_event_gen_vector_f(arb, [1,2,3,4]); # e1.set_time(13) # print dir(es) # e1 = es.event_create( "test_event", 13, 4 ); # e1 = es.event_create( "test_event", 13, 4 ); queue.register_event_type(es.event_type(e1)) queue.bind_handler(es.event_type(e1), h1p) queue.add_event(e1) # set up a vector sink for printing snk = gr.vector_sink_f() tb.connect(src, snk) # run the graph to completion and print output stream tb.run() print snk.data()
# define our new event handler key_handler = es.es_pyhandler_def(); key_handler.set_pyfactory_cb(key_factory); key_handler.set_pypre_hook_cb(pre_hook); key_handler.set_pypost_hook_cb(post_hook); key_handler_graph = es.es_handler_flowgraph( key_handler ); # set up some common es components arb = es.es_make_arbiter(); queue = es.queue(); queue.set_early_behavior(1); # set up the main flow graph tb = gr.top_block(); src = es.source( arb, queue, [gr.sizeof_float, gr.sizeof_float] ); sink = audio.sink(int(fs)); tb.connect((src,0),(sink,0)); tb.connect((src,1),(sink,1)); fsnk = gr.file_sink(gr.sizeof_gr_complex, "keypad.out"); f2c = gr.float_to_complex(); tb.connect( (src,0), (f2c,0) , fsnk); tb.connect( (src,1), (f2c,1) ); # create initial event, set up event bindings, handlers e1 = es.event_create("key-press", 10, evt_len ); tmp_pmt = pmt.pmt_intern("1"); print tmp_pmt; e1 = es.event_args_add( e1, key_sym, tmp_pmt ); queue.register_event_type( es.event_type( e1 ) );
key_handler.set_pypre_hook_cb(pre_hook) #key_handler.set_pypost_hook_cb(post_hook); key_handler_graph = es.es_handler_flowgraph(key_handler, 2) # set up some common es components arb = es.es_make_arbiter() queue = es.queue() # most packets will got out as scheduled # but if we are ever later just send it as soon as possible queue.set_early_behavior(1) #queue.set_early_behavior(0); # set up the main flow graph tb = gr.top_block() src = es.source(arb, queue, [gr.sizeof_gr_complex]) #sink = gr.file_sink(gr.sizeof_gr_complex , "outfile.dat" ); sink = gr.udp_sink(gr.sizeof_gr_complex, "localhost", 12345) summer = gr.add_cc() noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_amp) throttle = gr.throttle(gr.sizeof_gr_complex, fs) tb.connect(src, summer, sink) tb.connect(noise, throttle, (summer, 1)) # create initial event, set up event bindings, handlers e1 = es.event_create("burst_transmit", 10, 1000) e1 = es.event_args_add(e1, key_sym, pmt.intern("1")) queue.register_event_type(es.event_type(e1)) queue.bind_handler(es.event_type(e1), es.make_handler_pmt(key_handler_graph)) # start the main flowgraph
print args.blocks.keys(); r = es.es_hook_rval(); return r; ph = es.es_pyhandler_def(); ph.set_pyfactory_cb(factory_cb); #ph.set_pypre_hook_cb(hook_cb); #ph.set_pypost_hook_cb(hook_cb); fgh = es.es_handler_flowgraph( ph, 1 ); arb = es.es_make_arbiter(); queue = es.queue(); tb = gr.top_block(); src = es.source( arb, queue, [1] ); sink = gr.vector_sink_b(); src.set_max(20); tb.connect(src,sink); e1 = es.event_create("fg-event", 2, 3); e2 = es.event_create("fg-event", 8, 3); e3 = es.event_create("fg-event", 12, 3); queue.register_event_type( es.event_type( e1 ) ); queue.bind_handler( es.event_type( e1 ), es.make_handler_pmt(fgh) ); print "--------calling queue.add_event(e1)-------------"; queue.add_event( e1 ); queue.add_event( e2 );
r = es.es_hook_rval() return r ph = es.es_pyhandler_def() ph.set_pyfactory_cb(factory_cb) #ph.set_pypre_hook_cb(hook_cb); #ph.set_pypost_hook_cb(hook_cb); fgh = es.es_handler_flowgraph(ph, 1) arb = es.es_make_arbiter() queue = es.queue() tb = gr.top_block() src = es.source(arb, queue, [1]) sink = gr.vector_sink_b() src.set_max(20) tb.connect(src, sink) e1 = es.event_create("fg-event", 2, 3) e2 = es.event_create("fg-event", 8, 3) e3 = es.event_create("fg-event", 12, 3) queue.register_event_type(es.event_type(e1)) queue.bind_handler(es.event_type(e1), es.make_handler_pmt(fgh)) print "--------calling queue.add_event(e1)-------------" queue.add_event(e1) queue.add_event(e2)
# define our new event handler key_handler = es.es_pyhandler_def(); key_handler.set_pyfactory_cb(key_factory); key_handler.set_pypre_hook_cb(pre_hook); key_handler.set_pypost_hook_cb(post_hook); key_handler_graph = es.es_handler_flowgraph( key_handler, 2 ); # set up some common es components arb = es.es_make_arbiter(); queue = es.queue(); queue.set_early_behavior(1); # set up the main flow graph tb = gr.top_block(); src = es.source( arb, queue, [gr.sizeof_float, gr.sizeof_float] ); sink = audio.sink(int(fs)); tb.connect((src,0),(sink,0)); tb.connect((src,1),(sink,1)); fsnk = gr.file_sink(gr.sizeof_gr_complex, "keypad.out"); f2c = gr.float_to_complex(); tb.connect( (src,0), (f2c,0) , fsnk); tb.connect( (src,1), (f2c,1) ); # create initial event, set up event bindings, handlers e1 = es.event_create("key-press", 10, evt_len ); tmp_pmt = pmt.intern("1"); print tmp_pmt; e1 = es.event_args_add( e1, key_sym, tmp_pmt ); queue.register_event_type( es.event_type( e1 ) );
def __init__(self, pre_bits=[ 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0 ]): gr.top_block.__init__(self, "Psk Burst Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Psk Burst Tx") 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", "psk_burst_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.pre_bits = pre_bits ################################################## # Variables ################################################## self.samp_rate = samp_rate = 20e3 ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.interp_fir_filter_ccf( 2, firdes.root_raised_cosine(1, 2.0, 1, 0.35, 41)) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192, #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(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(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_const_sink_x_0 = qtgui.const_sink_c( 8192, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.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.top_grid_layout.addWidget(self._pyqt_meta_text_output_0_win) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0 self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.mapper_mapper_msg_0 = mapper.mapper_msg(mapper.QPSK, ([0, 1, 3, 2])) self.es_source_0 = es.source(1 * [gr.sizeof_gr_complex], 1, 2, 0) self.channels_channel_model_0_0 = channels.channel_model( noise_voltage=0.05, frequency_offset=random.random() * 1e-4, epsilon=1.0 + random.random() * 1e-4, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False) self.burst_scheduler_0 = burst.burst_scheduler() self.burst_randomizer_0 = burst.randomizer( ([0, 14, 15]), ([1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0]), 100000) self.burst_preamble_insert_0 = burst.preamble_insert((pre_bits)) self.burst_framer_0 = burst.framer(1024) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 1000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, '/tmp/psk_xmit.dat', False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.burst_framer_0, 'packed_pdus')) self.msg_connect((self.burst_framer_0, 'unpacked_pdus'), (self.burst_randomizer_0, 'pdus')) self.msg_connect((self.burst_preamble_insert_0, 'pdus'), (self.mapper_mapper_msg_0, 'pdus')) self.msg_connect((self.burst_randomizer_0, 'pdus'), (self.burst_preamble_insert_0, 'pdus')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.es_source_0, 'nproduced'), (self.burst_scheduler_0, 'nproduced')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.burst_scheduler_0, 'sched_pdu')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect((self.blocks_throttle_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.channels_channel_model_0_0, 0))
key_handler.set_pypre_hook_cb(pre_hook); #key_handler.set_pypost_hook_cb(post_hook); key_handler_graph = es.es_handler_flowgraph( key_handler,2 ); # set up some common es components arb = es.es_make_arbiter(); queue = es.queue(); # most packets will got out as scheduled # but if we are ever later just send it as soon as possible queue.set_early_behavior(1); #queue.set_early_behavior(0); # set up the main flow graph tb = gr.top_block(); src = es.source( arb, queue, [gr.sizeof_gr_complex] ); #sink = gr.file_sink(gr.sizeof_gr_complex , "outfile.dat" ); sink = gr.udp_sink( gr.sizeof_gr_complex, "localhost", 12345 ); summer = gr.add_cc(); noise = gr.noise_source_c( gr.GR_GAUSSIAN, noise_amp); throttle = gr.throttle(gr.sizeof_gr_complex, fs); tb.connect(src, summer, sink); tb.connect(noise, throttle, (summer,1)); # create initial event, set up event bindings, handlers e1 = es.event_create("burst_transmit", 10, 1000 ); e1 = es.event_args_add( e1, key_sym, pmt.intern("1") ); queue.register_event_type( es.event_type( e1 ) ); queue.bind_handler( es.event_type( e1 ), es.make_handler_pmt(key_handler_graph) ); # start the main flowgraph
def __init__(self): gr.top_block.__init__(self, "Epsilon Greedy Loopback") Qt.QWidget.__init__(self) self.setWindowTitle("Epsilon Greedy Loopback") 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", "epsilon_greedy_loopback") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 5000000 ################################################## # Blocks ################################################## self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 0 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.01) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.liquiddsp_flex_tx_0 = liquiddsp.flex_tx(0, 0, 0) self.liquiddsp_flex_rx_0 = liquiddsp.flex_rx() self.es_source_0 = es.source(1 * [gr.sizeof_gr_complex], 1, 2, 0) self.cognition_epsilon_greedy_0 = cognition.epsilon_greedy() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 50, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 125) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.liquiddsp_flex_tx_0, 'pdus')) self.msg_connect((self.cognition_epsilon_greedy_0, 'configuration'), (self.liquiddsp_flex_tx_0, 'configuration')) self.msg_connect((self.liquiddsp_flex_rx_0, 'packet_info'), (self.cognition_epsilon_greedy_0, 'packet_info')) self.msg_connect((self.liquiddsp_flex_rx_0, 'constellation'), (self.qtgui_const_sink_x_0, 'in')) self.msg_connect((self.liquiddsp_flex_tx_0, 'pdus'), (self.es_source_0, 'schedule_event')) self.connect((self.blocks_throttle_0, 0), (self.liquiddsp_flex_rx_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0))
def __init__(self, channel, processor, sdr_device="pluto-sdr"): gr.top_block.__init__(self, "Tx Flow") ################################################## # Variables ################################################## self.channel = channel self.sdr_device = sdr_device self.processor = processor ################################################## # Blocks ################################################## if self.sdr_device == "hackrf": self.sdr_sink = osmosdr.sink(args="numchan=1") self.sdr_sink.set_sample_rate(4e6) self.sdr_sink.set_center_freq(self.get_center_freq(), 0) self.sdr_sink.set_freq_corr(0, 0) self.sdr_sink.set_gain(10, 0) self.sdr_sink.set_if_gain(20, 0) self.sdr_sink.set_bb_gain(20, 0) self.sdr_sink.set_antenna('', 0) self.sdr_sink.set_bandwidth(0, 0) elif self.sdr_device == "pluto-sdr": self.sdr_sink = iio.pluto_sink('192.168.2.1', self.get_center_freq(), int(4e6), int(4e6), 0x8000, False, 0, '', True) self.sdr_source = iio.pluto_source('192.168.2.1', self.get_center_freq(), int(4e6), int(4e6), 0x8000, True, True, True, "manual", 50, '', True) self.ieee802_15_4_access_code_prefixer_0 = ieee802_15_4.access_code_prefixer( ) self.es_source_0 = es.source(1 * [gr.sizeof_gr_complex], 1, 2, 0) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( ([(1 + 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (-1 - 1j), (-1 + 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (-1 + 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (1 - 1j), (1 + 1j), (1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (1 - 1j), (1 + 1j), (1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (-1 - 1j), (-1 + 1j), (1 + 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (-1 - 1j), (-1 + 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (1 - 1j), (1 + 1j), (1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (-1 - 1j), (-1 + 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (-1 - 1j), (-1 + 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (1 - 1j), (1 + 1j), (1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 + 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (1 - 1j), (1 + 1j), (1 - 1j), (-1 - 1j), (1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (-1 - 1j), (1 + 1j), (-1 + 1j), (-1 + 1j), (-1 - 1j), (1 - 1j), (-1 - 1j), (1 - 1j), (1 + 1j), (1 - 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (-1 - 1j), (1 - 1j), (-1 + 1j), (-1 + 1j), (1 - 1j), (-1 - 1j), (-1 - 1j), (-1 + 1j), (1 + 1j), (-1 + 1j), (1 + 1j), (1 - 1j), (1 + 1j), (1 - 1j), (-1 - 1j)]), 16) self.blocks_vector_source_x_0 = blocks.vector_source_c( [0, sin(pi / 4), 1, sin(3 * pi / 4)], True, 1, []) self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.complex_t, 'pdu_length') self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length( gr.sizeof_gr_complex * 1, 'pdu_length', 128) self.blocks_tagged_stream_multiply_length_0.set_min_output_buffer( 20000) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, 4) self.blocks_pdu_to_tagged_stream_0_0_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'pdu_length') self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( 4, gr.GR_LSB_FIRST) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 2) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.msg_in_0 = msg_block_source() if self.sdr_device == "pluto-sdr": self.ieee802_15_4_oqpsk_phy_0 = ieee802_15_4_oqpsk_phy() self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.msg_out_0 = msg_sink_block(self.processor) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.ieee802_15_4_access_code_prefixer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0, 'pdus')) self.msg_connect((self.msg_in_0, 'msg_out'), (self.ieee802_15_4_access_code_prefixer_0, 'in')) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_delay_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_delay_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.sdr_sink, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_complex_to_float_0, 0)) if self.sdr_device == "pluto-sdr": self.msg_connect((self.ieee802_15_4_oqpsk_phy_0, 'rxout'), (self.msg_out_0, 'msg_in')) self.connect((self.ieee802_15_4_oqpsk_phy_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.sdr_source, 0), (self.ieee802_15_4_oqpsk_phy_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))
def __init__(self, pre_bits=[0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0]): gr.top_block.__init__(self, "Psk Burst Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Psk Burst Tx") 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", "psk_burst_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.pre_bits = pre_bits ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100e3 self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make('/home/abraxas3d/goodies/share/gnuradio/fec/ldpc/271.127.3.112'); ################################################## # Blocks ################################################## self.root_raised_cosine_filter_0 = filter.interp_fir_filter_ccf(2, firdes.root_raised_cosine( 1, 2.0, 1, 0.35, 41)) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 8192, #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(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(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0,0,1,0) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 8192, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1,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.top_layout.addWidget(self._pyqt_meta_text_output_0_win) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1,0) self.mapper_mapper_msg_0 = mapper.mapper_msg(mapper.QPSK, ([0,1,3,2])) self.fec_async_encoder_0 = fec.async_encoder(ldpc_enc, False, True, True, 1500) self.es_source_0 = es.source(1*[gr.sizeof_gr_complex], 1, 2) self.channels_channel_model_0_0 = channels.channel_model( noise_voltage=0.05, frequency_offset=random.random()*1e-4, epsilon=1.0+random.random()*1e-4, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False ) self.burst_scheduler_0 = burst.burst_scheduler() self.burst_randomizer_0 = burst.randomizer(([0,14,15]), ([1,0,0,1,0,1,0,1,0,0,0,0,0,0,0]), 100000) self.burst_preamble_insert_0 = burst.preamble_insert((pre_bits)) self.burst_padder_0 = burst.padder(144) self.burst_framer_0 = burst.framer(144) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_random_pdu_0 = blocks.random_pdu(50, 256/2, chr(0xFF), 2) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, '/tmp/psk_ldpc_xmit.dat', False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_random_pdu_0, 'generate')) self.msg_connect((self.blocks_random_pdu_0, 'pdus'), (self.burst_framer_0, 'packed_pdus')) self.msg_connect((self.burst_framer_0, 'unpacked_pdus'), (self.burst_padder_0, 'pdus')) self.msg_connect((self.burst_padder_0, 'pdus'), (self.burst_randomizer_0, 'pdus')) self.msg_connect((self.burst_preamble_insert_0, 'pdus'), (self.mapper_mapper_msg_0, 'pdus')) self.msg_connect((self.burst_randomizer_0, 'pdus'), (self.fec_async_encoder_0, 'in')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.es_source_0, 'schedule_event')) self.msg_connect((self.burst_scheduler_0, 'sched_pdu'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.es_source_0, 'nproduced'), (self.burst_scheduler_0, 'nproduced')) self.msg_connect((self.fec_async_encoder_0, 'out'), (self.burst_preamble_insert_0, 'pdus')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.burst_scheduler_0, 'sched_pdu')) self.msg_connect((self.mapper_mapper_msg_0, 'cpdus'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect((self.blocks_throttle_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.es_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.channels_channel_model_0_0, 0))