aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/rx_timed_samples.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-10-05 11:59:27 -0700
committerJosh Blum <josh@joshknows.com>2011-11-03 20:37:10 -0700
commita629bbe7e3c39a10bdc3a981f6badb85a436b443 (patch)
tree58036a96d8fa045ce8900821b073f9f5a441f683 /host/examples/rx_timed_samples.cpp
parente89b20da1511f02d887435d093d8efef3e4df261 (diff)
downloaduhd-a629bbe7e3c39a10bdc3a981f6badb85a436b443.tar.gz
uhd-a629bbe7e3c39a10bdc3a981f6badb85a436b443.tar.bz2
uhd-a629bbe7e3c39a10bdc3a981f6badb85a436b443.zip
uhd: updated examples to use new streamer interface
Diffstat (limited to 'host/examples/rx_timed_samples.cpp')
-rw-r--r--host/examples/rx_timed_samples.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 05cc0717b..6389375d9 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -70,6 +70,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Setting device timestamp to 0...") << std::endl;
usrp->set_time_now(uhd::time_spec_t(0.0));
+ //create a receive streamer
+ uhd::streamer_args stream_args("fc32"); //complex floats
+ uhd::rx_streamer::sptr rx_stream = usrp->get_rx_streamer(stream_args);
+
//setup streaming
std::cout << std::endl;
std::cout << boost::format(
@@ -85,7 +89,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::rx_metadata_t md;
//allocate buffer to receive with samples
- std::vector<std::complex<float> > buff(usrp->get_device()->get_max_recv_samps_per_packet());
+ std::vector<std::complex<float> > buff(rx_stream->get_max_num_samps());
//the first call to recv() will block this many seconds before receiving
double timeout = seconds_in_future + 0.1; //timeout (delay before receive + padding)
@@ -93,10 +97,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
size_t num_acc_samps = 0; //number of accumulated samples
while(num_acc_samps < total_num_samps){
//receive a single packet
- size_t num_rx_samps = usrp->get_device()->recv(
- &buff.front(), buff.size(), md,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, timeout
+ size_t num_rx_samps = rx_stream->recv(
+ &buff.front(), buff.size(), md, timeout
);
//use a small timeout for subsequent packets