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,2022 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_WHITENING_H
22#define INCLUDED_SATNOGS_WHITENING_H
23
24#include <gnuradio/digital/lfsr.h>
26#include <memory>
27
28namespace gr {
29namespace satnogs {
30
31/*!
32 * \brief Performs data whitening and de-whitening
33 *
34 */
36{
37public:
38 static int base_unique_id;
39
40 int unique_id();
41
42 using sptr = std::shared_ptr<whitening>;
43
44 static sptr make(uint32_t mask,
45 uint32_t seed,
46 uint32_t order,
47 bool msb = false,
48 bool self_sync = false);
49
50 static sptr make_ccsds(bool msb = false);
51
52 static sptr make_g3ruh(bool msb = false);
53
54 static sptr make_none();
55
56 whitening(uint32_t mask,
57 uint32_t seed,
58 uint32_t order,
59 bool msb = false,
60 bool self_sync = false);
61
63
64 void reset();
65
66 void scramble(uint8_t* out, const uint8_t* in, size_t len);
67 void descramble(uint8_t* out, const uint8_t* in, size_t len);
68
69 void scramble_one_bit_per_byte(uint8_t* out, const uint8_t* in, size_t bits_num);
70 void descramble_one_bit_per_byte(uint8_t* out, const uint8_t* in, size_t bits_num);
71
72private:
73 const bool d_msb;
74 const bool d_self_sync;
75 digital::lfsr d_lfsr;
76 int d_id;
77};
78
79} // namespace satnogs
80} // namespace gr
81
82#endif /* INCLUDED_SATNOGS_WHITENING_H */
#define SATNOGS_API
Definition: api.h:19
Performs data whitening and de-whitening.
Definition: whitening.h:36
whitening(uint32_t mask, uint32_t seed, uint32_t order, bool msb=false, bool self_sync=false)
static sptr make_none()
void descramble_one_bit_per_byte(uint8_t *out, const uint8_t *in, size_t bits_num)
void scramble_one_bit_per_byte(uint8_t *out, const uint8_t *in, size_t bits_num)
static sptr make_g3ruh(bool msb=false)
std::shared_ptr< whitening > sptr
Definition: whitening.h:42
static int base_unique_id
Definition: whitening.h:38
static sptr make(uint32_t mask, uint32_t seed, uint32_t order, bool msb=false, bool self_sync=false)
void scramble(uint8_t *out, const uint8_t *in, size_t len)
void descramble(uint8_t *out, const uint8_t *in, size_t len)
static sptr make_ccsds(bool msb=false)
Definition: amsat_duv_decoder.h:29