GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
burst_shaper.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 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
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef BURST_SHAPER_H
24 #define BURST_SHAPER_H
25 
26 #include <gnuradio/block.h>
27 #include <gnuradio/digital/api.h>
28 
29 namespace gr {
30 namespace digital {
31 
32 /*!
33  * \brief Burst shaper block for applying burst padding and ramping.
34  * \ingroup packet_operators_blk
35  *
36  * \details
37  *
38  * This block applies a configurable amount of zero padding before
39  * and/or after a burst indicated by tagged stream length tags.
40  *
41  * If phasing symbols are used, an alternating pattern of +1/-1
42  * symbols of length ceil(N/2) will be inserted before and after
43  * each burst, where N is the length of the taps vector. The ramp-
44  * up/ramp-down shape will be applied to these phasing symbols.
45  *
46  * If phasing symbols are not used, the taper will be applied
47  * directly to the head and tail of each burst.
48  *
49  * Length tags will be updated to include the length of any added
50  * zero padding or phasing symbols and will be placed at the
51  * beginning of the modified tagged stream. Any other tags found at
52  * the same offset as a length tag will also be placed at the
53  * beginning of the modified tagged stream, since these tags are
54  * assumed to be associated with the burst rather than a specific
55  * sample. For example, if "tx_time" tags are used to control
56  * bursts, their offsets should be consistent with their associated
57  * burst's length tags. Tags at other offsets will be placed with
58  * the samples on which they were found.
59  *
60  * \li input: stream of T
61  * \li output: stream of T
62  */
63 template <class T>
64 class DIGITAL_API burst_shaper : virtual public block
65 {
66 public:
67  typedef boost::shared_ptr<burst_shaper<T>> sptr;
68 
69  /*!
70  * Make a burst shaper block.
71  *
72  * \param taps: vector of window taper taps; the first ceil(N/2)
73  * items are the up flank and the last ceil(N/2)
74  * items are the down flank. If taps.size() is odd,
75  * the middle tap will be used as the last item of
76  * the up flank and first item of the down flank.
77  * \param pre_padding: number of zero samples to insert before
78  * the burst.
79  * \param post_padding: number of zero samples to append after
80  * the burst.
81  * \param insert_phasing: if true, insert alternating +1/-1
82  * pattern of length ceil(N/2) before and
83  * after the burst and apply ramp up and
84  * ramp down taps, respectively, to the
85  * inserted patterns instead of the head
86  * and tail items of the burst.
87  * \param length_tag_name: the name of the tagged stream length
88  * tag key.
89  */
90  static sptr make(const std::vector<T>& taps,
91  int pre_padding = 0,
92  int post_padding = 0,
93  bool insert_phasing = false,
94  const std::string& length_tag_name = "packet_len");
95 
96  /*!
97  * Returns the amount of zero padding inserted before each burst.
98  */
99  virtual int pre_padding() const = 0;
100 
101  /*!
102  * Returns the amount of zero padding inserted after each burst.
103  */
104  virtual int post_padding() const = 0;
105 
106  /*!
107  * Returns the total amount of zero padding and phasing symbols
108  * inserted before each burst.
109  */
110  virtual int prefix_length() const = 0;
111 
112  /*!
113  * Returns the total amount of zero padding and phasing symbols
114  * inserted after each burst.
115  */
116  virtual int suffix_length() const = 0;
117 };
118 
121 } // namespace digital
122 } // namespace gr
123 
124 #endif /* BURST_SHAPER_H */
burst_shaper< float > burst_shaper_ff
Definition: burst_shaper.h:119
boost::shared_ptr< burst_shaper< T > > sptr
Definition: burst_shaper.h:67
burst_shaper< gr_complex > burst_shaper_cc
Definition: burst_shaper.h:120
#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:43
static const float taps[NSTEPS+1][NTAPS]
Definition: interpolator_taps.h:9
Burst shaper block for applying burst padding and ramping.
Definition: burst_shaper.h:64
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: block.h:71