GNU Radio's LORA_SDR Package
dewhitening_impl.h
Go to the documentation of this file.
1 #ifndef INCLUDED_LORA_DEWHITENING_IMPL_H
2 #define INCLUDED_LORA_DEWHITENING_IMPL_H
3 
4 // #define GRLORA_DEBUG
5 #include <lora_sdr/dewhitening.h>
6 
7 namespace gr {
8 namespace lora_sdr {
9 
10 class dewhitening_impl : public dewhitening {
11 private:
12  /**
13  * @brief Payload length in bytes
14  *
15  */
16  int m_payload_len;
17 
18  /**
19  * @brief indicate the presence of a CRC
20  *
21  */
22  int m_crc_presence;
23 
24  /**
25  * @brief The offset in the whitening table
26  *
27  */
28  int offset = 0;
29 
30  /**
31  * @brief The dewhitened bytes
32  *
33  */
34  std::vector<uint8_t> dewhitened;
35 
36  /**
37  * @brief Handles the payload length received from the header_decoder block.
38  *
39  * @param payload_len : payload length
40  */
41  void header_pay_len_handler(pmt::pmt_t payload_len);
42 
43  /**
44  * @brief Reset the block variables for a new frame.
45  *
46  * @param id
47  */
48  void new_frame_handler(pmt::pmt_t id);
49 
50  /**
51  * @brief Receive indication on the CRC presence
52  *
53  * @param crc_presence : control message if add_crc is active
54  */
55  void header_crc_handler(pmt::pmt_t crc_presence);
56 
57 public:
58  /**
59  * @brief Construct a new dewhitening impl object
60  *
61  */
63 
64  /**
65  * @brief Destroy the dewhitening impl object
66  *
67  */
69 
70  /**
71  * @brief standard gnuradio function to tell the system when to start work
72  *
73  * @param noutput_items : number of output items
74  * @param ninput_items_required : number of input items required
75  */
76  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
77 
78  /**
79  * @brief Main dewhitining function
80  *
81  * @param noutput_items : number of output items
82  * @param ninput_items : number of input items
83  * @param input_items : input data (i.e. header_decoder stage)
84  * @param output_items : output data
85  * @return int
86  */
87  int general_work(int noutput_items, gr_vector_int &ninput_items,
88  gr_vector_const_void_star &input_items,
89  gr_vector_void_star &output_items);
90 };
91 
92 } // namespace lora_sdr
93 } // namespace gr
94 
95 #endif /* INCLUDED_LORA_DEWHITENING_IMPL_H */
gr::lora_sdr::dewhitening_impl::forecast
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
standard gnuradio function to tell the system when to start work
gr::lora_sdr::dewhitening_impl::~dewhitening_impl
~dewhitening_impl()
Destroy the dewhitening impl object.
dewhitening.h
gr::lora_sdr::dewhitening
Dewhites the received payload, for more information about the implementation visit crc_verify_impl.
Definition: dewhitening.h:36
gr::lora_sdr::dewhitening_impl
Definition: dewhitening_impl.h:10
gr
Definition: add_crc.h:28
gr::lora_sdr::dewhitening_impl::general_work
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Main dewhitining function.
gr::lora_sdr::dewhitening_impl::dewhitening_impl
dewhitening_impl()
Construct a new dewhitening impl object.