GNU Radio's SATNOGS Package
ax100_mode5.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-2023, 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 * SPDX-License-Identifier: GNU General Public License v3.0 or later
21 */
22
23#ifndef INCLUDED_SATNOGS_AX100_MODE5_H
24#define INCLUDED_SATNOGS_AX100_MODE5_H
25
31
32namespace gr {
33namespace satnogs {
34
35/*!
36 * \brief This decode implements the AX100 mode 5 scheme
37 *
38 */
40{
41public:
42 using sptr = std::shared_ptr<ax100_mode5>;
43 static sptr make(const std::vector<uint8_t>& preamble,
44 size_t preamble_threshold,
45 const std::vector<uint8_t>& sync,
46 size_t sync_threshold,
48 whitening::sptr descrambler,
49 bool enable_rs);
50
51 ax100_mode5(const std::vector<uint8_t>& preamble,
52 size_t preamble_threshold,
53 const std::vector<uint8_t>& sync,
54 size_t sync_threshold,
56 whitening::sptr descrambler,
57 bool enable_rs);
59
60 decoder_status_t decode(const void* in, int len);
61
62 void reset();
63
64 size_t input_multiple() const;
65
66private:
67 /**
68 * Decoding FSM
69 */
70 typedef enum {
71 SEARCHING, //!< when searching for the start of the preamble
72 SEARCHING_SYNC, //!< We have preamble, search for sync
73 DECODING_FRAME_LEN, //!< Decoding the frame length
74 DECODING_PAYLOAD //!< Decoding the payload
75 } decoding_state_t;
76
77 shift_reg d_preamble;
78 shift_reg d_preamble_shift_reg;
79 const size_t d_preamble_len;
80 const size_t d_preamble_thrsh;
81 shift_reg d_sync;
82 shift_reg d_sync_shift_reg;
83 const size_t d_sync_len;
84 const size_t d_sync_thrsh;
85 crc::type d_crc;
86 whitening::sptr d_descrambler;
87 const bool d_rs;
88 decoding_state_t d_state;
89 size_t d_cnt;
90 size_t d_len;
91 uint64_t d_frame_start;
92 size_t d_length_field_len;
93 uint8_t* d_pdu;
94
95 int search_preamble(const uint8_t* in, int len);
96
97 int search_sync(const uint8_t* in, int len);
98
99 int decode_frame_len(const uint8_t* in, int len);
100
101 void decode_payload(decoder_status_t& status, const uint8_t* in, int len);
102
103 bool check_crc();
104};
105
106} // namespace satnogs
107} // namespace gr
108
109#endif /* INCLUDED_SATNOGS_AX100_MODE5_H */
#define SATNOGS_API
Definition: api.h:19
This decode implements the AX100 mode 5 scheme.
Definition: ax100_mode5.h:40
static sptr make(const std::vector< uint8_t > &preamble, size_t preamble_threshold, const std::vector< uint8_t > &sync, size_t sync_threshold, crc::type crc, whitening::sptr descrambler, bool enable_rs)
decoder_status_t decode(const void *in, int len)
std::shared_ptr< ax100_mode5 > sptr
Definition: ax100_mode5.h:42
size_t input_multiple() const
ax100_mode5(const std::vector< uint8_t > &preamble, size_t preamble_threshold, const std::vector< uint8_t > &sync, size_t sync_threshold, crc::type crc, whitening::sptr descrambler, bool enable_rs)
Definition: crc.h:44
type
Predefined CRC types.
Definition: crc.h:51
Abstract class that provided the API for the c decoders.
Definition: decoder.h:71
Implements a bit shift register.
Definition: shift_reg.h:36
std::shared_ptr< whitening > sptr
Definition: whitening.h:42
class decoder_status decoder_status_t
Definition: decoder.h:56
Definition: amsat_duv_decoder.h:29