aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/rx_timed_samples.cpp
diff options
context:
space:
mode:
authorPhilip Balister <philip@opensdr.com>2010-07-14 20:36:48 +0000
committerPhilip Balister <philip@opensdr.com>2010-07-14 20:36:48 +0000
commit87428bf6e1c5fcf623595063921277f9827a919a (patch)
treefbd2855b45ff24bead6342375f87fe00abb20a05 /host/examples/rx_timed_samples.cpp
parent9ee1b33bbc170b2e76fbb5b9a075d6b6c7315a7e (diff)
parent959669e383c75fdcbd11091466516bd5af66cfb5 (diff)
downloaduhd-87428bf6e1c5fcf623595063921277f9827a919a.tar.gz
uhd-87428bf6e1c5fcf623595063921277f9827a919a.tar.bz2
uhd-87428bf6e1c5fcf623595063921277f9827a919a.zip
Merge branch 'master' of ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Diffstat (limited to 'host/examples/rx_timed_samples.cpp')
-rw-r--r--host/examples/rx_timed_samples.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 95f805007..3b9acbb2c 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -92,20 +92,32 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::RECV_MODE_ONE_PACKET
);
- if (num_rx_samps == 0 and num_acc_samps > 0){
+
+ //handle the error codes
+ switch(md.error_code){
+ case uhd::rx_metadata_t::ERROR_CODE_NONE:
+ break;
+
+ case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
+ if (num_acc_samps == 0) continue;
std::cout << boost::format(
- "Got error code 0x%x before all samples received, possible packet loss, exiting loop..."
+ "Got timeout before all samples received, possible packet loss, exiting loop..."
) % md.error_code << std::endl;
- break;
+ goto done_loop;
+
+ default:
+ std::cout << boost::format(
+ "Got error code 0x%x, exiting loop..."
+ ) % md.error_code << std::endl;
+ goto done_loop;
}
- if (num_rx_samps == 0) continue; //wait for packets with contents
if(verbose) std::cout << boost::format(
"Got packet: %u samples, %u full secs, %f frac secs"
) % num_rx_samps % md.time_spec.get_full_secs() % md.time_spec.get_frac_secs() << std::endl;
num_acc_samps += num_rx_samps;
- }
+ } done_loop:
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;