GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
message_strobe_random.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012-2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_GR_MESSAGE_STROBE_RANDOM_H
12 #define INCLUDED_GR_MESSAGE_STROBE_RANDOM_H
13 
14 #include <gnuradio/block.h>
15 #include <gnuradio/blocks/api.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*
21  * strobing models
22  */
23 typedef enum {
29 
30 /*!
31  * \brief Send message at defined interval
32  * \ingroup message_tools_blk
33  *
34  * \details
35 
36  * Takes a PMT message and sends it out at random
37  * intervals. The interval is based on a random distribution, \p
38  * dist, with specified mean (\p mean_ms) and variance (\p
39  * std_ms). Useful for testing/debugging the message system.
40  */
41 class BLOCKS_API message_strobe_random : virtual public block
42 {
43 public:
44  // gr::blocks::message_strobe_random::sptr
45  typedef std::shared_ptr<message_strobe_random> sptr;
46 
47  /*!
48  * Make a message stobe block to sends message \p msg at random
49  * intervals defined by the distribution \p dist with mean \p
50  * mean_ms and standard deviation \p std_ms.
51  *
52  * \param msg The message to send as a PMT.
53  * \param dist The random distribution from which to draw the time between
54  * events.
55  * \param mean_ms The mean of the distribution, in milliseconds.
56  * \param std_ms The standard deviation of the Gaussian distribution,
57  * or the maximum absolute deviation of the Uniform
58  * distribution, in milliseconds. This argument is ignored
59  * for other distributions.
60  */
63  float mean_ms,
64  float std_ms);
65 
66  /*!
67  * Reset the message being sent.
68  * \param msg The message to send as a PMT.
69  */
70  virtual void set_msg(pmt::pmt_t msg) = 0;
71 
72  /*!
73  * Get the value of the message being sent.
74  */
75  virtual pmt::pmt_t msg() const = 0;
76 
77  /*!
78  * \param dist new distribution.
79  */
81 
82  /*!
83  * get the current distribution.
84  */
86 
87  /*!
88  * Reset the sending interval.
89  * \param mean delay in milliseconds.
90  */
91  virtual void set_mean(float mean) = 0;
92 
93  /*!
94  * Get the time interval of the strobe_random.
95  */
96  virtual float mean() const = 0;
97 
98  /*!
99  * Reset the sending interval.
100  * \param std delay in milliseconds.
101  */
102  virtual void set_std(float std) = 0;
103 
104  /*!
105  * Get the std of strobe_random.
106  */
107  virtual float std() const = 0;
108 };
109 
110 } /* namespace blocks */
111 } /* namespace gr */
112 
113 #endif /* INCLUDED_GR_MESSAGE_STROBE_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Send message at defined interval.
Definition: message_strobe_random.h:42
virtual void set_dist(message_strobe_random_distribution_t dist)=0
virtual void set_msg(pmt::pmt_t msg)=0
virtual float std() const =0
virtual pmt::pmt_t msg() const =0
virtual void set_std(float std)=0
std::shared_ptr< message_strobe_random > sptr
Definition: message_strobe_random.h:45
virtual float mean() const =0
virtual void set_mean(float mean)=0
virtual message_strobe_random_distribution_t dist() const =0
static sptr make(pmt::pmt_t msg, message_strobe_random_distribution_t dist, float mean_ms, float std_ms)
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
message_strobe_random_distribution_t
Definition: message_strobe_random.h:23
@ STROBE_GAUSSIAN
Definition: message_strobe_random.h:25
@ STROBE_UNIFORM
Definition: message_strobe_random.h:26
@ STROBE_EXPONENTIAL
Definition: message_strobe_random.h:27
@ STROBE_POISSON
Definition: message_strobe_random.h:24
GR_RUNTIME_API const pmt::pmt_t msg()
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83