commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/08: qtgui: allow plotting of tags on mes


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/08: qtgui: allow plotting of tags on message based plots based on PDU metadata 'tags' field
Date: Sat, 25 Jun 2016 19:08:00 +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 de21ea91d6ceb7b58141a249dadd4f040e8143bd
Author: Tim O'Shea <address@hidden>
Date:   Wed Jun 22 21:56:07 2016 -0400

    qtgui: allow plotting of tags on message based plots based on PDU metadata 
'tags' field
---
 gr-qtgui/lib/time_sink_c_impl.cc | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc
index 98f603a..16019ed 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,30 @@ 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")) && 
pmt::dict_has_key(dict,pmt::mp("start"))){
+            d_tags.clear();
+            pmt::pmt_t tags = pmt::dict_ref(dict, pmt::mp("tags"), 
pmt::PMT_NIL);
+            int len = pmt::length(tags);
+            pmt::print(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 +760,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));
       }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]