GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
pwr_squelch_cc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006,2012 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 INCLUDED_ANALOG_PWR_SQUELCH_CC_H
24 #define INCLUDED_ANALOG_PWR_SQUELCH_CC_H
25 
26 #include <gnuradio/analog/api.h>
28 #include <cmath>
29 
30 namespace gr {
31 namespace analog {
32 
33 /*!
34  * \brief gate or zero output when input power below threshold
35  * \ingroup level_controllers_blk
36  */
37 class ANALOG_API pwr_squelch_cc : public squelch_base_cc, virtual public block
38 {
39 protected:
40  virtual void update_state(const gr_complex& in) = 0;
41  virtual bool mute() const = 0;
42 
43 public:
44  // gr::analog::pwr_squelch_cc::sptr
45  typedef boost::shared_ptr<pwr_squelch_cc> sptr;
46 
47  /*!
48  * \brief Make power-based squelch block.
49  *
50  * \param db threshold (in dB) for power squelch
51  * \param alpha Gain of averaging filter. Defaults to 0.0001.
52  * \param ramp attack / release time in samples; a sinusodial ramp
53  * is used. set to 0 to disable.
54  * \param gate if true, no output if no squelch tone.
55  * if false, output 0's if no squelch tone (default).
56  *
57  * The block will emit a tag with the key pmt::intern("squelch_sob")
58  * with the value of pmt::PMT_NIL on the first item it passes, and with
59  * the key pmt::intern("squelch:eob") on the last item it passes.
60  */
61  static sptr make(double db, double alpha = 0.0001, int ramp = 0, bool gate = false);
62 
63  virtual std::vector<float> squelch_range() const = 0;
64 
65  virtual double threshold() const = 0;
66  virtual void set_threshold(double db) = 0;
67  virtual void set_alpha(double alpha) = 0;
68 
69  virtual int ramp() const = 0;
70  virtual void set_ramp(int ramp) = 0;
71  virtual bool gate() const = 0;
72  virtual void set_gate(bool gate) = 0;
73  virtual bool unmuted() const = 0;
74 };
75 
76 } /* namespace analog */
77 } /* namespace gr */
78 
79 #endif /* INCLUDED_ANALOG_PWR_SQUELCH_CC_H */
gate or zero output when input power below threshold
Definition: pwr_squelch_cc.h:37
std::complex< float > gr_complex
Definition: gr_complex.h:27
boost::shared_ptr< pwr_squelch_cc > sptr
Definition: pwr_squelch_cc.h:45
basic squelch block; to be subclassed for other squelches.
Definition: squelch_base_cc.h:36
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:30
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: block.h:71