GNU Radio's MESA Package
SignalDetector_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_SIGNALDETECTOR_IMPL_H
22 #define INCLUDED_MESA_SIGNALDETECTOR_IMPL_H
23 
24 #include "signals_mesa.h"
25 #include <chrono>
26 #include <ctime>
27 #include <mesa/SignalDetector.h>
28 
29 using namespace MesaSignals;
30 
31 #define SIGDETECTOR_METHOD_SEPARATESIGNALS 1
32 #define SIGDETECTOR_METHOD_BOXOUTSIDEIN 2
33 
34 namespace gr {
35 namespace mesa {
36 
38 protected:
39  boost::mutex d_mutex;
42 
43  gr_complex *pMsgOutBuff;
45 
46  double d_sampleRate;
47  double d_centerFreq;
48  double d_minWidthHz;
49  double d_maxWidthHz;
51 
52  int d_fftSize;
54 
56 
57  std::chrono::time_point<std::chrono::steady_clock> startup, endup;
59  float d_holdUpSec;
60 
61  // Methods
62  float calcMinDutyCycle();
63  virtual int processData(int noutput_items, const gr_complex *in,
64  gr_complex *out, pmt::pmt_t *pMetadata);
65  void sendState(bool state);
66 
67 public:
68  SignalDetector_impl(int fftsize, float squelchThreshold, double minWidthHz,
69  double maxWidthHz, double radioCenterFreq,
70  double sampleRate, float holdUpSec, int framesToAvg,
71  bool genSignalPDUs, bool enableDebug,
72  int detectionMethod);
73  virtual ~SignalDetector_impl();
74 
75  virtual bool stop();
76 
77  void handleMsgIn(pmt::pmt_t msg);
78 
79  virtual float getSquelch() const;
80  virtual void setSquelch(float newValue);
81 
82  virtual double getCenterFrequency() const;
83  virtual void setCenterFrequency(double newValue);
84 
85  virtual double getMinWidthHz() const;
86  virtual void setMinWidthHz(double newValue);
87 
88  virtual double getMaxWidthHz() const;
89  virtual void setMaxWidthHz(double newValue);
90 
91  // Where all the action really happens
92  int work(int noutput_items, gr_vector_const_void_star &input_items,
93  gr_vector_void_star &output_items);
94 };
95 
96 } // namespace mesa
97 } // namespace gr
98 
99 #endif /* INCLUDED_MESA_SIGNALDETECTOR_IMPL_H */
Definition: SignalDetector_impl.h:37
bool d_startInitialized
Definition: SignalDetector_impl.h:58
gr_complex * pMsgOutBuff
Definition: SignalDetector_impl.h:43
int d_framesToAvg
Definition: SignalDetector_impl.h:50
double d_centerFreq
Definition: SignalDetector_impl.h:47
double d_minWidthHz
Definition: SignalDetector_impl.h:48
int d_fftSize
Definition: SignalDetector_impl.h:52
bool d_enableDebug
Definition: SignalDetector_impl.h:53
Definition: AutoDopplerCorrect.h:27
double d_sampleRate
Definition: SignalDetector_impl.h:46
int d_detectionMethod
Definition: SignalDetector_impl.h:41
<+description of block+>
Definition: SignalDetector.h:35
int msgBufferSize
Definition: SignalDetector_impl.h:44
Definition: signals_mesa.h:33
double d_maxWidthHz
Definition: SignalDetector_impl.h:49
EnergyAnalyzer * pEnergyAnalyzer
Definition: SignalDetector_impl.h:40
float d_holdUpSec
Definition: SignalDetector_impl.h:59
std::chrono::time_point< std::chrono::steady_clock > startup
Definition: SignalDetector_impl.h:57
bool d_genSignalPDUs
Definition: SignalDetector_impl.h:55
boost::mutex d_mutex
Definition: SignalDetector_impl.h:39
Definition: signals_mesa.h:175