summaryrefslogtreecommitdiff
path: root/gr-uhd/lib
diff options
context:
space:
mode:
authorJosh Blum2011-12-13 10:50:42 -0800
committerJosh Blum2011-12-13 10:50:42 -0800
commite1ad418028e103283775780663d078415590be31 (patch)
tree4a0fbce5fb51b4435bbdaaa89b406ec99886087b /gr-uhd/lib
parent0ee2298b82a20ab13da022e1991be13f5272d581 (diff)
downloadgnuradio-e1ad418028e103283775780663d078415590be31.tar.gz
gnuradio-e1ad418028e103283775780663d078415590be31.tar.bz2
gnuradio-e1ad418028e103283775780663d078415590be31.zip
uhd: added a finite acquisition call to usrp source
Diffstat (limited to 'gr-uhd/lib')
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_source.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc
index 51a756908..2244238bd 100644
--- a/gr-uhd/lib/gr_uhd_usrp_source.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_source.cc
@@ -409,6 +409,25 @@ public:
return true;
}
+ std::vector<std::complex<float> > finite_acquisition(const size_t nsamps){
+ #ifdef GR_UHD_USE_STREAM_API
+ uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
+ cmd.num_samps = nsamps;
+ cmd.stream_now = true;
+ _dev->issue_stream_cmd(cmd);
+
+ std::vector<std::complex<float> > samps(nsamps);
+ const size_t actual_num_samps = _rx_stream->recv(
+ &samps.front(), nsamps, _metadata, 0.1
+ );
+ samps.resize(actual_num_samps);
+
+ return samps;
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
private:
uhd::usrp::multi_usrp::sptr _dev;
const uhd::stream_args_t _stream_args;