summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2016-06-25 10:09:38 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2016-06-25 10:09:38 -0700
commit0b6947ee96d5a74f4c4d4816ed19a277128410e5 (patch)
treea5749ea5cff00cbf3f42bcdffc103c5b004fd9aa
parentf93f2ef3d80cd217a3a995470a51b9ff8df02978 (diff)
parent0dafca470824d63d1c25b5979da16ad8593fe80a (diff)
Merge remote-tracking branch 'osh/qtgui_msg_tags'
-rw-r--r--gr-qtgui/lib/time_sink_c_impl.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc
index 98f603a8b0..209f03340f 100644
--- a/gr-qtgui/lib/time_sink_c_impl.cc
+++ b/gr-qtgui/lib/time_sink_c_impl.cc
@@ -698,6 +698,7 @@ namespace gr {
{
size_t len;
pmt::pmt_t dict, samples;
+ std::vector< std::vector<gr::tag_t> > t(1);
// Test to make sure this is either a PDU or a uniform vector of
// samples. Get the samples PMT and the dictionary if it's a PDU.
@@ -714,6 +715,29 @@ namespace gr {
"a PDU or a uniform vector of samples.");
}
+ // add tag info if it is present in metadata
+ if(pmt::is_dict(dict)){
+ if(pmt::dict_has_key(dict, pmt::mp("tags"))){
+ d_tags.clear();
+ pmt::pmt_t tags = pmt::dict_ref(dict, pmt::mp("tags"), pmt::PMT_NIL);
+ int len = pmt::length(tags);
+ for(int i=0; i<len; i++){
+ // get tag info from list
+ pmt::pmt_t tup = pmt::vector_ref(tags, i);
+ int tagval = pmt::to_long(pmt::tuple_ref(tup,0));
+ pmt::pmt_t k = pmt::tuple_ref(tup,1);
+ pmt::pmt_t v = pmt::tuple_ref(tup,2);
+
+ // add the tag
+ t[0].push_back( gr::tag_t() );
+ t[0][t[0].size()-1].offset = tagval;
+ t[0][t[0].size()-1].key = k;
+ t[0][t[0].size()-1].value = v;
+ t[0][t[0].size()-1].srcid = pmt::PMT_NIL;
+ }
+ }
+ }
+
len = pmt::length(samples);
const gr_complex *in;
@@ -735,7 +759,6 @@ namespace gr {
d_buffers[2*d_nconnections+1],
in, len);
- std::vector< std::vector<gr::tag_t> > t;
d_qApplication->postEvent(d_main_gui,
new TimeUpdateEvent(d_buffers, len, t));
}