aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/rx_timed_samples.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/examples/rx_timed_samples.cpp')
-rw-r--r--host/examples/rx_timed_samples.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 58b5af9da..e971e9f6a 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -29,6 +29,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::string transport_args;
int seconds_in_future;
size_t total_num_samps;
+ double rx_rate;
//setup the program options
po::options_description desc("Allowed options");
@@ -37,6 +38,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("args", po::value<std::string>(&transport_args)->default_value(""), "simple uhd transport args")
("secs", po::value<int>(&seconds_in_future)->default_value(3), "number of seconds in the future to receive")
("nsamps", po::value<size_t>(&total_num_samps)->default_value(1000), "total number of samples to receive")
+ ("rxrate", po::value<double>(&rx_rate)->default_value(100e6/16), "rate of incoming samples")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -57,9 +59,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Using Device: %s") % sdev->get_name() << std::endl;
//set properties on the device
- double rx_rate = sdev->get_rx_rates()[4]; //pick some rate
std::cout << boost::format("Setting RX Rate: %f Msps...") % (rx_rate/1e6) << std::endl;
sdev->set_rx_rate(rx_rate);
+ std::cout << boost::format("Actual RX Rate: %f Msps...") % (sdev->get_rx_rate()/1e6) << std::endl;
std::cout << boost::format("Setting device timestamp to 0...") << std::endl;
sdev->set_time_now(uhd::time_spec_t(0));
@@ -67,11 +69,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << std::endl;
std::cout << boost::format("Begin streaming %u samples, %d seconds in the future...")
% total_num_samps % seconds_in_future << std::endl;
- uhd::stream_cmd_t stream_cmd;
+ uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
+ stream_cmd.num_samps = total_num_samps;
stream_cmd.stream_now = false;
stream_cmd.time_spec = uhd::time_spec_t(seconds_in_future);
- stream_cmd.continuous = false;
- stream_cmd.num_samps = total_num_samps;
sdev->issue_stream_cmd(stream_cmd);
//loop until total number of samples reached