GNU Radio 3.6.4.1 C++ API
pwr_squelch_cc_impl.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_IMPL_H
24
#define INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H
25
26
#include <
analog/pwr_squelch_cc.h
>
27
#include "
squelch_base_cc_impl.h
"
28
#include <
filter/single_pole_iir.h
>
29
#include <cmath>
30
31
namespace
gr {
32
namespace
analog {
33
34
class
ANALOG_API
pwr_squelch_cc_impl
:
35
public
pwr_squelch_cc
,
squelch_base_cc_impl
36
{
37
private
:
38
double
d_threshold;
39
double
d_pwr;
40
filter::single_pole_iir<double,double,double>
d_iir;
41
42
protected
:
43
virtual
void
update_state(
const
gr_complex
&in);
44
virtual
bool
mute
()
const
{
return
d_pwr < d_threshold; }
45
46
public
:
47
pwr_squelch_cc_impl
(
double
db,
double
alpha=0.0001,
48
int
ramp=0,
bool
gate=
false
);
49
~
pwr_squelch_cc_impl
();
50
51
std::vector<float> squelch_range()
const
;
52
53
double
threshold
()
const
{
return
10*log10(d_threshold); }
54
void
set_threshold
(
double
db) { d_threshold = std::pow(10.0, db/10); }
55
void
set_alpha
(
double
alpha) { d_iir.set_taps(alpha); }
56
57
int
ramp
()
const
{
return
squelch_base_cc_impl::ramp
(); }
58
void
set_ramp
(
int
ramp) {
squelch_base_cc_impl::set_ramp
(ramp); }
59
bool
gate
()
const
{
return
squelch_base_cc_impl::gate
(); }
60
void
set_gate
(
bool
gate) {
squelch_base_cc_impl::set_gate
(gate); }
61
bool
unmuted
()
const
{
return
squelch_base_cc_impl::unmuted
(); }
62
63
int
general_work(
int
noutput_items,
64
gr_vector_int
&ninput_items,
65
gr_vector_const_void_star
&input_items,
66
gr_vector_void_star
&output_items)
67
{
68
return
squelch_base_cc_impl::general_work
(noutput_items,
69
ninput_items,
70
input_items,
71
output_items);
72
}
73
};
74
75
}
/* namespace analog */
76
}
/* namespace gr */
77
78
#endif
/* INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H */
gr-analog
lib
pwr_squelch_cc_impl.h
Generated on Sun Apr 28 2013 20:26:36 for GNU Radio 3.6.4.1 C++ API by
1.8.3.1