GNU Radio's LORA_SDR Package
data_source_impl.h
Go to the documentation of this file.
1 #ifndef INCLUDED_LORA_SDR_DATA_SOURCE_IMPL_H
2 #define INCLUDED_LORA_SDR_DATA_SOURCE_IMPL_H
3 
4 #include <lora_sdr/data_source.h>
5 #include "helpers.h"
6 
7 namespace gr {
8 namespace lora_sdr {
9 
10 class data_source_impl : public data_source {
11 private:
12  /**
13  * @brief : Count the number of frame sent
14  *
15  */
16  int frame_cnt;
17  /**
18  * @brief : The maximal number of frame to send
19  *
20  */
21  int m_n_frames;
22  /**
23  * @brief : The payload length
24  *
25  */
26  int m_pay_len;
27 
28  /**
29  * @brief : Input data source, if empty random generated data source is used.
30  *
31  */
32  std::string m_string_input;
33 
34  /**
35  * @brief returns a random string containing [a-z A-Z 0-9] for testing the
36  * payload data
37  *
38  * @param nbytes : the number of char in the string
39  * @return std::string : the random generated string
40  */
41  std::string random_string(int nbytes);
42 
43  /**
44  * @brief Main function that handles the trigger and dispatches the message
45  * making
46  *
47  * @param msg : PMT input msg (i.e. trigger from strobe)
48  */
49  void trigg_handler(pmt::pmt_t msg);
50 
51 public:
52  /**
53  * @brief Construct a new data source impl object
54  *
55  * @param pay_len : payload length
56  * @param n_frames : number of frames to generate data for
57  * @param string_input
58  */
59  data_source_impl(int pay_len, int n_frames, std::string string_input);
60 
61  /**
62  * @brief Destroy the data source impl object
63  *
64  */
66 
67  /**
68  * @brief Place holder function of data_source that generated random ([a-z A-Z
69  * 0-9]) data source to be sent over the network
70  *
71  * @param noutput_items
72  * @param input_items
73  * @param output_items
74  * @return int
75  */
76  int work(int noutput_items, gr_vector_const_void_star &input_items,
77  gr_vector_void_star &output_items);
78 };
79 } // namespace lora_sdr
80 } // namespace gr
81 
82 #endif /* INCLUDED_LORA_SDR_DATA_SOURCE_IMPL_H */
gr::lora_sdr::data_source_impl::data_source_impl
data_source_impl(int pay_len, int n_frames, std::string string_input)
Construct a new data source impl object.
gr::lora_sdr::data_source
<+description of block+>
Definition: data_source.h:36
data_source.h
gr::lora_sdr::data_source_impl
Definition: data_source_impl.h:10
gr::lora_sdr::data_source_impl::~data_source_impl
~data_source_impl()
Destroy the data source impl object.
gr::lora_sdr::data_source_impl::work
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Place holder function of data_source that generated random ([a-z A-Z 0-9]) data source to be sent ove...
helpers.h
gr
Definition: add_crc.h:28