GNU Radio's SATNOGS Package
cw_decoder_priv.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 CW_DECODER_PRIV_H_
22#define CW_DECODER_PRIV_H_
23
29#include <pmt/pmt.h>
30#include <string>
31
32namespace gr {
33namespace satnogs {
34
35/**
36 * \brief Helper class for the CW decoder.
37 *
38 * Helper class for the CW decoder. This class performs the actual decoding.
39 *
40 */
42{
43public:
44 cw_decoder_priv(double freq,
45 float confidence,
46 size_t dot_duration,
47 size_t min_len,
48 size_t max_len);
49
51
52 decoder_status_t decode(float newval, float snr);
53
54 void reset();
55
56private:
57 typedef enum { NO_SYNC, SEARCH_DOT, SEARCH_DASH, SEARCH_SPACE } cw_dec_state_t;
58
59 const double d_freq;
60 const float d_confidence;
61 const size_t d_dot_duration;
62 const size_t d_dash_duration;
63 const size_t d_short_pause_duration;
64 const size_t d_long_pause_duration;
65 const size_t d_min_len;
66 const size_t d_max_len;
67 const float d_trigger_level;
68 size_t d_width;
69 morse_tree d_morse_tree;
70 std::string d_str;
71 cw_dec_state_t d_state;
72 float d_snr;
73 /**
74 * Moving sum for the SNR above threshold triggers
75 */
76 moving_sum<float> d_movs;
77 /**
78 * Local standard deviation of the triggers
79 */
80 moving_sum<float> d_std_movs;
81 /**
82 * Moving sum for the calculation of the local std
83 */
84 moving_sum<float> d_std_sq_movs;
85 gr::logger_ptr d_logger;
86
87 inline bool is_triggered(float meanval, float cv);
88
89 inline bool check_conf_level(size_t cnt, size_t target);
90
91 inline void enter_no_sync();
92
93 inline void enter_search_dot();
94
95 inline void enter_search_dash();
96
97 inline void enter_search_space();
98
99 inline void reset_snr_stats();
100
101
102 std::string received_symbol(morse_symbol_t s);
103};
104
105} /* namespace satnogs */
106} /* namespace gr */
107
108#endif /* CW_DECODER_PRIV_H_ */
#define SATNOGS_API
Definition: api.h:19
Helper class for the CW decoder.
Definition: cw_decoder_priv.h:42
cw_decoder_priv(double freq, float confidence, size_t dot_duration, size_t min_len, size_t max_len)
decoder_status_t decode(float newval, float snr)
A Binary tree representation of the Morse coding scheme. Left transitions occur when a dot is receive...
Definition: morse_tree.h:64
data_t s[NROOTS]
Definition: decode_rs.h:75
morse_symbol_t
Definition: morse.h:28
class decoder_status decoder_status_t
Definition: decoder.h:56
Definition: amsat_duv_decoder.h:29