GNU Radio's SATNOGS Package
cw_decoder.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
4  *
5  * Copyright (C) 2019, Libre Space Foundation <http://libre.space>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef INCLUDED_SATNOGS_CW_DECODER_H
22 #define INCLUDED_SATNOGS_CW_DECODER_H
23 
24 #include <satnogs/api.h>
25 #include <satnogs/decoder.h>
26 #include <satnogs/moving_sum.h>
28 #include <gnuradio/fft/fft.h>
29 #include <cstdlib>
30 #include <vector>
31 #include <deque>
32 
33 
34 
35 namespace gr {
36 namespace satnogs {
37 
38 /*!
39  * \brief CW decoder based on overlapping FFT
40  *
41  */
42 class SATNOGS_API cw_decoder : public decoder {
43 public:
44  static decoder::decoder_sptr
45  make(double samp_rate, int fft_len,
46  int overlapping,
47  float wpm = 22.0,
48  float snr = 10.0,
49  float confidence = 0.9,
50  size_t channels = 16,
51  size_t min_frame_size = 5,
52  size_t max_frame_size = 256);
53 
54  cw_decoder(double samp_rate,
55  int fft_len,
56  int overlapping,
57  float wpm,
58  float snr,
59  float confidence,
60  size_t channels,
61  size_t min_frame_size,
62  size_t max_frame_size);
63  ~cw_decoder();
64 
65 
67  decode(const void *in, int len);
68 
69  void
70  reset();
71 
72  size_t
73  input_multiple() const;
74 
75 private:
76  const double d_samp_rate;
77  const int d_fft_len;
78  const int d_overlapping;
79  const float d_wpm;
80  const float d_snr;
81  const float d_confidence;
82  const size_t d_min_frame_size;
83  const int d_new_samples;
84  const int d_shift_len;
85  const float d_fft_duration;
86  const size_t d_dot_duration;
87  int d_channels_num;
88  int d_channel_carriers;
89  int d_nf_est_remaining;
90  int d_dirty_samples;
91  std::vector<cw_decoder_priv *>d_decoders;
92  gr::fft::fft_complex *d_fft;
93  gr_complex *d_tmp_buf;
94  float *d_nf_buf;
95  float *d_psd;
96  std::deque<decoder_status_t> d_frames;
97 
98  void
99  process_psd();
100 
101  void
102  process_windows();
103 
104  void
105  calc_nf();
106 };
107 
108 } // namespace satnogs
109 } // namespace gr
110 
111 #endif /* INCLUDED_SATNOGS_CW_DECODER_H */
112 
CW decoder based on overlapping FFT.
Definition: cw_decoder.h:42
Abstract class that provided the API for the c decoders.
Definition: decoder.h:69
Definition: amsat_duv_decoder.h:29
class decoder_status decoder_status_t
Definition: decoder.h:55
#define SATNOGS_API
Definition: api.h:30