[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/23: blocks: adding a message port to the
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/23: blocks: adding a message port to the copy block to enable/disable copy. |
Date: |
Thu, 26 Jun 2014 19:54:43 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 9d4d472e93aeb77f3e808499215a2f07d563a83c
Author: Tom Rondeau <address@hidden>
Date: Tue Jun 24 18:37:19 2014 -0400
blocks: adding a message port to the copy block to enable/disable copy.
---
gr-blocks/grc/blocks_copy.xml | 5 +++++
gr-blocks/lib/copy_impl.cc | 12 ++++++++++++
gr-blocks/lib/copy_impl.h | 2 ++
3 files changed, 19 insertions(+)
diff --git a/gr-blocks/grc/blocks_copy.xml b/gr-blocks/grc/blocks_copy.xml
index 55c4b34..4d505d9 100644
--- a/gr-blocks/grc/blocks_copy.xml
+++ b/gr-blocks/grc/blocks_copy.xml
@@ -67,6 +67,11 @@ self.$(id).set_enabled($enabled)</make>
<type>$type</type>
<vlen>$vlen</vlen>
</sink>
+ <sink>
+ <name>en</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
<source>
<name>out</name>
<type>$type</type>
diff --git a/gr-blocks/lib/copy_impl.cc b/gr-blocks/lib/copy_impl.cc
index 564ea09..0284836 100644
--- a/gr-blocks/lib/copy_impl.cc
+++ b/gr-blocks/lib/copy_impl.cc
@@ -45,6 +45,9 @@ namespace gr {
d_itemsize(itemsize),
d_enabled(true)
{
+ message_port_register_in(pmt::mp("en"));
+ set_msg_handler(pmt::mp("en"),
+ boost::bind(©_impl::handle_enable, this, _1));
}
copy_impl::~copy_impl()
@@ -52,6 +55,15 @@ namespace gr {
}
void
+ copy_impl::handle_enable(pmt::pmt_t msg)
+ {
+ if(pmt::is_bool(msg)) {
+ bool en = pmt::to_bool(msg);
+ d_enabled = en;
+ }
+ }
+
+ void
copy_impl::forecast(int noutput_items, gr_vector_int
&ninput_items_required)
{
unsigned ninputs = ninput_items_required.size();
diff --git a/gr-blocks/lib/copy_impl.h b/gr-blocks/lib/copy_impl.h
index 5f3c81a..925efb2 100644
--- a/gr-blocks/lib/copy_impl.h
+++ b/gr-blocks/lib/copy_impl.h
@@ -41,6 +41,8 @@ namespace gr {
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
bool check_topology(int ninputs, int noutputs);
+ void handle_enable(pmt::pmt_t msg);
+
void set_enabled(bool enable) { d_enabled = enable; }
bool enabled() const { return d_enabled;}
- [Commit-gnuradio] [gnuradio] branch master updated (ad9b547 -> 71a57cc), git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 07/23: qtgui: Mostly adds sunset and cool color schemes for waterfall/raster plots., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 10/23: qtgui: allows toggling rf frequencies on/off in GRC options box., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 12/23: qtgui: freq, waterfall, and sink blocks produce a frequency message when double-clicked. Also can take in a frequency message to adjust the x-axis., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 05/23: digital: adding a rotate_phase message for the constellation_receiver to adjust the phase of the constellation., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 01/23: volk: cmake: Rename GrBoost to VolkBoost to differentiate it from GR's GrBoost. Although they set the same BOOST variables internally, this change make it clear which cmake file to include., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 09/23: qtgui: minor mods, including putting min/max lines in FFT sink behind all other lines., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 04/23: blocks: adding a message port to the copy block to enable/disable copy.,
git <=
- [Commit-gnuradio] [gnuradio] 13/23: filter: adds a message input port to frequency xlating FIR filter to update the frequency., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 03/23: digital: expose set_constellation message port in GRC for constellation_receiver., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 08/23: qtgui: adds an alternative qss file., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 14/23: docs: adding docs for blocks::copy and digital::constellation_receiver to describe their message ports., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 15/23: qtgui: dynamically adjust min/max amplitude for qtgui freq and waterfall plots., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 16/23: Merge branch 'maint', git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 11/23: qtgui: for sink_x, waterfall_sink_x, and freq_sink_x, when the display is double-clicked, the center frequency is adjusted to the clicked frequency and a message is posted containing the new center frequency., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 17/23: replaced dynamic_ by static_cast; typechecking done before, git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 02/23: cmake: Include GrBoost at the top level such that the correct default BOOST variables are set throughout the build. Because of the way CMake handles non-cached variables, each GR component (e.g., Volk) can change the BOOST variables for its particular needs without overriding these default values for other components., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 06/23: blocks.head: added callback to GRC definition, git, 2014/06/26