summaryrefslogtreecommitdiff
path: root/gr-uhd
diff options
context:
space:
mode:
authorNathan West <nathan.west@okstate.edu>2016-05-02 18:02:18 -0400
committerNathan West <nathan.west@okstate.edu>2016-05-02 18:02:18 -0400
commitf19ccc8159ee9e17eb22990dfb5834c8e6a99509 (patch)
treeb552ab7b6f58e782574a80cbd5f8b13f5ddc1039 /gr-uhd
parent6aa995a5477feea1b6f9ef1f49c3045c25d147b1 (diff)
uhd: add command handler to add a time tag
Diffstat (limited to 'gr-uhd')
-rw-r--r--gr-uhd/lib/usrp_source_impl.cc9
-rw-r--r--gr-uhd/lib/usrp_source_impl.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc
index 7ad2280955..0a09ed34b3 100644
--- a/gr-uhd/lib/usrp_source_impl.cc
+++ b/gr-uhd/lib/usrp_source_impl.cc
@@ -31,6 +31,8 @@
namespace gr {
namespace uhd {
+ const pmt::pmt_t CMD_TAG_KEY = pmt::mp("tag");
+
usrp_source::sptr
usrp_source::make(const ::uhd::device_addr_t &device_addr,
const ::uhd::io_type_t &io_type,
@@ -80,6 +82,7 @@ namespace gr {
#ifdef GR_UHD_USE_STREAM_API
_samps_per_packet = 1;
#endif
+ register_msg_cmd_handler(CMD_TAG_KEY, boost::bind(&usrp_source_impl::_cmd_handler_tag, this, _1));
}
usrp_source_impl::~usrp_source_impl()
@@ -359,6 +362,12 @@ namespace gr {
}
void
+ usrp_source_impl::_cmd_handler_tag(const pmt::pmt_t &tag)
+ {
+ _tag_now = true;
+ }
+
+ void
usrp_source_impl::set_start_time(const ::uhd::time_spec_t &time)
{
_start_time = time;
diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h
index b43df4dab3..78a8341a5a 100644
--- a/gr-uhd/lib/usrp_source_impl.h
+++ b/gr-uhd/lib/usrp_source_impl.h
@@ -112,6 +112,7 @@ namespace gr {
private:
//! Like set_center_freq(), but uses _curr_freq and _curr_lo_offset
::uhd::tune_result_t _set_center_freq_from_internals(size_t chan);
+ void _cmd_handler_tag(const pmt::pmt_t &tag);
#ifdef GR_UHD_USE_STREAM_API
::uhd::rx_streamer::sptr _rx_stream;