GNU Radio's LORA Package
encode_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2016 Bastille Networks.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_LORA_ENCODE_IMPL_H
22 #define INCLUDED_LORA_ENCODE_IMPL_H
23 
24 #include <volk/volk.h>
25 #include <bitset>
26 #include <lora/encode.h>
27 
28 namespace gr {
29  namespace lora {
30 
31  class encode_impl : public encode
32  {
33  private:
34  const unsigned short *d_whitening_sequence;
35 
36  pmt::pmt_t d_in_port;
37  pmt::pmt_t d_out_port;
38 
39  unsigned char d_sf;
40  unsigned char d_cr;
41  bool d_ldr;
42  bool d_header;
43 
44  unsigned short d_fft_size;
45  unsigned char d_interleaver_size;
46 
47  public:
48  encode_impl( short spreading_factor,
49  short code_rate,
50  bool low_data_rate,
51  bool header);
52  ~encode_impl();
53 
54  void to_gray(std::vector<unsigned short> &symbols);
55  void from_gray(std::vector<unsigned short> &symbols);
56  void whiten(std::vector<unsigned short> &symbols);
57  void interleave(std::vector<unsigned char> &codewords, std::vector<unsigned short> &symbols, unsigned char ppm, unsigned char rdd);
58  void hamming_encode(std::vector<unsigned char> &nybbles, std::vector<unsigned char> &codewords, unsigned char rdd);
59  unsigned char parity(unsigned char c, unsigned char bitmask);
60  void print_payload(std::vector<unsigned char> &payload);
61 
62  void print_bitwise_u8 (std::vector<unsigned char> &buffer);
63  void print_bitwise_u16(std::vector<unsigned short> &buffer);
64 
65  void encode(pmt::pmt_t msg);
66 
67  };
68 
69  } // namespace lora
70 } // namespace gr
71 
72 #endif /* INCLUDED_LORA_ENCODE_IMPL_H */
73 
void to_gray(std::vector< unsigned short > &symbols)
void from_gray(std::vector< unsigned short > &symbols)
void print_bitwise_u8(std::vector< unsigned char > &buffer)
void hamming_encode(std::vector< unsigned char > &nybbles, std::vector< unsigned char > &codewords, unsigned char rdd)
unsigned char parity(unsigned char c, unsigned char bitmask)
Definition: decode.h:31
void print_bitwise_u16(std::vector< unsigned short > &buffer)
Definition: encode_impl.h:31
void interleave(std::vector< unsigned char > &codewords, std::vector< unsigned short > &symbols, unsigned char ppm, unsigned char rdd)
void whiten(std::vector< unsigned short > &symbols)
<+description of block+>
Definition: encode.h:37
void print_payload(std::vector< unsigned char > &payload)
encode_impl(short spreading_factor, short code_rate, bool low_data_rate, bool header)
void encode(pmt::pmt_t msg)