send fixed number of messages (strings), capture packets
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>id</key>
|
<key>id</key>
|
||||||
<value>wifi_loopback</value>
|
<value>wifi_loopback_noGUI</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>max_nouts</key>
|
<key>max_nouts</key>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>run_options</key>
|
<key>run_options</key>
|
||||||
<value>prompt</value>
|
<value>run</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>run</key>
|
<key>run</key>
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_coordinate</key>
|
<key>_coordinate</key>
|
||||||
<value>(176, 11)</value>
|
<value>(272, 59)</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_rotation</key>
|
<key>_rotation</key>
|
||||||
@@ -124,15 +124,15 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_enabled</key>
|
<key>_enabled</key>
|
||||||
<value>False</value>
|
<value>True</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>file</key>
|
<key>file</key>
|
||||||
<value>/tmp/ofdm.bin</value>
|
<value>/tmp/ofdm_n" + str(nmessages) + "_s" + str(snr) + "_e" + str(encoding) + "_i" + str(interval) + ".pcap</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_coordinate</key>
|
<key>_coordinate</key>
|
||||||
<value>(896, 187)</value>
|
<value>(64, 331)</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_rotation</key>
|
<key>_rotation</key>
|
||||||
@@ -140,7 +140,7 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>id</key>
|
<key>id</key>
|
||||||
<value>blocks_file_sink_0</value>
|
<value>blocks_file_sink_0_0</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>type</key>
|
<key>type</key>
|
||||||
@@ -155,53 +155,6 @@
|
|||||||
<value>1</value>
|
<value>1</value>
|
||||||
</param>
|
</param>
|
||||||
</block>
|
</block>
|
||||||
<block>
|
|
||||||
<key>blocks_message_strobe</key>
|
|
||||||
<param>
|
|
||||||
<key>alias</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>comment</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>affinity</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_enabled</key>
|
|
||||||
<value>True</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_coordinate</key>
|
|
||||||
<value>(48, 131)</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_rotation</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>id</key>
|
|
||||||
<value>blocks_message_strobe_0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>maxoutbuf</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>msg</key>
|
|
||||||
<value>pmt.intern("".join("x" for i in range(pdu_length)))</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>minoutbuf</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>period</key>
|
|
||||||
<value>interval</value>
|
|
||||||
</param>
|
|
||||||
</block>
|
|
||||||
<block>
|
<block>
|
||||||
<key>blocks_multiply_const_vxx</key>
|
<key>blocks_multiply_const_vxx</key>
|
||||||
<param>
|
<param>
|
||||||
@@ -277,11 +230,11 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_coordinate</key>
|
<key>_coordinate</key>
|
||||||
<value>(232, 545)</value>
|
<value>(296, 313)</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_rotation</key>
|
<key>_rotation</key>
|
||||||
<value>0</value>
|
<value>180</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>id</key>
|
<key>id</key>
|
||||||
@@ -300,100 +253,6 @@
|
|||||||
<value>1</value>
|
<value>1</value>
|
||||||
</param>
|
</param>
|
||||||
</block>
|
</block>
|
||||||
<block>
|
|
||||||
<key>blocks_null_sink</key>
|
|
||||||
<param>
|
|
||||||
<key>alias</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>bus_conns</key>
|
|
||||||
<value>[[0,],]</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>comment</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>affinity</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_enabled</key>
|
|
||||||
<value>True</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_coordinate</key>
|
|
||||||
<value>(480, 633)</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_rotation</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>id</key>
|
|
||||||
<value>blocks_null_sink_1</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>type</key>
|
|
||||||
<value>float</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>num_inputs</key>
|
|
||||||
<value>1</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>vlen</key>
|
|
||||||
<value>1</value>
|
|
||||||
</param>
|
|
||||||
</block>
|
|
||||||
<block>
|
|
||||||
<key>blocks_pdu_to_tagged_stream</key>
|
|
||||||
<param>
|
|
||||||
<key>alias</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>comment</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>affinity</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_enabled</key>
|
|
||||||
<value>True</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_coordinate</key>
|
|
||||||
<value>(136, 635)</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_rotation</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>id</key>
|
|
||||||
<value>blocks_pdu_to_tagged_stream_0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>type</key>
|
|
||||||
<value>float</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>tag</key>
|
|
||||||
<value>packet_len</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>maxoutbuf</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>minoutbuf</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
</block>
|
|
||||||
<block>
|
<block>
|
||||||
<key>parameter</key>
|
<key>parameter</key>
|
||||||
<param>
|
<param>
|
||||||
@@ -427,7 +286,7 @@ Else: 0</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>short_id</key>
|
<key>short_id</key>
|
||||||
<value></value>
|
<value>c</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>type</key>
|
<key>type</key>
|
||||||
@@ -533,7 +392,7 @@ Else: 0</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>short_id</key>
|
<key>short_id</key>
|
||||||
<value></value>
|
<value>e</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>type</key>
|
<key>type</key>
|
||||||
@@ -603,6 +462,65 @@ Else: 0</value>
|
|||||||
<value>0</value>
|
<value>0</value>
|
||||||
</param>
|
</param>
|
||||||
</block>
|
</block>
|
||||||
|
<block>
|
||||||
|
<key>foo_periodic_msg_source</key>
|
||||||
|
<param>
|
||||||
|
<key>alias</key>
|
||||||
|
<value></value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>comment</key>
|
||||||
|
<value></value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>affinity</key>
|
||||||
|
<value></value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>debug</key>
|
||||||
|
<value>False</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>_enabled</key>
|
||||||
|
<value>True</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>_coordinate</key>
|
||||||
|
<value>(64, 131)</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>_rotation</key>
|
||||||
|
<value>0</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>id</key>
|
||||||
|
<value>foo_periodic_msg_source_0</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>maxoutbuf</key>
|
||||||
|
<value>0</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>msg</key>
|
||||||
|
<value>pmt.intern("Hello World!")</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>minoutbuf</key>
|
||||||
|
<value>0</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>num</key>
|
||||||
|
<value>nmessages</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>interval</key>
|
||||||
|
<value>interval</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<key>quit</key>
|
||||||
|
<value>True</value>
|
||||||
|
</param>
|
||||||
|
</block>
|
||||||
<block>
|
<block>
|
||||||
<key>foo_wireshark_connector</key>
|
<key>foo_wireshark_connector</key>
|
||||||
<param>
|
<param>
|
||||||
@@ -623,15 +541,15 @@ Else: 0</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_enabled</key>
|
<key>_enabled</key>
|
||||||
<value>False</value>
|
<value>True</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_coordinate</key>
|
<key>_coordinate</key>
|
||||||
<value>(688, 195)</value>
|
<value>(96, 259)</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_rotation</key>
|
<key>_rotation</key>
|
||||||
<value>0</value>
|
<value>180</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>id</key>
|
<key>id</key>
|
||||||
@@ -685,7 +603,7 @@ Max: 0.1</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>short_id</key>
|
<key>short_id</key>
|
||||||
<value></value>
|
<value>o</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>type</key>
|
<key>type</key>
|
||||||
@@ -724,7 +642,7 @@ Max: 0.1</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_coordinate</key>
|
<key>_coordinate</key>
|
||||||
<value>(416, 139)</value>
|
<value>(416, 163)</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_rotation</key>
|
<key>_rotation</key>
|
||||||
@@ -747,53 +665,6 @@ Max: 0.1</value>
|
|||||||
<value>[0x23, 0x23, 0x23, 0x23, 0x23, 0x23]</value>
|
<value>[0x23, 0x23, 0x23, 0x23, 0x23, 0x23]</value>
|
||||||
</param>
|
</param>
|
||||||
</block>
|
</block>
|
||||||
<block>
|
|
||||||
<key>ieee802_11_ofdm_parse_mac</key>
|
|
||||||
<param>
|
|
||||||
<key>alias</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>comment</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>affinity</key>
|
|
||||||
<value></value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>debug</key>
|
|
||||||
<value>True</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_enabled</key>
|
|
||||||
<value>True</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_coordinate</key>
|
|
||||||
<value>(112, 259)</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>_rotation</key>
|
|
||||||
<value>180</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>id</key>
|
|
||||||
<value>ieee802_11_ofdm_parse_mac_0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>log</key>
|
|
||||||
<value>False</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>maxoutbuf</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<key>minoutbuf</key>
|
|
||||||
<value>0</value>
|
|
||||||
</param>
|
|
||||||
</block>
|
|
||||||
<block>
|
<block>
|
||||||
<key>import</key>
|
<key>import</key>
|
||||||
<param>
|
<param>
|
||||||
@@ -860,7 +731,7 @@ Max: 1000</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>short_id</key>
|
<key>short_id</key>
|
||||||
<value></value>
|
<value>i</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>type</key>
|
<key>type</key>
|
||||||
@@ -897,7 +768,7 @@ Max: 1500</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>id</key>
|
<key>id</key>
|
||||||
<value>pdu_length</value>
|
<value>nmessages</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>label</key>
|
<key>label</key>
|
||||||
@@ -905,7 +776,7 @@ Max: 1500</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>short_id</key>
|
<key>short_id</key>
|
||||||
<value></value>
|
<value>n</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>type</key>
|
<key>type</key>
|
||||||
@@ -913,7 +784,7 @@ Max: 1500</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>value</key>
|
<key>value</key>
|
||||||
<value>500</value>
|
<value>50</value>
|
||||||
</param>
|
</param>
|
||||||
</block>
|
</block>
|
||||||
<block>
|
<block>
|
||||||
@@ -951,7 +822,7 @@ Max: 30</value>
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>short_id</key>
|
<key>short_id</key>
|
||||||
<value></value>
|
<value>s</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>type</key>
|
<key>type</key>
|
||||||
@@ -1009,24 +880,12 @@ Max: 30</value>
|
|||||||
<value>encoding</value>
|
<value>encoding</value>
|
||||||
</param>
|
</param>
|
||||||
</block>
|
</block>
|
||||||
<connection>
|
|
||||||
<source_block_id>blocks_message_strobe_0</source_block_id>
|
|
||||||
<sink_block_id>ieee802_11_ofdm_mac_0</sink_block_id>
|
|
||||||
<source_key>strobe</source_key>
|
|
||||||
<sink_key>app in</sink_key>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<source_block_id>blocks_multiply_const_vxx_0</source_block_id>
|
<source_block_id>blocks_multiply_const_vxx_0</source_block_id>
|
||||||
<sink_block_id>channels_channel_model_0</sink_block_id>
|
<sink_block_id>channels_channel_model_0</sink_block_id>
|
||||||
<source_key>0</source_key>
|
<source_key>0</source_key>
|
||||||
<sink_key>0</sink_key>
|
<sink_key>0</sink_key>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<source_block_id>blocks_pdu_to_tagged_stream_0</source_block_id>
|
|
||||||
<sink_block_id>blocks_null_sink_1</sink_block_id>
|
|
||||||
<source_key>0</source_key>
|
|
||||||
<sink_key>0</sink_key>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<source_block_id>channels_channel_model_0</source_block_id>
|
<source_block_id>channels_channel_model_0</source_block_id>
|
||||||
<sink_block_id>wifi_phy_hier_0</sink_block_id>
|
<sink_block_id>wifi_phy_hier_0</sink_block_id>
|
||||||
@@ -1039,9 +898,21 @@ Max: 30</value>
|
|||||||
<source_key>0</source_key>
|
<source_key>0</source_key>
|
||||||
<sink_key>0</sink_key>
|
<sink_key>0</sink_key>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<source_block_id>foo_periodic_msg_source_0</source_block_id>
|
||||||
|
<sink_block_id>foo_wireshark_connector_0</sink_block_id>
|
||||||
|
<source_key>out</source_key>
|
||||||
|
<sink_key>in</sink_key>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<source_block_id>foo_periodic_msg_source_0</source_block_id>
|
||||||
|
<sink_block_id>ieee802_11_ofdm_mac_0</sink_block_id>
|
||||||
|
<source_key>out</source_key>
|
||||||
|
<sink_key>app in</sink_key>
|
||||||
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<source_block_id>foo_wireshark_connector_0</source_block_id>
|
<source_block_id>foo_wireshark_connector_0</source_block_id>
|
||||||
<sink_block_id>blocks_file_sink_0</sink_block_id>
|
<sink_block_id>blocks_file_sink_0_0</sink_block_id>
|
||||||
<source_key>0</source_key>
|
<source_key>0</source_key>
|
||||||
<sink_key>0</sink_key>
|
<sink_key>0</sink_key>
|
||||||
</connection>
|
</connection>
|
||||||
@@ -1051,12 +922,6 @@ Max: 30</value>
|
|||||||
<source_key>phy out</source_key>
|
<source_key>phy out</source_key>
|
||||||
<sink_key>mac_in</sink_key>
|
<sink_key>mac_in</sink_key>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<source_block_id>ieee802_11_ofdm_parse_mac_0</source_block_id>
|
|
||||||
<sink_block_id>blocks_pdu_to_tagged_stream_0</sink_block_id>
|
|
||||||
<source_key>fer</source_key>
|
|
||||||
<sink_key>pdus</sink_key>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<source_block_id>wifi_phy_hier_0</source_block_id>
|
<source_block_id>wifi_phy_hier_0</source_block_id>
|
||||||
<sink_block_id>blocks_null_sink_0</sink_block_id>
|
<sink_block_id>blocks_null_sink_0</sink_block_id>
|
||||||
@@ -1065,7 +930,7 @@ Max: 30</value>
|
|||||||
</connection>
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<source_block_id>wifi_phy_hier_0</source_block_id>
|
<source_block_id>wifi_phy_hier_0</source_block_id>
|
||||||
<sink_block_id>ieee802_11_ofdm_parse_mac_0</sink_block_id>
|
<sink_block_id>foo_wireshark_connector_0</sink_block_id>
|
||||||
<source_key>mac_out</source_key>
|
<source_key>mac_out</source_key>
|
||||||
<sink_key>in</sink_key>
|
<sink_key>in</sink_key>
|
||||||
</connection>
|
</connection>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##################################################
|
##################################################
|
||||||
# GNU Radio Python Flow Graph
|
# GNU Radio Python Flow Graph
|
||||||
# Title: Wifi Loopback
|
# Title: Wifi Loopback Nogui
|
||||||
# Generated: Sat Oct 31 12:11:06 2015
|
# Generated: Tue Nov 3 15:44:35 2015
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -24,19 +24,19 @@ import math
|
|||||||
import pmt
|
import pmt
|
||||||
|
|
||||||
|
|
||||||
class wifi_loopback(gr.top_block):
|
class wifi_loopback_noGUI(gr.top_block):
|
||||||
|
|
||||||
def __init__(self, chan_est=1, encoding=0, freq_offset=0, pdu_length=500, snr=10, interval=500):
|
def __init__(self, nmessages=50, chan_est=1, snr=10, freq_offset=0, encoding=0, interval=500):
|
||||||
gr.top_block.__init__(self, "Wifi Loopback")
|
gr.top_block.__init__(self, "Wifi Loopback Nogui")
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Parameters
|
# Parameters
|
||||||
##################################################
|
##################################################
|
||||||
|
self.nmessages = nmessages
|
||||||
self.chan_est = chan_est
|
self.chan_est = chan_est
|
||||||
self.encoding = encoding
|
|
||||||
self.freq_offset = freq_offset
|
|
||||||
self.pdu_length = pdu_length
|
|
||||||
self.snr = snr
|
self.snr = snr
|
||||||
|
self.freq_offset = freq_offset
|
||||||
|
self.encoding = encoding
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
@@ -51,8 +51,9 @@ class wifi_loopback(gr.top_block):
|
|||||||
encoding=encoding,
|
encoding=encoding,
|
||||||
chan_est=chan_est,
|
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.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_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, 500, 0)
|
||||||
(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(
|
||||||
@@ -63,26 +64,32 @@ class wifi_loopback(gr.top_block):
|
|||||||
noise_seed=0,
|
noise_seed=0,
|
||||||
block_tags=False
|
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_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_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_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/ofdm_n" + str(nmessages) + "_s" + str(snr) + "_e" + str(encoding) + "_i" + str(interval) + ".pcap", False)
|
||||||
|
self.blocks_file_sink_0_0.set_unbuffered(True)
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Connections
|
# Connections
|
||||||
##################################################
|
##################################################
|
||||||
self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in'))
|
self.msg_connect((self.foo_periodic_msg_source_0, 'out'), (self.foo_wireshark_connector_0, 'in'))
|
||||||
|
self.msg_connect((self.foo_periodic_msg_source_0, 'out'), (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_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_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.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_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, 0))
|
||||||
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
|
||||||
|
|
||||||
@@ -90,12 +97,13 @@ class wifi_loopback(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_encoding(self):
|
def get_snr(self):
|
||||||
return self.encoding
|
return self.snr
|
||||||
|
|
||||||
def set_encoding(self, encoding):
|
def set_snr(self, snr):
|
||||||
self.encoding = encoding
|
self.snr = snr
|
||||||
self.wifi_phy_hier_0.set_encoding(self.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")
|
||||||
|
|
||||||
def get_freq_offset(self):
|
def get_freq_offset(self):
|
||||||
return self.freq_offset
|
return self.freq_offset
|
||||||
@@ -104,26 +112,20 @@ class wifi_loopback(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_pdu_length(self):
|
def get_encoding(self):
|
||||||
return self.pdu_length
|
return self.encoding
|
||||||
|
|
||||||
def set_pdu_length(self, pdu_length):
|
def set_encoding(self, encoding):
|
||||||
self.pdu_length = pdu_length
|
self.encoding = encoding
|
||||||
self.blocks_message_strobe_0.set_msg(pmt.intern("".join("x" for i in range(self.pdu_length))))
|
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_snr(self):
|
|
||||||
return self.snr
|
|
||||||
|
|
||||||
def set_snr(self, snr):
|
|
||||||
self.snr = snr
|
|
||||||
self.blocks_multiply_const_vxx_0.set_k(((10**(self.snr/10.0))**.5, ))
|
|
||||||
|
|
||||||
def get_interval(self):
|
def get_interval(self):
|
||||||
return self.interval
|
return self.interval
|
||||||
|
|
||||||
def set_interval(self, interval):
|
def set_interval(self, interval):
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
self.blocks_message_strobe_0.set_period(self.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")
|
||||||
|
|
||||||
def get_out_buf_size(self):
|
def get_out_buf_size(self):
|
||||||
return self.out_buf_size
|
return self.out_buf_size
|
||||||
@@ -135,37 +137,32 @@ class wifi_loopback(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(
|
parser.add_option(
|
||||||
"", "--chan-est", dest="chan_est", type="intx", default=1,
|
"-n", "--nmessages", dest="nmessages", type="intx", default=50,
|
||||||
|
help="Set nmessages [default=%default]")
|
||||||
|
parser.add_option(
|
||||||
|
"-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(
|
parser.add_option(
|
||||||
"", "--encoding", dest="encoding", type="intx", default=0,
|
"-s", "--snr", dest="snr", type="eng_float", default=eng_notation.num_to_str(10),
|
||||||
help="Set encoding [default=%default]")
|
|
||||||
parser.add_option(
|
|
||||||
"", "--freq-offset", dest="freq_offset", type="eng_float", default=eng_notation.num_to_str(0),
|
|
||||||
help="Set freq_offset [default=%default]")
|
|
||||||
parser.add_option(
|
|
||||||
"", "--pdu-length", dest="pdu_length", type="intx", default=500,
|
|
||||||
help="Set pdu_length [default=%default]")
|
|
||||||
parser.add_option(
|
|
||||||
"", "--snr", dest="snr", type="eng_float", default=eng_notation.num_to_str(10),
|
|
||||||
help="Set snr [default=%default]")
|
help="Set snr [default=%default]")
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
"", "--interval", dest="interval", type="intx", default=500,
|
"-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(
|
||||||
|
"-e", "--encoding", dest="encoding", type="intx", default=0,
|
||||||
|
help="Set encoding [default=%default]")
|
||||||
|
parser.add_option(
|
||||||
|
"-i", "--interval", dest="interval", type="intx", default=500,
|
||||||
help="Set interval [default=%default]")
|
help="Set interval [default=%default]")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def main(top_block_cls=wifi_loopback, options=None):
|
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(chan_est=options.chan_est, encoding=options.encoding, freq_offset=options.freq_offset, pdu_length=options.pdu_length, snr=options.snr, interval=options.interval)
|
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.start()
|
tb.start()
|
||||||
try:
|
|
||||||
raw_input('Press Enter to quit: ')
|
|
||||||
except EOFError:
|
|
||||||
pass
|
|
||||||
tb.stop()
|
|
||||||
tb.wait()
|
tb.wait()
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user