GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
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 {
26  STROBE_UNIFORM = 3
28 
29 /*!
30  * \brief Send message at defined interval
31  * \ingroup message_tools_blk
32  *
33  * \details
34 
35  * Takes a PMT message and sends it out every at random
36  * intervals. The interval is basedon a random distribution, \p
37  * dist, with specified mean (\p mean_ms) and variance (\p
38  * std_ms). Useful for testing/debugging the message system.
39  */
40 class BLOCKS_API message_strobe_random : virtual public block
41 {
42 public:
43  // gr::blocks::message_strobe_random::sptr
44  typedef std::shared_ptr<message_strobe_random> sptr;
45 
46  /*!
47  * Make a message stobe block to sends message \p msg at random
48  * intervals defined by the distribution \p dist with mean \p
49  * mean_ms and standard deviation \p std_ms.
50  *
51  * \param msg The message to send as a PMT.
52  * \param dist The random distribution from which to draw events.
53  * \param mean_ms The mean of the distribution.
54  * \param std_ms The standard deviation of the distribution.
55  */
56  static sptr make(pmt::pmt_t msg,
58  float mean_ms,
59  float std_ms);
60 
61  /*!
62  * Reset the message being sent.
63  * \param msg The message to send as a PMT.
64  */
65  virtual void set_msg(pmt::pmt_t msg) = 0;
66 
67  /*!
68  * Get the value of the message being sent.
69  */
70  virtual pmt::pmt_t msg() const = 0;
71 
72  /*!
73  * \param dist new distribution.
74  */
76 
77  /*!
78  * get the current distribution.
79  */
81 
82  /*!
83  * Reset the sending interval.
84  * \param mean delay in milliseconds.
85  */
86  virtual void set_mean(float mean) = 0;
87 
88  /*!
89  * Get the time interval of the strobe_random.
90  */
91  virtual float mean() const = 0;
92 
93  /*!
94  * Reset the sending interval.
95  * \param std delay in milliseconds.
96  */
97  virtual void set_std(float std) = 0;
98 
99  /*!
100  * Get the std of strobe_random.
101  */
102  virtual float std() const = 0;
103 };
104 
105 } /* namespace blocks */
106 } /* namespace gr */
107 
108 #endif /* INCLUDED_GR_MESSAGE_STROBE_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:60
Send message at defined interval.
Definition: message_strobe_random.h:41
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:44
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_POISSON
Definition: message_strobe_random.h:24
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:84