2019-09-01 16:09:35 +02:00
|
|
|
/* -*- c++ -*- */
|
|
|
|
/*
|
|
|
|
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019, Libre Space Foundation <http://libre.space>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDE_SATNOGS_METADATA_H_
|
|
|
|
#define INCLUDE_SATNOGS_METADATA_H_
|
|
|
|
|
2019-09-02 19:20:21 +02:00
|
|
|
#include <satnogs/api.h>
|
2019-09-01 16:09:35 +02:00
|
|
|
#include <string>
|
2019-09-01 21:30:57 +02:00
|
|
|
#include <pmt/pmt.h>
|
|
|
|
#include <json/json.h>
|
2019-09-02 19:20:21 +02:00
|
|
|
#include <cstdint>
|
2019-09-01 16:09:35 +02:00
|
|
|
|
|
|
|
namespace gr {
|
|
|
|
|
|
|
|
namespace satnogs {
|
|
|
|
|
|
|
|
|
2019-09-12 15:25:10 +02:00
|
|
|
class SATNOGS_API metadata {
|
2019-09-01 16:09:35 +02:00
|
|
|
public:
|
2019-09-12 15:25:10 +02:00
|
|
|
typedef enum key {
|
2019-09-02 19:20:21 +02:00
|
|
|
PDU = 0,
|
2019-09-01 16:09:35 +02:00
|
|
|
CRC_VALID,
|
|
|
|
FREQ_OFFSET,
|
2019-09-01 21:30:57 +02:00
|
|
|
CORRECTED_BITS,
|
|
|
|
TIME,
|
|
|
|
SAMPLE_START,
|
2019-09-01 22:32:59 +02:00
|
|
|
SAMPLE_CNT,
|
2019-09-02 19:20:21 +02:00
|
|
|
SYMBOL_ERASURES,
|
|
|
|
KEYS_NUM
|
2019-09-01 16:09:35 +02:00
|
|
|
} key_t;
|
|
|
|
|
|
|
|
static std::string
|
2019-09-12 15:25:10 +02:00
|
|
|
value(const key_t &k);
|
2019-09-01 21:30:57 +02:00
|
|
|
|
2019-09-02 19:20:21 +02:00
|
|
|
static std::string
|
|
|
|
keys();
|
|
|
|
|
2019-09-01 21:30:57 +02:00
|
|
|
static std::string
|
|
|
|
time_iso8601();
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_time_iso8601(pmt::pmt_t &m);
|
|
|
|
|
2019-09-02 19:20:21 +02:00
|
|
|
static void
|
|
|
|
add_pdu(pmt::pmt_t &m, const uint8_t *in, size_t len);
|
|
|
|
|
2019-09-01 21:30:57 +02:00
|
|
|
static void
|
|
|
|
add_crc_valid(pmt::pmt_t &m, bool valid);
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_sample_start(pmt::pmt_t &m, uint64_t idx);
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_sample_cnt(pmt::pmt_t &m, uint64_t cnt);
|
|
|
|
|
2019-09-01 22:32:59 +02:00
|
|
|
static void
|
|
|
|
add_symbol_erasures(pmt::pmt_t &m, uint32_t cnt);
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_corrected_bits(pmt::pmt_t &m, uint32_t cnt);
|
|
|
|
|
2019-09-01 21:30:57 +02:00
|
|
|
static Json::Value
|
2019-09-12 15:25:10 +02:00
|
|
|
to_json(const pmt::pmt_t &m);
|
2019-09-01 16:09:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace satnogs
|
|
|
|
|
|
|
|
} // namespace gr
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* INCLUDE_SATNOGS_METADATA_H_ */
|