From 4fc9efd1f5f39caddfb40dd3daffcfb08854f9e0 Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Mon, 22 May 2017 17:00:08 -0700 Subject: examples: Added channel param for samps to/from file example - Also, fixed an issue with the --repeat option in tx_samples_from_file --- host/examples/rx_samples_to_file.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'host/examples/rx_samples_to_file.cpp') diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp index 941e5eb65..444fd155c 100644 --- a/host/examples/rx_samples_to_file.cpp +++ b/host/examples/rx_samples_to_file.cpp @@ -37,6 +37,7 @@ template void recv_to_file( uhd::usrp::multi_usrp::sptr usrp, const std::string &cpu_format, const std::string &wire_format, + const std::string &channel, const std::string &file, size_t samps_per_buff, unsigned long long num_requested_samples, @@ -50,6 +51,9 @@ template void recv_to_file( unsigned long long num_total_samps = 0; //create a receive streamer uhd::stream_args_t stream_args(cpu_format,wire_format); + std::vector channel_nums; + channel_nums.push_back(boost::lexical_cast(channel)); + stream_args.channels = channel_nums; uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args); uhd::rx_metadata_t md; @@ -209,7 +213,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ uhd::set_thread_priority_safe(); //variables to be set by po - std::string args, file, type, ant, subdev, ref, wirefmt; + std::string args, file, type, ant, subdev, ref, wirefmt, channel; size_t total_num_samps, spb; double rate, freq, gain, bw, total_time, setup_time; @@ -229,6 +233,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("gain", po::value(&gain), "gain for the RF chain") ("ant", po::value(&ant), "antenna selection") ("subdev", po::value(&subdev), "subdevice specification") + ("channel", po::value(&channel)->default_value("0"), "which channel to use") ("bw", po::value(&bw), "analog frontend filter bandwidth in Hz") ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") ("wirefmt", po::value(&wirefmt)->default_value("sc16"), "wire format (sc8, sc16 or s16)") @@ -329,7 +334,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } #define recv_to_file_args(format) \ - (usrp, format, wirefmt, file, spb, total_num_samps, total_time, bw_summary, stats, null, enable_size_map, continue_on_bad_packet) + (usrp, format, wirefmt, channel, file, spb, total_num_samps, total_time, bw_summary, stats, null, enable_size_map, continue_on_bad_packet) //recv to file if (wirefmt == "s16") { if (type == "double") recv_to_filerecv_to_file_args("f64"); -- cgit v1.2.3