GNU Radio 3.6.5 C++ API

packet_header_ofdm.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /* Copyright 2012 Free Software Foundation, Inc.
00003  * 
00004  * This file is part of GNU Radio
00005  * 
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  * 
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H
00023 #define INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H
00024 
00025 #include <vector>
00026 #include <digital/api.h>
00027 #include <digital/packet_header_default.h>
00028 
00029 namespace gr {
00030   namespace digital {
00031 
00032     /*!
00033      * \brief Header utility for OFDM signals.
00034      * \ingroup ofdm_blk
00035      *
00036      */
00037     class DIGITAL_API packet_header_ofdm : public packet_header_default
00038     {
00039      public:
00040       typedef boost::shared_ptr<packet_header_ofdm> sptr;
00041 
00042       packet_header_ofdm(
00043                       const std::vector<std::vector<int> > &occupied_carriers,
00044                       int n_syms,
00045                       const std::string &len_tag_key,
00046                       const std::string &frame_len_tag_key,
00047                       const std::string &num_tag_key,
00048                       int bits_per_header_sym,
00049                       int bits_per_payload_sym);
00050       ~packet_header_ofdm();
00051 
00052       /*!
00053        * \brief Inverse function to header_formatter().
00054        *
00055        * Does the same as packet_header_default::header_parser(), but
00056        * adds another tag that stores the number of OFDM symbols in the
00057        * packet.
00058        * Note that there is usually no linear connection between the number
00059        * of OFDM symbols and the packet length, because, a packet might
00060        * finish mid-OFDM-symbol.
00061        */
00062       bool header_parser(
00063         const unsigned char *header,
00064         std::vector<gr_tag_t> &tags);
00065 
00066       /*!
00067        * \param occupied_carriers See carrier allocator
00068        * \param n_syms The number of OFDM symbols the header should be (usually 1)
00069        * \param len_tag_key The tag key used for the packet length (number of bytes)
00070        * \param frame_len_tag_key The tag key used for the frame length (number of
00071        *                          OFDM symbols, this is the tag key required for the
00072        *                          frame equalizer etc.)
00073        * \param num_tag_key The tag key used for packet numbering.
00074        * \param bits_per_header_sym Bits per complex symbol in the header, e.g. 1 if
00075        *                            the header is BPSK modulated, 2 if it's QPSK
00076        *                            modulated etc.
00077        * \param bits_per_payload_sym Bits per complex symbol in the payload. This is
00078        *                             required to figure out how many OFDM symbols
00079        *                             are necessary to encode the given number of
00080        *                             bytes.
00081        */
00082       static sptr make(
00083             const std::vector<std::vector<int> > &occupied_carriers,
00084             int n_syms,
00085             const std::string &len_tag_key="packet_len",
00086             const std::string &frame_len_tag_key="frame_len",
00087             const std::string &num_tag_key="packet_num",
00088             int bits_per_header_sym=1,
00089             int bits_per_payload_sym=1
00090       );
00091 
00092 
00093      protected:
00094       pmt::pmt_t d_frame_len_tag_key;
00095       const std::vector<std::vector<int> > d_occupied_carriers; //!< Which carriers/symbols carry data
00096       int d_syms_per_set; //!< Helper variable: Total number of elements in d_occupied_carriers
00097       int d_bits_per_payload_sym;
00098     };
00099 
00100   } // namespace digital
00101 } // namespace gr
00102 
00103 #endif /* INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H */
00104