diff options
author | Josh Blum | 2012-03-19 10:34:48 -0700 |
---|---|---|
committer | Josh Blum | 2012-03-23 14:10:11 -0700 |
commit | a751e4884d918c079d07d3108f5561ac43c3553e (patch) | |
tree | 2a570d03f2dd5bdc6a54f0ab7b79b8492da4082f /gr-uhd/lib/gr_uhd_usrp_sink.cc | |
parent | 7954c7dbfe5267cc3504598410b8ea73bef34fe5 (diff) | |
download | gnuradio-a751e4884d918c079d07d3108f5561ac43c3553e.tar.gz gnuradio-a751e4884d918c079d07d3108f5561ac43c3553e.tar.bz2 gnuradio-a751e4884d918c079d07d3108f5561ac43c3553e.zip |
uhd: added set_start_time calls to source/sink
Diffstat (limited to 'gr-uhd/lib/gr_uhd_usrp_sink.cc')
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_sink.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc index 05237100c..5d8d235a1 100644 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc @@ -56,7 +56,9 @@ public: gr_make_io_signature(0, 0, 0) ), _stream_args(stream_args), - _nchan(std::max<size_t>(1, stream_args.channels.size())) + _nchan(std::max<size_t>(1, stream_args.channels.size())), + _stream_now(_nchan == 1), + _start_time_set(false) { if (stream_args.cpu_format == "fc32") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_FLOAT32); if (stream_args.cpu_format == "sc16") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_INT16); @@ -372,6 +374,12 @@ public: } } + void set_start_time(const uhd::time_spec_t &time){ + _start_time = time; + _start_time_set = true; + _stream_now = false; + } + //Send an empty start-of-burst packet to begin streaming. //Set at a time in the near future to avoid late packets. bool start(void){ @@ -381,8 +389,14 @@ public: _metadata.start_of_burst = true; _metadata.end_of_burst = false; - _metadata.has_time_spec = _nchan > 1; - _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); + _metadata.has_time_spec = not _stream_now; + if (_start_time_set){ + _start_time_set = false; //cleared for next run + _metadata.time_spec = _start_time; + } + else{ + _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); + } #ifdef GR_UHD_USE_STREAM_API _tx_stream->send( @@ -423,9 +437,13 @@ private: uhd::tx_streamer::sptr _tx_stream; #endif size_t _nchan; + bool _stream_now; uhd::tx_metadata_t _metadata; double _sample_rate; + uhd::time_spec_t _start_time; + bool _start_time_set; + //stream tags related stuff std::vector<gr_tag_t> _tags; }; |