GNU Radio's SATNOGS Package
waterfall_sink.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) 2017,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_WATERFALL_SINK_H
22 #define INCLUDED_SATNOGS_WATERFALL_SINK_H
23 
24 #include <satnogs/api.h>
25 #include <gnuradio/sync_block.h>
26 
27 namespace gr {
28 namespace satnogs {
29 
30 /*!
31  * \brief This block computes the waterfall of the incoming signal
32  * and stores the result to a file.
33  *
34  * The file has a special header, so plotting tools can reconstruct properly
35  * the spectrum.
36  *
37  * \ingroup satnogs
38  *
39  */
40 class SATNOGS_API waterfall_sink : virtual public gr::sync_block {
41 public:
42  typedef boost::shared_ptr<waterfall_sink> sptr;
43 
44  /**
45  * This block computes the waterfall of the incoming signal
46  * and stores the result to a file.
47  *
48  * The file has a constant sized header of 52 bytes, so that plotting tools can
49  * reconstruct properly the spectrum.
50  *
51  * The structure of the header is the following:
52  * - A 32 byte string containing the timestamp in
53  * ISO-8601 format. This timer has microsecond accuracy.
54  * - A 4 byte integer containing the sampling rate
55  * - A 4 byte integer with the FFT size
56  * - A 4 byte integer containing the number of FFT snapshots for one row
57  * at the waterfall
58  * - A 4 byte float with the center frequency of the observation.
59  * - A 4 byte integer indicating the endianness of the rest of the file. If
60  * set to 0 the file continues in Big endian. Otherwise, in little endian.
61  * The change of the endianness is performed to reduce the overhead at the
62  * station.
63  *
64  * @note All contents of the header are in Network Byte order! The rest
65  * of the file is in native byte order, mainly for performance reasons.
66  * Users can use data of the header to determine if their architecture match
67  * the architecture of the host generated the waterfall file and act
68  * accordingly.
69  *
70  * The file continues with information regarding the spectral content of the
71  * observation.
72  * Each waterfall line is prepended with a int64_t field indicating the
73  * absolute time in microseconds with respect to the start of the waterfall
74  * data (stored in the corresponding header field).
75  * The spectral content is stored in $FFT$ float values already converted in
76  * dB scale.
77  *
78  * @param samp_rate the sampling rate
79  * @param center_freq the observation center frequency. Used only for
80  * plotting reasons. For a normalized frequency x-axis set it to 0.
81  * @param rps rows per second
82  * @param fft_size FFT size
83  * @param filename the name of the output file
84  * @param mode the mode that the waterfall.
85  * - 0: Simple decimation
86  * - 1: Max hold
87  * - 2: Mean energy
88  * @return shared pointer to the object
89  */
90  static sptr
91  make(float samp_rate, float center_freq,
92  float rps, size_t fft_size,
93  const std::string &filename, int mode = 0);
94 };
95 
96 } // namespace satnogs
97 } // namespace gr
98 
99 #endif /* INCLUDED_SATNOGS_WATERFALL_SINK_H */
100 
boost::shared_ptr< waterfall_sink > sptr
Definition: waterfall_sink.h:42
This block computes the waterfall of the incoming signal and stores the result to a file...
Definition: waterfall_sink.h:40
Definition: amsat_duv_decoder.h:29
#define SATNOGS_API
Definition: api.h:30