Example #1
0
 def __init__(self, data, len_tag_key):
     gr.top_block.__init__(self, "ofdm_tx")
     tx_data, tags = tagged_streams.packets_to_vectors((data,), len_tag_key)
     src = blocks.vector_source_b(data, False, 1, tags)
     self.tx = ofdm_tx(packet_length_tag_key=len_tag_key, debug_log=LOG_DEBUG_INFO)
     self.sink = blocks.vector_sink_c()
     self.connect(src, self.tx, self.sink)
Example #2
0
    def __init__(self):
        gr.hier_block2.__init__(
            self, "OFDM PHY",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            gr.io_signature2(2, 2, gr.sizeof_gr_complex * 1, gr.sizeof_char))
        
        # Message Port
        self.message_port_register_hier_out("from_mac")
        self.message_port_register_hier_in("to_mac")

        # Blocks
        self.tx_pdu = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_length")
        self.tx_path = ofdm_tx(scramble_bits=True)

        self.rx_path = ofdm_rx(scramble_bits=True)
        self.rx_pdu = blocks.tagged_stream_to_pdu(blocks.byte_t, "packet_length")

        # Connections
        self.connect(self.tx_pdu, self.tx_path, self)
        self.connect(self, self.rx_path, self.rx_pdu)
        self.connect((self.rx_path, 1), (self, 1))

        # Message Connection
        self.msg_connect(self, "from_mac", self.tx_pdu, "pdus")
        self.msg_connect(self.rx_pdu, "pdus", self, "to_mac")
Example #3
0
 def test_001_tx (self):
     """ Just make sure the Tx works in general """
     len_tag_key = 'frame_len'
     n_bytes = 52
     n_samples_expected = (numpy.ceil(1.0 * (n_bytes + 4) / 6) + 3) * 80
     test_data = [random.randint(0, 255) for x in range(n_bytes)]
     tx_data, tags = tagged_streams.packets_to_vectors((test_data,), len_tag_key)
     src = blocks.vector_source_b(test_data, False, 1, tags)
     tx = ofdm_tx(packet_length_tag_key=len_tag_key)
     tx_fg = ofdm_tx_fg(test_data, len_tag_key)
     tx_fg.run()
     self.assertEqual(len(tx_fg.get_tx_samples()), n_samples_expected)