summaryrefslogtreecommitdiff
path: root/gr-blocks/include/gnuradio/blocks/message_strobe.h
blob: 2a2fbdae5baf98940b17d389833ba6f57a0c8b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* -*- c++ -*- */
/*
 * Copyright 2012-2013 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifndef INCLUDED_GR_MESSAGE_STROBE_H
#define INCLUDED_GR_MESSAGE_STROBE_H

#include <gnuradio/blocks/api.h>
#include <gnuradio/block.h>

namespace gr {
namespace blocks {

/*!
 * \brief Send message at defined interval
 * \ingroup message_tools_blk
 *
 * \details
 * Takes a PMT message and sends it out every \p period_ms
 * milliseconds. Useful for testing/debugging the message system.
 */
class BLOCKS_API message_strobe : virtual public block
{
public:
    // gr::blocks::message_strobe::sptr
    typedef boost::shared_ptr<message_strobe> sptr;

    /*!
     * Make a message stobe block to send message \p msg every \p
     * period_ms milliseconds.
     *
     * \param msg The message to send as a PMT.
     * \param period_ms the time period in milliseconds in which to
     *                  send \p msg.
     */
    static sptr make(pmt::pmt_t msg, long period_ms);

    /*!
     * Reset the message being sent.
     * \param msg The message to send as a PMT.
     */
    virtual void set_msg(pmt::pmt_t msg) = 0;

    /*!
     * Get the value of the message being sent.
     */
    virtual pmt::pmt_t msg() const = 0;

    /*!
     * Reset the sending interval.
     * \param period_ms the time period in milliseconds.
     */
    virtual void set_period(long period_ms) = 0;

    /*!
     * Get the time interval of the strobe.
     */
    virtual long period() const = 0;
};

} /* namespace blocks */
} /* namespace gr */

#endif /* INCLUDED_GR_MESSAGE_STROBE_H */