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);
47
48 ax100_mode5(const std::vector<uint8_t>& preamble,
49 size_t preamble_threshold,
50 const std::vector<uint8_t>& sync,
51 size_t sync_threshold);
53
54 decoder_status_t decode(const void* in, int len);
55
56 void reset();
57
58 size_t input_multiple() const;
59
60private:
61 /**
62 * Decoding FSM
63 */
64 typedef enum {
65 SEARCHING, //!< when searching for the start of the preamble
66 SEARCHING_SYNC, //!< We have preamble, search for sync
67 DECODING_FRAME_LEN, //!< Decoding the frame length
68 DECODING_PAYLOAD //!< Decoding the payload
69 } decoding_state_t;
70
71 shift_reg d_preamble;
72 shift_reg d_preamble_shift_reg;
73 const size_t d_preamble_len;
74 const size_t d_preamble_thrsh;
75 shift_reg d_sync;
76 shift_reg d_sync_shift_reg;
77 const size_t d_sync_len;
78 const size_t d_sync_thrsh;
79 decoding_state_t d_state;
80 size_t d_cnt;
81 size_t d_len;
82 uint64_t d_frame_start;
83 size_t d_length_field_len;
84 uint8_t* d_pdu;
85
86 int search_preamble(const uint8_t* in, int len);
87
88 int search_sync(const uint8_t* in, int len);
89
90 int decode_frame_len(const uint8_t* in, int len);
91
92 void decode_payload(decoder_status_t& status, const uint8_t* in, int len);
93};
94
95} // namespace satnogs
96} // namespace gr
97
98#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
decoder_status_t decode(const void *in, int len)
static sptr make(const std::vector< uint8_t > &preamble, size_t preamble_threshold, const std::vector< uint8_t > &sync, size_t sync_threshold)
std::shared_ptr< ax100_mode5 > sptr
Definition ax100_mode5.h:42
ax100_mode5(const std::vector< uint8_t > &preamble, size_t preamble_threshold, const std::vector< uint8_t > &sync, size_t sync_threshold)
size_t input_multiple() const
Abstract class that provided the API for the c decoders.
Definition decoder.h:71
Implements a bit shift register.
Definition shift_reg.h:36
class decoder_status decoder_status_t
Definition decoder.h:56
Definition amsat_duv_decoder.h:29