diff options
author | Tom Rondeau | 2010-12-30 17:19:51 -0500 |
---|---|---|
committer | Tom Rondeau | 2010-12-30 17:19:51 -0500 |
commit | c6dfc4ce9227001a371457a39d0e44528b1f6827 (patch) | |
tree | 24fb83f01e3dd4892bf57611a5f1d84c0efed6c3 /gr-uhd | |
parent | 91ca107edc1e4cad69f102d947471d2c0adfc354 (diff) | |
download | gnuradio-c6dfc4ce9227001a371457a39d0e44528b1f6827.tar.gz gnuradio-c6dfc4ce9227001a371457a39d0e44528b1f6827.tar.bz2 gnuradio-c6dfc4ce9227001a371457a39d0e44528b1f6827.zip |
Adding tags back into UHD source. If a packet received from a UHD source has a timestamp, we create a tag from it and pass it down the line. If no timestamp, produce no tags.
This should not affect behavior of the UHD single source for those not dealing with tags.
Diffstat (limited to 'gr-uhd')
-rw-r--r-- | gr-uhd/lib/uhd_single_usrp_source.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc index 907e8be54..45f852a3e 100644 --- a/gr-uhd/lib/uhd_single_usrp_source.cc +++ b/gr-uhd/lib/uhd_single_usrp_source.cc @@ -49,6 +49,7 @@ public: _type(io_type) { _dev = uhd::usrp::single_usrp::make(device_addr); + d_tag_srcid = pmt::mp("uhd_single_usrp_source"); } void set_subdev_spec(const std::string &spec){ @@ -138,7 +139,16 @@ public: switch(metadata.error_code){ case uhd::rx_metadata_t::ERROR_CODE_NONE: - return num_samps; + if(metadata.has_time_spec) { + d_tstamp_pair = pmt::mp(pmt::mp(metadata.time_spec.get_full_secs()), + pmt::mp(metadata.time_spec.get_frac_secs())); + add_item_tag(0, nitems_written(0), + //gr_tags::key_time, + pmt::pmt_string_to_symbol("time"), + d_tstamp_pair, + d_tag_srcid); + } + return num_samps; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: //ignore overflows and try work again @@ -165,6 +175,7 @@ public: private: uhd::usrp::single_usrp::sptr _dev; const uhd::io_type_t _type; + pmt::pmt_t d_tag_srcid; }; |