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 
4 #include <lora_sdr/crc_verif.h>
5 
6 // #define GRLORA_DEBUG
7 
8 namespace gr {
9  namespace lora_sdr {
10 
11  class crc_verif_impl : public crc_verif
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  bool print_rx_msg; ///< print received message in terminal or not
22 
23  uint32_t cnt=0;///< count the number of frame
24 
25  /**
26  * \brief Handles the payload length received from the header_decoder block.
27  */
28  void header_pay_len_handler(pmt::pmt_t payload_len);
29  /**
30  * \brief Handles the crc_presence received from the header_decoder block.
31  */
32  void header_crc_handler(pmt::pmt_t crc_presence);
33  /**
34  * \brief Calculate the CRC 16 using poly=0x1021 and Init=0x0000
35  *
36  * \param data
37  * The pointer to the data beginning.
38  * \param len
39  * The length of the data in bytes.
40  */
41  unsigned int crc16(uint8_t* data, uint32_t len);
42 
43  public:
44  crc_verif_impl(bool print_rx_msg);
46 
47  void forecast (int noutput_items, gr_vector_int &ninput_items_required);
48 
49  int general_work(int noutput_items,
50  gr_vector_int &ninput_items,
51  gr_vector_const_void_star &input_items,
52  gr_vector_void_star &output_items);
53 
54  };
55  } // namespace lora
56 } // namespace gr
57 
58 #endif /* INCLUDED_LORA_CRC_VERIF_IMPL_H */
<+description of block+>
Definition: crc_verif.h:36
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
Definition: add_crc.h:28
crc_verif_impl(bool print_rx_msg)
Definition: crc_verif_impl.h:11
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)