diff options
author | Josh Blum <josh@joshknows.com> | 2011-10-05 11:59:27 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-11-03 20:37:10 -0700 |
commit | a629bbe7e3c39a10bdc3a981f6badb85a436b443 (patch) | |
tree | 58036a96d8fa045ce8900821b073f9f5a441f683 /host/examples/tx_timed_samples.cpp | |
parent | e89b20da1511f02d887435d093d8efef3e4df261 (diff) | |
download | uhd-a629bbe7e3c39a10bdc3a981f6badb85a436b443.tar.gz uhd-a629bbe7e3c39a10bdc3a981f6badb85a436b443.tar.bz2 uhd-a629bbe7e3c39a10bdc3a981f6badb85a436b443.zip |
uhd: updated examples to use new streamer interface
Diffstat (limited to 'host/examples/tx_timed_samples.cpp')
-rw-r--r-- | host/examples/tx_timed_samples.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp index 1c222d414..3daf1974a 100644 --- a/host/examples/tx_timed_samples.cpp +++ b/host/examples/tx_timed_samples.cpp @@ -73,8 +73,12 @@ 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 transmit streamer + uhd::streamer_args stream_args("fc32"); //complex floats + uhd::tx_streamer::sptr tx_stream = usrp->get_tx_streamer(stream_args); + //allocate buffer with data to send - std::vector<std::complex<float> > buff(usrp->get_device()->get_max_send_samps_per_packet(), std::complex<float>(ampl, ampl)); + std::vector<std::complex<float> > buff(tx_stream->get_max_num_samps(), std::complex<float>(ampl, ampl)); //setup metadata for the first packet uhd::tx_metadata_t md; @@ -91,10 +95,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ size_t samps_to_send = std::min(total_num_samps - num_acc_samps, buff.size()); //send a single packet - size_t num_tx_samps = usrp->get_device()->send( - &buff.front(), samps_to_send, md, - uhd::io_type_t::COMPLEX_FLOAT32, - uhd::device::SEND_MODE_ONE_PACKET, timeout + size_t num_tx_samps = tx_stream->send( + &buff.front(), samps_to_send, md, timeout ); //do not use time spec for subsequent packets @@ -108,10 +110,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //send a mini EOB packet md.end_of_burst = true; - usrp->get_device()->send("", 0, md, - uhd::io_type_t::COMPLEX_FLOAT32, - uhd::device::SEND_MODE_FULL_BUFF - ); + tx_stream->send("", 0, md); std::cout << std::endl << "Waiting for async burst ACK... " << std::flush; uhd::async_metadata_t async_md; |