GNU Radio's SATNOGS Package
ax25_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) 2020, 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_AX25_ENCODER_H_
22 #define INCLUDE_SATNOGS_AX25_ENCODER_H_
23 
24 
25 #include <satnogs/encoder.h>
26 
27 
28 namespace gr {
29 namespace satnogs {
30 
31 /*!
32  * \brief AX.25 frame encoder definition
33  */
35 public:
36 
37  static encoder::encoder_sptr
38  make(const std::string &dest_addr, uint8_t dest_ssid,
39  const std::string &src_addr, uint8_t src_ssid, size_t preamble_len = 16,
40  size_t postamble_len = 16, bool scramble = true,
41  bool nrzi = true);
42 
43  ax25_encoder(const std::string &dest_addr, uint8_t dest_ssid,
44  const std::string &src_addr, uint8_t src_ssid,
45  size_t preamble_len, size_t postamble_len,
46  bool scramble = true, bool nrzi = true);
47  ~ax25_encoder();
48 
49  pmt::pmt_t
50  encode(pmt::pmt_t msg);
51 
52 private:
53  const std::string d_dest_addr;
54  const uint8_t d_dest_ssid;
55  const std::string d_src_addr;
56  const uint8_t d_src_ssid;
57  const size_t d_preamble_len = 16;
58  const size_t d_postamble_len = 16;
59  const bool d_scramble;
60  const bool d_nrzi;
61 
62  size_t
63  insert_address(uint8_t *out);
64 
65  size_t
66  insert_ctrl(uint8_t *out);
67 
68  size_t
69  insert_pid(uint8_t *out);
70 };
71 
72 } // namespace satnogs
73 } // namespace gr
74 
75 #endif /* INCLUDE_SATNOGS_AX25_ENCODER_H_ */
AX.25 frame encoder definition.
Definition: ax25_encoder.h:34
Abstract class defining the API of the SatNOGS Encoders.
Definition: encoder.h:43
Definition: amsat_duv_decoder.h:29
#define SATNOGS_API
Definition: api.h:30