GNU Radio's LORA_SDR Package
data_source_sim_impl.h
Go to the documentation of this file.
1/**
2 * @file data_source_sim_impl.h
3 * @author your name (you@domain.com)
4 * @brief
5 * @version 0.1
6 * @date 2021-01-05
7 *
8 * @copyright Copyright (c) 2021
9 *
10 */
11#ifndef INCLUDED_LORA_SDR_DATA_SOURCE_SIM_IMPL_H
12#define INCLUDED_LORA_SDR_DATA_SOURCE_SIM_IMPL_H
13
15#include "helpers.h"
16
17namespace gr {
18namespace lora_sdr {
19
21private:
22 /**
23 * @brief : Count the number of frame sent
24 *
25 */
26 int frame_cnt;
27 /**
28 * @brief : The maximal number of frame to send
29 *
30 */
31 int m_n_frames;
32 /**
33 * @brief : The payload length
34 *
35 */
36 int m_pay_len;
37
38 /**
39 * @brief Variables that holds the mean time of the uniform distribution
40 *
41 */
42 uint32_t m_mean;
43
44 /**
45 * @brief : Input data source, if empty random generated data source is used.
46 *
47 */
48 std::string m_string_input;
49
50 /**
51 * @brief bollean if we have to control multiple tx chains
52 *
53 */
54 bool m_multi_control;
55
56 /**
57 * @brief
58 *
59 */
60 bool m_finished_wait;
61
62 /**
63 * @brief internal state variable to tell system
64 * if we have received ctrl_in and should send WORK_DONE to the rest of the blocks.
65 *
66 */
67 bool m_finished;
68
69 /**
70 * @brief
71 *
72 */
73 bool m_wait;
74
75 /**
76 * @brief
77 *
78 */
79 int m_n_send;
80
81 /**
82 * @brief returns a random string containing [a-z A-Z 0-9] for testing the
83 * payload data
84 *
85 * @param nbytes : the number of char in the string
86 * @return std::string : the random generated string
87 */
88 std::string random_string(int nbytes);
89
90
91public:
92 /**
93 * @brief Construct a new data source impl object
94 *
95 * @param pay_len : payload length
96 * @param n_frames : number of frames to generate data for
97 * @param string_input : input string to be used
98 * @param mean : Mean time for uniform distribution in ms
99 */
100 data_source_sim_impl(int pay_len, int n_frames, std::string string_input,
101 uint32_t mean, bool multi_control);
102
103 /**
104 * @brief Destroy the data source impl object
105 *
106 */
108
109 /**
110 * @brief Place holder function does not do anything for the data source.
111 *
112 * @param noutput_items
113 * @param ninput_items_required
114 */
115 void forecast(int noutput_items, gr_vector_int &ninput_items_required);
116
117 /**
118 * @brief Main function, generates random ([a-z A-Z
119 * 0-9]) data input to be sent over the network or if input_string set send this over the network.
120 * The sim version of the data_source has an internal sleep function set by the parameter mean
121 *
122 * @param noutput_items : number of output items : 1
123 * @param ninput_items : number of input items : 0
124 * @param input_items : input item : 0
125 * @param output_items : output items :
126 * @return int : work status
127 */
128 int general_work(int noutput_items, gr_vector_int &ninput_items,
129 gr_vector_const_void_star &input_items,
130 gr_vector_void_star &output_items);
131};
132
133} // namespace lora_sdr
134} // namespace gr
135
136#endif /* INCLUDED_LORA_SDR_DATA_SOURCE_SIM_IMPL_H */
Definition: data_source_sim_impl.h:20
~data_source_sim_impl()
Destroy the data source impl object.
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
Place holder function does not do anything for the data source.
data_source_sim_impl(int pay_len, int n_frames, std::string string_input, uint32_t mean, bool multi_control)
Construct a new data source 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)
Main function, generates random ([a-z A-Z 0-9]) data input to be sent over the network or if input_st...
Data source that can both generate random strings or static strings, for more information about the i...
Definition: data_source_sim.h:28
Definition: add_crc.h:28