GNU Radio's LORA_SDR Package
add_crc_impl.h
Go to the documentation of this file.
1#ifndef INCLUDED_LORA_ADD_CRC_IMPL_H
2#define INCLUDED_LORA_ADD_CRC_IMPL_H
3
4#include <lora_sdr/add_crc.h>
5#include "helpers.h"
6namespace gr {
7namespace lora_sdr {
8
9class add_crc_impl : public add_crc {
10private:
11/**
12 * @brief indicate the presence of a payload CRC
13 *
14 */
15 bool m_has_crc;
16
17 /**
18 * @brief payload data
19 *
20 */
21 std::vector<uint8_t> m_payload;
22
23 /**
24 * @brief length of the payload in Bytes
25 *
26 */
27 uint8_t m_payload_len;
28
29 /**
30 * @brief length of the frame in number of gnuradio items
31 *
32 */
33 int m_frame_len;
34
35 /**
36 * @brief counter of the number of symbol in frame
37 *
38 */
39 int m_cnt;
40
41 /**
42 * @brief Calculates the crc value for a given byte
43 *
44 * @param crcValue : current crc value
45 * @param newByte : byte for calculate the crc value for
46 * @return unsigned int
47 */
48 unsigned int crc16(unsigned int crcValue, unsigned char newByte);
49
50public:
51/**
52 * @brief Construct a new add crc impl object
53 *
54 * @param has_crc : boolean if crc is turned on or not
55 */
56 add_crc_impl(bool has_crc);
57
58 /**
59 * @brief Destroy the add crc impl object
60 *
61 */
63
64 /**
65 * @brief Standard gnuradio function for telling the scheduler how many input items are needed
66 *
67 * @param noutput_items number of input items
68 * @param ninput_items_required minimum items required
69 */
70 void forecast(int noutput_items, gr_vector_int &ninput_items_required);
71
72 /**
73 * @brief stanard gnuradio function that does the actual computations
74 *
75 * @param noutput_items number of output items
76 * @param ninput_items number of input items
77 * @param input_items input items (input data)
78 * @param output_items output items (output data)
79 * @return int
80 */
81 int general_work(int noutput_items, gr_vector_int &ninput_items,
82 gr_vector_const_void_star &input_items,
83 gr_vector_void_star &output_items);
84};
85} // namespace lora_sdr
86} // namespace gr
87
88#endif /* INCLUDED_LORA_ADD_CRC_IMPL_H */
Definition: add_crc_impl.h:9
add_crc_impl(bool has_crc)
Construct a new add crc impl object.
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
stanard gnuradio function that does the actual computations
~add_crc_impl()
Destroy the add crc impl object.
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
Standard gnuradio function for telling the scheduler how many input items are needed.
This block adds LoRa CRC (Cyclic redundancy check) into the payload if boolean has_crc is True,...
Definition: add_crc.h:38
Definition: add_crc.h:28