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
6// #define GRLORA_DEBUG
7
8namespace gr {
9 namespace lora_sdr {
10
12 {
13 private:
14 uint32_t m_payload_len;///< Payload length in bytes
15 bool m_crc_presence;///< Indicate if there is a payload CRC
16 uint16_t m_crc;///< The CRC calculated from the received payload
17 std::string message_str;///< The payload string
18 char m_char;///< A new char of the payload
19 bool new_frame; ///<indicate a new frame
20 std::vector<uint8_t> in_buff;///< input buffer containing the data bytes and CRC if any
21 int print_rx_msg; ///< print received message in terminal. 0: no print, 1: ASCII, 2: HEX
22 bool output_crc_check; ///< output the result of the payload CRC check
23 tag_t curent_tag; ///< the most recent tag for the packet we are currently processing
24
25
26 uint32_t cnt=0;///< count the number of frame
27
28 /**
29 * \brief Handles the payload length received from the header_decoder block.
30 */
31 void header_pay_len_handler(pmt::pmt_t payload_len);
32 /**
33 * \brief Handles the crc_presence received from the header_decoder block.
34 */
35 void header_crc_handler(pmt::pmt_t crc_presence);
36 /**
37 * \brief Calculate the CRC 16 using poly=0x1021 and Init=0x0000
38 *
39 * \param data
40 * The pointer to the data beginning.
41 * \param len
42 * The length of the data in bytes.
43 */
44 unsigned int crc16(uint8_t* data, uint32_t len);
45
46 public:
47 crc_verif_impl(int print_rx_msg, bool output_crc_check);
49
50 void forecast (int noutput_items, gr_vector_int &ninput_items_required);
51
52 int general_work(int noutput_items,
53 gr_vector_int &ninput_items,
54 gr_vector_const_void_star &input_items,
55 gr_vector_void_star &output_items);
56
57 };
58 } // namespace lora
59} // namespace gr
60
61#endif /* INCLUDED_LORA_CRC_VERIF_IMPL_H */
Definition crc_verif_impl.h:12
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
crc_verif_impl(int print_rx_msg, bool output_crc_check)
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
<+description of block+>
Definition crc_verif.h:37
Definition add_crc.h:28