summaryrefslogtreecommitdiff
path: root/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h
blob: 212cf0e0cfae8e4ef4dc8c9e291479fa5c3549cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* -*- c++ -*- */
/*
 * Copyright 2006,2012 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifndef INCLUDED_ANALOG_PWR_SQUELCH_FF_H
#define INCLUDED_ANALOG_PWR_SQUELCH_FF_H

#include <gnuradio/analog/api.h>
#include <gnuradio/analog/squelch_base_ff.h>
#include <cmath>

namespace gr {
namespace analog {

/*!
 * \brief gate or zero output when input power below threshold
 * \ingroup level_controllers_blk
 */
class ANALOG_API pwr_squelch_ff : public squelch_base_ff, virtual public block
{
protected:
    virtual void update_state(const float& in) = 0;
    virtual bool mute() const = 0;

public:
    // gr::analog::pwr_squelch_ff::sptr
    typedef boost::shared_ptr<pwr_squelch_ff> sptr;

    /*!
     * \brief Make power-based squelch block.
     *
     * \param db threshold (in dB) for power squelch
     * \param alpha Gain of averaging filter. Defaults to 0.0001.
     * \param ramp attack / release time in samples; a sinusodial ramp
     *             is used. set to 0 to disable.
     * \param gate if true, no output if no squelch tone.
     *             if false, output 0's if no squelch tone (default).
     *
     * The block will emit a tag with the key pmt::intern("squelch_sob")
     * with the value of pmt::PMT_NIL on the first item it passes, and with
     * the key pmt::intern("squelch:eob") on the last item it passes.
     */
    static sptr make(double db, double alpha = 0.0001, int ramp = 0, bool gate = false);

    virtual std::vector<float> squelch_range() const = 0;

    virtual double threshold() const = 0;
    virtual void set_threshold(double db) = 0;
    virtual void set_alpha(double alpha) = 0;

    virtual int ramp() const = 0;
    virtual void set_ramp(int ramp) = 0;
    virtual bool gate() const = 0;
    virtual void set_gate(bool gate) = 0;
    virtual bool unmuted() const = 0;
};

} /* namespace analog */
} /* namespace gr */

#endif /* INCLUDED_ANALOG_PWR_SQUELCH_FF_H */