GNU Radio's SATNOGS Package
ax100_mode5_encoder.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) 2021, 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_AX100_MODE5_ENCODER_H
22 #define INCLUDED_SATNOGS_AX100_MODE5_ENCODER_H
23 
24 #include <satnogs/api.h>
25 #include <satnogs/encoder.h>
26 #include <satnogs/shift_reg.h>
27 #include <satnogs/crc.h>
28 
29 #include <vector>
30 
31 namespace gr {
32 namespace satnogs {
33 
34 /*!
35  * \brief This encoder implements the AX100 mode 5 framing and coding scheme
36  *
37  */
39 public:
40  static encoder::encoder_sptr
41  make(const std::vector<uint8_t> &preamble,
42  const std::vector<uint8_t> &sync,
44  bool enable_rs);
45 
46  ax100_mode5_encoder(const std::vector<uint8_t> &preamble,
47  const std::vector<uint8_t> &sync,
48  crc::crc_t crc,
49  bool enable_rs);
51 
52  pmt::pmt_t
53  encode(pmt::pmt_t msg);
54 
55 private:
56  crc::crc_t d_crc;
57  bool d_rs;
58  size_t d_payload_start;
59  uint8_t *d_pdu;
60 
61  void
62  write_16bits(uint16_t u16, size_t ind);
63 
64  void
65  write_24bits(uint32_t u32, size_t ind);
66 
67  size_t
68  add_crc(const uint8_t *pdu, size_t pdu_len, size_t ind);
69 
70 };
71 
72 } // namespace satnogs
73 } // namespace gr
74 
75 #endif /* INCLUDED_SATNOGS_AX100_MODE5_ENCODER_H */
Abstract class defining the API of the SatNOGS Encoders.
Definition: encoder.h:43
This encoder implements the AX100 mode 5 framing and coding scheme.
Definition: ax100_mode5_encoder.h:38
Definition: amsat_duv_decoder.h:29
enum gr::satnogs::crc::crc_type crc_t
Definition: crc.h:33
#define SATNOGS_API
Definition: api.h:30