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