Ejemplo n.º 1
0
    def __init__(self, ampl=0.7, args='', arq_timeout=.1*0 + 0.04, dest_addr=-1, iface='tun0', mtu=128, ogradio_addr=0, port="12345", rate=1e6, rx_antenna="TX/RX", rx_gain=65-20, rx_lo_offset=0, samps_per_sym=4, tx_gain=45, tx_lo_offset=0, max_arq_attempts=5 * 2, tx_freq=915e6, rx_freq=915e6):
        gr.top_block.__init__(self, "Batmannogui")

        self._lock = threading.RLock()

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.dest_addr = dest_addr
        self.iface = iface
        self.mtu = mtu
        self.ogradio_addr = ogradio_addr
        self.port = port
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset
        self.max_arq_attempts = max_arq_attempts
        self.tx_freq = tx_freq
        self.rx_freq = rx_freq

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = rate

        ##################################################
        # Blocks
        ##################################################
        self.gmsk_radio_0 = gmsk_radio(
            rate=samp_rate,
            args=args,
            tx_gain=tx_gain,
            tx_freq=tx_freq,
            rx_ant=rx_antenna,
            rx_freq=rx_freq,
            rx_gain=rx_gain,
            ampl=ampl,
            rx_lo_offset=rx_lo_offset,
            tx_lo_offset=tx_lo_offset,
            samps_per_sym=samps_per_sym,
            access_code_threshold=0 + 12 + 4*0,
        )
        self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu(iface, mtu*0 + 1532, False)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'), (self.gmsk_radio_0, 'msg_in'))    
        self.msg_connect((self.gmsk_radio_0, 'msg_out'), (self.blocks_tuntap_pdu_0, 'pdus'))    
Ejemplo n.º 2
0
    def __init__(self, ampl=0.7, args='', arq_timeout=.1*0 + 0.04, dest_addr=-1, iface='tun0', max_arq_attempts=5 * 2, mtu=128, ogradio_addr=0, ogrx_freq=915e6, ogtx_freq=915e6, port="12345", rate=1e6, rx_antenna="TX/RX", rx_gain=65-20, rx_lo_offset=0, samps_per_sym=4, tx_gain=45, tx_lo_offset=0):
        grc_wxgui.top_block_gui.__init__(self, title="Broadcastwithfreqandmac")

        self._lock = threading.RLock()

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.dest_addr = dest_addr
        self.iface = iface
        self.max_arq_attempts = max_arq_attempts
        self.mtu = mtu
        self.ogradio_addr = ogradio_addr
        self.ogrx_freq = ogrx_freq
        self.ogtx_freq = ogtx_freq
        self.port = port
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset

        ##################################################
        # Variables
        ##################################################
        self.user_tx_gain = user_tx_gain = tx_gain
        self.user_rx_gain = user_rx_gain = rx_gain
        self.tx_freq = tx_freq = 915e6
        self.samp_rate = samp_rate = rate
        self.rx_freq = rx_freq = 915e6
        self.radio_addr = radio_addr = 84

        ##################################################
        # Blocks
        ##################################################
        _user_tx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._user_tx_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_user_tx_gain_sizer,
        	value=self.user_tx_gain,
        	callback=self.set_user_tx_gain,
        	label="TX Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._user_tx_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_user_tx_gain_sizer,
        	value=self.user_tx_gain,
        	callback=self.set_user_tx_gain,
        	minimum=0,
        	maximum=90,
        	num_steps=90,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_user_tx_gain_sizer)
        _user_rx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._user_rx_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_user_rx_gain_sizer,
        	value=self.user_rx_gain,
        	callback=self.set_user_rx_gain,
        	label="RX Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._user_rx_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_user_rx_gain_sizer,
        	value=self.user_rx_gain,
        	callback=self.set_user_rx_gain,
        	minimum=0,
        	maximum=90,
        	num_steps=90,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_user_rx_gain_sizer)
        self._tx_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.tx_freq,
        	callback=self.set_tx_freq,
        	label='tx_freq',
        	converter=forms.float_converter(),
        )
        self.Add(self._tx_freq_text_box)
        self._rx_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.rx_freq,
        	callback=self.set_rx_freq,
        	label='rx_freq',
        	converter=forms.float_converter(),
        )
        self.Add(self._rx_freq_text_box)
        self._radio_addr_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.radio_addr,
        	callback=self.set_radio_addr,
        	label="Local address",
        	converter=forms.int_converter(),
        )
        self.Add(self._radio_addr_text_box)
        self.mac_802_3_tracker = mac.tracker_802_3(verbose=False)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c(
        	self.GetWin(),
        	title="RX",
        	sample_rate=samp_rate,
        	v_scale=0.02,
        	v_offset=0,
        	t_scale=0.0001,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_NORM,
        	y_axis_label="Counts",
        )
        self.GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1)
        self.simple_mac_1 = mac.simple_mac(
        radio_addr,
        arq_timeout,
        max_arq_attempts,
        2.0,
        False,
        0.05,
        node_expiry_delay=10.0,
        expire_on_arq_failure=False,
        only_send_if_alive=False,
        prepend_dummy=False,
        )
        self.mac_virtual_channel_encoder_0_0 = mac.virtual_channel_encoder(-1, True,mtu=mtu,
        chan_id=1,
        prepend_dummy=False,
        chan_tracker=self.mac_802_3_tracker,
        )
        self.mac_virtual_channel_encoder_0 = mac.virtual_channel_encoder(-1, True,mtu=mtu,
        chan_id=0,
        prepend_dummy=False,
        )
        self.mac_virtual_channel_decoder_0 = mac.virtual_channel_decoder(3, [0, 1])
        self.gmsk_radio_0 = gmsk_radio(
            access_code_threshold=0 + 12 + 4*0,
            samps_per_sym=samps_per_sym,
            tx_lo_offset=tx_lo_offset,
            rx_lo_offset=rx_lo_offset,
            ampl=ampl,
            rx_gain=user_rx_gain,
            rx_freq=rx_freq,
            rx_ant=rx_antenna,
            tx_freq=tx_freq,
            tx_gain=user_tx_gain,
            args=args,
            rate=samp_rate,
        )
        self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu(iface, mtu*0 + 1514, False)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "", port, mtu, False)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(10000, 1./10000, 40000/4)
        self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("T"), 1)
        self.blocks_message_debug_0_0_1 = blocks.message_debug()
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.simple_mac_1, 'ctrl_in'))    
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.mac_virtual_channel_encoder_0, 'in'))    
        self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'), (self.mac_virtual_channel_encoder_0_0, 'in'))    
        self.msg_connect((self.gmsk_radio_0, 'msg_out'), (self.simple_mac_1, 'from_radio'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out2'), (self.blocks_message_debug_0_0_1, 'print'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out0'), (self.blocks_socket_pdu_0, 'pdus'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out1'), (self.blocks_tuntap_pdu_0, 'pdus'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out1'), (self.mac_802_3_tracker, 'in'))    
        self.msg_connect((self.mac_virtual_channel_encoder_0, 'out'), (self.simple_mac_1, 'from_app_arq'))    
        self.msg_connect((self.mac_virtual_channel_encoder_0_0, 'out'), (self.simple_mac_1, 'from_app_arq'))    
        self.msg_connect((self.simple_mac_1, 'to_radio'), (self.gmsk_radio_0, 'msg_in'))    
        self.msg_connect((self.simple_mac_1, 'to_app'), (self.mac_virtual_channel_decoder_0, 'in'))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_moving_average_xx_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.wxgui_scopesink2_0_0, 1))    
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.gmsk_radio_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.gmsk_radio_0, 0), (self.wxgui_scopesink2_0_0, 0))    
Ejemplo n.º 3
0
    def __init__(self, ampl=0.7, args='addr=192.168.10.3', arq_timeout=.1*0 + 0.04, broadcast_interval=1, dest_addr=85, lo_offset=5e6, max_arq_attempts=5 * 2, mtu=2000, port='12346', radio_addr=86, rate=1e6, rx_antenna='TX/RX', rx_freq=915e6, rx_gain=65-20, rx_lo_offset=0, samps_per_sym=4, tx_freq=915e6, tx_gain=45, tx_lo_offset=0):
        gr.top_block.__init__(self, "Simple Trx Mac Dsa")

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.broadcast_interval = broadcast_interval
        self.dest_addr = dest_addr
        self.lo_offset = lo_offset
        self.max_arq_attempts = max_arq_attempts
        self.mtu = mtu
        self.port = port
        self.radio_addr = radio_addr
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_freq = rx_freq
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_freq = tx_freq
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset

        ##################################################
        # Variables
        ##################################################
        self.variable_0 = variable_0 = 0
        self.samp_rate = samp_rate = rate

        ##################################################
        # Blocks
        ##################################################
        self.sdr_source = uhd.usrp_source(
        	",".join(('', args)),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.sdr_source.set_clock_source('gpsdo', 0)
        self.sdr_source.set_time_source('gpsdo', 0)
        self.sdr_source.set_samp_rate(samp_rate)
        self.sdr_source.set_center_freq(rx_freq, 0)
        self.sdr_source.set_gain(rx_gain, 0)
        self.sdr_source.set_antenna('TX/RX', 0)
        self.sdr_source.set_auto_dc_offset(True, 0)
        self.sdr_source.set_auto_iq_balance(True, 0)
        self.sdr_sink = uhd.usrp_sink(
        	",".join(('', args)),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.sdr_sink.set_clock_source('gpsdo', 0)
        self.sdr_sink.set_time_source('gpsdo', 0)
        self.sdr_sink.set_samp_rate(samp_rate)
        self.sdr_sink.set_center_freq(tx_freq, 0)
        self.sdr_sink.set_gain(tx_gain, 0)
        self.sdr_sink.set_antenna('TX/RX', 0)
        self.mac_virtual_channel_encoder_0 = mac.virtual_channel_encoder(dest_addr, True,mtu=mtu,
        chan_id=0,
        prepend_dummy=False,
        )
        self.mac_virtual_channel_decoder_0 = mac.virtual_channel_decoder(3, [0,1])
        self.gmsk_radio_0 = gmsk_radio(
            rate=samp_rate,
            samps_per_sym=samps_per_sym,
            ampl=ampl,
            access_code_threshold=0 + 12 + 4*0,
        )
        self.dsa_vt_simple_mac_dsa_0 = dsa_vt.simple_mac_dsa(
        self.sdr_source,
        radio_addr,
        0.04,
        10,
        broadcast_interval,
        False,
        0.05,
        node_expiry_delay=10.0,
        expire_on_arq_failure=False,
        only_send_if_alive=False,
        prepend_dummy=False,
        )
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '127.0.0.1', port, mtu, False)
        self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("T"), 1)



        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.dsa_vt_simple_mac_dsa_0, 'ctrl_in'))
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.mac_virtual_channel_encoder_0, 'in'))
        self.msg_connect((self.dsa_vt_simple_mac_dsa_0, 'to_radio'), (self.gmsk_radio_0, 'msg_in'))
        self.msg_connect((self.dsa_vt_simple_mac_dsa_0, 'to_app'), (self.mac_virtual_channel_decoder_0, 'in'))
        self.msg_connect((self.gmsk_radio_0, 'msg_out'), (self.dsa_vt_simple_mac_dsa_0, 'from_radio'))
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out0'), (self.blocks_socket_pdu_0, 'pdus'))
        self.msg_connect((self.mac_virtual_channel_encoder_0, 'out'), (self.dsa_vt_simple_mac_dsa_0, 'from_app'))
        self.connect((self.gmsk_radio_0, 0), (self.sdr_sink, 0))
        self.connect((self.sdr_source, 0), (self.gmsk_radio_0, 0))
Ejemplo n.º 4
0
    def __init__(self,
                 ampl=0.7,
                 args='addr=192.168.10.3',
                 arq_timeout=.1 * 0 + 0.04,
                 broadcast_interval=1,
                 dest_addr=85,
                 lo_offset=5e6,
                 max_arq_attempts=5 * 2,
                 mtu=255,
                 port='12346',
                 radio_addr=86,
                 rate=1e6,
                 rx_antenna='TX/RX',
                 rx_freq=915e6,
                 rx_gain=65 - 20,
                 rx_lo_offset=0,
                 samps_per_sym=4,
                 tx_freq=915e6,
                 tx_gain=45,
                 tx_lo_offset=0):
        gr.top_block.__init__(self, "Simple Trx Mac Dsa Rl")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Simple Trx Mac Dsa Rl")
        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", "simple_trx_mac_dsa_RL")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.broadcast_interval = broadcast_interval
        self.dest_addr = dest_addr
        self.lo_offset = lo_offset
        self.max_arq_attempts = max_arq_attempts
        self.mtu = mtu
        self.port = port
        self.radio_addr = radio_addr
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_freq = rx_freq
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_freq = tx_freq
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset

        ##################################################
        # Variables
        ##################################################
        self.variable_0 = variable_0 = 0
        self.samp_rate = samp_rate = rate

        ##################################################
        # Blocks
        ##################################################
        self.simple_mac_0 = mac.simple_mac(
            radio_addr,
            arq_timeout,
            10,
            broadcast_interval,
            False,
            0.05,
            node_expiry_delay=10.0,
            expire_on_arq_failure=False,
            only_send_if_alive=False,
            prepend_dummy=False,
        )
        self.sdr_source = uhd.usrp_source(
            ",".join(('', args)),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.sdr_source.set_clock_source('gpsdo', 0)
        self.sdr_source.set_time_source('gpsdo', 0)
        self.sdr_source.set_samp_rate(samp_rate)
        self.sdr_source.set_center_freq(rx_freq, 0)
        self.sdr_source.set_gain(rx_gain, 0)
        self.sdr_source.set_antenna('TX/RX', 0)
        self.sdr_source.set_auto_dc_offset(True, 0)
        self.sdr_source.set_auto_iq_balance(True, 0)
        self.sdr_sink = uhd.usrp_sink(
            ",".join(('', args)),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.sdr_sink.set_clock_source('gpsdo', 0)
        self.sdr_sink.set_time_source('gpsdo', 0)
        self.sdr_sink.set_samp_rate(samp_rate)
        self.sdr_sink.set_center_freq(tx_freq, 0)
        self.sdr_sink.set_gain(tx_gain, 0)
        self.sdr_sink.set_antenna('TX/RX', 0)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            rx_freq,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

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

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.mac_virtual_channel_encoder_0 = mac.virtual_channel_encoder(
            dest_addr,
            True,
            mtu=mtu,
            chan_id=0,
            prepend_dummy=False,
        )
        self.mac_virtual_channel_decoder_0 = mac.virtual_channel_decoder(
            3, [0, 1])
        self.gmsk_radio_0 = gmsk_radio(
            rate=samp_rate,
            samps_per_sym=samps_per_sym,
            ampl=ampl,
            access_code_threshold=0 + 12 + 4 * 0,
        )
        self.dsa_vt_RL_engine_0 = dsa_vt.RL_engine(self.sdr_source, -5)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '127.0.0.1',
                                                     port, mtu, False)
        self.blocks_message_strobe_0 = blocks.message_strobe(
            pmt.intern("T"), 1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'),
                         (self.simple_mac_0, 'ctrl_in'))
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'),
                         (self.mac_virtual_channel_encoder_0, 'in'))
        self.msg_connect((self.gmsk_radio_0, 'msg_out'),
                         (self.simple_mac_0, 'from_radio'))
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out0'),
                         (self.blocks_socket_pdu_0, 'pdus'))
        self.msg_connect((self.mac_virtual_channel_encoder_0, 'out'),
                         (self.simple_mac_0, 'from_app_arq'))
        self.msg_connect((self.simple_mac_0, 'to_radio'),
                         (self.gmsk_radio_0, 'msg_in'))
        self.msg_connect((self.simple_mac_0, 'to_app'),
                         (self.mac_virtual_channel_decoder_0, 'in'))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.dsa_vt_RL_engine_0, 0))
        self.connect((self.gmsk_radio_0, 0), (self.sdr_sink, 0))
        self.connect((self.sdr_source, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.sdr_source, 0), (self.gmsk_radio_0, 0))
        self.connect((self.sdr_source, 0), (self.qtgui_freq_sink_x_0, 0))
Ejemplo n.º 5
0
    def __init__(self,
                 ampl=0.7,
                 args='',
                 arq_timeout=.1 * 0 + 0.04,
                 dest_addr=-1,
                 iface='tun0',
                 max_arq_attempts=5 * 2,
                 mtu=128,
                 ogradio_addr=0,
                 ogrx_freq=915e6,
                 ogtx_freq=915e6,
                 port="12345",
                 rate=1e6,
                 rx_antenna="TX/RX",
                 rx_gain=65 - 20,
                 rx_lo_offset=0,
                 samps_per_sym=4,
                 tx_gain=45,
                 tx_lo_offset=0):
        grc_wxgui.top_block_gui.__init__(self, title="Broadcastwithfreqnomac")

        self._lock = threading.RLock()

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.dest_addr = dest_addr
        self.iface = iface
        self.max_arq_attempts = max_arq_attempts
        self.mtu = mtu
        self.ogradio_addr = ogradio_addr
        self.ogrx_freq = ogrx_freq
        self.ogtx_freq = ogtx_freq
        self.port = port
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset

        ##################################################
        # Variables
        ##################################################
        self.user_tx_gain = user_tx_gain = tx_gain
        self.user_rx_gain = user_rx_gain = rx_gain
        self.tx_freq = tx_freq = 915e6
        self.samp_rate = samp_rate = rate
        self.rx_freq = rx_freq = 915e6

        ##################################################
        # Blocks
        ##################################################
        _user_tx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._user_tx_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_user_tx_gain_sizer,
            value=self.user_tx_gain,
            callback=self.set_user_tx_gain,
            label="TX Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._user_tx_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_user_tx_gain_sizer,
            value=self.user_tx_gain,
            callback=self.set_user_tx_gain,
            minimum=0,
            maximum=90,
            num_steps=90,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_user_tx_gain_sizer)
        _user_rx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._user_rx_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_user_rx_gain_sizer,
            value=self.user_rx_gain,
            callback=self.set_user_rx_gain,
            label="RX Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._user_rx_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_user_rx_gain_sizer,
            value=self.user_rx_gain,
            callback=self.set_user_rx_gain,
            minimum=0,
            maximum=90,
            num_steps=90,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_user_rx_gain_sizer)
        self._tx_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.tx_freq,
            callback=self.set_tx_freq,
            label='tx_freq',
            converter=forms.float_converter(),
        )
        self.Add(self._tx_freq_text_box)
        self._rx_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.rx_freq,
            callback=self.set_rx_freq,
            label='rx_freq',
            converter=forms.float_converter(),
        )
        self.Add(self._rx_freq_text_box)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c(
            self.GetWin(),
            title="RX",
            sample_rate=samp_rate,
            v_scale=0.02,
            v_offset=0,
            t_scale=0.0001,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=wxgui.TRIG_MODE_NORM,
            y_axis_label="Counts",
        )
        self.GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1)
        self.gmsk_radio_0 = gmsk_radio(
            access_code_threshold=0 + 12 + 4 * 0,
            samps_per_sym=samps_per_sym,
            tx_lo_offset=tx_lo_offset,
            rx_lo_offset=rx_lo_offset,
            ampl=ampl,
            rx_gain=user_rx_gain,
            rx_freq=rx_freq,
            rx_ant=rx_antenna,
            tx_freq=tx_freq,
            tx_gain=user_tx_gain,
            args=args,
            rate=samp_rate,
        )
        self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu(iface, mtu * 0 + 1532,
                                                     False)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(
            10000, 1. / 10000, 40000 / 4)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'),
                         (self.gmsk_radio_0, 'msg_in'))
        self.msg_connect((self.gmsk_radio_0, 'msg_out'),
                         (self.blocks_tuntap_pdu_0, 'pdus'))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.wxgui_scopesink2_0_0, 1))
        self.connect((self.blocks_moving_average_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.gmsk_radio_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.gmsk_radio_0, 0), (self.wxgui_scopesink2_0_0, 0))
Ejemplo n.º 6
0
    def __init__(self, ampl=0.7, args='', arq_timeout=.1*0 + 0.04, dest_addr=-1, iface='tun0', max_arq_attempts=5 * 2, mtu=128, port="12345", rx_antenna="TX/RX", rx_gain=65-20, rx_lo_offset=0, samps_per_sym=4, tx_gain=45, tx_lo_offset=0, radio_addr=63, rx_freq=915e6, tx_freq=915e6, rate=1e6):
        gr.top_block.__init__(self, "Broadcasfandmnogui")

        self._lock = threading.RLock()

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.dest_addr = dest_addr
        self.iface = iface
        self.max_arq_attempts = max_arq_attempts
        self.mtu = mtu
        self.port = port
        self.rx_antenna = rx_antenna
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset
        self.radio_addr = radio_addr
        self.rx_freq = rx_freq
        self.tx_freq = tx_freq
        self.rate = rate

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = rate

        ##################################################
        # Blocks
        ##################################################
        self.mac_802_3_tracker = mac.tracker_802_3(verbose=False)
        self.simple_mac_1 = mac.simple_mac(
        radio_addr,
        arq_timeout,
        max_arq_attempts,
        2.0,
        False,
        0.05,
        node_expiry_delay=10.0,
        expire_on_arq_failure=False,
        only_send_if_alive=False,
        prepend_dummy=False,
        )
        self.mac_virtual_channel_encoder_0_0 = mac.virtual_channel_encoder(-1, True,mtu=mtu,
        chan_id=1,
        prepend_dummy=False,
        chan_tracker=self.mac_802_3_tracker,
        )
        self.mac_virtual_channel_encoder_0 = mac.virtual_channel_encoder(-1, True,mtu=mtu,
        chan_id=0,
        prepend_dummy=False,
        )
        self.mac_virtual_channel_decoder_0 = mac.virtual_channel_decoder(3, [0, 1])
        self.gmsk_radio_0 = gmsk_radio(
            rate=samp_rate,
            args=args,
            tx_gain=tx_gain,
            tx_freq=tx_freq,
            rx_ant=rx_antenna,
            rx_freq=rx_freq,
            rx_gain=rx_gain,
            ampl=ampl,
            rx_lo_offset=rx_lo_offset,
            tx_lo_offset=tx_lo_offset,
            samps_per_sym=samps_per_sym,
            access_code_threshold=0 + 12 + 4*0,
        )
        self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu(iface, mtu*0 + 1514, False)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "", port, mtu, False)
        self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("T"), 1)
        self.blocks_message_debug_0_0_1 = blocks.message_debug()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.simple_mac_1, 'ctrl_in'))    
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.mac_virtual_channel_encoder_0, 'in'))    
        self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'), (self.mac_virtual_channel_encoder_0_0, 'in'))    
        self.msg_connect((self.gmsk_radio_0, 'msg_out'), (self.simple_mac_1, 'from_radio'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out2'), (self.blocks_message_debug_0_0_1, 'print'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out0'), (self.blocks_socket_pdu_0, 'pdus'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out1'), (self.blocks_tuntap_pdu_0, 'pdus'))    
        self.msg_connect((self.mac_virtual_channel_decoder_0, 'out1'), (self.mac_802_3_tracker, 'in'))    
        self.msg_connect((self.mac_virtual_channel_encoder_0, 'out'), (self.simple_mac_1, 'from_app_arq'))    
        self.msg_connect((self.mac_virtual_channel_encoder_0_0, 'out'), (self.simple_mac_1, 'from_app_arq'))    
        self.msg_connect((self.simple_mac_1, 'to_radio'), (self.gmsk_radio_0, 'msg_in'))    
        self.msg_connect((self.simple_mac_1, 'to_app'), (self.mac_virtual_channel_decoder_0, 'in'))    
    def __init__(self, ampl=0.7, args='', arq_timeout=.1*0 + 0.04, dest_addr=-1, iface='tun0', max_arq_attempts=5 * 2, mtu=128, ogradio_addr=0, ogrx_freq=915e6, ogtx_freq=915e6, port="12345", rate=1e6, rx_antenna="TX/RX", rx_gain=65-20, rx_lo_offset=0, samps_per_sym=4, tx_gain=45, tx_lo_offset=0):
        grc_wxgui.top_block_gui.__init__(self, title="Broadcastwithfreqnomac")

        self._lock = threading.RLock()

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.dest_addr = dest_addr
        self.iface = iface
        self.max_arq_attempts = max_arq_attempts
        self.mtu = mtu
        self.ogradio_addr = ogradio_addr
        self.ogrx_freq = ogrx_freq
        self.ogtx_freq = ogtx_freq
        self.port = port
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset

        ##################################################
        # Variables
        ##################################################
        self.user_tx_gain = user_tx_gain = tx_gain
        self.user_rx_gain = user_rx_gain = rx_gain
        self.tx_freq = tx_freq = 915e6
        self.samp_rate = samp_rate = rate
        self.rx_freq = rx_freq = 915e6

        ##################################################
        # Blocks
        ##################################################
        _user_tx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._user_tx_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_user_tx_gain_sizer,
        	value=self.user_tx_gain,
        	callback=self.set_user_tx_gain,
        	label="TX Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._user_tx_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_user_tx_gain_sizer,
        	value=self.user_tx_gain,
        	callback=self.set_user_tx_gain,
        	minimum=0,
        	maximum=90,
        	num_steps=90,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_user_tx_gain_sizer)
        _user_rx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._user_rx_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_user_rx_gain_sizer,
        	value=self.user_rx_gain,
        	callback=self.set_user_rx_gain,
        	label="RX Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._user_rx_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_user_rx_gain_sizer,
        	value=self.user_rx_gain,
        	callback=self.set_user_rx_gain,
        	minimum=0,
        	maximum=90,
        	num_steps=90,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_user_rx_gain_sizer)
        self._tx_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.tx_freq,
        	callback=self.set_tx_freq,
        	label='tx_freq',
        	converter=forms.float_converter(),
        )
        self.Add(self._tx_freq_text_box)
        self._rx_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.rx_freq,
        	callback=self.set_rx_freq,
        	label='rx_freq',
        	converter=forms.float_converter(),
        )
        self.Add(self._rx_freq_text_box)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c(
        	self.GetWin(),
        	title="RX",
        	sample_rate=samp_rate,
        	v_scale=0.02,
        	v_offset=0,
        	t_scale=0.0001,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_NORM,
        	y_axis_label="Counts",
        )
        self.GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1)
        self.gmsk_radio_0 = gmsk_radio(
            access_code_threshold=0 + 12 + 4*0,
            samps_per_sym=samps_per_sym,
            tx_lo_offset=tx_lo_offset,
            rx_lo_offset=rx_lo_offset,
            ampl=ampl,
            rx_gain=user_rx_gain,
            rx_freq=rx_freq,
            rx_ant=rx_antenna,
            tx_freq=tx_freq,
            tx_gain=user_tx_gain,
            args=args,
            rate=samp_rate,
        )
        self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu(iface, mtu*0 + 1532, False)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(10000, 1./10000, 40000/4)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'), (self.gmsk_radio_0, 'msg_in'))    
        self.msg_connect((self.gmsk_radio_0, 'msg_out'), (self.blocks_tuntap_pdu_0, 'pdus'))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_moving_average_xx_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.wxgui_scopesink2_0_0, 1))    
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.gmsk_radio_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.gmsk_radio_0, 0), (self.wxgui_scopesink2_0_0, 0))    
Ejemplo n.º 8
0
    def __init__(self,
                 ampl=0.7,
                 args='',
                 arq_timeout=.1 * 0 + 0.04,
                 dest_addr=-1,
                 iface='tun0',
                 mtu=128,
                 ogradio_addr=0,
                 port="12345",
                 rate=1e6,
                 rx_antenna="TX/RX",
                 rx_gain=65 - 20,
                 rx_lo_offset=0,
                 samps_per_sym=4,
                 tx_gain=45,
                 tx_lo_offset=0,
                 max_arq_attempts=5 * 2,
                 tx_freq=915e6,
                 rx_freq=915e6):
        gr.top_block.__init__(self, "Batmannogui")

        self._lock = threading.RLock()

        ##################################################
        # Parameters
        ##################################################
        self.ampl = ampl
        self.args = args
        self.arq_timeout = arq_timeout
        self.dest_addr = dest_addr
        self.iface = iface
        self.mtu = mtu
        self.ogradio_addr = ogradio_addr
        self.port = port
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_gain = rx_gain
        self.rx_lo_offset = rx_lo_offset
        self.samps_per_sym = samps_per_sym
        self.tx_gain = tx_gain
        self.tx_lo_offset = tx_lo_offset
        self.max_arq_attempts = max_arq_attempts
        self.tx_freq = tx_freq
        self.rx_freq = rx_freq

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = rate

        ##################################################
        # Blocks
        ##################################################
        self.gmsk_radio_0 = gmsk_radio(
            rate=samp_rate,
            args=args,
            tx_gain=tx_gain,
            tx_freq=tx_freq,
            rx_ant=rx_antenna,
            rx_freq=rx_freq,
            rx_gain=rx_gain,
            ampl=ampl,
            rx_lo_offset=rx_lo_offset,
            tx_lo_offset=tx_lo_offset,
            samps_per_sym=samps_per_sym,
            access_code_threshold=0 + 12 + 4 * 0,
        )
        self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu(iface, mtu * 0 + 1532,
                                                     False)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'),
                         (self.gmsk_radio_0, 'msg_in'))
        self.msg_connect((self.gmsk_radio_0, 'msg_out'),
                         (self.blocks_tuntap_pdu_0, 'pdus'))
Ejemplo n.º 9
0
    def __init__(self, args='', tx_lo_offset=0, rx_lo_offset=0, rate=1e6, rx_antenna="TX/RX", rx_freq=915e6, tx_freq=915e6, rx_gain=65-20, tx_gain=45, port="12345", mtu=255, ampl=0.7, samps_per_sym=4):
        gr.top_block.__init__(self, "Phy Rf")

        ##################################################
        # Parameters
        ##################################################
        self.args = args
        self.tx_lo_offset = tx_lo_offset
        self.rx_lo_offset = rx_lo_offset
        self.rate = rate
        self.rx_antenna = rx_antenna
        self.rx_freq = rx_freq
        self.tx_freq = tx_freq
        self.rx_gain = rx_gain
        self.tx_gain = tx_gain
        self.port = port
        self.mtu = mtu
        self.ampl = ampl
        self.samps_per_sym = samps_per_sym

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = rate

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", args)),
        	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(rx_freq, 0)
        self.uhd_usrp_source_0.set_gain(rx_gain, 0)
        self.uhd_usrp_source_0.set_antenna(rx_antenna, 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", args)),
        	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_center_freq(tx_freq, 0)
        self.uhd_usrp_sink_0.set_gain(tx_gain, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.gmsk_radio_0 = gmsk_radio(
            rate=samp_rate,
            samps_per_sym=samps_per_sym,
            ampl=ampl,
            access_code_threshold=0 + 12 + 4*0,
        )
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "", port, mtu, False)
        self.blocks_message_debug_0_0_1 = blocks.message_debug()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.gmsk_radio_0, 'msg_in'))    
        self.msg_connect((self.gmsk_radio_0, 'msg_out'), (self.blocks_message_debug_0_0_1, 'print_pdu'))    
        self.msg_connect((self.gmsk_radio_0, 'msg_out'), (self.blocks_socket_pdu_0, 'pdus'))    
        self.connect((self.gmsk_radio_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.gmsk_radio_0, 0))