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