GNU Radio's MESA Package
MaxPower_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2019 ghostop14.
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef INCLUDED_MESA_MAXPOWER_IMPL_H
22#define INCLUDED_MESA_MAXPOWER_IMPL_H
23
24#include "signals_mesa.h"
25#include <boost/circular_buffer.hpp>
26#include <chrono>
27#include <ctime>
28#include <mesa/MaxPower.h>
29
30using namespace MesaSignals;
31
32namespace gr {
33namespace mesa {
34
35class MaxPower_impl : public MaxPower {
36private:
37 // Nothing to declare in this block.
38 boost::mutex d_mutex;
39 EnergyAnalyzer *pEnergyAnalyzer;
40 double d_sampleRate;
41 int d_framesToAvg;
42 float d_squelchThreshold;
43
44 int d_fftSize;
45
46 bool d_produceOut;
47
48 int iBufferCapacity;
49
50 boost::circular_buffer<float> *maxBuffer;
51
52 bool d_startInitialized;
53 float d_holdUpSec;
54 bool curState;
55 float d_stateThreshold;
56 std::chrono::time_point<std::chrono::steady_clock> holdTime;
57
58 virtual void handleMsgIn(pmt::pmt_t msg);
59
60 virtual int processData(int noutput_items, const gr_complex *in);
61 virtual void sendState(bool state);
62
63 virtual float calcAverage();
64
65public:
66 MaxPower_impl(double sampleRate, int fft_size, float squelchThreshold,
67 float framesToAvg, bool produceOut, float stateThreshold,
68 float holdUpSec);
70
71 void setup_rpc();
72 virtual float getSquelchThreshold() const;
73 virtual void setSquelchThreshold(float newValue);
74 virtual float getStateThreshold() const;
75 virtual void setStateThreshold(float newValue);
76 virtual float getHoldTime() const;
77 virtual void setHoldTime(float newValue);
78
79 virtual bool stop();
80
81 // Where all the action really happens
82 int work(int noutput_items, gr_vector_const_void_star &input_items,
83 gr_vector_void_star &output_items);
84};
85
86} // namespace mesa
87} // namespace gr
88
89#endif /* INCLUDED_MESA_MAXPOWER_IMPL_H */
Definition signals_mesa.h:175
virtual void setHoldTime(float newValue)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
virtual void setSquelchThreshold(float newValue)
virtual float getStateThreshold() const
virtual void setStateThreshold(float newValue)
MaxPower_impl(double sampleRate, int fft_size, float squelchThreshold, float framesToAvg, bool produceOut, float stateThreshold, float holdUpSec)
virtual float getHoldTime() const
virtual float getSquelchThreshold() const
<+description of block+>
Definition MaxPower.h:35
Definition signals_mesa.h:33
Definition AutoDopplerCorrect.h:28
Definition AutoDopplerCorrect.h:27