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 <mesa/MaxPower.h>
25 #include "signals_mesa.h"
26 #include <boost/circular_buffer.hpp>
27 #include <chrono>
28 #include <ctime>
29 
30 using namespace MesaSignals;
31 
32 namespace gr {
33  namespace mesa {
34 
35  class MaxPower_impl : public MaxPower
36  {
37  private:
38  // Nothing to declare in this block.
39  boost::mutex d_mutex;
40  EnergyAnalyzer *pEnergyAnalyzer;
41  float d_sampleRate;
42  int d_framesToAvg;
43  float d_squelchThreshold;
44 
45  int d_fftSize;
46 
47  bool d_produceOut;
48 
49  int iBufferCapacity;
50 
51  boost::circular_buffer<float> *maxBuffer;
52 
53  bool d_startInitialized;
54  float d_holdUpSec;
55  bool curState;
56  float d_stateThreshold;
57  std::chrono::time_point<std::chrono::steady_clock> holdTime;
58 
59  virtual void handleMsgIn(pmt::pmt_t msg);
60 
61  virtual int processData(int noutput_items,const gr_complex *in);
62  virtual void sendState(bool state);
63 
64  virtual float calcAverage();
65 
66  public:
67  MaxPower_impl(float sampleRate, int fft_size, float squelchThreshold, float framesToAvg, bool produceOut, float stateThreshold, float holdUpSec);
68  ~MaxPower_impl();
69 
70  void setup_rpc();
71  virtual float getSquelchThreshold() const;
72  virtual void setSquelchThreshold(float newValue);
73  virtual float getStateThreshold() const;
74  virtual void setStateThreshold(float newValue);
75  virtual float getHoldTime() const;
76  virtual void setHoldTime(float newValue);
77 
78 
79 
80  virtual bool stop();
81 
82 
83  // Where all the action really happens
84  int work(int noutput_items,
85  gr_vector_const_void_star &input_items,
86  gr_vector_void_star &output_items);
87  };
88 
89  } // namespace mesa
90 } // namespace gr
91 
92 #endif /* INCLUDED_MESA_MAXPOWER_IMPL_H */
93 
<+description of block+>
Definition: MaxPower.h:36
Definition: AutoDopplerCorrect.h:28
Definition: MaxPower_impl.h:35
Definition: signals_mesa.h:33
Definition: signals_mesa.h:171