GNU Radio 3.6.5.1 C++ API
packet_header_ofdm.h
Go to the documentation of this file.
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_PACKET_HEADER_OFDM_H
23 #define INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H
24 
25 #include <vector>
26 #include <digital/api.h>
28 
29 namespace gr {
30  namespace digital {
31 
32  /*!
33  * \brief Header utility for OFDM signals.
34  * \ingroup ofdm_blk
35  *
36  */
38  {
39  public:
41 
43  const std::vector<std::vector<int> > &occupied_carriers,
44  int n_syms,
45  const std::string &len_tag_key,
46  const std::string &frame_len_tag_key,
47  const std::string &num_tag_key,
48  int bits_per_header_sym,
49  int bits_per_payload_sym);
51 
52  /*!
53  * \brief Inverse function to header_formatter().
54  *
55  * Does the same as packet_header_default::header_parser(), but
56  * adds another tag that stores the number of OFDM symbols in the
57  * packet.
58  * Note that there is usually no linear connection between the number
59  * of OFDM symbols and the packet length, because, a packet might
60  * finish mid-OFDM-symbol.
61  */
62  bool header_parser(
63  const unsigned char *header,
64  std::vector<gr_tag_t> &tags);
65 
66  /*!
67  * \param occupied_carriers See carrier allocator
68  * \param n_syms The number of OFDM symbols the header should be (usually 1)
69  * \param len_tag_key The tag key used for the packet length (number of bytes)
70  * \param frame_len_tag_key The tag key used for the frame length (number of
71  * OFDM symbols, this is the tag key required for the
72  * frame equalizer etc.)
73  * \param num_tag_key The tag key used for packet numbering.
74  * \param bits_per_header_sym Bits per complex symbol in the header, e.g. 1 if
75  * the header is BPSK modulated, 2 if it's QPSK
76  * modulated etc.
77  * \param bits_per_payload_sym Bits per complex symbol in the payload. This is
78  * required to figure out how many OFDM symbols
79  * are necessary to encode the given number of
80  * bytes.
81  */
82  static sptr make(
83  const std::vector<std::vector<int> > &occupied_carriers,
84  int n_syms,
85  const std::string &len_tag_key="packet_len",
86  const std::string &frame_len_tag_key="frame_len",
87  const std::string &num_tag_key="packet_num",
88  int bits_per_header_sym=1,
89  int bits_per_payload_sym=1
90  );
91 
92 
93  protected:
95  const std::vector<std::vector<int> > d_occupied_carriers; //!< Which carriers/symbols carry data
96  int d_syms_per_set; //!< Helper variable: Total number of elements in d_occupied_carriers
98  };
99 
100  } // namespace digital
101 } // namespace gr
102 
103 #endif /* INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H */
104