GNU Radio 3.7.1 C++ API
|
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 <gnuradio/digital/api.h> 00027 #include <gnuradio/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 class DIGITAL_API packet_header_ofdm : public packet_header_default 00037 { 00038 public: 00039 typedef boost::shared_ptr<packet_header_ofdm> sptr; 00040 00041 packet_header_ofdm( 00042 const std::vector<std::vector<int> > &occupied_carriers, 00043 int n_syms, 00044 const std::string &len_tag_key, 00045 const std::string &frame_len_tag_key, 00046 const std::string &num_tag_key, 00047 int bits_per_header_sym, 00048 int bits_per_payload_sym); 00049 ~packet_header_ofdm(); 00050 00051 /*! 00052 * \brief Inverse function to header_formatter(). 00053 * 00054 * Does the same as packet_header_default::header_parser(), but 00055 * adds another tag that stores the number of OFDM symbols in the 00056 * packet. 00057 * Note that there is usually no linear connection between the number 00058 * of OFDM symbols and the packet length, because, a packet might 00059 * finish mid-OFDM-symbol. 00060 */ 00061 bool header_parser( 00062 const unsigned char *header, 00063 std::vector<tag_t> &tags); 00064 00065 /*! 00066 * \param occupied_carriers See carrier allocator 00067 * \param n_syms The number of OFDM symbols the header should be (usually 1) 00068 * \param len_tag_key The tag key used for the packet length (number of bytes) 00069 * \param frame_len_tag_key The tag key used for the frame length (number of 00070 * OFDM symbols, this is the tag key required for the 00071 * frame equalizer etc.) 00072 * \param num_tag_key The tag key used for packet numbering. 00073 * \param bits_per_header_sym Bits per complex symbol in the header, e.g. 1 if 00074 * the header is BPSK modulated, 2 if it's QPSK 00075 * modulated etc. 00076 * \param bits_per_payload_sym Bits per complex symbol in the payload. This is 00077 * required to figure out how many OFDM symbols 00078 * are necessary to encode the given number of 00079 * bytes. 00080 */ 00081 static sptr make( 00082 const std::vector<std::vector<int> > &occupied_carriers, 00083 int n_syms, 00084 const std::string &len_tag_key="packet_len", 00085 const std::string &frame_len_tag_key="frame_len", 00086 const std::string &num_tag_key="packet_num", 00087 int bits_per_header_sym=1, 00088 int bits_per_payload_sym=1 00089 ); 00090 00091 00092 protected: 00093 pmt::pmt_t d_frame_len_tag_key; 00094 const std::vector<std::vector<int> > d_occupied_carriers; //!< Which carriers/symbols carry data 00095 int d_syms_per_set; //!< Helper variable: Total number of elements in d_occupied_carriers 00096 int d_bits_per_payload_sym; 00097 }; 00098 00099 } // namespace digital 00100 } // namespace gr 00101 00102 #endif /* INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H */ 00103