def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Loopback Ah") ################################################## # Variables ################################################## self.snr = snr = 20 self.pdu_length = pdu_length = 500 self.out_buf_size = out_buf_size = 96000 self.interval = interval = 100 self.encoding = encoding = 0 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## _snr_sizer = wx.BoxSizer(wx.VERTICAL) self._snr_text_box = forms.text_box( parent=self.GetWin(), sizer=_snr_sizer, value=self.snr, callback=self.set_snr, label='snr', converter=forms.float_converter(), proportion=0, ) self._snr_slider = forms.slider( parent=self.GetWin(), sizer=_snr_sizer, value=self.snr, callback=self.set_snr, minimum=-15, maximum=30, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_snr_sizer) _pdu_length_sizer = wx.BoxSizer(wx.VERTICAL) self._pdu_length_text_box = forms.text_box( parent=self.GetWin(), sizer=_pdu_length_sizer, value=self.pdu_length, callback=self.set_pdu_length, label='pdu_length', converter=forms.int_converter(), proportion=0, ) self._pdu_length_slider = forms.slider( parent=self.GetWin(), sizer=_pdu_length_sizer, value=self.pdu_length, callback=self.set_pdu_length, minimum=0, maximum=1500, num_steps=1000, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_pdu_length_sizer) _interval_sizer = wx.BoxSizer(wx.VERTICAL) self._interval_text_box = forms.text_box( parent=self.GetWin(), sizer=_interval_sizer, value=self.interval, callback=self.set_interval, label="PDU Interval (ms)", converter=forms.int_converter(), proportion=0, ) self._interval_slider = forms.slider( parent=self.GetWin(), sizer=_interval_sizer, value=self.interval, callback=self.set_interval, minimum=10, maximum=1000, num_steps=1000, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_interval_sizer) self._encoding_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.encoding, callback=self.set_encoding, label="Encoding", choices=[0, 1, 2, 3, 4, 5, 6, 7, 8], labels=[ "BPSK 1/2", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4", "64QAM 5/6", "256QAM 3/4" ], style=wx.RA_HORIZONTAL, ) self.Add(self._encoding_chooser) self._chan_est_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.chan_est, callback=self.set_chan_est, label='chan_est', choices=[0, 1], labels=["LMS", "Linear Comb"], style=wx.RA_HORIZONTAL, ) self.Add(self._chan_est_chooser) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.GetWin(), title="Scope Plot", sample_rate=12500, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="%", minval=0, maxval=100, factor=1.0, decimal_places=2, ref_level=0, sample_rate=1, number_rate=15, average=True, avg_alpha=0.02, label="Frame Error Rate", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.wifi_phy_hier_ah_0 = wifi_phy_hier_ah( chan_est=chan_est, encoding=encoding, sensitivity=0.56, ) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, True) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac( ([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 500, 0) (self.foo_packet_pad2_0).set_min_output_buffer(96000) self.channels_channel_model_0 = channels.channel_model( noise_voltage=1, frequency_offset=0, epsilon=1.0, taps=(1.0, ), noise_seed=0, block_tags=False) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.float_t, "packet_len") self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( ((10**(snr / 10.0))**.5, )) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("".join("x" for i in range(pdu_length))), interval) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_ah_0, 'mac_in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.wifi_phy_hier_ah_0, 'mac_out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.wifi_phy_hier_ah_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.wifi_phy_hier_ah_0, 0), (self.foo_packet_pad2_0, 0)) self.connect((self.wifi_phy_hier_ah_0, 1), (self.wxgui_scopesink2_0, 0))
def __init__(self, addr, no_usrp, rate, lo_offset, encod, rime, otw, source, no_self_loop, debug_MAC): grc_wxgui.top_block_gui.__init__(self, title="TransceiverSlave") ################################################## # Variables ################################################## self.addr = addr self.no_usrp = no_usrp self.samp_rate = rate self.rime = rime self.otw = otw self.no_self_loop = no_self_loop self.debug_MAC = debug_MAC self.lo_offset = lo_offset ################################################## # Blocks ################################################## if self.no_usrp: self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, self.samp_rate * 1e6, True) ################################ ## Using files instead of USRPs ############################### self.blocks_slaveFileSource = blocks.file_source( gr.sizeof_gr_complex * 1, (os.getcwd() + "/masterFileSink"), True) self.blocks_slaveFileSink = blocks.file_sink( gr.sizeof_gr_complex * 1, (os.getcwd() + "/slaveFileSink"), False) self.blocks_slaveFileSink.set_unbuffered(False) else: ############ ## source ############ self.uhd_usrp_source_0 = uhd.usrp_source( ",".join((self.addr, "")), stream_args=uhd.stream_args( cpu_format="fc32", otw_format=self.otw, channels=range(1), ), ) # TODO Explain the usage self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) ############# ## sink ############# self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join((self.addr, "")), uhd.stream_args( cpu_format="fc32", otw_format=self.otw, channels=range(1), ), "packet_len", ) # TODO Explain the usage self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) # 802.15.4 PHY Layer O-QPSK #self.PHY = ieee802_15_4_phy() # 802.11 a,g,p PHY Layer OFDM # Encoding choices=[0,1,2,3,4,5,6,7]="BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4" self.PHY = wifi_phy_hier(encoding=int(encod), ) # Foo block #TODO explain its usage self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 0, 10000) ## ?! ## (self.foo_packet_pad2_0).set_min_output_buffer(100000) # Multiply Const Block self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (0.38, )) #mult = 0.38 (self.blocks_multiply_const_vxx_0).set_min_output_buffer(100000) # 802.15.4m MAC layer # self.MAC = mac(self.debug_MAC, self.no_self_loop) # 802.11 a,g,p OFDM MAC Layer self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac( ([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) # ofdm_parse_mac block for debugging purpose TODO Modify it so that it parse the frames structure of the MAC am using self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, True) # Communication Layer RIME Stack self.ieee802_15_4_rime_stack_0 = ieee802_15_4.rime_stack( ([129]), ([131]), ([132]), ([23, 42])) # Ethernet Encapsulation #TODO explain its usage self.ieee802_11_ether_encap_0 = ieee802_11.ether_encap(True) ################################################## # Asynch Message Connections ################################################## if self.rime: if source == "tuntap": # Tuntap Block to quantify the achievable throughput self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu("tap0", 440, True) # istunFlag == True: TUN(IP Packet) # == False: TAP(Ethernet Frame) self.msg_connect(self.ieee802_11_ether_encap_0, "to tap", self.blocks_tuntap_pdu_0, "pdus") self.msg_connect(self.blocks_tuntap_pdu_0, "pdus", self.ieee802_11_ether_encap_0, "from tap") self.msg_connect(self.ieee802_15_4_rime_stack_0, "bcout", self.ieee802_11_ether_encap_0, "from wifi") self.msg_connect(self.ieee802_11_ether_encap_0, "to wifi", self.ieee802_15_4_rime_stack_0, "bcin") else: #using PDU Sockets instead #TODO Test ME ! self.blocks_socket_pdu_0_Tx = blocks.socket_pdu( "UDP_SERVER", "localhost", "52004", 10000) self.blocks_socket_pdu_0_Rx = blocks.socket_pdu( "UDP_CLIENT", "localhost", "3333", 10000) self.msg_connect(self.ieee802_15_4_rime_stack_0, "bcout", self.self.blocks_socket_pdu_0_Rx, "pdus") self.msg_connect(self.blocks_socket_pdu_0_Tx, "pdus", self.ieee802_15_4_rime_stack_0, "bcin") self.msg_connect(self.ieee802_15_4_rime_stack_0, "toMAC", self.ieee802_11_ofdm_parse_mac_0, "app in") self.msg_connect(self.ieee802_11_ofdm_parse_mac_0, "app out", self.ieee802_15_4_rime_stack_0, "fromMAC") else: if source == "tuntap": # Tuntap Block to quantify the achievable throughput # istunFlag == True: TUN(IP Packet) # == False: TAP(Ethernet Frame) self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu("tap0", 440, True) self.msg_connect(self.ieee802_11_ether_encap_0, "to tap", self.blocks_tuntap_pdu_0, "pdus") self.msg_connect(self.blocks_tuntap_pdu_0, "pdus", self.ieee802_11_ether_encap_0, "from tap") self.msg_connect(self.ieee802_11_ofdm_mac_0, "app out", self.blocks_tuntap_pdu_0, "pdus") self.msg_connect(self.blocks_tuntap_pdu_0, "pdus", self.ieee802_11_ofdm_mac_0, "app in") #print "Using Tap interface (IP) ==> No ethernet Encapsulation used !!" #self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu("tap0", 440, True) #self.msg_connect(self.ieee802_11_ofdm_mac_0, "app out", self.blocks_tuntap_pdu_0, "pdus") #self.msg_connect(self.blocks_tuntap_pdu_0, "pdus", self.ieee802_11_ofdm_mac_0, "app in") else: ##using PDU Sockets instead #TODO Test ME ! self.blocks_socket_pdu_0_Tx = blocks.socket_pdu( "UDP_SERVER", "localhost", "52004", 10000) self.blocks_socket_pdu_0_Rx = blocks.socket_pdu( "UDP_CLIENT", "localhost", "3333", 10000) self.msg_connect(self.ieee802_11_ofdm_mac_0, "app out", self.blocks_socket_pdu_0_Rx, "pdus") self.msg_connect(self.blocks_socket_pdu_0_Tx, "pdus", self.ieee802_11_ofdm_mac_0, "app in") ## Debugging at the MAC level To parse at the level of MAC ! Look at the flowgraph ##self.msg_connect(self.PHY, "mac_out", self.ieee802_11_ofdm_parse_mac_0, "in") self.msg_connect(self.PHY, "mac_out", self.ieee802_11_ofdm_parse_mac_0, "in") self.msg_connect(self.PHY, "mac_out", self.ieee802_11_ofdm_mac_0, "phy in") self.msg_connect(self.ieee802_11_ofdm_mac_0, "phy out", self.PHY, "mac_in") ################################################## # Connections ################################################## if self.no_usrp: self.connect((self.PHY, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_slaveFileSource, 0), (self.PHY, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_slaveFileSink, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) else: self.connect((self.PHY, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.PHY, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0))
def __init__(self, chan_est=0): gr.top_block.__init__(self, "Wifi Tx Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Tx Rx") 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", "wifi_tx_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.chan_est = chan_est ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 5e5 self.period = period = 10 self.pdu_length = pdu_length = 30 self.out_buf_size = out_buf_size = 96000 self.header_formatter = header_formatter = ieee802_11.wifi_signal_field() self.freq_sin = freq_sin = 1000 self.freq = freq = 943e6 self.encoding = encoding = 0 self.decimation = decimation = 40 ################################################## # Blocks ################################################## self._period_range = Range(1, 10000, 1, 10, 200) self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float) self.top_layout.addWidget(self._period_win) self._pdu_length_range = Range(10, 1500, 1, 30, 200) self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int) self.top_layout.addWidget(self._pdu_length_win) self._encoding_options = (0, 1, 2, ) self._encoding_labels = ("BPSK 1/2" , "BPSK 3/4", "QPSK 1/2", ) self._encoding_tool_bar = Qt.QToolBar(self) self._encoding_tool_bar.addWidget(Qt.QLabel("Encoding"+": ")) self._encoding_combo_box = Qt.QComboBox() self._encoding_tool_bar.addWidget(self._encoding_combo_box) for label in self._encoding_labels: self._encoding_combo_box.addItem(label) self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod(self._encoding_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._encoding_options.index(i))) self._encoding_callback(self.encoding) self._encoding_combo_box.currentIndexChanged.connect( lambda i: self.set_encoding(self._encoding_options[i])) self.top_layout.addWidget(self._encoding_tool_bar) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 32, #size 100, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-1, 110) self.qtgui_time_sink_x_2.set_y_label("Frame error rata", "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(True) self.qtgui_time_sink_x_2.enable_control_panel(False) if not True: self.qtgui_time_sink_x_2.disable_legend() labels = ["Packets Reveiced", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_2_win) (self.qtgui_time_sink_x_2).set_processor_affinity([3]) self.qtgui_time_sink_x_0_0_0_1_0_1 = qtgui.time_sink_c( 2**10, #size samp_rate/1000, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_1_0_1.set_update_time(1) self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_axis(-0.1, 1000) self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_label("Generated Samples", "") self.qtgui_time_sink_x_0_0_0_1_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.001, 5e-3, 0, "FISTOR") self.qtgui_time_sink_x_0_0_0_1_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0_1_0_1.enable_grid(True) self.qtgui_time_sink_x_0_0_0_1_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_1_0_1.disable_legend() labels = ["correlation I", "correlation Q", "correlation_big", "", "", "", "", "", "", ""] 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_0_0_1_0_1.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_1_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_1_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_0_1_win) self.qtgui_number_sink_0 = qtgui.number_sink( gr.sizeof_float, 0.99, qtgui.NUM_GRAPH_HORIZ, 1 ) self.qtgui_number_sink_0.set_update_time(0.0000010) self.qtgui_number_sink_0.set_title("Frame error Rata") labels = ["", "", "", "", "", "", "", "", "", ""] units = ["", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 100) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_0_win) (self.qtgui_number_sink_0).set_processor_affinity([3]) self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_int,1,0) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8192) self.nutaq_rtdex_source_0.set_channels("0") (self.nutaq_rtdex_source_0).set_processor_affinity([1]) self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,1) self.nutaq_rtdex_sink_0.set_type(0) self.nutaq_rtdex_sink_0.set_packet_size(8192) self.nutaq_rtdex_sink_0.set_channels("0") (self.nutaq_rtdex_sink_0).set_processor_affinity([3]) self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0) self.nutaq_radio420_tx_0_0.set_default_enable(1) self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6) self.nutaq_radio420_tx_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_tx_0_0.set_default_calibrate(0) self.nutaq_radio420_tx_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-15) self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5) self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0) self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2) self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1) self.nutaq_radio420_rx_0.set_default_enable(1) self.nutaq_radio420_rx_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0.set_default_reference(0) self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_rx_0.set_default_calibrate(0) self.nutaq_radio420_rx_0.set_default_band(0) self.nutaq_radio420_rx_0.set_default_update_rate(1) self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3) self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3) self.nutaq_radio420_rx_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0.set_default_rx_gain3(3) self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0) self.nutaq_custom_register_0_2 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0_2.set_index(0) self.nutaq_custom_register_0_2.set_default_value(int((4e6)/samp_rate/40*(2**32))) self.nutaq_custom_register_0_2.set_update_rate(1) self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0_1.set_index(2) self.nutaq_custom_register_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0_1.set_index(3) self.nutaq_custom_register_0_0_1.set_default_value(7) self.nutaq_custom_register_0_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0_0.set_index(6) self.nutaq_custom_register_0_0_0.set_default_value(600) self.nutaq_custom_register_0_0_0.set_update_rate(1) self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0.set_index(4) self.nutaq_custom_register_0_0.set_update_rate(1) self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0.set_index(1) self.nutaq_custom_register_0.set_default_value(3) self.nutaq_custom_register_0.set_update_rate(1) self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.101") self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.56, 2, False, False) (self.ieee802_11_ofdm_sync_short_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_sync_short_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False) (self.ieee802_11_ofdm_sync_long_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_sync_long_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) (self.ieee802_11_ofdm_parse_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_parse_mac_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_mapper_0 = ieee802_11.ofdm_mapper(encoding, False) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255])) (self.ieee802_11_ofdm_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_mac_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False) (self.ieee802_11_ofdm_equalize_symbols_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_equalize_symbols_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False) (self.ieee802_11_ofdm_decode_signal_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_decode_signal_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False) (self.ieee802_11_ofdm_decode_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_decode_mac_0).set_min_output_buffer(96000) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16) (self.ieee802_11_moving_average_xx_1).set_processor_affinity([3]) (self.ieee802_11_moving_average_xx_1).set_min_output_buffer(96000) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size) (self.ieee802_11_moving_average_xx_0).set_processor_affinity([3]) (self.ieee802_11_moving_average_xx_0).set_min_output_buffer(96000) self.ieee802_11_chunks_to_symbols_xx_0 = ieee802_11.chunks_to_symbols() (self.ieee802_11_chunks_to_symbols_xx_0).set_min_output_buffer(96000) self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200) self._freq_sin_win = RangeWidget(self._freq_sin_range, self.set_freq_sin, "freq_sin", "counter_slider", float) self.top_layout.addWidget(self._freq_sin_win) self.foo_packet_pad2_0_0 = foo.packet_pad2(False, False, 0.0001, 100000, 100000) (self.foo_packet_pad2_0_0).set_processor_affinity([3]) (self.foo_packet_pad2_0_0).set_min_output_buffer(262144) self.fft_vxx_0_0 = fft.fft_vcc(64, False, (tuple([1/52**.5] * 64)), True, 1) (self.fft_vxx_0_0).set_min_output_buffer(96000) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) (self.fft_vxx_0).set_processor_affinity([3]) (self.fft_vxx_0).set_min_output_buffer(96000) self.digital_packet_headergenerator_bb_0 = digital.packet_headergenerator_bb(header_formatter.formatter(), "packet_len") self.digital_ofdm_cyclic_prefixer_0_0 = digital.ofdm_cyclic_prefixer(64, 64+16, 2, "packet_len") (self.digital_ofdm_cyclic_prefixer_0_0).set_min_output_buffer(96000) self.digital_ofdm_carrier_allocator_cvc_0_0_0 = digital.ofdm_carrier_allocator_cvc(64, (range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27),), ((-21, -7, 7, 21), ), ((1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1)), ((0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746-1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746+1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0, 0j, 0, 0j, 0, 0j, -1, 1j, -1, 1j, -1, 1j, -1, -1j, 1, 1j, 1, -1j, -1, 1j, 1, 1j, 1, 1j, 1, 1j, -1, (-0-1j), 1, -1j, -1, 1j, 0, -1j, 1, (-0-1j), 1, -1j, 1, 1j, -1, -1j, 1, (-0-1j), -1, 1j, 1, 1j, 1, 1j, 1, 1j, -1, -1j, 1, 1j, 1, -1j, -1, 0j, 0, 0j, 0, 0j), (0, 0, 0, 0, 0, 0, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 0, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 0, 0, 0, 0, 0)), "packet_len") (self.digital_ofdm_carrier_allocator_cvc_0_0_0).set_min_output_buffer(96000) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([-1, 1]), 1) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(gr.sizeof_gr_complex*1, "packet_len", 1) (self.blocks_tagged_stream_mux_0).set_min_output_buffer(96000) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) (self.blocks_stream_to_vector_0).set_processor_affinity([3]) (self.blocks_stream_to_vector_0).set_min_output_buffer(96000) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") (self.blocks_pdu_to_tagged_stream_0).set_processor_affinity([3]) (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(96000) self.blocks_null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_int*1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) (self.blocks_multiply_xx_0).set_processor_affinity([3]) (self.blocks_multiply_xx_0).set_min_output_buffer(96000) self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("".join("x" for i in range(pdu_length)) + "1234"), period) (self.blocks_message_strobe_0_0).set_processor_affinity([3]) (self.blocks_message_strobe_0_0).set_min_output_buffer(96000) self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1) (self.blocks_interleave_0).set_processor_affinity([3]) self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1) (self.blocks_float_to_short_0_0_0).set_processor_affinity([3]) self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1) (self.blocks_float_to_short_0_0).set_processor_affinity([3]) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) (self.blocks_float_to_complex_0).set_processor_affinity([2]) self.blocks_divide_xx_0 = blocks.divide_ff(1) (self.blocks_divide_xx_0).set_processor_affinity([3]) (self.blocks_divide_xx_0).set_min_output_buffer(96000) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) (self.blocks_delay_0_0).set_processor_affinity([3]) (self.blocks_delay_0_0).set_min_output_buffer(96000) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) (self.blocks_delay_0).set_processor_affinity([3]) (self.blocks_delay_0).set_min_output_buffer(96000) self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int*1, 1) (self.blocks_deinterleave_0).set_processor_affinity([1]) (self.blocks_deinterleave_0).set_min_output_buffer(32768) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() (self.blocks_conjugate_cc_0).set_processor_affinity([3]) (self.blocks_conjugate_cc_0).set_min_output_buffer(96000) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) (self.blocks_complex_to_mag_squared_0).set_processor_affinity([3]) (self.blocks_complex_to_mag_squared_0).set_min_output_buffer(96000) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) (self.blocks_complex_to_mag_0).set_processor_affinity([3]) (self.blocks_complex_to_mag_0).set_min_output_buffer(96000) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) (self.blocks_complex_to_float_0).set_processor_affinity([3]) (self.blocks_complex_to_float_0).set_min_output_buffer(16384) self.COWN_syncher2_0 = COWN.syncher2() (self.COWN_syncher2_0).set_processor_affinity([1]) self.COWN_resta_0 = COWN.resta() (self.COWN_resta_0).set_processor_affinity([1]) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.ieee802_11_ofdm_mapper_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.COWN_resta_0, 0), (self.blocks_null_sink_0_0, 0)) self.connect((self.COWN_syncher2_0, 0), (self.blocks_deinterleave_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_deinterleave_0, 3), (self.COWN_resta_0, 0)) self.connect((self.blocks_deinterleave_0, 2), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_deinterleave_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0)) self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1)) self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0), (self.fft_vxx_0_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.foo_packet_pad2_0_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.qtgui_time_sink_x_0_0_0_1_0_1, 0)) self.connect((self.digital_packet_headergenerator_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.fft_vxx_0_0, 0), (self.digital_ofdm_cyclic_prefixer_0_0, 0)) self.connect((self.foo_packet_pad2_0_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.ieee802_11_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_mapper_0, 0), (self.digital_packet_headergenerator_bb_0, 0)) self.connect((self.ieee802_11_ofdm_mapper_0, 0), (self.ieee802_11_chunks_to_symbols_xx_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_null_sink_0_0_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0))
def __init__(self, addr, no_usrp, rate, lo_offset, encod, otw, debug): grc_wxgui.top_block_gui.__init__(self, title="TransceiverMaster") # Variables self.addr = addr self.no_usrp = no_usrp self.samp_rate = rate self.otw = otw self.debug = debug self.lo_offset = lo_offset # Blocks if self.no_usrp: self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, self.samp_rate * 1e6, True) ## Using files instead of USRPs self.blocks_file_source_Master = blocks.file_source( gr.sizeof_gr_complex * 1, (os.getcwd() + "/utils/fileSourceMaster"), True) self.blocks_file_sink_Master = blocks.file_sink( gr.sizeof_gr_complex * 1, (os.getcwd() + "/utils/fileSinkMaster"), False) self.blocks_file_sink_Master.set_unbuffered(False) else: ## usrp_source self.uhd_usrp_source_0 = uhd.usrp_source( ",".join((self.addr, "")), uhd.stream_args( cpu_format="fc32", otw_format=self.otw, channels=range(1), ), ) self.uhd_usrp_source_0.set_time_now(uhd.time_spec( time.time()), uhd.ALL_MBOARDS) # TODO Explain the usage ## usrp_sink self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join((self.addr, "")), uhd.stream_args( cpu_format="fc32", otw_format=self.otw, channels=range(1), ), "packet_len", ) # 802.11 a,g,p PHY Layer OFDM # Encoding choices=[0,1,2,3,4,5,6,7]="BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4" self.PHY = wifi_phy_hier(encoding=int(encod), ) self.foo_packet_pad2_0 = foo.packet_pad2( False, False, 0.001, 0, 10000) #TODO explain its usage (self.foo_packet_pad2_0).set_min_output_buffer(100000) # Multiply Const Block self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.38, )) (self.blocks_multiply_const_vxx_0).set_min_output_buffer(100000) # 802.11 a,g,p OFDM MAC Layer self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac( ([0x33, 0x33, 0x33, 0x33, 0x33, 0x33]), ([0x32, 0x32, 0x32, 0x32, 0x32, 0x32]), ([0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc]), self.debug, True) # ofdm_parse_mac block for debugging purpose self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, False) #TODO make it parse frames' structure of the MAC am using # Ethernet Encapsulation #TODO explain its usage self.ieee802_11_ether_encap_0 = ieee802_11.ether_encap(True) # Asynch Message Connections self.blocks_socket_pdu_0_Tx = blocks.socket_pdu( "UDP_SERVER", "localhost", "52002", 10000) self.blocks_socket_pdu_0_Rx = blocks.socket_pdu( "UDP_CLIENT", "localhost", "3334", 10000) self.msg_connect(self.ieee802_11_ofdm_mac_0, "app out", self.blocks_socket_pdu_0_Rx, "pdus") self.msg_connect(self.blocks_socket_pdu_0_Tx, "pdus", self.ieee802_11_ofdm_mac_0, "app in") self.msg_connect(self.PHY, "mac_out", self.ieee802_11_ofdm_parse_mac_0, "in") self.msg_connect(self.PHY, "mac_out", self.ieee802_11_ofdm_mac_0, "phy in") self.msg_connect(self.ieee802_11_ofdm_mac_0, "phy out", self.PHY, "mac_in") # Connections if self.no_usrp: self.connect((self.PHY, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_file_source_Master, 0), (self.PHY, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_file_sink_Master, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) else: self.connect((self.PHY, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.PHY, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) if not self.lo_offset: self.lo_offset = self.samp_rate / 2.0 print "LO offset set to", self.lo_offset / 1e6, "MHz"
def __init__(self): gr.top_block.__init__(self, "Wifi Rx Jun28") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx Jun28") 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", "wifi_rx_jun28") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 0.5e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 943000000.0 self.decimation = decimation = 40 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## self._samp_rate_options = [0.5e6, 1e6, 5e6, 10e6, 20e6] self._samp_rate_labels = [ "500 KHz", "1 MHz", "5 MHz", "10 MHz", "20 MHz" ] self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("Sample Rate" + ": ")) self._samp_rate_combo_box = Qt.QComboBox() self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box) for label in self._samp_rate_labels: self._samp_rate_combo_box.addItem(label) self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod( self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i))) self._samp_rate_callback(self.samp_rate) self._samp_rate_combo_box.currentIndexChanged.connect( lambda i: self.set_samp_rate(self._samp_rate_options[i])) self.top_layout.addWidget(self._samp_rate_tool_bar) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 32, #size 10, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-1, 110) self.qtgui_time_sink_x_2.set_y_label("Amplitude", "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(True) self.qtgui_time_sink_x_2.enable_control_panel(False) if not True: self.qtgui_time_sink_x_2.disable_legend() labels = ["Packets Reveiced", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance( self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_2_win) self.qtgui_time_sink_x_0_0_0_0 = qtgui.time_sink_c( 2**17, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0_0.set_y_axis(-2, 2) self.qtgui_time_sink_x_0_0_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_0.set_trigger_mode( qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.02, 0.1, 0, "ofdm_start") self.qtgui_time_sink_x_0_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_0.disable_legend() labels = [ "samples", "corr", "correlation_big", "", "", "", "", "", "", "" ] 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_0_0_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( 2**17, #size samp_rate, #samp_rate "", #name 1 #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(-0.1, 1000) self.qtgui_time_sink_x_0_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, threshold, 5e-3, 0, "FISTOR") self.qtgui_time_sink_x_0_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0.disable_legend() labels = [ "correlation I", "correlation Q", "correlation_big", "", "", "", "", "", "", "" ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_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_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0.99, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.0000010) self.qtgui_number_sink_0.set_title("Frame error Rata") labels = ["", "", "", "", "", "", "", "", "", ""] units = ["", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 100) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_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_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) self.ofdm_80211_ftc_0 = ofdm_80211.ftc() self.nutaq_rtdex_source_0 = nutaq.rtdex_source( "nutaq_carrier_perseus_0", gr.sizeof_float, 1, 3) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8192) self.nutaq_rtdex_source_0.set_channels("2") self.nutaq_radio420_tx_0_0_0 = nutaq.radio420_tx( "nutaq_carrier_perseus_0", 2, 2) self.nutaq_radio420_tx_0_0_0.set_default_enable(0) self.nutaq_radio420_tx_0_0_0.set_default_tx_freq(743e6) self.nutaq_radio420_tx_0_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_tx_0_0_0.set_default_calibrate(1) self.nutaq_radio420_tx_0_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0_0.set_default_tx_vga1_gain(-10) self.nutaq_radio420_tx_0_0_0.set_default_tx_vga2_gain(15) self.nutaq_radio420_tx_0_0_0.set_default_tx_gain3(3) self.nutaq_radio420_tx_0_0_0.set_default_tx_lpf_bandwidth(6) self.nutaq_radio420_tx_0_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx( "nutaq_carrier_perseus_0", 1, 0) self.nutaq_radio420_tx_0_0.set_default_enable(0) self.nutaq_radio420_tx_0_0.set_default_tx_freq(743e6) self.nutaq_radio420_tx_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_tx_0_0.set_default_calibrate(1) self.nutaq_radio420_tx_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10) self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15) self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3) self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6) self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx( "nutaq_carrier_perseus_0", 2, 3) self.nutaq_radio420_rx_0_0.set_default_enable(1) self.nutaq_radio420_rx_0_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0_0.set_default_reference(0) self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_rx_0_0.set_default_calibrate(1) self.nutaq_radio420_rx_0_0.set_default_band(0) self.nutaq_radio420_rx_0_0.set_default_update_rate(1) self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(3) self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(3) self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0_0.set_default_rx_gain3(8) self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1) self.nutaq_radio420_rx_0.set_default_enable(0) self.nutaq_radio420_rx_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0.set_default_reference(0) self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_rx_0.set_default_calibrate(1) self.nutaq_radio420_rx_0.set_default_band(0) self.nutaq_radio420_rx_0.set_default_update_rate(1) self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2) self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1) self.nutaq_radio420_rx_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0.set_default_rx_gain3(3) self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0) self.nutaq_custom_register_0_2 = nutaq.custom_register( "nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0_2.set_index(0) self.nutaq_custom_register_0_2.set_default_value( int((4e6) / samp_rate / 40 * (2**32))) self.nutaq_custom_register_0_2.set_update_rate(1) self.nutaq_custom_register_0_1 = nutaq.custom_register( "nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0_1.set_index(2) self.nutaq_custom_register_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_1 = nutaq.custom_register( "nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0_1.set_index(3) self.nutaq_custom_register_0_0_1.set_default_value(7) self.nutaq_custom_register_0_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_0 = nutaq.custom_register( "nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0_0.set_index(6) self.nutaq_custom_register_0_0_0.set_default_value(600) self.nutaq_custom_register_0_0_0.set_update_rate(1) self.nutaq_custom_register_0_0 = nutaq.custom_register( "nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0.set_index(4) self.nutaq_custom_register_0_0.set_update_rate(1) self.nutaq_custom_register_0 = nutaq.custom_register( "nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0.set_index(1) self.nutaq_custom_register_0.set_default_value(3) self.nutaq_custom_register_0.set_update_rate(1) self.nutaq_carrier_perseus_0 = nutaq.carrier( 0, "nutaq_carrier_perseus_0", "192.168.0.101") self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long( sync_length, False, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, False) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols( ieee802_11.LMS, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal( False, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac( False, False) self._gain_range = Range(0, 100, 1, 20, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "slider") self.top_layout.addWidget(self._gain_win) self._freq_options = [ 943000000.0, 2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0 ] self._freq_labels = [ ' 0 | 943.0 | ??', ' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p' ] self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("Channel" + ": ")) self._freq_combo_box = Qt.QComboBox() self._freq_tool_bar.addWidget(self._freq_combo_box) for label in self._freq_labels: self._freq_combo_box.addItem(label) self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod( self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i))) self._freq_callback(self.freq) self._freq_combo_box.currentIndexChanged.connect( lambda i: self.set_freq(self._freq_options[i])) self.top_layout.addWidget(self._freq_tool_bar) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.float_t, "packet_len") self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.carajito, 0), (self.qtgui_time_sink_x_0_0_0_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.nutaq_rtdex_source_0, 0), (self.ofdm_80211_ftc_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1_0_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.qtgui_time_sink_x_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Traffic Monitor") ################################################## # Variables ################################################## self.tx_gain = tx_gain = 90 self.samp_rate = samp_rate = 2 * 10e5 self.rx_gain = rx_gain = 50 self.mult = mult = 0.38 self.lo_offset = lo_offset = 0 self.freq = freq = 5.89e9 self.encoding = encoding = 0 ################################################## # Blocks ################################################## self.wifi_phy_hier_0 = wifi_phy_hier(encoding=0, ) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(freq - lo_offset, lo_offset), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), "packet_len", ) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq( uhd.tune_request(freq - lo_offset, lo_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, True) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac( ([0x30, 0x30, 0x30, 0x30, 0x30, 0x30]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 0, 10000) (self.foo_packet_pad2_0).set_min_output_buffer(100000) # self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((mult, )) (self.blocks_multiply_const_vxx_0).set_min_output_buffer(100000) #self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern(" Laptop3 "), 100) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, "/tmp/ofdm.pcap", True) self.blocks_file_sink_0.set_unbuffered(True) #Add by Xuepeng Xu self.controller = Controller(self) self.transmitter = DsrcServer(controller=self.controller) #self.message_generator = message_generator() #self.message_collector = message_collector() ################################################## # Connections ################################################## self.msg_connect(self.transmitter, 'received out', self.ieee802_11_ofdm_mac_0, 'app in') #self.msg_connect((self.transmitter,'received out'), (self.blocks_message_strobe_0, 'set_msg')) #self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect(self.ieee802_11_ofdm_mac_0, 'app out', self.transmitter, 'send in') #self.msg_connect((self.ieee802_11_ofdm_mac_0, 'app out'),(self.message_collector, 'message_stream in')) #self.msg_connect((self.message_collector,'message_to_collect out'),(self.transmitter,'send in')) self.msg_connect(self.ieee802_11_ofdm_mac_0, 'phy out', self.foo_wireshark_connector_0, 'in') self.msg_connect(self.ieee802_11_ofdm_mac_0, 'phy out', self.wifi_phy_hier_0, 'mac_in') self.msg_connect(self.wifi_phy_hier_0, 'mac_out', self.foo_wireshark_connector_0, 'in') self.msg_connect(self.wifi_phy_hier_0, 'mac_out', self.ieee802_11_ofdm_mac_0, 'phy in') self.msg_connect(self.wifi_phy_hier_0, 'mac_out', self.ieee802_11_ofdm_parse_mac_0, 'in') self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.blocks_multiply_const_vxx_0, 0)) #self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_sink_0, 0)) self.controller.start()
def __init__(self): gr.top_block.__init__(self, "Wifi Loopback") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Loopback") 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", "wifi_loopback") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.snr = snr = 36 self.samp_rate = samp_rate = 1e6 self.pdu_length = pdu_length = 500 self.out_buf_size = out_buf_size = 96000 self.noise_var = noise_var = -150 self.interval = interval = 100 self.freq_offset = freq_offset = 0 self.encoding = encoding = 0 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._snr_range = Range(-15, 50, 1, 36, 200) self._snr_win = RangeWidget(self._snr_range, self.set_snr, "snr", "counter_slider") self.top_layout.addWidget(self._snr_win) self._noise_var_range = Range(-180, -40, 5, -150, 200) self._noise_var_win = RangeWidget(self._noise_var_range, self.set_noise_var, "noise_var", "counter_slider") self.top_layout.addWidget(self._noise_var_win) self._encoding_options = [0, 1, 2, 3, 4, 5, 6, 7] self._encoding_labels = [ "BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4", ] self._encoding_group_box = Qt.QGroupBox("encoding") self._encoding_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._encoding_button_group = variable_chooser_button_group() self._encoding_group_box.setLayout(self._encoding_box) for i, label in enumerate(self._encoding_labels): radio_button = Qt.QRadioButton(label) self._encoding_box.addWidget(radio_button) self._encoding_button_group.addButton(radio_button, i) self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod( self._encoding_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._encoding_options.index(i)) ) self._encoding_callback(self.encoding) self._encoding_button_group.buttonClicked[int].connect(lambda i: self.set_encoding(self._encoding_options[i])) self.top_layout.addWidget(self._encoding_group_box) self._chan_est_options = [0, 1] self._chan_est_labels = ["LMS", "Linear Comb"] self._chan_est_group_box = Qt.QGroupBox("chan_est") self._chan_est_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._chan_est_button_group = variable_chooser_button_group() self._chan_est_group_box.setLayout(self._chan_est_box) for i, label in enumerate(self._chan_est_labels): radio_button = Qt.QRadioButton(label) self._chan_est_box.addWidget(radio_button) self._chan_est_button_group.addButton(radio_button, i) self._chan_est_callback = lambda i: Qt.QMetaObject.invokeMethod( self._chan_est_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._chan_est_options.index(i)) ) self._chan_est_callback(self.chan_est) self._chan_est_button_group.buttonClicked[int].connect(lambda i: self.set_chan_est(self._chan_est_options[i])) self.top_layout.addWidget(self._chan_est_group_box) self.wifi_phy_hier_0 = wifi_phy_hier(encoding=encoding, chan_est=chan_est) self.sync_long = ieee802_11.ofdm_sync_long(sync_length, False, False) self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 2 ** 14, samp_rate, "", 1 # size # samp_rate # name # number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label("My own sycn short", "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.05, 0, 0, "ofdm_start") self.qtgui_time_sink_x_1.enable_autoscale(True) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2 * 1): if len(labels[i]) == 0: if i % 2 == 0: self.qtgui_time_sink_x_1.set_line_label(i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_1.set_line_label(i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 2 ** 15, samp_rate, "", 3 # size # samp_rate # name # number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-0.01, 0.4) 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_NORM, qtgui.TRIG_SLOPE_POS, 0.15, 2e-3, 2, "FISTOR") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["samples", "corr", "correlation_big", "", "", "", "", "", "", ""] 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(3): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("nuber sync") labels = ["", "", "", "", "", "", "", "", "", ""] units = ["", "", "", "", "", "", "", "", "", ""] colors = [ ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, -1) self.qtgui_number_sink_0.set_max(i, 1) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_0_win) self._pdu_length_range = Range(0, 1500, 1, 500, 200) self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider") self.top_layout.addWidget(self._pdu_length_win) self.marica = ofdm_80211.short_match_filter(160, 16) self._interval_range = Range(10, 10000, 1, 100, 200) self._interval_win = RangeWidget(self._interval_range, self.set_interval, "interval", "counter_slider") self.top_layout.addWidget(self._interval_win) self.ieee802_11_ofdm_parse_mac_0_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, False) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac( ([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]), ) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False) self._freq_offset_range = Range(-0.10, 0.1, 0.0001, 0, 200) self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, "freq_offset", "slider") self.top_layout.addWidget(self._freq_offset_win) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 500, 0) (self.foo_packet_pad2_0).set_min_output_buffer(96000) self.fft_vxx_0_1 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.carajito = ofdm_80211.ofdm_sync_short(0.05, 2, False, False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate / 2, True) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex * 1, 64) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex * 1) self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_null_sink_0_1_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vff((4e9 * 10 ** ((36 - snr) / 10.0),)) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((9e9,)) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((10 ** ((snr + noise_var) / 20.0) + 1,)) self.blocks_message_strobe_1_0 = blocks.message_strobe( pmt.intern( "HOLAabcd123456aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234" ), 1000, ) self.blocks_delay_0_1 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_complex_to_mag_squared_0_1_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_squared_0_1 = blocks.complex_to_mag_squared(1) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_1_0, "strobe"), (self.ieee802_11_ofdm_mac_0, "app in")) self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, "out"), (self.ieee802_11_ofdm_parse_mac_0_0, "in")) self.msg_connect((self.ieee802_11_ofdm_mac_0, "phy out"), (self.wifi_phy_hier_0, "mac_in")) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0_0, "fer"), (self.blocks_pdu_to_tagged_stream_0_0, "pdus")) self.msg_connect((self.wifi_phy_hier_0, "mac_out"), (self.ieee802_11_ofdm_parse_mac_0, "in")) self.connect((self.blocks_complex_to_mag_squared_0_1, 0), (self.blocks_multiply_const_vxx_0_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_1_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_delay_0_1, 0), (self.sync_long, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.marica, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_null_source_0, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0_1, 0)) self.connect((self.carajito, 0), (self.blocks_null_sink_0_1_0_0, 0)) self.connect((self.carajito, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.carajito, 0), (self.sync_long, 0)) self.connect((self.fft_vxx_0_1, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.marica, 1), (self.blocks_complex_to_mag_squared_0_1, 0)) self.connect((self.marica, 0), (self.blocks_complex_to_mag_squared_0_1_0, 0)) self.connect((self.marica, 2), (self.blocks_null_sink_0_1_0, 0)) self.connect((self.marica, 1), (self.carajito, 1)) self.connect((self.marica, 3), (self.carajito, 2)) self.connect((self.marica, 0), (self.carajito, 0)) self.connect((self.marica, 3), (self.qtgui_time_sink_x_0, 2)) self.connect((self.sync_long, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_sink_0_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.foo_packet_pad2_0, 0))
def __init__(self, options, hostname, msgq): grc_wxgui.top_block_gui.__init__(self, title="Wifi Rx") #_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" #self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 20e6 self.lo_offset = lo_offset = 0e6 self.gain = gain = 20 self.freq = freq = 5.87e9 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._samp_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.samp_rate, callback=self.set_samp_rate, label="Sample Rate", choices=[5e6, 10e6, 20e6], labels=["5 MHz", "10 MHz", "20 MHz"], style=wx.RA_HORIZONTAL, ) self.Add(self._samp_rate_chooser) self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation") self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation") self.Add(self.nb) self._lo_offset_chooser = forms.drop_down( parent=self.GetWin(), value=self.lo_offset, callback=self.set_lo_offset, label="LO Offset", choices=[0, 6e6, 11e6], labels=['0 MHz', '6 MHz', '11 MHz'], ) self.Add(self._lo_offset_chooser) _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='gain', converter=forms.int_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_gain_sizer) self._freq_chooser = forms.drop_down( parent=self.GetWin(), value=self.freq, callback=self.set_freq, label="Channel", choices=[ 2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0 ], labels=[ ' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p' ], ) self.Add(self._freq_chooser) self._chan_est_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.chan_est, callback=self.set_chan_est, label='chan_est', choices=[0, 1], labels=["LMS", "Linear Comb"], style=wx.RA_HORIZONTAL, ) self.Add(self._chan_est_chooser) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.nb.GetPage(1).GetWin(), title="Scope Plot", sample_rate=samp_rate, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win) self.wxgui_scopesink1 = scopesink2.scope_sink_c( self.nb.GetPage(0).GetWin(), title="Scope Plot", sample_rate=12500, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.nb.GetPage(0).Add(self.wxgui_scopesink1.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="%", minval=0, maxval=100, factor=1.0, decimal_places=2, ref_level=0, sample_rate=1, number_rate=15, average=True, avg_alpha=0.02, label="Frame Error Rate", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(freq, rf_freq=freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short( 0.56, 2, False, False) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long( sync_length, True, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, True) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols( chan_est, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal( False, False, True) #######Added 3rd argument self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac( True, False) ### _reg self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff( window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc( window_size) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 48) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) ##self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_SERVER", "", "52001", 10000, False) ##self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") ##The following block is newly added self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_CLIENT", hostname, str(options.PHYRXport), 10000) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.msg_sink = blocks.message_sink(4, msgq, True) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) ##self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) ##The following connection is newly added ###self.msg_connect(self.ieee802_11_ofdm_parse_mac_0, "fer", self.blocks_socket_pdu_0, "pdus") self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.blocks_socket_pdu_0, "pdus")) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2)) self.connect((self.blocks_divide_xx_0, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) #self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.wxgui_scopesink1, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1)) ##new added connection self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.msg_sink)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx Oct 28") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx Oct 28") 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", "wifi_rx_oct_28") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 0.25e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 943000000.0 self.decimation = decimation = 40 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## self._samp_rate_options = [0.25e6, 1e6, 5e6, 10e6, 20e6] self._samp_rate_labels = ["500 KHz", "1 MHz", "5 MHz", "10 MHz", "20 MHz"] self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("Sample Rate" + ": ")) self._samp_rate_combo_box = Qt.QComboBox() self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box) for label in self._samp_rate_labels: self._samp_rate_combo_box.addItem(label) self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod( self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i)) ) self._samp_rate_callback(self.samp_rate) self._samp_rate_combo_box.currentIndexChanged.connect(lambda i: self.set_samp_rate(self._samp_rate_options[i])) self.top_layout.addWidget(self._samp_rate_tool_bar) self.qtgui_time_sink_x_0_0_0_1 = qtgui.time_sink_c( 2 ** 13, samp_rate, "", 1 # size # samp_rate # name # number of inputs ) self.qtgui_time_sink_x_0_0_0_1.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0_1.set_y_axis(-0.8, 0.8) self.qtgui_time_sink_x_0_0_0_1.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_1.set_trigger_mode( qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, threshold, 0.25e-3, 0, "BAD TAG" ) self.qtgui_time_sink_x_0_0_0_1.enable_autoscale(False) self.qtgui_time_sink_x_0_0_0_1.enable_grid(True) self.qtgui_time_sink_x_0_0_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_1.disable_legend() labels = ["I", "Q", "correlation_big", "", "", "", "", "", "", ""] 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, 1, 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_0_0_1.set_line_label(i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) self.ofdm_80211_adc_tags_gen_0 = ofdm_80211.adc_tags_gen() self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0", gr.sizeof_float, 1, 0) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8192) self.nutaq_rtdex_source_0.set_channels("0") (self.nutaq_rtdex_source_0).set_min_output_buffer(16384) (self.nutaq_rtdex_source_0).set_max_output_buffer(32768) self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0", gr.sizeof_short, 1, 1) self.nutaq_rtdex_sink_0.set_type(0) self.nutaq_rtdex_sink_0.set_packet_size(8192) self.nutaq_rtdex_sink_0.set_channels("0") self.nutaq_radio420_tx_0_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 2, 2) self.nutaq_radio420_tx_0_0_0.set_default_enable(0) self.nutaq_radio420_tx_0_0_0.set_default_tx_freq(943e6) self.nutaq_radio420_tx_0_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_tx_0_0_0.set_default_calibrate(1) self.nutaq_radio420_tx_0_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0_0.set_default_tx_vga1_gain(-10) self.nutaq_radio420_tx_0_0_0.set_default_tx_vga2_gain(15) self.nutaq_radio420_tx_0_0_0.set_default_tx_gain3(3) self.nutaq_radio420_tx_0_0_0.set_default_tx_lpf_bandwidth(6) self.nutaq_radio420_tx_0_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0) self.nutaq_radio420_tx_0_0.set_default_enable(1) self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6) self.nutaq_radio420_tx_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_tx_0_0.set_default_calibrate(0) self.nutaq_radio420_tx_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10) self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15) self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3) self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6) self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 2, 3) self.nutaq_radio420_rx_0_0.set_default_enable(1) self.nutaq_radio420_rx_0_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0_0.set_default_reference(0) self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_rx_0_0.set_default_calibrate(1) self.nutaq_radio420_rx_0_0.set_default_band(0) self.nutaq_radio420_rx_0_0.set_default_update_rate(1) self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(3) self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(3) self.nutaq_radio420_rx_0_0.set_default_rx_gain2(4) self.nutaq_radio420_rx_0_0.set_default_rx_gain3(8) self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1) self.nutaq_radio420_rx_0.set_default_enable(0) self.nutaq_radio420_rx_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0.set_default_reference(0) self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_rx_0.set_default_calibrate(1) self.nutaq_radio420_rx_0.set_default_band(0) self.nutaq_radio420_rx_0.set_default_update_rate(1) self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2) self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1) self.nutaq_radio420_rx_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0.set_default_rx_gain3(3) self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0) self.nutaq_custom_register_0_2 = nutaq.custom_register("nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0_2.set_index(0) self.nutaq_custom_register_0_2.set_default_value(int((4e6) / samp_rate / 40 * (2 ** 32))) self.nutaq_custom_register_0_2.set_update_rate(1) self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0_1.set_index(2) self.nutaq_custom_register_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0_1.set_index(3) self.nutaq_custom_register_0_0_1.set_default_value(7) self.nutaq_custom_register_0_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0_0.set_index(6) self.nutaq_custom_register_0_0_0.set_default_value(600) self.nutaq_custom_register_0_0_0.set_update_rate(1) self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0.set_index(4) self.nutaq_custom_register_0_0.set_update_rate(1) self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0.set_index(1) self.nutaq_custom_register_0.set_default_value(3) self.nutaq_custom_register_0.set_update_rate(1) self.nutaq_carrier_perseus_0 = nutaq.carrier(0, "nutaq_carrier_perseus_0", "192.168.0.102") self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(ieee802_11.LMS, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, True) self._gain_range = Range(0, 100, 1, 20, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "slider") self.top_layout.addWidget(self._gain_win) self._freq_options = [ 943000000.0, 2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0, ] self._freq_labels = [ " 0 | 943.0 | ??", " 1 | 2412.0 | 11g", " 2 | 2417.0 | 11g", " 3 | 2422.0 | 11g", " 4 | 2427.0 | 11g", " 5 | 2432.0 | 11g", " 6 | 2437.0 | 11g", " 7 | 2442.0 | 11g", " 8 | 2447.0 | 11g", " 9 | 2452.0 | 11g", " 10 | 2457.0 | 11g", " 11 | 2462.0 | 11g", " 12 | 2467.0 | 11g", " 13 | 2472.0 | 11g", " 14 | 2484.0 | 11g", " 34 | 5170.0 | 11a", " 36 | 5180.0 | 11a", " 38 | 5190.0 | 11a", " 40 | 5200.0 | 11a", " 42 | 5210.0 | 11a", " 44 | 5220.0 | 11a", " 46 | 5230.0 | 11a", " 48 | 5240.0 | 11a", " 52 | 5260.0 | 11a", " 56 | 5280.0 | 11a", " 58 | 5300.0 | 11a", " 60 | 5320.0 | 11a", "100 | 5500.0 | 11a", "104 | 5520.0 | 11a", "108 | 5540.0 | 11a", "112 | 5560.0 | 11a", "116 | 5580.0 | 11a", "120 | 5600.0 | 11a", "124 | 5620.0 | 11a", "128 | 5640.0 | 11a", "132 | 5660.0 | 11a", "136 | 5680.0 | 11a", "140 | 5700.0 | 11a", "149 | 5745.0 | 11a", "153 | 5765.0 | 11a", "157 | 5785.0 | 11a", "161 | 5805.0 | 11a", "165 | 5825.0 | 11a", "172 | 5860.0 | 11p", "174 | 5870.0 | 11p", "176 | 5880.0 | 11p", "178 | 5890.0 | 11p", "180 | 5900.0 | 11p", "182 | 5910.0 | 11p", "184 | 5920.0 | 11p", ] self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("Channel" + ": ")) self._freq_combo_box = Qt.QComboBox() self._freq_tool_bar.addWidget(self._freq_combo_box) for label in self._freq_labels: self._freq_combo_box.addItem(label) self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod( self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i)) ) self._freq_callback(self.freq) self._freq_combo_box.currentIndexChanged.connect(lambda i: self.set_freq(self._freq_options[i])) self.top_layout.addWidget(self._freq_tool_bar) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex * 1, 64) self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1) self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2 ** 11 - 1) self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2 ** 11 - 1) self.blocks_file_source_0_0 = blocks.file_source( gr.sizeof_gr_complex * 1, "/home/juan/transmiter/waveforms/fmcw_chirp_80pc.bin", True ) self.blocks_delay_2 = blocks.delay(gr.sizeof_float * 1, 1) (self.blocks_delay_2).set_min_output_buffer(16384) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) (self.blocks_complex_to_float_0).set_min_output_buffer(8192) (self.blocks_complex_to_float_0).set_max_output_buffer(8192) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, "out"), (self.ieee802_11_ofdm_parse_mac_0, "in")) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_delay_2, 0), (self.ofdm_80211_adc_tags_gen_0, 0)) self.connect((self.blocks_file_source_0_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0)) self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1)) self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.nutaq_rtdex_source_0, 0), (self.blocks_delay_2, 0)) self.connect((self.ofdm_80211_adc_tags_gen_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1_0_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2)) self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.qtgui_time_sink_x_0_0_0_1, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Rx") ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 20e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 2.412e9 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._samp_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.samp_rate, callback=self.set_samp_rate, label="Sample Rate", choices=[5e6, 10e6, 20e6], labels=["5 MHz", "10 MHz", "20 MHz"], style=wx.RA_HORIZONTAL, ) self.Add(self._samp_rate_chooser) self._lo_offset_chooser = forms.drop_down( parent=self.GetWin(), value=self.lo_offset, callback=self.set_lo_offset, label="LO Offset", choices=[0, 6e6, 11e6], labels=['0 MHz', '6 MHz', '11 MHz'], ) self.Add(self._lo_offset_chooser) _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='gain', converter=forms.int_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_gain_sizer) self._freq_chooser = forms.drop_down( parent=self.GetWin(), value=self.freq, callback=self.set_freq, label="Channel", choices=[2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0], labels=[' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p'], ) self.Add(self._freq_chooser) self._chan_est_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.chan_est, callback=self.set_chan_est, label='chan_est', choices=[0, 1], labels=["LMS", "Linear Comb"], style=wx.RA_HORIZONTAL, ) self.Add(self._chan_est_chooser) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(freq, rf_freq = freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation") self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation") self.Add(self.nb) self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.56, 2, False, False) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, False) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/ofdm.pcap", True) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self, addr, no_usrp, rate, lo_offset, encod, otw, source, no_self_loop, debug_MAC): grc_wxgui.top_block_gui.__init__(self, title="TransceiverSlave") #FIXME how to get rid of the gui ################################################## # Variables ################################################## self.addr = addr self.no_usrp = no_usrp self.samp_rate = rate self.otw = otw self.no_self_loop = no_self_loop self.debug_MAC = debug_MAC self.lo_offset = lo_offset ################################################## # Blocks ################################################## if self.no_usrp: self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, self.samp_rate*1e6,True) ################################ ## Using files instead of USRPs ############################### self.blocks_slaveFileSource = blocks.file_source(gr.sizeof_gr_complex*1, (os.getcwd()+"/utils/fileSinkMaster"), True) self.blocks_slaveFileSink = blocks.file_sink(gr.sizeof_gr_complex*1, (os.getcwd()+"/utils/fileSinkSlave"), False) self.blocks_slaveFileSink.set_unbuffered(False) else: ############ ## source ############ self.uhd_usrp_source_0 = uhd.usrp_source(",".join((self.addr, "")), uhd.stream_args(cpu_format="fc32", otw_format=self.otw, channels=range(1),),) # TODO Explain the usage self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) ############# ## sink ############# self.uhd_usrp_sink_0 = uhd.usrp_sink(",".join((self.addr, "")), uhd.stream_args(cpu_format="fc32", otw_format=self.otw, channels=range(1),),"packet_len",) # TODO Explain the usage self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) # 802.11 a,g,p PHY Layer OFDM # Encoding choices=[0,1,2,3,4,5,6,7]="BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4" print "Encoding Used: ", int(encod) #FIXME add the equivalent scheme self.PHY = wifi_phy_hier( encoding=int(encod), ) # Foo block #TODO explain its usage self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 0, 10000) ## ?! ## (self.foo_packet_pad2_0).set_min_output_buffer(100000) # Multiply Const Block self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.38, )) #mult = 0.38 (self.blocks_multiply_const_vxx_0).set_min_output_buffer(100000) # 802.11 a,g,p OFDM MAC Layer self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x43, 0x43, 0x43, 0x43, 0x43, 0x43]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) # ofdm_parse_mac block for debugging purpose self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, False) # Ethernet Encapsulation #TODO explain its usage self.ieee802_11_ether_encap_0 = ieee802_11.ether_encap(True) # /////////////////////////////////////////////////////////////////////////////////////////////////////// # Set virtual ethernet interface (tap0), relays packets between the interface and the GNU Radio PHY+MAC # Use the Universal TUN/TAP device driver to move packets to/from kernel # See /usr/src/linux/Documentation/networking/tuntap.txt # /////////////////////////////////////////////////////////////////////////////////////////////////////// if source == "tuntap": self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu("tap0", 440, False) ################################################## # Asynch Message Connections ##################################################i self.msg_connect(self.ieee802_11_ether_encap_0, "to tap", self.blocks_tuntap_pdu_0, "pdus") self.msg_connect(self.blocks_tuntap_pdu_0, "pdus", self.ieee802_11_ether_encap_0, "from tap") self.msg_connect(self.ieee802_11_ether_encap_0, "to wifi", self.ieee802_11_ofdm_mac_0, "app in") self.msg_connect(self.ieee802_11_ofdm_mac_0, "app out", self.ieee802_11_ether_encap_0, "from wifi") else: # UDP_Sockets #TODO Test me ! self.blocks_socket_pdu_0_Tx = blocks.socket_pdu("UDP_SERVER", "localhost", "52004", 10000) self.blocks_socket_pdu_0_Rx = blocks.socket_pdu("UDP_CLIENT", "localhost", "3333", 10000) self.msg_connect(self.ieee802_11_ofdm_mac_0, "app out", self.blocks_socket_pdu_0_Rx, "pdus") self.msg_connect(self.blocks_socket_pdu_0_Tx, "pdus" , self.ieee802_11_ofdm_mac_0, "app in") ## Debugging at the MAC level To parse at the level of MAC ! Look at the flowgraph self.msg_connect(self.PHY, "mac_out", self.ieee802_11_ofdm_parse_mac_0, "in") #TODO Test me ! self.msg_connect(self.PHY, "mac_out", self.ieee802_11_ofdm_mac_0, "phy in") self.msg_connect(self.ieee802_11_ofdm_mac_0, "phy out", self.PHY, "mac_in") ################################################## # Connections ################################################## if self.no_usrp: self.connect((self.PHY, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_slaveFileSource, 0), (self.PHY, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_slaveFileSink, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) else: self.connect((self.PHY, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.PHY, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) if not self.lo_offset: self.lo_offset = self.samp_rate / 2.0 print "LO offset set to: ", self.lo_offset/1e6, "MHz"
def __init__(self, options, hostname): gr.top_block.__init__(self) ################################################## # Variables ################################################## window_size = options.window_size sync_length = options.sync_length gain = options.gain freq = options.freq samp_rate = options.bandwidth self.uhd_usrp_source_0 = uhd.usrp_source(device_addr="", stream_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(freq, 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.ieee802_1_ofdm_sync_short_0 = gr_ieee802_11.ofdm_sync_short(0.8, 80 * 80, 2, False) self.ieee802_1_ofdm_sync_long_0 = gr_ieee802_11.ofdm_sync_long(sync_length, 100, False) self.ieee802_1_ofdm_equalize_symbols_0 = gr_ieee802_11.ofdm_equalize_symbols(False) self.ieee802_1_ofdm_decode_signal_0 = gr_ieee802_11.ofdm_decode_signal(False) self.ieee802_1_ofdm_decode_mac_0 = gr_ieee802_11.ofdm_decode_mac(False) self.ieee802_11_ofdm_parse_mac_0 = gr_ieee802_11.ofdm_parse_mac(True) self.gr_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.gr_socket_pdu_0 = blocks.socket_pdu("TCP_CLIENT", hostname, str(options.PHYport), 10000) self.gr_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, 20000000) self.gr_multiply_xx_0 = blocks.multiply_vcc(1) self.gr_divide_xx_0 = blocks.divide_ff(1) self.gr_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.gr_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.gr_conjugate_cc_0 = blocks.conjugate_cc() self.gr_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.gr_complex_to_mag_0 = blocks.complex_to_mag(1) self.fir_filter_xxx_0_0 = filter.fir_filter_ccf(1, ([1]*window_size)) self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ([1]*window_size)) self.fft_vxx_0 = fft.fft_vcc(64, True, (), True, 1) self.message_debug = blocks.message_debug() ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.gr_skiphead_0, 0)) self.connect((self.gr_skiphead_0, 0), (self.gr_complex_to_mag_squared_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.gr_divide_xx_0, 1)) self.connect((self.gr_complex_to_mag_squared_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.gr_skiphead_0, 0), (self.gr_multiply_xx_0, 0)) self.connect((self.gr_conjugate_cc_0, 0), (self.gr_multiply_xx_0, 1)) self.connect((self.gr_complex_to_mag_0, 0), (self.gr_divide_xx_0, 0)) self.connect((self.gr_multiply_xx_0, 0), (self.fir_filter_xxx_0_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.gr_complex_to_mag_0, 0)) self.connect((self.gr_skiphead_0, 0), (self.gr_delay_0, 0)) self.connect((self.gr_delay_0, 0), (self.gr_conjugate_cc_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_1_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_1_ofdm_equalize_symbols_0, 0), (self.ieee802_1_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_1_ofdm_decode_signal_0, 0), (self.ieee802_1_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_1_ofdm_sync_short_0, 0), (self.gr_delay_0_0, 0)) self.connect((self.gr_delay_0, 0), (self.ieee802_1_ofdm_sync_short_0, 0)) self.connect((self.gr_divide_xx_0, 0), (self.ieee802_1_ofdm_sync_short_0, 1)) self.connect((self.gr_delay_0_0, 0), (self.ieee802_1_ofdm_sync_long_0, 1)) self.connect((self.ieee802_1_ofdm_sync_short_0, 0), (self.ieee802_1_ofdm_sync_long_0, 0)) self.connect((self.ieee802_1_ofdm_sync_long_0, 0), (self.gr_stream_to_vector_0, 0)) self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.ieee802_1_ofdm_decode_mac_0, "out", self.ieee802_11_ofdm_parse_mac_0, "in") self.msg_connect(self.ieee802_11_ofdm_parse_mac_0, "out", self.gr_socket_pdu_0, "pdus")
def __init__(self, options, hostname, msgq): gr.top_block.__init__(self) ################################################## # Variables ################################################## window_size = options.window_size sync_length = options.sync_length gain = options.gain freq = options.freq samp_rate = options.bandwidth self.uhd_usrp_source_0 = uhd.usrp_source(device_addr="", stream_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(freq, 0) self.uhd_usrp_source_0.set_gain(gain, 0) """ self.ieee802_1_ofdm_sync_short_0 = gr_ieee802_11.ofdm_sync_short(0.56, 2, False, False) self.ieee802_1_ofdm_sync_long_0 = gr_ieee802_11.ofdm_sync_long(sync_length, True, False) self.ieee802_1_ofdm_equalize_symbols_0 = gr_ieee802_11.ofdm_equalize_symbols(0, False) self.ieee802_1_ofdm_decode_signal_0 = gr_ieee802_11.ofdm_decode_signal(True, False) self.ieee802_1_ofdm_decode_mac_0 = gr_ieee802_11.ofdm_decode_mac(True, False) self.ieee802_11_ofdm_parse_mac_0 = gr_ieee802_11.ofdm_parse_mac(False, True) """ self.ieee802_11_ofdm_sync_short_0 = gr_ieee802_11.ofdm_sync_short( 0.56, 2, False, False) self.ieee802_11_ofdm_sync_long_0 = gr_ieee802_11.ofdm_sync_long( sync_length, False, False) self.ieee802_11_ofdm_parse_mac_0 = gr_ieee802_11.ofdm_parse_mac( False, True) self.ieee802_11_ofdm_equalize_symbols_0 = gr_ieee802_11.ofdm_equalize_symbols( 0, False) self.ieee802_11_ofdm_decode_signal_0 = gr_ieee802_11.ofdm_decode_signal( True, False) self.ieee802_11_ofdm_decode_mac_0 = gr_ieee802_11.ofdm_decode_mac( True, False) self.ieee802_11_moving_average_xx_1 = gr_ieee802_11.moving_average_ff( window_size + 16) self.ieee802_11_moving_average_xx_0 = gr_ieee802_11.moving_average_cc( window_size) """ self.gr_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.gr_socket_pdu_0 = blocks.socket_pdu("TCP_CLIENT", hostname, str(options.PHYRXport), 10000) self.gr_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, 20000000) self.gr_multiply_xx_0 = blocks.multiply_vcc(1) self.gr_divide_xx_0 = blocks.divide_ff(1) self.gr_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.gr_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.gr_conjugate_cc_0 = blocks.conjugate_cc() self.gr_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.gr_complex_to_mag_0 = blocks.complex_to_mag(1) self.fir_filter_xxx_0_0 = filter.fir_filter_ccf(1, ([1]*window_size)) self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ([1]*window_size)) self.fft_vxx_0 = fft.fft_vcc(64, True, (), True, 1) self.msg_sink = blocks.message_sink(4,msgq,True) """ self.gr_socket_pdu_0 = blocks.socket_pdu("TCP_CLIENT", hostname, str(options.PHYRXport), 10000) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) #self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 48) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.float_t, "packet_len") self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) #self.message_debug = gr.message_debug() ################################################## # Connections ################################################## """ self.connect((self.uhd_usrp_source_0, 0), (self.gr_skiphead_0, 0)) self.connect((self.gr_skiphead_0, 0), (self.gr_complex_to_mag_squared_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.msg_sink, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.gr_divide_xx_0, 1)) self.connect((self.gr_complex_to_mag_squared_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.gr_skiphead_0, 0), (self.gr_multiply_xx_0, 0)) self.connect((self.gr_conjugate_cc_0, 0), (self.gr_multiply_xx_0, 1)) self.connect((self.gr_complex_to_mag_0, 0), (self.gr_divide_xx_0, 0)) self.connect((self.gr_multiply_xx_0, 0), (self.fir_filter_xxx_0_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.gr_complex_to_mag_0, 0)) self.connect((self.gr_skiphead_0, 0), (self.gr_delay_0, 0)) self.connect((self.gr_delay_0, 0), (self.gr_conjugate_cc_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_1_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_1_ofdm_equalize_symbols_0, 0), (self.ieee802_1_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_1_ofdm_decode_signal_0, 0), (self.ieee802_1_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_1_ofdm_sync_short_0, 0), (self.gr_delay_0_0, 0)) self.connect((self.gr_delay_0, 0), (self.ieee802_1_ofdm_sync_short_0, 0)) self.connect((self.gr_divide_xx_0, 0), (self.ieee802_1_ofdm_sync_short_0, 2)) self.connect((self.gr_delay_0_0, 0), (self.ieee802_1_ofdm_sync_long_0, 1)) self.connect((self.ieee802_1_ofdm_sync_short_0, 0), (self.ieee802_1_ofdm_sync_long_0, 0)) self.connect((self.ieee802_1_ofdm_sync_long_0, 0), (self.gr_stream_to_vector_0, 0)) self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) """ self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2)) #self.connect((self.blocks_divide_xx_0, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) #self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) #self.connect((self.blocks_vector_to_stream_0, 0), (self.wxgui_scopesink1, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1)) #self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0)) ################################################## # Asynch Message Connections ################################################## """ self.msg_connect(self.ieee802_1_ofdm_decode_mac_0, "out", self.ieee802_11_ofdm_parse_mac_0, "in") self.msg_connect(self.ieee802_11_ofdm_parse_mac_0, "fer", self.gr_socket_pdu_0, "pdus") #self.msg_connect(self.ieee802_11_ofdm_parse_mac_0, "out", self.message_debug, "print") #self.msg_connect(self.ieee802_11_ofdm_parse_mac_0, "out", self.message_debug, "store") """ self.msg_connect(self.ieee802_11_ofdm_parse_mac_0, "fer", self.gr_socket_pdu_0, "pdus") self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in'))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx Jun28") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx Jun28") 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", "wifi_rx_jun28") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 0.5e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 943000000.0 self.decimation = decimation = 40 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## self._samp_rate_options = [0.5e6, 1e6, 5e6, 10e6, 20e6] self._samp_rate_labels = ["500 KHz", "1 MHz", "5 MHz", "10 MHz", "20 MHz"] self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("Sample Rate"+": ")) self._samp_rate_combo_box = Qt.QComboBox() self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box) for label in self._samp_rate_labels: self._samp_rate_combo_box.addItem(label) self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod(self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i))) self._samp_rate_callback(self.samp_rate) self._samp_rate_combo_box.currentIndexChanged.connect( lambda i: self.set_samp_rate(self._samp_rate_options[i])) self.top_layout.addWidget(self._samp_rate_tool_bar) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 32, #size 10, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-1, 110) self.qtgui_time_sink_x_2.set_y_label("Amplitude", "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(True) self.qtgui_time_sink_x_2.enable_control_panel(False) if not True: self.qtgui_time_sink_x_2.disable_legend() labels = ["Packets Reveiced", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_2_win) self.qtgui_time_sink_x_0_0_0_0 = qtgui.time_sink_c( 2**17, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0_0.set_y_axis(-2, 2) self.qtgui_time_sink_x_0_0_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.02, 0.1, 0, "ofdm_start") self.qtgui_time_sink_x_0_0_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_0.disable_legend() labels = ["samples", "corr", "correlation_big", "", "", "", "", "", "", ""] 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_0_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win) self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f( 2**17, #size samp_rate, #samp_rate "", #name 1 #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(-0.1, 1000) self.qtgui_time_sink_x_0_0_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, threshold, 5e-3, 0, "FISTOR") self.qtgui_time_sink_x_0_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0.disable_legend() labels = ["correlation I", "correlation Q", "correlation_big", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_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_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win) self.qtgui_number_sink_0 = qtgui.number_sink( gr.sizeof_float, 0.99, qtgui.NUM_GRAPH_HORIZ, 1 ) self.qtgui_number_sink_0.set_update_time(0.0000010) self.qtgui_number_sink_0.set_title("Frame error Rata") labels = ["", "", "", "", "", "", "", "", "", ""] units = ["", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 100) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_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_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if complex == type(float()): self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) self.ofdm_80211_ftc_0 = ofdm_80211.ftc() self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_float,1,3) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8192) self.nutaq_rtdex_source_0.set_channels("2") self.nutaq_radio420_tx_0_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 2, 2) self.nutaq_radio420_tx_0_0_0.set_default_enable(0) self.nutaq_radio420_tx_0_0_0.set_default_tx_freq(743e6) self.nutaq_radio420_tx_0_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_tx_0_0_0.set_default_calibrate(1) self.nutaq_radio420_tx_0_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0_0.set_default_tx_vga1_gain(-10) self.nutaq_radio420_tx_0_0_0.set_default_tx_vga2_gain(15) self.nutaq_radio420_tx_0_0_0.set_default_tx_gain3(3) self.nutaq_radio420_tx_0_0_0.set_default_tx_lpf_bandwidth(6) self.nutaq_radio420_tx_0_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0) self.nutaq_radio420_tx_0_0.set_default_enable(0) self.nutaq_radio420_tx_0_0.set_default_tx_freq(743e6) self.nutaq_radio420_tx_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_tx_0_0.set_default_calibrate(1) self.nutaq_radio420_tx_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10) self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15) self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3) self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6) self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 2, 3) self.nutaq_radio420_rx_0_0.set_default_enable(1) self.nutaq_radio420_rx_0_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0_0.set_default_reference(0) self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_rx_0_0.set_default_calibrate(1) self.nutaq_radio420_rx_0_0.set_default_band(0) self.nutaq_radio420_rx_0_0.set_default_update_rate(1) self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(3) self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(3) self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0_0.set_default_rx_gain3(8) self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1) self.nutaq_radio420_rx_0.set_default_enable(0) self.nutaq_radio420_rx_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0.set_default_reference(0) self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_rx_0.set_default_calibrate(1) self.nutaq_radio420_rx_0.set_default_band(0) self.nutaq_radio420_rx_0.set_default_update_rate(1) self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2) self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1) self.nutaq_radio420_rx_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0.set_default_rx_gain3(3) self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0) self.nutaq_custom_register_0_2 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0_2.set_index(0) self.nutaq_custom_register_0_2.set_default_value(int((4e6)/samp_rate/40*(2**32))) self.nutaq_custom_register_0_2.set_update_rate(1) self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0_1.set_index(2) self.nutaq_custom_register_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0_1.set_index(3) self.nutaq_custom_register_0_0_1.set_default_value(7) self.nutaq_custom_register_0_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0_0.set_index(6) self.nutaq_custom_register_0_0_0.set_default_value(600) self.nutaq_custom_register_0_0_0.set_update_rate(1) self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0.set_index(4) self.nutaq_custom_register_0_0.set_update_rate(1) self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0.set_index(1) self.nutaq_custom_register_0.set_default_value(3) self.nutaq_custom_register_0.set_update_rate(1) self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.101") self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, False) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(ieee802_11.LMS, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False) self._gain_range = Range(0, 100, 1, 20, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "slider") self.top_layout.addWidget(self._gain_win) self._freq_options = [943000000.0, 2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0] self._freq_labels = [' 0 | 943.0 | ??', ' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p'] self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("Channel"+": ")) self._freq_combo_box = Qt.QComboBox() self._freq_tool_bar.addWidget(self._freq_combo_box) for label in self._freq_labels: self._freq_combo_box.addItem(label) self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod(self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i))) self._freq_callback(self.freq) self._freq_combo_box.currentIndexChanged.connect( lambda i: self.set_freq(self._freq_options[i])) self.top_layout.addWidget(self._freq_tool_bar) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_null_sink_0_1_0_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.carajito, 0), (self.qtgui_time_sink_x_0_0_0_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.nutaq_rtdex_source_0, 0), (self.ofdm_80211_ftc_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.ofdm_80211_ftc_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1_0_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.qtgui_time_sink_x_0_0_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Transceiver") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.tx_gain = tx_gain = 15 self.samp_rate = samp_rate = 10e6 self.rx_gain = rx_gain = 5 self.mult = mult = 0.38 self.lo_offset = lo_offset = 0 self.freq = freq = 5.89e9 self.encoding = encoding = 0 ################################################## # Blocks ################################################## self._samp_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.samp_rate, callback=self.set_samp_rate, label="Sample Rate", choices=[5e6,10e6, 20e6], labels=["5MHz", "10 MHz", "20 MHz"], style=wx.RA_HORIZONTAL, ) self.Add(self._samp_rate_chooser) _mult_sizer = wx.BoxSizer(wx.VERTICAL) self._mult_text_box = forms.text_box( parent=self.GetWin(), sizer=_mult_sizer, value=self.mult, callback=self.set_mult, label='mult', converter=forms.float_converter(), proportion=0, ) self._mult_slider = forms.slider( parent=self.GetWin(), sizer=_mult_sizer, value=self.mult, callback=self.set_mult, minimum=0, maximum=1, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_mult_sizer) self._encoding_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.encoding, callback=self.set_encoding, label="Encoding", choices=[0,1,2,3,4,5,6,7], labels=["BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4"], style=wx.RA_HORIZONTAL, ) self.Add(self._encoding_chooser) self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c( self.GetWin(), title="Scope Plot", sample_rate=5000, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0_0.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.GetWin(), title="Scope Plot", sample_rate=5000, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.wifi_phy_hier_0_0 = wifi_phy_hier( chan_est=0, encoding=0, ) self.wifi_phy_hier_0 = wifi_phy_hier( chan_est=0, encoding=0, ) _tx_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._tx_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_tx_gain_sizer, value=self.tx_gain, callback=self.set_tx_gain, label='tx_gain', converter=forms.float_converter(), proportion=0, ) self._tx_gain_slider = forms.slider( parent=self.GetWin(), sizer=_tx_gain_sizer, value=self.tx_gain, callback=self.set_tx_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_tx_gain_sizer) _rx_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._rx_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_rx_gain_sizer, value=self.rx_gain, callback=self.set_rx_gain, label='rx_gain', converter=forms.float_converter(), proportion=0, ) self._rx_gain_slider = forms.slider( parent=self.GetWin(), sizer=_rx_gain_sizer, value=self.rx_gain, callback=self.set_rx_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_rx_gain_sizer) self._lo_offset_chooser = forms.drop_down( parent=self.GetWin(), value=self.lo_offset, callback=self.set_lo_offset, label="LO Offset", choices=[0, 6e6, 11e6], labels=['0 MHz', '6 MHz', '11 MHz'], ) self.Add(self._lo_offset_chooser) self.ieee802_11_ofdm_parse_mac_0_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_mac_0_0 = ieee802_11.ofdm_mac(([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]), ([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]), ([0x12, 0x34, 0x56, 0x78, 0x90, 0xab])) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]), ([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]), ([0x12, 0x34, 0x56, 0x78, 0x90, 0xab])) self.ieee802_11_ether_encap_0_0 = ieee802_11.ether_encap(False) self.ieee802_11_ether_encap_0 = ieee802_11.ether_encap(False) self._freq_chooser = forms.drop_down( parent=self.GetWin(), value=self.freq, callback=self.set_freq, label="Channel", choices=[2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0], labels=[' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p'], ) self.Add(self._freq_chooser) self.foo_packet_pad2_0_0 = foo.packet_pad2(False, False, 0.001, 10000, 10000) (self.foo_packet_pad2_0_0).set_min_output_buffer(100000) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 10000, 10000) (self.foo_packet_pad2_0).set_min_output_buffer(100000) self.blocks_tuntap_pdu_0_0 = blocks.tuntap_pdu("tap1", 1500, False) self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu("tap0", 1500, False) self.blocks_throttle_1 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((mult, )) (self.blocks_multiply_const_vxx_0_0).set_min_output_buffer(100000) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((mult, )) (self.blocks_multiply_const_vxx_0).set_min_output_buffer(100000) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'), (self.ieee802_11_ether_encap_0, 'from tap')) self.msg_connect((self.blocks_tuntap_pdu_0_0, 'pdus'), (self.ieee802_11_ether_encap_0_0, 'from tap')) self.msg_connect((self.ieee802_11_ether_encap_0, 'to tap'), (self.blocks_tuntap_pdu_0, 'pdus')) self.msg_connect((self.ieee802_11_ether_encap_0, 'to wifi'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ether_encap_0_0, 'to tap'), (self.blocks_tuntap_pdu_0_0, 'pdus')) self.msg_connect((self.ieee802_11_ether_encap_0_0, 'to wifi'), (self.ieee802_11_ofdm_mac_0_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_0, 'mac_in')) self.msg_connect((self.ieee802_11_ofdm_mac_0_0, 'phy out'), (self.wifi_phy_hier_0_0, 'mac_in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ether_encap_0, 'from wifi')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ofdm_mac_0, 'phy in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.msg_connect((self.wifi_phy_hier_0_0, 'mac_out'), (self.ieee802_11_ether_encap_0_0, 'from wifi')) self.msg_connect((self.wifi_phy_hier_0_0, 'mac_out'), (self.ieee802_11_ofdm_mac_0_0, 'phy in')) self.msg_connect((self.wifi_phy_hier_0_0, 'mac_out'), (self.ieee802_11_ofdm_parse_mac_0_0, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.foo_packet_pad2_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.wifi_phy_hier_0_0, 0)) self.connect((self.blocks_throttle_1, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_throttle_1, 0)) self.connect((self.foo_packet_pad2_0_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.wifi_phy_hier_0, 1), (self.wxgui_scopesink2_0, 0)) self.connect((self.wifi_phy_hier_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.wifi_phy_hier_0_0, 1), (self.wxgui_scopesink2_0_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Transceiver") ################################################## # Variables ################################################## self.tx_gain = tx_gain = 40 self.samp_rate = samp_rate = 20e6 self.rx_gain = rx_gain = 40 self.mult = mult = 0.38 self.lo_offset = lo_offset = 0 self.freq = freq = 2.412e9 self.encoding = encoding = 0 ################################################## # Blocks ################################################## _tx_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._tx_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_tx_gain_sizer, value=self.tx_gain, callback=self.set_tx_gain, label='tx_gain', converter=forms.float_converter(), proportion=0, ) self._tx_gain_slider = forms.slider( parent=self.GetWin(), sizer=_tx_gain_sizer, value=self.tx_gain, callback=self.set_tx_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_tx_gain_sizer) self._samp_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.samp_rate, callback=self.set_samp_rate, label="Sample Rate", choices=[5e6,10e6, 20e6], labels=["5MHz", "10 MHz", "20 MHz"], style=wx.RA_HORIZONTAL, ) self.Add(self._samp_rate_chooser) _rx_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._rx_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_rx_gain_sizer, value=self.rx_gain, callback=self.set_rx_gain, label='rx_gain', converter=forms.float_converter(), proportion=0, ) self._rx_gain_slider = forms.slider( parent=self.GetWin(), sizer=_rx_gain_sizer, value=self.rx_gain, callback=self.set_rx_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_rx_gain_sizer) _mult_sizer = wx.BoxSizer(wx.VERTICAL) self._mult_text_box = forms.text_box( parent=self.GetWin(), sizer=_mult_sizer, value=self.mult, callback=self.set_mult, label='mult', converter=forms.float_converter(), proportion=0, ) self._mult_slider = forms.slider( parent=self.GetWin(), sizer=_mult_sizer, value=self.mult, callback=self.set_mult, minimum=0, maximum=1, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_mult_sizer) self._lo_offset_chooser = forms.drop_down( parent=self.GetWin(), value=self.lo_offset, callback=self.set_lo_offset, label="LO Offset", choices=[0, 6e6, 11e6], labels=['0 MHz', '6 MHz', '11 MHz'], ) self.Add(self._lo_offset_chooser) self._freq_chooser = forms.drop_down( parent=self.GetWin(), value=self.freq, callback=self.set_freq, label="Channel", choices=[2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0], labels=[' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p'], ) self.Add(self._freq_chooser) self._encoding_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.encoding, callback=self.set_encoding, label="Encoding", choices=[0,1,2,3,4,5,6,7], labels=["BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4"], style=wx.RA_HORIZONTAL, ) self.Add(self._encoding_chooser) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.GetWin(), title="Scope Plot", sample_rate=5000, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.wifi_phy_hier_0 = wifi_phy_hier( chan_est=0, encoding=0, sensitivity=0.56, ) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(freq, rf_freq = freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), "packet_len", ) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(freq, rf_freq = freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]), ([0x30, 0x14, 0x4a, 0xe6, 0x46, 0xe4]), ([0x02, 0x11, 0x87, 0xBA, 0x68, 0x3B])) self.ieee802_11_ether_encap_0 = ieee802_11.ether_encap(False) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 10000, 10000) (self.foo_packet_pad2_0).set_min_output_buffer(100000) self.blocks_tuntap_pdu_0 = blocks.tuntap_pdu("tap0", 440, False) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((mult, )) (self.blocks_multiply_const_vxx_0).set_min_output_buffer(100000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/ofdm.pcap", True) self.blocks_file_sink_0.set_unbuffered(True) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tuntap_pdu_0, 'pdus'), (self.ieee802_11_ether_encap_0, 'from tap')) self.msg_connect((self.ieee802_11_ether_encap_0, 'to tap'), (self.blocks_tuntap_pdu_0, 'pdus')) self.msg_connect((self.ieee802_11_ether_encap_0, 'to wifi'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_0, 'mac_in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ether_encap_0, 'from wifi')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ofdm_mac_0, 'phy in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.foo_packet_pad2_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.wifi_phy_hier_0, 1), (self.wxgui_scopesink2_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Rx Only Power") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 20e6 self.lo_offset = lo_offset = 11e6 self.gain = gain = 20 self.freq = freq = 5.805e9 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._samp_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.samp_rate, callback=self.set_samp_rate, label="Sample Rate", choices=[5e6, 10e6, 20e6], labels=["5 MHz", "10 MHz", "20 MHz"], style=wx.RA_HORIZONTAL, ) self.Add(self._samp_rate_chooser) self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation") self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation") self.nb.AddPage(grc_wxgui.Panel(self.nb), "FFT") self.Add(self.nb) self._lo_offset_chooser = forms.drop_down( parent=self.GetWin(), value=self.lo_offset, callback=self.set_lo_offset, label="LO Offset", choices=[0, 6e6, 11e6], labels=['0 MHz', '6 MHz', '11 MHz'], ) self.Add(self._lo_offset_chooser) _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='gain', converter=forms.int_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_gain_sizer) self._freq_chooser = forms.drop_down( parent=self.GetWin(), value=self.freq, callback=self.set_freq, label="Channel", choices=[2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0], labels=[' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p'], ) self.Add(self._freq_chooser) self._chan_est_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.chan_est, callback=self.set_chan_est, label='chan_est', choices=[0, 1], labels=["LMS", "Linear Comb"], style=wx.RA_HORIZONTAL, ) self.Add(self._chan_est_chooser) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.nb.GetPage(1).GetWin(), title="Scope Plot", sample_rate=samp_rate, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win) self.wxgui_scopesink1 = scopesink2.scope_sink_c( self.nb.GetPage(0).GetWin(), title="Scope Plot", sample_rate=12500, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.nb.GetPage(0).Add(self.wxgui_scopesink1.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="%", minval=0, maxval=100, factor=1.0, decimal_places=2, ref_level=0, sample_rate=1, number_rate=15, average=True, avg_alpha=0.02, label="Frame Error Rate", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.nb.GetPage(2).GetWin(), baseband_freq=580.5*10e6, y_per_div=10, y_divs=10, ref_level=gain, ref_scale=2.0, sample_rate=samp_rate, fft_size=64, fft_rate=15, average=True, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.nb.GetPage(2).Add(self.wxgui_fftsink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(freq, rf_freq = freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.56, 2, False, False) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, True, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(True, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(True, True) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_vector_to_stream_1 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 64) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 48) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/furonics/GNURadio/25Feb2016DataTransfer.dat", False) self.blocks_file_sink_1.set_unbuffered(False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/furonics/GNURadio/11thFeb2016_AtHome.pcap", False) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2)) self.connect((self.blocks_divide_xx_0, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.wxgui_scopesink1, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.blocks_file_sink_1, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_1, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wifi Loopback Ah") ################################################## # Variables ################################################## self.snr = snr = 20 self.pdu_length = pdu_length = 500 self.out_buf_size = out_buf_size = 96000 self.interval = interval = 100 self.encoding = encoding = 0 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## _snr_sizer = wx.BoxSizer(wx.VERTICAL) self._snr_text_box = forms.text_box( parent=self.GetWin(), sizer=_snr_sizer, value=self.snr, callback=self.set_snr, label='snr', converter=forms.float_converter(), proportion=0, ) self._snr_slider = forms.slider( parent=self.GetWin(), sizer=_snr_sizer, value=self.snr, callback=self.set_snr, minimum=-15, maximum=30, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_snr_sizer) _pdu_length_sizer = wx.BoxSizer(wx.VERTICAL) self._pdu_length_text_box = forms.text_box( parent=self.GetWin(), sizer=_pdu_length_sizer, value=self.pdu_length, callback=self.set_pdu_length, label='pdu_length', converter=forms.int_converter(), proportion=0, ) self._pdu_length_slider = forms.slider( parent=self.GetWin(), sizer=_pdu_length_sizer, value=self.pdu_length, callback=self.set_pdu_length, minimum=0, maximum=1500, num_steps=1000, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_pdu_length_sizer) _interval_sizer = wx.BoxSizer(wx.VERTICAL) self._interval_text_box = forms.text_box( parent=self.GetWin(), sizer=_interval_sizer, value=self.interval, callback=self.set_interval, label="PDU Interval (ms)", converter=forms.int_converter(), proportion=0, ) self._interval_slider = forms.slider( parent=self.GetWin(), sizer=_interval_sizer, value=self.interval, callback=self.set_interval, minimum=10, maximum=1000, num_steps=1000, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.Add(_interval_sizer) self._encoding_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.encoding, callback=self.set_encoding, label="Encoding", choices=[0,1,2,3,4,5,6,7,8], labels=["BPSK 1/2", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4", "64QAM 5/6", "256QAM 3/4" ], style=wx.RA_HORIZONTAL, ) self.Add(self._encoding_chooser) self._chan_est_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.chan_est, callback=self.set_chan_est, label='chan_est', choices=[0, 1], labels=["LMS", "Linear Comb"], style=wx.RA_HORIZONTAL, ) self.Add(self._chan_est_chooser) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.GetWin(), title="Scope Plot", sample_rate=12500, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=True, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="%", minval=0, maxval=100, factor=1.0, decimal_places=2, ref_level=0, sample_rate=1, number_rate=15, average=True, avg_alpha=0.02, label="Frame Error Rate", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.wifi_phy_hier_ah_0 = wifi_phy_hier_ah( chan_est=chan_est, encoding=encoding, sensitivity=0.56, ) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 500, 0) (self.foo_packet_pad2_0).set_min_output_buffer(96000) self.channels_channel_model_0 = channels.channel_model( noise_voltage=1, frequency_offset=0, epsilon=1.0, taps=(1.0, ), noise_seed=0, block_tags=False ) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(((10**(snr/10.0))**.5, )) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("".join("x" for i in range(pdu_length))), interval) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_ah_0, 'mac_in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.wifi_phy_hier_ah_0, 'mac_out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.wifi_phy_hier_ah_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.wifi_phy_hier_ah_0, 0), (self.foo_packet_pad2_0, 0)) self.connect((self.wifi_phy_hier_ah_0, 1), (self.wxgui_scopesink2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx From Reco 150920") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx From Reco 150920") 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", "wifi_rx_from_reco_150920") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 0.5e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 943000000.0 self.decimation = decimation = 40 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## self._samp_rate_options = [0.5e6, 1e6, 5e6, 10e6, 20e6] self._samp_rate_labels = ["500 KHz", "1 MHz", "5 MHz", "10 MHz", "20 MHz"] self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("Sample Rate"+": ")) self._samp_rate_combo_box = Qt.QComboBox() self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box) for label in self._samp_rate_labels: self._samp_rate_combo_box.addItem(label) self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod(self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i))) self._samp_rate_callback(self.samp_rate) self._samp_rate_combo_box.currentIndexChanged.connect( lambda i: self.set_samp_rate(self._samp_rate_options[i])) self.top_layout.addWidget(self._samp_rate_tool_bar) self.qtgui_const_sink_x_1 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_1.set_update_time(0.10) self.qtgui_const_sink_x_1.set_y_axis(-2, 2) self.qtgui_const_sink_x_1.set_x_axis(-2, 2) self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_1.enable_autoscale(False) self.qtgui_const_sink_x_1.enable_grid(False) if not True: self.qtgui_const_sink_x_1.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_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_1.set_line_label(i, labels[i]) self.qtgui_const_sink_x_1.set_line_width(i, widths[i]) self.qtgui_const_sink_x_1.set_line_color(i, colors[i]) self.qtgui_const_sink_x_1.set_line_style(i, styles[i]) self.qtgui_const_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_1_win = sip.wrapinstance(self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_1_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(ieee802_11.LMS, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False) self._gain_range = Range(0, 100, 1, 20, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "slider") self.top_layout.addWidget(self._gain_win) self._freq_options = [943000000.0, 2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0] self._freq_labels = [' 0 | 943.0 | ??', ' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p'] self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("Channel"+": ")) self._freq_combo_box = Qt.QComboBox() self._freq_tool_bar.addWidget(self._freq_combo_box) for label in self._freq_labels: self._freq_combo_box.addItem(label) self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod(self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i))) self._freq_callback(self.freq) self._freq_combo_box.currentIndexChanged.connect( lambda i: self.set_freq(self._freq_options[i])) self.top_layout.addWidget(self._freq_tool_bar) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False) self.blocks_vector_to_stream_2 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 48) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) (self.blocks_throttle_0).set_min_output_buffer(2048) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) self.blocks_null_sink_0_1_0_0_0_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_file_source_0_1_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/juan/COWN/waveforms/80211_ofdm_padded_waveform_direct_fromTX_20150930.bin", True) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_file_source_0_1_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.blocks_vector_to_stream_2, 0), (self.qtgui_const_sink_x_1, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.blocks_vector_to_stream_2, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1_0_0_0_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2)) self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0))
def __init__(self, chan_est=1, encoding=0, freq_offset=0, interval=500, pdu_length=500, snr=10): gr.top_block.__init__(self, "Wifi Loopback") ################################################## # Parameters ################################################## self.chan_est = chan_est self.encoding = encoding self.freq_offset = freq_offset self.interval = interval self.pdu_length = pdu_length self.snr = snr ################################################## # Variables ################################################## self.out_buf_size = out_buf_size = 96000 ################################################## # Blocks ################################################## self.wifi_phy_hier_0 = wifi_phy_hier( encoding=encoding, chan_est=chan_est, ) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 500, 0) (self.foo_packet_pad2_0).set_min_output_buffer(96000) self.channels_channel_model_0 = channels.channel_model( noise_voltage=.5**.5, frequency_offset=freq_offset, epsilon=1.0, taps=(1.0, ), noise_seed=0, block_tags=False ) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float*1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(((10**(snr/10.0))**.5, )) self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("".join("x" for i in range(pdu_length))), interval) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/sim.csv", False) self.blocks_file_sink_0.set_unbuffered(True) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_0, 'mac_in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.foo_wireshark_connector_0, 'in')) self.msg_connect((self.wifi_phy_hier_0, 'mac_out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_null_sink_1, 0)) self.connect((self.channels_channel_model_0, 0), (self.wifi_phy_hier_0, 0)) self.connect((self.foo_packet_pad2_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_sink_0, 0)) self.connect((self.wifi_phy_hier_0, 0), (self.foo_packet_pad2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx From Reco 150920") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx From Reco 150920") 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", "wifi_rx_from_reco_150920") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 0.5e6 self.lo_offset = lo_offset = 0 self.gain = gain = 20 self.freq = freq = 943000000.0 self.decimation = decimation = 40 self.chan_est = chan_est = 1 ################################################## # Blocks ################################################## self._samp_rate_options = [0.5e6, 1e6, 5e6, 10e6, 20e6] self._samp_rate_labels = [ "500 KHz", "1 MHz", "5 MHz", "10 MHz", "20 MHz" ] self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("Sample Rate" + ": ")) self._samp_rate_combo_box = Qt.QComboBox() self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box) for label in self._samp_rate_labels: self._samp_rate_combo_box.addItem(label) self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod( self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i))) self._samp_rate_callback(self.samp_rate) self._samp_rate_combo_box.currentIndexChanged.connect( lambda i: self.set_samp_rate(self._samp_rate_options[i])) self.top_layout.addWidget(self._samp_rate_tool_bar) self.qtgui_const_sink_x_1 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_1.set_update_time(0.10) self.qtgui_const_sink_x_1.set_y_axis(-2, 2) self.qtgui_const_sink_x_1.set_x_axis(-2, 2) self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_1.enable_autoscale(False) self.qtgui_const_sink_x_1.enable_grid(False) if not True: self.qtgui_const_sink_x_1.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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_1.set_line_label(i, labels[i]) self.qtgui_const_sink_x_1.set_line_width(i, widths[i]) self.qtgui_const_sink_x_1.set_line_color(i, colors[i]) self.qtgui_const_sink_x_1.set_line_style(i, styles[i]) self.qtgui_const_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_1_win = sip.wrapinstance( self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_1_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long( sync_length, False, False) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, True) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols( ieee802_11.LMS, False) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal( False, False) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac( False, False) self._gain_range = Range(0, 100, 1, 20, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "slider") self.top_layout.addWidget(self._gain_win) self._freq_options = [ 943000000.0, 2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0 ] self._freq_labels = [ ' 0 | 943.0 | ??', ' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p' ] self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("Channel" + ": ")) self._freq_combo_box = Qt.QComboBox() self._freq_tool_bar.addWidget(self._freq_combo_box) for label in self._freq_labels: self._freq_combo_box.addItem(label) self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod( self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i))) self._freq_callback(self.freq) self._freq_combo_box.currentIndexChanged.connect( lambda i: self.set_freq(self._freq_options[i])) self.top_layout.addWidget(self._freq_tool_bar) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False) self.blocks_vector_to_stream_2 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 48) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) (self.blocks_throttle_0).set_min_output_buffer(2048) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) self.blocks_null_sink_0_1_0_0_0_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_file_source_0_1_0 = blocks.file_source( gr.sizeof_gr_complex * 1, "/home/juan/COWN/waveforms/80211_ofdm_padded_waveform_direct_fromTX_20150930.bin", True) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_file_source_0_1_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.blocks_vector_to_stream_2, 0), (self.qtgui_const_sink_x_1, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.blocks_vector_to_stream_2, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1_0_0_0_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2)) self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0))
def __init__(self, chan_est=0): gr.top_block.__init__(self, "Wifi Tx Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Tx Rx") 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", "wifi_tx_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.chan_est = chan_est ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 5e5 self.period = period = 10 self.pdu_length = pdu_length = 30 self.out_buf_size = out_buf_size = 96000 self.header_formatter = header_formatter = ieee802_11.wifi_signal_field( ) self.freq_sin = freq_sin = 1000 self.freq = freq = 943e6 self.encoding = encoding = 0 self.decimation = decimation = 40 ################################################## # Blocks ################################################## self._period_range = Range(1, 10000, 1, 10, 200) self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float) self.top_layout.addWidget(self._period_win) self._pdu_length_range = Range(10, 1500, 1, 30, 200) self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int) self.top_layout.addWidget(self._pdu_length_win) self._encoding_options = ( 0, 1, 2, ) self._encoding_labels = ( "BPSK 1/2", "BPSK 3/4", "QPSK 1/2", ) self._encoding_tool_bar = Qt.QToolBar(self) self._encoding_tool_bar.addWidget(Qt.QLabel("Encoding" + ": ")) self._encoding_combo_box = Qt.QComboBox() self._encoding_tool_bar.addWidget(self._encoding_combo_box) for label in self._encoding_labels: self._encoding_combo_box.addItem(label) self._encoding_callback = lambda i: Qt.QMetaObject.invokeMethod( self._encoding_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._encoding_options.index(i))) self._encoding_callback(self.encoding) self._encoding_combo_box.currentIndexChanged.connect( lambda i: self.set_encoding(self._encoding_options[i])) self.top_layout.addWidget(self._encoding_tool_bar) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 32, #size 100, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-1, 110) self.qtgui_time_sink_x_2.set_y_label("Frame error rata", "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(True) self.qtgui_time_sink_x_2.enable_control_panel(False) if not True: self.qtgui_time_sink_x_2.disable_legend() labels = ["Packets Reveiced", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance( self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_2_win) (self.qtgui_time_sink_x_2).set_processor_affinity([3]) self.qtgui_time_sink_x_0_0_0_1_0_1 = qtgui.time_sink_c( 2**10, #size samp_rate / 1000, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_1_0_1.set_update_time(1) self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_axis(-0.1, 1000) self.qtgui_time_sink_x_0_0_0_1_0_1.set_y_label("Generated Samples", "") self.qtgui_time_sink_x_0_0_0_1_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_0_1_0_1.set_trigger_mode( qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.001, 5e-3, 0, "FISTOR") self.qtgui_time_sink_x_0_0_0_1_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0_1_0_1.enable_grid(True) self.qtgui_time_sink_x_0_0_0_1_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_1_0_1.disable_legend() labels = [ "correlation I", "correlation Q", "correlation_big", "", "", "", "", "", "", "" ] 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_0_0_1_0_1.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_1_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_1_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_0_1_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_0_1_win) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0.99, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.0000010) self.qtgui_number_sink_0.set_title("Frame error Rata") labels = ["", "", "", "", "", "", "", "", "", ""] units = ["", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 100) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_0_win) (self.qtgui_number_sink_0).set_processor_affinity([3]) self.nutaq_rtdex_source_0 = nutaq.rtdex_source( "nutaq_carrier_perseus_0", gr.sizeof_int, 1, 0) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8192) self.nutaq_rtdex_source_0.set_channels("0") (self.nutaq_rtdex_source_0).set_processor_affinity([1]) self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0", gr.sizeof_short, 1, 1) self.nutaq_rtdex_sink_0.set_type(0) self.nutaq_rtdex_sink_0.set_packet_size(8192) self.nutaq_rtdex_sink_0.set_channels("0") (self.nutaq_rtdex_sink_0).set_processor_affinity([3]) self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx( "nutaq_carrier_perseus_0", 1, 0) self.nutaq_radio420_tx_0_0.set_default_enable(1) self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6) self.nutaq_radio420_tx_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_tx_0_0.set_default_calibrate(0) self.nutaq_radio420_tx_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-15) self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(5) self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0) self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2) self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1) self.nutaq_radio420_rx_0.set_default_enable(1) self.nutaq_radio420_rx_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0.set_default_reference(0) self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2 * decimation) self.nutaq_radio420_rx_0.set_default_calibrate(0) self.nutaq_radio420_rx_0.set_default_band(0) self.nutaq_radio420_rx_0.set_default_update_rate(1) self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3) self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3) self.nutaq_radio420_rx_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0.set_default_rx_gain3(3) self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0) self.nutaq_custom_register_0_2 = nutaq.custom_register( "nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0_2.set_index(0) self.nutaq_custom_register_0_2.set_default_value( int((4e6) / samp_rate / 40 * (2**32))) self.nutaq_custom_register_0_2.set_update_rate(1) self.nutaq_custom_register_0_1 = nutaq.custom_register( "nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0_1.set_index(2) self.nutaq_custom_register_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_1 = nutaq.custom_register( "nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0_1.set_index(3) self.nutaq_custom_register_0_0_1.set_default_value(7) self.nutaq_custom_register_0_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_0 = nutaq.custom_register( "nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0_0.set_index(6) self.nutaq_custom_register_0_0_0.set_default_value(600) self.nutaq_custom_register_0_0_0.set_update_rate(1) self.nutaq_custom_register_0_0 = nutaq.custom_register( "nutaq_carrier_perseus_0", 5) self.nutaq_custom_register_0_0.set_index(4) self.nutaq_custom_register_0_0.set_update_rate(1) self.nutaq_custom_register_0 = nutaq.custom_register( "nutaq_carrier_perseus_0", 4) self.nutaq_custom_register_0.set_index(1) self.nutaq_custom_register_0.set_default_value(3) self.nutaq_custom_register_0.set_update_rate(1) self.nutaq_carrier_perseus_0 = nutaq.carrier( 0, "nutaq_carrier_perseus_0", "192.168.0.101") self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short( 0.56, 2, False, False) (self.ieee802_11_ofdm_sync_short_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_sync_short_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long( sync_length, False, False) (self.ieee802_11_ofdm_sync_long_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_sync_long_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac( False, True) (self.ieee802_11_ofdm_parse_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_parse_mac_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_mapper_0 = ieee802_11.ofdm_mapper(encoding, False) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac( ([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255])) (self.ieee802_11_ofdm_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_mac_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols( chan_est, False) (self.ieee802_11_ofdm_equalize_symbols_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_equalize_symbols_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal( False, False) (self.ieee802_11_ofdm_decode_signal_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_decode_signal_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac( False, False) (self.ieee802_11_ofdm_decode_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_decode_mac_0).set_min_output_buffer(96000) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff( window_size + 16) (self.ieee802_11_moving_average_xx_1).set_processor_affinity([3]) (self.ieee802_11_moving_average_xx_1).set_min_output_buffer(96000) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc( window_size) (self.ieee802_11_moving_average_xx_0).set_processor_affinity([3]) (self.ieee802_11_moving_average_xx_0).set_min_output_buffer(96000) self.ieee802_11_chunks_to_symbols_xx_0 = ieee802_11.chunks_to_symbols() (self.ieee802_11_chunks_to_symbols_xx_0).set_min_output_buffer(96000) self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200) self._freq_sin_win = RangeWidget(self._freq_sin_range, self.set_freq_sin, "freq_sin", "counter_slider", float) self.top_layout.addWidget(self._freq_sin_win) self.foo_packet_pad2_0_0 = foo.packet_pad2(False, False, 0.0001, 100000, 100000) (self.foo_packet_pad2_0_0).set_processor_affinity([3]) (self.foo_packet_pad2_0_0).set_min_output_buffer(262144) self.fft_vxx_0_0 = fft.fft_vcc(64, False, (tuple([1 / 52**.5] * 64)), True, 1) (self.fft_vxx_0_0).set_min_output_buffer(96000) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) (self.fft_vxx_0).set_processor_affinity([3]) (self.fft_vxx_0).set_min_output_buffer(96000) self.digital_packet_headergenerator_bb_0 = digital.packet_headergenerator_bb( header_formatter.formatter(), "packet_len") self.digital_ofdm_cyclic_prefixer_0_0 = digital.ofdm_cyclic_prefixer( 64, 64 + 16, 2, "packet_len") (self.digital_ofdm_cyclic_prefixer_0_0).set_min_output_buffer(96000) self.digital_ofdm_carrier_allocator_cvc_0_0_0 = digital.ofdm_carrier_allocator_cvc( 64, (range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27), ), ((-21, -7, 7, 21), ), ((1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (1, 1, 1, -1), (1, 1, 1, -1), (1, 1, 1, -1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1), (-1, -1, -1, 1)), ((0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (-1.4719601443879746 - 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, (1.4719601443879746 + 1.4719601443879746j), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0, 0j, 0, 0j, 0, 0j, -1, 1j, -1, 1j, -1, 1j, -1, -1j, 1, 1j, 1, -1j, -1, 1j, 1, 1j, 1, 1j, 1, 1j, -1, (-0 - 1j), 1, -1j, -1, 1j, 0, -1j, 1, (-0 - 1j), 1, -1j, 1, 1j, -1, -1j, 1, (-0 - 1j), -1, 1j, 1, 1j, 1, 1j, 1, 1j, -1, -1j, 1, 1j, 1, -1j, -1, 0j, 0, 0j, 0, 0j), (0, 0, 0, 0, 0, 0, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 0, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 0, 0, 0, 0, 0)), "packet_len") (self.digital_ofdm_carrier_allocator_cvc_0_0_0 ).set_min_output_buffer(96000) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( ([-1, 1]), 1) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux( gr.sizeof_gr_complex * 1, "packet_len", 1) (self.blocks_tagged_stream_mux_0).set_min_output_buffer(96000) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) (self.blocks_stream_to_vector_0).set_processor_affinity([3]) (self.blocks_stream_to_vector_0).set_min_output_buffer(96000) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.float_t, "packet_len") (self.blocks_pdu_to_tagged_stream_0).set_processor_affinity([3]) (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(96000) self.blocks_null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_int * 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) (self.blocks_multiply_xx_0).set_processor_affinity([3]) (self.blocks_multiply_xx_0).set_min_output_buffer(96000) self.blocks_message_strobe_0_0 = blocks.message_strobe( pmt.intern("".join("x" for i in range(pdu_length)) + "1234"), period) (self.blocks_message_strobe_0_0).set_processor_affinity([3]) (self.blocks_message_strobe_0_0).set_min_output_buffer(96000) self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1) (self.blocks_interleave_0).set_processor_affinity([3]) self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1) (self.blocks_float_to_short_0_0_0).set_processor_affinity([3]) self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1) (self.blocks_float_to_short_0_0).set_processor_affinity([3]) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) (self.blocks_float_to_complex_0).set_processor_affinity([2]) self.blocks_divide_xx_0 = blocks.divide_ff(1) (self.blocks_divide_xx_0).set_processor_affinity([3]) (self.blocks_divide_xx_0).set_min_output_buffer(96000) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16) (self.blocks_delay_0_0).set_processor_affinity([3]) (self.blocks_delay_0_0).set_min_output_buffer(96000) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) (self.blocks_delay_0).set_processor_affinity([3]) (self.blocks_delay_0).set_min_output_buffer(96000) self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int * 1, 1) (self.blocks_deinterleave_0).set_processor_affinity([1]) (self.blocks_deinterleave_0).set_min_output_buffer(32768) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() (self.blocks_conjugate_cc_0).set_processor_affinity([3]) (self.blocks_conjugate_cc_0).set_min_output_buffer(96000) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) (self.blocks_complex_to_mag_squared_0).set_processor_affinity([3]) (self.blocks_complex_to_mag_squared_0).set_min_output_buffer(96000) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) (self.blocks_complex_to_mag_0).set_processor_affinity([3]) (self.blocks_complex_to_mag_0).set_min_output_buffer(96000) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) (self.blocks_complex_to_float_0).set_processor_affinity([3]) (self.blocks_complex_to_float_0).set_min_output_buffer(16384) self.COWN_syncher2_0 = COWN.syncher2() (self.COWN_syncher2_0).set_processor_affinity([1]) self.COWN_resta_0 = COWN.resta() (self.COWN_resta_0).set_processor_affinity([1]) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.ieee802_11_ofdm_mapper_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.COWN_resta_0, 0), (self.blocks_null_sink_0_0, 0)) self.connect((self.COWN_syncher2_0, 0), (self.blocks_deinterleave_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_deinterleave_0, 3), (self.COWN_resta_0, 0)) self.connect((self.blocks_deinterleave_0, 2), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_deinterleave_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0)) self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1)) self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.digital_ofdm_carrier_allocator_cvc_0_0_0, 0), (self.fft_vxx_0_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.foo_packet_pad2_0_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.qtgui_time_sink_x_0_0_0_1_0_1, 0)) self.connect((self.digital_packet_headergenerator_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.fft_vxx_0_0, 0), (self.digital_ofdm_cyclic_prefixer_0_0, 0)) self.connect((self.foo_packet_pad2_0_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.ieee802_11_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_mapper_0, 0), (self.digital_packet_headergenerator_bb_0, 0)) self.connect((self.ieee802_11_ofdm_mapper_0, 0), (self.ieee802_11_chunks_to_symbols_xx_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_null_sink_0_0_0, 0)) self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0))
def __init__(self, chan_est=0): gr.top_block.__init__(self, "Top Block Waveforms") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block Waveforms") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block_waveforms") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.chan_est = chan_est ################################################## # Variables ################################################## self.window_size = window_size = 48 self.threshold = threshold = 1000 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 5e5 self.period = period = 300 self.pdu_length = pdu_length = 1000 self.out_buf_size = out_buf_size = 96000 self.freq_sin = freq_sin = 1000 self.freq = freq = 943e6 self.decimation = decimation = 40 ################################################## # Blocks ################################################## self._period_range = Range(1, 10000, 1, 300, 200) self._period_win = RangeWidget(self._period_range, self.set_period, "period", "counter_slider", float) self.top_layout.addWidget(self._period_win) self._pdu_length_range = Range(10, 1500, 1, 1000, 200) self._pdu_length_win = RangeWidget(self._pdu_length_range, self.set_pdu_length, "pdu_length", "counter_slider", int) self.top_layout.addWidget(self._pdu_length_win) self.wifi_PHY_tx_hier_1 = wifi_PHY_tx_hier( chan_est=1, encoding=ieee802_11.BPSK_1_2, ) (self.wifi_PHY_tx_hier_1).set_min_output_buffer(262144) self.qtgui_time_sink_x_2_0 = qtgui.time_sink_f( 128, #size 100, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2_0.set_update_time(0.10) self.qtgui_time_sink_x_2_0.set_y_axis(-1, 110) self.qtgui_time_sink_x_2_0.set_y_label("Frame error rata", "") self.qtgui_time_sink_x_2_0.enable_tags(-1, True) self.qtgui_time_sink_x_2_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_2_0.enable_autoscale(False) self.qtgui_time_sink_x_2_0.enable_grid(True) self.qtgui_time_sink_x_2_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_2_0.disable_legend() labels = ["Packets Reveiced", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_0_win = sip.wrapinstance(self.qtgui_time_sink_x_2_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_2_0_win) (self.qtgui_time_sink_x_2_0).set_processor_affinity([3]) self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 64, #size 1, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.050) self.qtgui_time_sink_x_1.set_y_axis(-20, 20) self.qtgui_time_sink_x_1.set_y_label("Amplitude", "") self.qtgui_time_sink_x_1.enable_tags(-1, False) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.5, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(True) self.qtgui_time_sink_x_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [0, 0, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, 0, -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_1.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0_0_0_1 = qtgui.time_sink_c( 2**16, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_0_1.set_update_time(0.10) self.qtgui_time_sink_x_0_0_0_1.set_y_axis(-0.1, 1000) self.qtgui_time_sink_x_0_0_0_1.set_y_label("Received Samples", "") self.qtgui_time_sink_x_0_0_0_1.enable_tags(-1, False) self.qtgui_time_sink_x_0_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.05, 5e-3, 0, "FISTOR") self.qtgui_time_sink_x_0_0_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_0_0_1.enable_grid(True) self.qtgui_time_sink_x_0_0_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_0_1.disable_legend() labels = ["correlation I", "correlation Q", "correlation_big", "", "", "", "", "", "", ""] 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_0_0_1.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_1_win) self.ofdm_80211_short_MF_v2_0 = ofdm_80211.short_MF_v2(160, 16) (self.ofdm_80211_short_MF_v2_0).set_processor_affinity([2]) (self.ofdm_80211_short_MF_v2_0).set_min_output_buffer(131072) self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_int,1,0) self.nutaq_rtdex_source_0.set_type(0) self.nutaq_rtdex_source_0.set_packet_size(8600) self.nutaq_rtdex_source_0.set_channels("0") (self.nutaq_rtdex_source_0).set_min_output_buffer(2048) self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,1) self.nutaq_rtdex_sink_0.set_type(0) self.nutaq_rtdex_sink_0.set_packet_size(8192) self.nutaq_rtdex_sink_0.set_channels("0") self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0) self.nutaq_radio420_tx_0_0.set_default_enable(1) self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6) self.nutaq_radio420_tx_0_0.set_default_reference(0) self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_tx_0_0.set_default_calibrate(0) self.nutaq_radio420_tx_0_0.set_default_band(0) self.nutaq_radio420_tx_0_0.set_default_update_rate(1) self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-20) self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(0) self.nutaq_radio420_tx_0_0.set_default_tx_gain3(0) self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2) self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0) self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0) self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1) self.nutaq_radio420_rx_0.set_default_enable(1) self.nutaq_radio420_rx_0.set_default_rx_freq(943e6) self.nutaq_radio420_rx_0.set_default_reference(0) self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2*decimation) self.nutaq_radio420_rx_0.set_default_calibrate(0) self.nutaq_radio420_rx_0.set_default_band(0) self.nutaq_radio420_rx_0.set_default_update_rate(1) self.nutaq_radio420_rx_0.set_default_rx_lna_gain(3) self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(3) self.nutaq_radio420_rx_0.set_default_rx_gain2(0) self.nutaq_radio420_rx_0.set_default_rx_gain3(3) self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2) self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2) self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0) self.nutaq_radio420_rx_0.set_default_rf_ctrl(0) self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0) self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0) self.nutaq_custom_register_0_2 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0_2.set_index(0) self.nutaq_custom_register_0_2.set_default_value(int((4e6)/samp_rate/40*(2**32))) self.nutaq_custom_register_0_2.set_update_rate(1) self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0_1.set_index(2) self.nutaq_custom_register_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_1 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0_1.set_index(3) self.nutaq_custom_register_0_0_1.set_default_value(7) self.nutaq_custom_register_0_0_1.set_update_rate(1) self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0_0.set_index(6) self.nutaq_custom_register_0_0_0.set_default_value(600) self.nutaq_custom_register_0_0_0.set_update_rate(1) self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5) self.nutaq_custom_register_0_0.set_index(4) self.nutaq_custom_register_0_0.set_update_rate(1) self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4) self.nutaq_custom_register_0.set_index(1) self.nutaq_custom_register_0.set_default_value(3) self.nutaq_custom_register_0.set_update_rate(1) self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.102") self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, False, False) (self.ieee802_11_ofdm_sync_long_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_sync_long_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True) (self.ieee802_11_ofdm_parse_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_parse_mac_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 255])) self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False) (self.ieee802_11_ofdm_equalize_symbols_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_equalize_symbols_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(False, False) (self.ieee802_11_ofdm_decode_signal_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_decode_signal_0).set_min_output_buffer(96000) self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(False, False) (self.ieee802_11_ofdm_decode_mac_0).set_processor_affinity([3]) (self.ieee802_11_ofdm_decode_mac_0).set_min_output_buffer(96000) self._freq_sin_range = Range(-2.5e5, 2.5e5, 500, 1000, 200) self._freq_sin_win = RangeWidget(self._freq_sin_range, self.set_freq_sin, "freq_sin", "counter_slider", float) self.top_layout.addWidget(self._freq_sin_win) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) (self.fft_vxx_0).set_processor_affinity([3]) (self.fft_vxx_0).set_min_output_buffer(96000) self.carajito = ofdm_80211.ofdm_sync_short(threshold, 2, False, False) (self.carajito).set_processor_affinity([2]) (self.carajito).set_min_output_buffer(131072) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 64) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64) (self.blocks_stream_to_vector_0).set_processor_affinity([3]) (self.blocks_stream_to_vector_0).set_min_output_buffer(96000) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len") (self.blocks_pdu_to_tagged_stream_0_0).set_processor_affinity([3]) (self.blocks_pdu_to_tagged_stream_0_0).set_min_output_buffer(96000) self.blocks_null_sink_0_1 = blocks.null_sink(gr.sizeof_float*1) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.intern("Hello__" +"".join("x" for i in range(pdu_length)) + "1234"), period) self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1) (self.blocks_interleave_0).set_min_output_buffer(262144) self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**8-1) (self.blocks_float_to_short_0_0_0).set_min_output_buffer(262144) self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**8-1) (self.blocks_float_to_short_0_0).set_min_output_buffer(262144) self.blocks_float_to_complex_1 = blocks.float_to_complex(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length) (self.blocks_delay_0).set_processor_affinity([3]) (self.blocks_delay_0).set_min_output_buffer(96000) self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_int*1, 1) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) (self.blocks_complex_to_float_0).set_min_output_buffer(262144) self.COWN_tx_valve_0 = COWN.tx_valve() self.COWN_syncher2_0 = COWN.syncher2() (self.COWN_syncher2_0).set_min_output_buffer(16384) self.COWN_resta_0 = COWN.resta() ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in')) self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_PHY_tx_hier_1, 'mac_in')) self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.connect((self.COWN_resta_0, 0), (self.blocks_null_sink_0_0, 0)) self.connect((self.COWN_syncher2_0, 0), (self.blocks_deinterleave_0, 0)) self.connect((self.COWN_tx_valve_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0)) self.connect((self.blocks_deinterleave_0, 3), (self.COWN_resta_0, 0)) self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_1, 0)) self.connect((self.blocks_deinterleave_0, 2), (self.blocks_float_to_complex_1, 1)) self.connect((self.blocks_deinterleave_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1)) self.connect((self.blocks_float_to_complex_1, 0), (self.ofdm_80211_short_MF_v2_0, 0)) self.connect((self.blocks_float_to_complex_1, 0), (self.qtgui_time_sink_x_0_0_0_1, 0)) self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0)) self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1)) self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.qtgui_time_sink_x_2_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.carajito, 0), (self.blocks_delay_0, 0)) self.connect((self.carajito, 0), (self.ieee802_11_ofdm_sync_long_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0)) self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0)) self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0)) self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.nutaq_rtdex_source_0, 0), (self.COWN_syncher2_0, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 2), (self.blocks_null_sink_0_1, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 0), (self.carajito, 0)) self.connect((self.ofdm_80211_short_MF_v2_0, 1), (self.carajito, 1)) self.connect((self.ofdm_80211_short_MF_v2_0, 3), (self.carajito, 2)) self.connect((self.wifi_PHY_tx_hier_1, 0), (self.COWN_tx_valve_0, 0))