GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
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
27#include <vector>
28
29namespace gr {
30namespace digital {
31
32/*!
33 * \brief Header utility for OFDM signals.
34 * \ingroup ofdm_blk
35 */
37{
38public:
39 typedef boost::shared_ptr<packet_header_ofdm> sptr;
40
41 packet_header_ofdm(const std::vector<std::vector<int>>& occupied_carriers,
42 int n_syms,
43 const std::string& len_tag_key,
44 const std::string& frame_len_tag_key,
45 const std::string& num_tag_key,
46 int bits_per_header_sym,
47 int bits_per_payload_sym,
48 bool scramble_header);
50
51 /*!
52 * \brief Header formatter.
53 *
54 * Does the same as packet_header_default::header_formatter(), but
55 * optionally scrambles the bits (this is more important for OFDM to avoid
56 * PAPR spikes).
57 */
58 bool
59 header_formatter(long packet_len, unsigned char* out, const std::vector<tag_t>& tags);
60
61 /*!
62 * \brief Inverse function to header_formatter().
63 *
64 * Does the same as packet_header_default::header_parser(), but
65 * adds another tag that stores the number of OFDM symbols in the
66 * packet.
67 * Note that there is usually no linear connection between the number
68 * of OFDM symbols and the packet length because a packet might
69 * finish mid-OFDM-symbol.
70 */
71 bool header_parser(const unsigned char* header, std::vector<tag_t>& tags);
72
73 /*!
74 * \param occupied_carriers See carrier allocator
75 * \param n_syms The number of OFDM symbols the header should be (usually 1)
76 * \param len_tag_key The tag key used for the packet length (number of bytes)
77 * \param frame_len_tag_key The tag key used for the frame length (number of
78 * OFDM symbols, this is the tag key required for the
79 * frame equalizer etc.)
80 * \param num_tag_key The tag key used for packet numbering.
81 * \param bits_per_header_sym Bits per complex symbol in the header, e.g. 1 if
82 * the header is BPSK modulated, 2 if it's QPSK
83 * modulated etc.
84 * \param bits_per_payload_sym Bits per complex symbol in the payload. This is
85 * required to figure out how many OFDM symbols
86 * are necessary to encode the given number of
87 * bytes.
88 * \param scramble_header Set this to true to scramble the bits. This is highly
89 * recommended, as it reduces PAPR spikes.
90 */
91 static sptr make(const std::vector<std::vector<int>>& occupied_carriers,
92 int n_syms,
93 const std::string& len_tag_key = "packet_len",
94 const std::string& frame_len_tag_key = "frame_len",
95 const std::string& num_tag_key = "packet_num",
96 int bits_per_header_sym = 1,
97 int bits_per_payload_sym = 1,
98 bool scramble_header = false);
99
100
101protected:
102 pmt::pmt_t d_frame_len_tag_key; //!< Tag key of the additional frame length tag
103 const std::vector<std::vector<int>>
104 d_occupied_carriers; //!< Which carriers/symbols carry data
106 std::vector<unsigned char>
107 d_scramble_mask; //!< Bits are xor'd with this before tx'ing
108};
109
110} // namespace digital
111} // namespace gr
112
113#endif /* INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H */
Default header formatter for digital packet transmission.
Definition packet_header_default.h:51
Header utility for OFDM signals.
Definition packet_header_ofdm.h:37
int d_bits_per_payload_sym
Definition packet_header_ofdm.h:105
bool header_parser(const unsigned char *header, std::vector< tag_t > &tags)
Inverse function to header_formatter().
const std::vector< std::vector< int > > d_occupied_carriers
Which carriers/symbols carry data.
Definition packet_header_ofdm.h:104
pmt::pmt_t d_frame_len_tag_key
Tag key of the additional frame length tag.
Definition packet_header_ofdm.h:102
static sptr make(const std::vector< std::vector< int > > &occupied_carriers, int n_syms, const std::string &len_tag_key="packet_len", const std::string &frame_len_tag_key="frame_len", const std::string &num_tag_key="packet_num", int bits_per_header_sym=1, int bits_per_payload_sym=1, bool scramble_header=false)
packet_header_ofdm(const std::vector< std::vector< int > > &occupied_carriers, int n_syms, const std::string &len_tag_key, const std::string &frame_len_tag_key, const std::string &num_tag_key, int bits_per_header_sym, int bits_per_payload_sym, bool scramble_header)
std::vector< unsigned char > d_scramble_mask
Bits are xor'd with this before tx'ing.
Definition packet_header_ofdm.h:107
boost::shared_ptr< packet_header_ofdm > sptr
Definition packet_header_ofdm.h:39
bool header_formatter(long packet_len, unsigned char *out, const std::vector< tag_t > &tags)
Header formatter.
#define DIGITAL_API
Definition gr-digital/include/gnuradio/digital/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46
boost::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition pmt.h:96