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