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