GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
message_strobe.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_H
12 #define INCLUDED_GR_MESSAGE_STROBE_H
13 
14 #include <gnuradio/block.h>
15 #include <gnuradio/blocks/api.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief Send message at defined interval
22  * \ingroup message_tools_blk
23  *
24  * \details
25  * Takes a PMT message and sends it out every \p period_ms
26  * milliseconds. Useful for testing/debugging the message system.
27  */
28 class BLOCKS_API message_strobe : virtual public block
29 {
30 public:
31  // gr::blocks::message_strobe::sptr
32  typedef std::shared_ptr<message_strobe> sptr;
33 
34  /*!
35  * Make a message stobe block to send message \p msg every \p
36  * period_ms milliseconds.
37  *
38  * \param msg The message to send as a PMT.
39  * \param period_ms the time period in milliseconds in which to
40  * send \p msg.
41  */
42  static sptr make(pmt::pmt_t msg, long period_ms);
43 
44  /*!
45  * Reset the message being sent.
46  * \param msg The message to send as a PMT.
47  */
48  virtual void set_msg(pmt::pmt_t msg) = 0;
49 
50  /*!
51  * Get the value of the message being sent.
52  */
53  virtual pmt::pmt_t msg() const = 0;
54 
55  /*!
56  * Reset the sending interval.
57  * \param period_ms the time period in milliseconds.
58  */
59  virtual void set_period(long period_ms) = 0;
60 
61  /*!
62  * Get the time interval of the strobe.
63  */
64  virtual long period() const = 0;
65 };
66 
67 } /* namespace blocks */
68 } /* namespace gr */
69 
70 #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.h:29
virtual pmt::pmt_t msg() const =0
std::shared_ptr< message_strobe > sptr
Definition: message_strobe.h:32
virtual long period() const =0
virtual void set_msg(pmt::pmt_t msg)=0
static sptr make(pmt::pmt_t msg, long period_ms)
virtual void set_period(long period_ms)=0
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
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