fixed problem where last packet doesn't show up in pcap
This commit is contained in:
@@ -230,7 +230,7 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_coordinate</key>
|
<key>_coordinate</key>
|
||||||
<value>(296, 313)</value>
|
<value>(272, 313)</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_rotation</key>
|
<key>_rotation</key>
|
||||||
@@ -455,11 +455,11 @@ Else: 0</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>pad_front</key>
|
<key>pad_front</key>
|
||||||
<value>500</value>
|
<value>1000</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>pad_tail</key>
|
<key>pad_tail</key>
|
||||||
<value>0</value>
|
<value>1000</value>
|
||||||
</param>
|
</param>
|
||||||
</block>
|
</block>
|
||||||
<block>
|
<block>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
##################################################
|
##################################################
|
||||||
# GNU Radio Python Flow Graph
|
# GNU Radio Python Flow Graph
|
||||||
# Title: Wifi Loopback Nogui
|
# Title: Wifi Loopback Nogui
|
||||||
# Generated: Tue Nov 3 15:44:35 2015
|
# Generated: Tue Nov 3 19:25:31 2015
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -26,18 +26,18 @@ import pmt
|
|||||||
|
|
||||||
class wifi_loopback_noGUI(gr.top_block):
|
class wifi_loopback_noGUI(gr.top_block):
|
||||||
|
|
||||||
def __init__(self, nmessages=50, chan_est=1, snr=10, freq_offset=0, encoding=0, interval=500):
|
def __init__(self, chan_est=1, encoding=0, freq_offset=0, interval=500, nmessages=50, snr=10):
|
||||||
gr.top_block.__init__(self, "Wifi Loopback Nogui")
|
gr.top_block.__init__(self, "Wifi Loopback Nogui")
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Parameters
|
# Parameters
|
||||||
##################################################
|
##################################################
|
||||||
self.nmessages = nmessages
|
|
||||||
self.chan_est = chan_est
|
self.chan_est = chan_est
|
||||||
self.snr = snr
|
|
||||||
self.freq_offset = freq_offset
|
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
|
self.freq_offset = freq_offset
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
|
self.nmessages = nmessages
|
||||||
|
self.snr = snr
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Variables
|
# Variables
|
||||||
@@ -54,7 +54,7 @@ class wifi_loopback_noGUI(gr.top_block):
|
|||||||
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_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_wireshark_connector_0 = foo.wireshark_connector(127, False)
|
||||||
self.foo_periodic_msg_source_0 = foo.periodic_msg_source(pmt.intern("Hello World!"), interval, nmessages, True, False)
|
self.foo_periodic_msg_source_0 = foo.periodic_msg_source(pmt.intern("Hello World!"), interval, nmessages, True, False)
|
||||||
self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 500, 0)
|
self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 1000, 1000)
|
||||||
(self.foo_packet_pad2_0).set_min_output_buffer(96000)
|
(self.foo_packet_pad2_0).set_min_output_buffer(96000)
|
||||||
self.channels_channel_model_0 = channels.channel_model(
|
self.channels_channel_model_0 = channels.channel_model(
|
||||||
noise_voltage=.5**.5,
|
noise_voltage=.5**.5,
|
||||||
@@ -83,13 +83,6 @@ class wifi_loopback_noGUI(gr.top_block):
|
|||||||
self.connect((self.wifi_phy_hier_0, 1), (self.blocks_null_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))
|
self.connect((self.wifi_phy_hier_0, 0), (self.foo_packet_pad2_0, 0))
|
||||||
|
|
||||||
def get_nmessages(self):
|
|
||||||
return self.nmessages
|
|
||||||
|
|
||||||
def set_nmessages(self, nmessages):
|
|
||||||
self.nmessages = nmessages
|
|
||||||
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
|
||||||
|
|
||||||
def get_chan_est(self):
|
def get_chan_est(self):
|
||||||
return self.chan_est
|
return self.chan_est
|
||||||
|
|
||||||
@@ -97,13 +90,13 @@ class wifi_loopback_noGUI(gr.top_block):
|
|||||||
self.chan_est = chan_est
|
self.chan_est = chan_est
|
||||||
self.wifi_phy_hier_0.set_chan_est(self.chan_est)
|
self.wifi_phy_hier_0.set_chan_est(self.chan_est)
|
||||||
|
|
||||||
def get_snr(self):
|
def get_encoding(self):
|
||||||
return self.snr
|
return self.encoding
|
||||||
|
|
||||||
def set_snr(self, snr):
|
def set_encoding(self, encoding):
|
||||||
self.snr = snr
|
self.encoding = encoding
|
||||||
self.blocks_multiply_const_vxx_0.set_k(((10**(self.snr/10.0))**.5, ))
|
|
||||||
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
||||||
|
self.wifi_phy_hier_0.set_encoding(self.encoding)
|
||||||
|
|
||||||
def get_freq_offset(self):
|
def get_freq_offset(self):
|
||||||
return self.freq_offset
|
return self.freq_offset
|
||||||
@@ -112,14 +105,6 @@ class wifi_loopback_noGUI(gr.top_block):
|
|||||||
self.freq_offset = freq_offset
|
self.freq_offset = freq_offset
|
||||||
self.channels_channel_model_0.set_frequency_offset(self.freq_offset)
|
self.channels_channel_model_0.set_frequency_offset(self.freq_offset)
|
||||||
|
|
||||||
def get_encoding(self):
|
|
||||||
return self.encoding
|
|
||||||
|
|
||||||
def set_encoding(self, encoding):
|
|
||||||
self.encoding = encoding
|
|
||||||
self.wifi_phy_hier_0.set_encoding(self.encoding)
|
|
||||||
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
|
||||||
|
|
||||||
def get_interval(self):
|
def get_interval(self):
|
||||||
return self.interval
|
return self.interval
|
||||||
|
|
||||||
@@ -127,6 +112,21 @@ class wifi_loopback_noGUI(gr.top_block):
|
|||||||
self.interval = interval
|
self.interval = interval
|
||||||
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
||||||
|
|
||||||
|
def get_nmessages(self):
|
||||||
|
return self.nmessages
|
||||||
|
|
||||||
|
def set_nmessages(self, nmessages):
|
||||||
|
self.nmessages = nmessages
|
||||||
|
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
||||||
|
|
||||||
|
def get_snr(self):
|
||||||
|
return self.snr
|
||||||
|
|
||||||
|
def set_snr(self, snr):
|
||||||
|
self.snr = snr
|
||||||
|
self.blocks_file_sink_0_0.open("/tmp/ofdm_n" + str(self.nmessages) + "_s" + str(self.snr) + "_e" + str(self.encoding) + "_i" + str(self.interval) + ".pcap")
|
||||||
|
self.blocks_multiply_const_vxx_0.set_k(((10**(self.snr/10.0))**.5, ))
|
||||||
|
|
||||||
def get_out_buf_size(self):
|
def get_out_buf_size(self):
|
||||||
return self.out_buf_size
|
return self.out_buf_size
|
||||||
|
|
||||||
@@ -136,24 +136,24 @@ class wifi_loopback_noGUI(gr.top_block):
|
|||||||
|
|
||||||
def argument_parser():
|
def argument_parser():
|
||||||
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
|
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
|
||||||
parser.add_option(
|
|
||||||
"-n", "--nmessages", dest="nmessages", type="intx", default=50,
|
|
||||||
help="Set nmessages [default=%default]")
|
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
"-c", "--chan-est", dest="chan_est", type="intx", default=1,
|
"-c", "--chan-est", dest="chan_est", type="intx", default=1,
|
||||||
help="Set chan_est [default=%default]")
|
help="Set chan_est [default=%default]")
|
||||||
parser.add_option(
|
|
||||||
"-s", "--snr", dest="snr", type="eng_float", default=eng_notation.num_to_str(10),
|
|
||||||
help="Set snr [default=%default]")
|
|
||||||
parser.add_option(
|
|
||||||
"-o", "--freq-offset", dest="freq_offset", type="eng_float", default=eng_notation.num_to_str(0),
|
|
||||||
help="Set freq_offset [default=%default]")
|
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
"-e", "--encoding", dest="encoding", type="intx", default=0,
|
"-e", "--encoding", dest="encoding", type="intx", default=0,
|
||||||
help="Set encoding [default=%default]")
|
help="Set encoding [default=%default]")
|
||||||
|
parser.add_option(
|
||||||
|
"-o", "--freq-offset", dest="freq_offset", type="eng_float", default=eng_notation.num_to_str(0),
|
||||||
|
help="Set freq_offset [default=%default]")
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
"-i", "--interval", dest="interval", type="intx", default=500,
|
"-i", "--interval", dest="interval", type="intx", default=500,
|
||||||
help="Set interval [default=%default]")
|
help="Set interval [default=%default]")
|
||||||
|
parser.add_option(
|
||||||
|
"-n", "--nmessages", dest="nmessages", type="intx", default=50,
|
||||||
|
help="Set nmessages [default=%default]")
|
||||||
|
parser.add_option(
|
||||||
|
"-s", "--snr", dest="snr", type="eng_float", default=eng_notation.num_to_str(10),
|
||||||
|
help="Set snr [default=%default]")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ def main(top_block_cls=wifi_loopback_noGUI, options=None):
|
|||||||
if options is None:
|
if options is None:
|
||||||
options, _ = argument_parser().parse_args()
|
options, _ = argument_parser().parse_args()
|
||||||
|
|
||||||
tb = top_block_cls(nmessages=options.nmessages, chan_est=options.chan_est, snr=options.snr, freq_offset=options.freq_offset, encoding=options.encoding, interval=options.interval)
|
tb = top_block_cls(chan_est=options.chan_est, encoding=options.encoding, freq_offset=options.freq_offset, interval=options.interval, nmessages=options.nmessages, snr=options.snr)
|
||||||
tb.start()
|
tb.start()
|
||||||
tb.wait()
|
tb.wait()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user