summaryrefslogtreecommitdiff
path: root/gr-blocks/include
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-06 09:54:14 -0500
committerTom Rondeau <trondeau@vt.edu>2013-03-06 09:54:14 -0500
commit520626bcc203a15ec22ed7351204662a33a17ef5 (patch)
treebcbf90619e9ad3971f74c1990ee87305ce2940fc /gr-blocks/include
parent53ff88a6d6721aa7d31e70bf74511e1138fa833e (diff)
blocks: moving message blocks to gr-blocks.
message_burst_source, message_source, message_sink, message_debug, message_strobe.
Diffstat (limited to 'gr-blocks/include')
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt5
-rw-r--r--gr-blocks/include/blocks/message_burst_source.h52
-rw-r--r--gr-blocks/include/blocks/message_debug.h85
-rw-r--r--gr-blocks/include/blocks/message_sink.h49
-rw-r--r--gr-blocks/include/blocks/message_source.h52
-rw-r--r--gr-blocks/include/blocks/message_strobe.h81
6 files changed, 324 insertions, 0 deletions
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
index 585810864a..66cdbf41c5 100644
--- a/gr-blocks/include/blocks/CMakeLists.txt
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -125,6 +125,11 @@ install(FILES
interleaved_short_to_complex.h
keep_m_in_n.h
keep_one_in_n.h
+ message_debug.h
+ message_sink.h
+ message_source.h
+ message_strobe.h
+ message_burst_source.h
multiply_cc.h
multiply_ff.h
multiply_conjugate_cc.h
diff --git a/gr-blocks/include/blocks/message_burst_source.h b/gr-blocks/include/blocks/message_burst_source.h
new file mode 100644
index 0000000000..864d43452f
--- /dev/null
+++ b/gr-blocks/include/blocks/message_burst_source.h
@@ -0,0 +1,52 @@
+/* -*- 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_BURST_SOURCE_H
+#define INCLUDED_GR_MESSAGE_BURST_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Turn received messages into a stream and tag them for UHD to send.
+ * \ingroup source_blk
+ */
+ class BLOCKS_API message_burst_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::message_source::sptr
+ typedef boost::shared_ptr<message_burst_source> sptr;
+
+ static sptr make(size_t itemsize, int msgq_limit);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq);
+
+ virtual gr_msg_queue_sptr msgq() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_MESSAGE_BURST_SOURCE_H */
diff --git a/gr-blocks/include/blocks/message_debug.h b/gr-blocks/include/blocks/message_debug.h
new file mode 100644
index 0000000000..f0212331c2
--- /dev/null
+++ b/gr-blocks/include/blocks/message_debug.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_DEBUG_H
+#define INCLUDED_GR_MESSAGE_DEBUG_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Debug block for the message passing system.
+ * \ingroup sink_blk
+ *
+ * The message debug block is used to capture and print or store
+ * messages as they are received. Any block that generates a
+ * message may connect that message port to one or more of the
+ * three message input ports of this debug block. The message
+ * ports are:
+ *
+ * \li print: prints the message directly to standard out.
+ * \li store: stores the message in an internal vector. May be
+ * access using the get_message function.
+ * \li print_pdu: specifically designed to handle formatted PDUs
+ * (see pdu.h).
+ */
+ class BLOCKS_API message_debug : virtual public gr_block
+ {
+ public:
+ // gr::blocks::message_debug::sptr
+ typedef boost::shared_ptr<message_debug> sptr;
+
+ /*!
+ * \brief Build the message debug block. It takes no parameters
+ * and has three message ports: print, store, and
+ * print_pdu.
+ */
+ static sptr make();
+
+ /*!
+ * \brief Reports the number of messages received by this block.
+ */
+ virtual int num_messages() = 0;
+
+ /*!
+ * \brief Get a message (as a PMT) from the message vector at index \p i.
+ *
+ * Messages passed to the 'store' port will be stored in a
+ * vector. This function retrieves those messages by index. They
+ * are index in order of when they were received (all messages
+ * are just pushed onto the back of a vector). This is mostly
+ * useful in debugging message passing graphs and in QA code.
+ *
+ * \param i The index in the vector for the message to retrieve.
+ *
+ * \return a message at index \p i as a pmt_t.
+ */
+ virtual pmt::pmt_t get_message(int i) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_MESSAGE_DEBUG_H */
diff --git a/gr-blocks/include/blocks/message_sink.h b/gr-blocks/include/blocks/message_sink.h
new file mode 100644
index 0000000000..5d14836dd4
--- /dev/null
+++ b/gr-blocks/include/blocks/message_sink.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_SINK_H
+#define INCLUDED_GR_MESSAGE_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Gather received items into messages and insert into msgq
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API message_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::message_sink::sptr
+ typedef boost::shared_ptr<message_sink> sptr;
+
+ static sptr make (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_MESSAGE_SINK_H */
diff --git a/gr-blocks/include/blocks/message_source.h b/gr-blocks/include/blocks/message_source.h
new file mode 100644
index 0000000000..5b55191880
--- /dev/null
+++ b/gr-blocks/include/blocks/message_source.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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_SOURCE_H
+#define INCLUDED_GR_MESSAGE_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Turn received messages into a stream
+ * \ingroup source_blk
+ */
+ class BLOCKS_API message_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::message_source::sptr
+ typedef boost::shared_ptr<message_source> sptr;
+
+ static sptr make(size_t itemsize, int msgq_limit=0);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq);
+
+ virtual gr_msg_queue_sptr msgq() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_MESSAGE_SOURCE_H */
diff --git a/gr-blocks/include/blocks/message_strobe.h b/gr-blocks/include/blocks/message_strobe.h
new file mode 100644
index 0000000000..6b427d539c
--- /dev/null
+++ b/gr-blocks/include/blocks/message_strobe.h
@@ -0,0 +1,81 @@
+/* -*- 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 <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Send message at defined interval
+ * \ingroup msg_blk
+ *
+ * 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 gr_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, float 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(float period_ms) = 0;
+
+ /*!
+ * Get the time interval of the strobe.
+ */
+ virtual float period() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_MESSAGE_STROBE_H */