1 /* -*- c++ -*- */
2 /* Copyright 2012 Free Software Foundation, Inc.
3  *
4  * This file is part of GNU Radio
5  *
6  * GNU Radio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * GNU Radio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GNU Radio; see the file COPYING.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H
23 #define INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H
24 
25 #include <gnuradio/digital/api.h>
26 #include <gnuradio/digital/ofdm_carrier_allocator_cvc.h>
27 #include <gnuradio/tagged_stream_block.h>
28 
29 namespace gr {
30 namespace digital {
31 
32 /*!
33  * \brief Serializes complex modulations symbols from OFDM sub-carriers
34  * \ingroup ofdm_blk
35  *
36  * \details
37  * This is the inverse block to the carrier_allocator_cvc. It outputs the
38  * complex data symbols as a tagged stream, discarding the pilot symbols.
39  *
40  * If given, two different tags are parsed: The first key (\p len_tag_key)
41  * specifies the number of OFDM symbols in the frame at the input. The
42  * second key (\p packet_len_tag_key) specifies the number of complex symbols
43  * that are coded into this frame. If given, this second key is then used
44  * at the output, otherwise, \p len_tag_key is used.
45  * If both are given, the packet length specifies the maximum number of
46  * output items, and the frame length specifies the exact number of
47  * consumed input items.
48  *
49  * It is possible to correct a carrier offset in this function by passing
50  * another tag with said offset.
51  *
52  * Input: Complex vectors of length \p fft_len
53  * Output: Complex scalars, in the same order as specified in occupied_carriers.
54  */
55 class DIGITAL_API ofdm_serializer_vcc : virtual public tagged_stream_block
56 {
57 public:
58     typedef boost::shared_ptr<ofdm_serializer_vcc> sptr;
59 
60     /*!
61      * \param fft_len FFT length
62      * \param occupied_carriers See ofdm_carrier_allocator_cvc.
63      * \param len_tag_key The key of the tag identifying the length of the input frame in
64      * OFDM symbols. \param packet_len_tag_key The key of the tag identifying the number
65      * of complex symbols in this packet. \param symbols_skipped If the first symbol is
66      * not allocated as in \p occupied_carriers[0], set this \param carr_offset_key When
67      * this block should correct a carrier offset, specify the tag key of the offset here
68      * (not necessary if following an ofdm_frame_equalizer_vcvc) \param input_is_shifted
69      * If the input has the DC carrier on index 0 (i.e. it is not FFT shifted), set this
70      * to false
71      */
72     static sptr make(int fft_len,
73                      const std::vector<std::vector<int>>& occupied_carriers,
74                      const std::string& len_tag_key = "frame_len",
75                      const std::string& packet_len_tag_key = "",
76                      int symbols_skipped = 0,
77                      const std::string& carr_offset_key = "",
78                      bool input_is_shifted = true);
79 
80     /*!
81      * \param allocator The carrier allocator block of which this shall be the inverse
82      * \param packet_len_tag_key The key of the tag identifying the number of complex
83      * symbols in this packet. \param symbols_skipped If the first symbol is not allocated
84      * as in \p occupied_carriers[0], set this \param carr_offset_key When this block
85      * should correct a carrier offset, specify the tag key of the offset here (not
86      * necessary if following an ofdm_frame_equalizer_vcvc) \param input_is_shifted If the
87      * input has the DC carrier on index 0 (i.e. it is not FFT shifted), set this to false
88      */
89     static sptr make(const gr::digital::ofdm_carrier_allocator_cvc::sptr& allocator,
90                      const std::string& packet_len_tag_key = "",
91                      int symbols_skipped = 0,
92                      const std::string& carr_offset_key = "",
93                      bool input_is_shifted = true);
94 };
95 
96 } // namespace digital
97 } // namespace gr
98 
99 #endif /* INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H */
100