aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/rx_samples_to_udp.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_samples_to_udp.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_samples_to_udp.cpp')
-rw-r--r--host/examples/rx_samples_to_udp.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp
index d06f1bc6e..3db436ad5 100644
--- a/host/examples/rx_samples_to_udp.cpp
+++ b/host/examples/rx_samples_to_udp.cpp
@@ -130,6 +130,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
UHD_ASSERT_THROW(ref_locked.to_bool());
}
+ //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
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
stream_cmd.num_samps = total_num_samps;
@@ -139,14 +143,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//loop until total number of samples reached
size_t num_acc_samps = 0; //number of accumulated samples
uhd::rx_metadata_t md;
- 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());
uhd::transport::udp_simple::sptr udp_xport = uhd::transport::udp_simple::make_connected(addr, port);
while(num_acc_samps < total_num_samps){
- 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
+ size_t num_rx_samps = rx_stream->recv(
+ &buff.front(), buff.size(), md
);
//handle the error codes