GNU Radio's SATNOGS Package
whitening.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) 2016, Libre Space Foundation <http://librespacefoundation.org/>
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_WHITENING_H
22 #define INCLUDED_SATNOGS_WHITENING_H
23 
24 #include <satnogs/api.h>
25 #include <gnuradio/digital/lfsr.h>
26 #include <boost/shared_ptr.hpp>
27 
28 namespace gr {
29 namespace satnogs {
30 
31 /*!
32  * \brief Performs data whitening and de-whitening
33  *
34  */
36 public:
37  static int base_unique_id;
38 
39  int
40  unique_id();
41 
42  typedef boost::shared_ptr<whitening> whitening_sptr;
43 
44  static whitening_sptr
45  make(uint32_t mask, uint32_t seed, uint32_t order);
46 
47  static whitening_sptr
48  make_ccsds();
49 
50  whitening(uint32_t mask, uint32_t seed, uint32_t order);
51 
52  ~whitening();
53 
54  void
55  reset();
56 
57  void
58  scramble(uint8_t *out, const uint8_t *in, size_t len, bool msb = false);
59  void
60  descramble(uint8_t *out, const uint8_t *in, size_t len, bool msb = false);
61 
62  void
63  scramble_one_bit_per_byte(uint8_t *out, const uint8_t *in, size_t bits_num);
64  void
65  descramble_one_bit_per_byte(uint8_t *out, const uint8_t *in,
66  size_t bits_num);
67 
68 private:
69  digital::lfsr d_lfsr;
70  int d_id;
71 };
72 
73 } // namespace satnogs
74 } // namespace gr
75 
76 #endif /* INCLUDED_SATNOGS_WHITENING_H */
77 
Performs data whitening and de-whitening.
Definition: whitening.h:35
static int base_unique_id
Definition: whitening.h:37
Definition: amsat_duv_decoder.h:29
#define SATNOGS_API
Definition: api.h:30