From c6dfc4ce9227001a371457a39d0e44528b1f6827 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 30 Dec 2010 17:19:51 -0500 Subject: 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. --- gr-uhd/lib/uhd_single_usrp_source.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gr-uhd/lib') 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; }; -- cgit