[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/03: blocks: add message output port to p
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/03: blocks: add message output port to probe_rate block |
Date: |
Fri, 30 Jan 2015 00:34:24 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 9581348d0263fae49bc63f95c9b3a5e46e8afa16
Author: Tim O'Shea <address@hidden>
Date: Thu Jan 29 10:30:09 2015 -0500
blocks: add message output port to probe_rate block
---
gr-blocks/grc/blocks_probe_rate.xml | 5 +++++
gr-blocks/lib/probe_rate_impl.cc | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/gr-blocks/grc/blocks_probe_rate.xml
b/gr-blocks/grc/blocks_probe_rate.xml
index 08df23e..f79444c 100644
--- a/gr-blocks/grc/blocks_probe_rate.xml
+++ b/gr-blocks/grc/blocks_probe_rate.xml
@@ -63,4 +63,9 @@
<type>$type</type>
<vlen>$vlen</vlen>
</sink>
+ <source>
+ <name>rate</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
</block>
diff --git a/gr-blocks/lib/probe_rate_impl.cc b/gr-blocks/lib/probe_rate_impl.cc
index 84977be..015b157 100644
--- a/gr-blocks/lib/probe_rate_impl.cc
+++ b/gr-blocks/lib/probe_rate_impl.cc
@@ -48,6 +48,7 @@ namespace gr {
d_lastthru(0),
d_itemsize(itemsize)
{
+ message_port_register_out(pmt::mp("rate"));
}
probe_rate_impl::~probe_rate_impl(){}
@@ -68,6 +69,10 @@ namespace gr {
} else {
d_avg = rate_this_update*d_alpha + d_avg*d_beta;
}
+ pmt::pmt_t d = pmt::make_dict();
+ d = pmt::dict_add(d, pmt::mp("rate_avg"), pmt::mp(d_avg));
+ d = pmt::dict_add(d, pmt::mp("rate_now"),
pmt::mp(rate_this_update));
+ message_port_pub(pmt::mp("rate"), pmt::cons(d, pmt::PMT_NIL));
}
return noutput_items;
}