GNU Radio 3.6.4.1 C++ API
digital_ofdm_insert_preamble.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007,2011 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H
23 #define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H
24 
25 #include <digital_api.h>
26 #include <gr_block.h>
27 #include <vector>
28 
31 
34  const std::vector<std::vector<gr_complex> > &preamble);
35 
36 /*!
37  * \brief insert "pre-modulated" preamble symbols before each payload.
38  * \ingroup sync_blk
39  * \ingroup ofdm_blk
40  *
41  * <pre>
42  * input 1: stream of vectors of gr_complex [fft_length]
43  * These are the modulated symbols of the payload.
44  *
45  * input 2: stream of char. The LSB indicates whether the corresponding
46  * symbol on input 1 is the first symbol of the payload or not.
47  * It's a 1 if the corresponding symbol is the first symbol,
48  * otherwise 0.
49  *
50  * N.B., this implies that there must be at least 1 symbol in the payload.
51  *
52  *
53  * output 1: stream of vectors of gr_complex [fft_length]
54  * These include the preamble symbols and the payload symbols.
55  *
56  * output 2: stream of char. The LSB indicates whether the corresponding
57  * symbol on input 1 is the first symbol of a packet (i.e., the
58  * first symbol of the preamble.) It's a 1 if the corresponding
59  * symbol is the first symbol, otherwise 0.
60  * </pre>
61  *
62  * \param fft_length length of each symbol in samples.
63  * \param preamble vector of symbols that represent the pre-modulated preamble.
64  */
65 
67 {
69  digital_make_ofdm_insert_preamble(int fft_length,
70  const std::vector<std::vector<gr_complex> > &preamble);
71 
72 protected:
73  digital_ofdm_insert_preamble(int fft_length,
74  const std::vector<std::vector<gr_complex> > &preamble);
75 
76 private:
77  enum state_t {
78  ST_IDLE,
79  ST_PREAMBLE,
80  ST_FIRST_PAYLOAD,
81  ST_PAYLOAD
82  };
83 
84  int d_fft_length;
85  const std::vector<std::vector<gr_complex> > d_preamble;
86  state_t d_state;
87  int d_nsymbols_output;
88  int d_pending_flag;
89 
90  void enter_idle();
91  void enter_first_payload();
92  void enter_payload();
93 
94 
95 public:
97  void enter_preamble();
98 
99  int general_work (int noutput_items,
100  gr_vector_int &ninput_items,
101  gr_vector_const_void_star &input_items,
102  gr_vector_void_star &output_items);
103  void forecast (int noutput_items, gr_vector_int &ninput_items_required);
104 
105 };
106 
107 #endif /* INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H */