GNU Radio's MESA Package
AutoDopplerCorrect_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_AUTODOPPLERCORRECT_IMPL_H
22 #define INCLUDED_MESA_AUTODOPPLERCORRECT_IMPL_H
23 
25 #include <chrono>
26 #include <ctime>
27 #include "signals_mesa.h"
28 #include <gnuradio/fxpt_nco.h>
29 
30 using namespace MesaSignals;
31 
32 #define AUTODOPPLER_METHOD_CLOSESTSIGNAL 1
33 #define AUTODOPPLER_METHOD_BOXOUTSIDEIN 2
34 
35 namespace gr {
36  namespace mesa {
37 
39  {
40  protected:
41  boost::mutex d_mutex;
42 
45 
46  gr::fxpt_nco d_nco;
47 
48  gr_complex *pMsgOutBuff;
50 
51  float d_sampleRate;
52  float d_gain;
53  float d_centerFreq;
54  float d_maxDrift;
58 
60  int d_fftSize;
61  float d_minWidthHz;
62  float d_maxWidthHz;
64  float d_holdUpSec;
65 
67 
68  std::chrono::time_point<std::chrono::steady_clock> lastSeen, lastShifted;
69 
70  virtual void sendMessageData(gr_complex *data,long datasize, float signalCenterFreq, float signalWidth, float maxPower, pmt::pmt_t *pMetadata);
71  void sendState(bool state);
72 
73  public:
74  AutoDopplerCorrect_impl(float freq, float sampleRate, float maxDrift, float minWidth, float expectedWidth, int shiftHolddownMS, int fft_size,
75  float squelchThreshold, int framesToAvg, float holdUpSec, bool processMessages, int detectionMethod);
77 
78  void setup_rpc();
79 
80  virtual bool stop();
81 
82  // Needed to be public for debug testing
83  virtual int processData(int noutput_items,const gr_complex *in,gr_complex *out, pmt::pmt_t *pMetadata, bool testMode=false);
84 
85  void handleMsgIn(pmt::pmt_t msg);
86 
87  // Where all the action really happens
88  int work(int noutput_items,
89  gr_vector_const_void_star &input_items,
90  gr_vector_void_star &output_items);
91 
92  virtual float getSquelch() const;
93  virtual void setSquelch(float newValue);
94 
95  virtual float getCenterFrequency() const;
96  virtual void setCenterFrequency(float newValue);
97 
98  virtual float getMinWidthHz() const;
99  virtual void setMinWidthHz(float newValue);
100 
101  virtual float getExpectedWidth() const;
102  virtual void setExpectedWidth(float newValue);
103 
104  virtual float getMaxDrift() const;
105  virtual void setMaxDrift(float newValue);
106 
107  };
108 
109  } // namespace mesa
110 } // namespace gr
111 
112 #endif /* INCLUDED_MESA_AUTODOPPLERCORRECT_IMPL_H */
113 
float d_sampleRate
Definition: AutoDopplerCorrect_impl.h:51
int d_framesToAvg
Definition: AutoDopplerCorrect_impl.h:59
float d_maxWidthHz
Definition: AutoDopplerCorrect_impl.h:62
EnergyAnalyzer * pEnergyAnalyzer
Definition: AutoDopplerCorrect_impl.h:43
gr_complex * pMsgOutBuff
Definition: AutoDopplerCorrect_impl.h:48
boost::mutex d_mutex
Definition: AutoDopplerCorrect_impl.h:41
gr::fxpt_nco d_nco
Definition: AutoDopplerCorrect_impl.h:46
int d_detectionMethod
Definition: AutoDopplerCorrect_impl.h:44
int msgBufferSize
Definition: AutoDopplerCorrect_impl.h:49
float d_expectedWidth
Definition: AutoDopplerCorrect_impl.h:55
bool d_processMessages
Definition: AutoDopplerCorrect_impl.h:57
Definition: AutoDopplerCorrect_impl.h:38
bool d_startInitialized
Definition: AutoDopplerCorrect_impl.h:63
std::chrono::time_point< std::chrono::steady_clock > lastShifted
Definition: AutoDopplerCorrect_impl.h:68
Definition: AutoDopplerCorrect.h:28
float d_minWidthHz
Definition: AutoDopplerCorrect_impl.h:61
int d_shiftHolddownMS
Definition: AutoDopplerCorrect_impl.h:56
float d_gain
Definition: AutoDopplerCorrect_impl.h:52
float d_centerFreq
Definition: AutoDopplerCorrect_impl.h:53
int d_fftSize
Definition: AutoDopplerCorrect_impl.h:60
Definition: signals_mesa.h:33
<+description of block+>
Definition: AutoDopplerCorrect.h:36
float d_maxDrift
Definition: AutoDopplerCorrect_impl.h:54
float d_currentFreqShiftDelta
Definition: AutoDopplerCorrect_impl.h:66
float d_holdUpSec
Definition: AutoDopplerCorrect_impl.h:64
Definition: signals_mesa.h:171