aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-09 17:35:15 -0700
committerJosh Blum <josh@joshknows.com>2010-07-09 17:35:15 -0700
commitbf77d1f6e38e1cb561520408ecff8f633f5cefc7 (patch)
treebdf9efe00dd25f542d5ca301136fe64c2108149b /host/examples
parentecd7308793ad639880faf2a44f3b8b603d87c7fd (diff)
downloaduhd-bf77d1f6e38e1cb561520408ecff8f633f5cefc7.tar.gz
uhd-bf77d1f6e38e1cb561520408ecff8f633f5cefc7.tar.bz2
uhd-bf77d1f6e38e1cb561520408ecff8f633f5cefc7.zip
uhd: added error codes to rx metadata, switched examples to use
vrt packet handler fills in error codes and inspects non-data packet
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/benchmark_rx_rate.cpp5
-rw-r--r--host/examples/rx_timed_samples.cpp9
2 files changed, 10 insertions, 4 deletions
diff --git a/host/examples/benchmark_rx_rate.cpp b/host/examples/benchmark_rx_rate.cpp
index 7b512e56e..ba4dd34d0 100644
--- a/host/examples/benchmark_rx_rate.cpp
+++ b/host/examples/benchmark_rx_rate.cpp
@@ -53,10 +53,13 @@ static inline void test_device(
uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::RECV_MODE_ONE_PACKET
);
- if (num_rx_samps == 0){
+ if (num_rx_samps == 0 and md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){
std::cerr << "Unexpected timeout on recv, exit test..." << std::endl;
return;
}
+ if (num_rx_samps == 0){
+ std::cerr << "Unexpected error on recv, continuing..." << std::endl;
+ }
if (not md.has_time_spec){
std::cerr << "Metadata missing time spec, exit test..." << std::endl;
return;
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index fcf662c4e..95f805007 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -93,13 +93,16 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::device::RECV_MODE_ONE_PACKET
);
if (num_rx_samps == 0 and num_acc_samps > 0){
- std::cout << "Got timeout before all samples received, possible packet loss, exiting loop..." << std::endl;
+ std::cout << boost::format(
+ "Got error code 0x%x before all samples received, possible packet loss, exiting loop..."
+ ) % md.error_code << std::endl;
break;
}
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;
+ 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;
}