GNU Radio 3.5.3.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2007,2011 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00020 */ 00021 00022 #ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H 00023 #define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H 00024 00025 #include <digital_api.h> 00026 #include <gr_block.h> 00027 #include <vector> 00028 00029 class digital_ofdm_insert_preamble; 00030 typedef boost::shared_ptr<digital_ofdm_insert_preamble> digital_ofdm_insert_preamble_sptr; 00031 00032 DIGITAL_API digital_ofdm_insert_preamble_sptr 00033 digital_make_ofdm_insert_preamble(int fft_length, 00034 const std::vector<std::vector<gr_complex> > &preamble); 00035 00036 /*! 00037 * \brief insert "pre-modulated" preamble symbols before each payload. 00038 * \ingroup sync_blk 00039 * \ingroup ofdm_blk 00040 * 00041 * <pre> 00042 * input 1: stream of vectors of gr_complex [fft_length] 00043 * These are the modulated symbols of the payload. 00044 * 00045 * input 2: stream of char. The LSB indicates whether the corresponding 00046 * symbol on input 1 is the first symbol of the payload or not. 00047 * It's a 1 if the corresponding symbol is the first symbol, 00048 * otherwise 0. 00049 * 00050 * N.B., this implies that there must be at least 1 symbol in the payload. 00051 * 00052 * 00053 * output 1: stream of vectors of gr_complex [fft_length] 00054 * These include the preamble symbols and the payload symbols. 00055 * 00056 * output 2: stream of char. The LSB indicates whether the corresponding 00057 * symbol on input 1 is the first symbol of a packet (i.e., the 00058 * first symbol of the preamble.) It's a 1 if the corresponding 00059 * symbol is the first symbol, otherwise 0. 00060 * </pre> 00061 * 00062 * \param fft_length length of each symbol in samples. 00063 * \param preamble vector of symbols that represent the pre-modulated preamble. 00064 */ 00065 00066 class DIGITAL_API digital_ofdm_insert_preamble : public gr_block 00067 { 00068 friend DIGITAL_API digital_ofdm_insert_preamble_sptr 00069 digital_make_ofdm_insert_preamble(int fft_length, 00070 const std::vector<std::vector<gr_complex> > &preamble); 00071 00072 protected: 00073 digital_ofdm_insert_preamble(int fft_length, 00074 const std::vector<std::vector<gr_complex> > &preamble); 00075 00076 private: 00077 enum state_t { 00078 ST_IDLE, 00079 ST_PREAMBLE, 00080 ST_FIRST_PAYLOAD, 00081 ST_PAYLOAD 00082 }; 00083 00084 int d_fft_length; 00085 const std::vector<std::vector<gr_complex> > d_preamble; 00086 state_t d_state; 00087 int d_nsymbols_output; 00088 int d_pending_flag; 00089 00090 void enter_idle(); 00091 void enter_preamble(); 00092 void enter_first_payload(); 00093 void enter_payload(); 00094 00095 00096 public: 00097 ~digital_ofdm_insert_preamble(); 00098 00099 int general_work (int noutput_items, 00100 gr_vector_int &ninput_items, 00101 gr_vector_const_void_star &input_items, 00102 gr_vector_void_star &output_items); 00103 }; 00104 00105 #endif /* INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H */