GNU Radio's SATNOGS Package
metadata.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 INCLUDE_SATNOGS_METADATA_H_
22 #define INCLUDE_SATNOGS_METADATA_H_
23 
24 #include <satnogs/api.h>
25 #include <satnogs/decoder.h>
26 #include <string>
27 #include <pmt/pmt.h>
28 #include <nlohmann/json.hpp>
29 #include <cstdint>
30 
31 namespace gr {
32 
33 namespace satnogs {
34 
36 public:
37 
38  typedef boost::shared_ptr<metadata> metadata_sptr;
39 
40  typedef enum key {
41  PDU = 0,
53  SNR,
60  KEYS_NUM
61  } key_t;
62 
63  static std::string
64  value(const key_t &k);
65 
66  static std::string
67  keys();
68 
69  static std::string
70  time_iso8601();
71 
72  static void
73  add_time_iso8601(pmt::pmt_t &m);
74 
75  static void
76  add_pdu(pmt::pmt_t &m, const uint8_t *in, size_t len);
77 
78  static void
79  add_crc_valid(pmt::pmt_t &m, bool valid);
80 
81  static void
82  add_sample_start(pmt::pmt_t &m, uint64_t idx);
83 
84  static void
85  add_sample_cnt(pmt::pmt_t &m, uint64_t cnt);
86 
87  static void
88  add_symbol_erasures(pmt::pmt_t &m, uint32_t cnt);
89 
90  static void
91  add_corrected_bits(pmt::pmt_t &m, uint32_t cnt);
92 
93  static void
94  add_center_freq(pmt::pmt_t &m, double offset);
95 
96  static void
97  add_freq_offset(pmt::pmt_t &m, double offset);
98 
99  static void
100  add_snr(pmt::pmt_t &m, float snr);
101 
102  static void
103  add_decoder(pmt::pmt_t &m, const std::string &name,
104  const std::string &version);
105 
106  static void
107  add_decoder(pmt::pmt_t &m, const decoder *dec);
108 
109  static void
110  add_antenna_azimuth(pmt::pmt_t &m, double azimuth);
111 
112  static void
113  add_antenna_elevation(pmt::pmt_t &m, double elevation);
114 
115  static void
116  add_antenna_polarization(pmt::pmt_t &m, std::string polarization);
117 
118  static void
119  add_phase_delay(pmt::pmt_t &m, uint64_t phase);
120 
121  static void
122  add_resampling_ratio(pmt::pmt_t &m, float ratio);
123 
124  static void
125  add_symbol_timing_error(pmt::pmt_t &m, double error);
126 
127  static nlohmann::json
128  to_json(const pmt::pmt_t &m);
129 
130  /*!
131  * Transforms the PMT metadata message of gr-satnogs to the appropriate form.
132  * The form and the storage is implementation specific
133  *
134  * @param m the message containing a dictionary of gr-satnogs matadata
135  */
136  virtual void
137  transform(pmt::pmt_t &m) = 0;
138 
139  /*!
140  * Stores to file the metadata. The form of the data depends on the
141  * implementation
142  *
143  * @param filename the full path to the metadata file
144  */
145  virtual void
146  to_file(const std::string &filename) = 0;
147 
148  /*!
149  *
150  * @return string representation of the processed metadata
151  */
152  virtual const
153  std::string to_sting() = 0;
154 
155  virtual ~metadata();
156 };
157 
158 } // namespace satnogs
159 
160 } // namespace gr
161 
162 
163 #endif /* INCLUDE_SATNOGS_METADATA_H_ */
CONSTDATA date::month dec
Definition: date.h:1900
enum gr::satnogs::metadata::key key_t
Abstract class that provided the API for the c decoders.
Definition: decoder.h:69
Definition: metadata.h:46
Definition: metadata.h:53
Definition: metadata.h:49
Definition: amsat_duv_decoder.h:29
Definition: metadata.h:51
Definition: metadata.h:50
Definition: metadata.h:47
Definition: metadata.h:43
Definition: metadata.h:54
key
Definition: metadata.h:40
#define SATNOGS_API
Definition: api.h:30
int k
Definition: decode_rs.h:71
Definition: metadata.h:35