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