GNU Radio's LORA_SDR Package
crc_verif_impl.h
Go to the documentation of this file.
1#ifndef INCLUDED_LORA_CRC_VERIF_IMPL_H
2#define INCLUDED_LORA_CRC_VERIF_IMPL_H
3
5#include "helpers.h"
6
7//#define GRLORA_DEBUGV
8#define GRLORA_DEBUG
9namespace gr {
10 namespace lora_sdr {
11
13 {
14 private:
15 uint32_t m_payload_len;///< Payload length in bytes
16 bool m_crc_presence;///< Indicate if there is a payload CRC
17 uint16_t m_crc;///< The CRC calculated from the received payload
18 std::string message_str;///< The payload string
19 char m_char;///< A new char of the payload
20 bool new_frame; ///<indicate a new frame
21 std::vector<uint8_t> in_buff;///< input buffer containing the data bytes and CRC if any
22 std::chrono::high_resolution_clock::time_point t1;
23 /**
24 * @brief Boolean value to tell if we should close the program if "work_done" signal is received
25 *
26 */
27 bool m_exit;
28
29 uint32_t cnt=0;///< count the number of frame
30 /**
31 * \brief Handles the payload length received from the header_decoder block.
32 */
33 void header_pay_len_handler(pmt::pmt_t payload_len);
34 /**
35 * \brief Handles the crc_presence received from the header_decoder block.
36 */
37 void header_crc_handler(pmt::pmt_t crc_presence);
38 /**
39 * \brief Calculate the CRC 16 using poly=0x1021 and Init=0x0000
40 *
41 * \param data
42 * The pointer to the data beginning.
43 * \param len
44 * The length of the data in bytes.
45 */
46 unsigned int crc16(uint8_t* data, uint32_t len);
47
48 public:
49 crc_verif_impl(bool exit);
51
52 void forecast (int noutput_items, gr_vector_int &ninput_items_required);
53
54 int general_work(int noutput_items,
55 gr_vector_int &ninput_items,
56 gr_vector_const_void_star &input_items,
57 gr_vector_void_star &output_items);
58
59 };
60 } // namespace lora
61} // namespace gr
62
63#endif /* INCLUDED_LORA_CRC_VERIF_IMPL_H */
Definition: crc_verif_impl.h:13
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
Verifies if the included crc is correct or not for more information about the implementation visit cr...
Definition: crc_verif.h:37
Definition: add_crc.h:28