From 81dc70a6217f3d35dcf477a44c0151a6bc56e5a9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 17 Jan 2011 14:02:42 -0800 Subject: examples: init metadata with time before loop begins --- host/examples/tx_timed_samples.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp index 074b13e81..6d6aa7010 100644 --- a/host/examples/tx_timed_samples.cpp +++ b/host/examples/tx_timed_samples.cpp @@ -84,15 +84,17 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //allocate data to send std::vector > buff(samps_per_packet, std::complex(ampl, ampl)); + uhd::tx_metadata_t md; + md.time_spec = uhd::time_spec_t(seconds_in_future); + //send the data in multiple packets size_t num_packets = (total_num_samps+samps_per_packet-1)/samps_per_packet; for (size_t i = 0; i < num_packets; i++){ - //setup the metadata flags and time spec - uhd::tx_metadata_t md; + + //setup the metadata flags per fragment md.start_of_burst = (i == 0); //only first packet has SOB md.end_of_burst = (i == num_packets-1); //only last packet has EOB md.has_time_spec = (i == 0); //only first packet has time - md.time_spec = uhd::time_spec_t(seconds_in_future); size_t samps_to_send = std::min(total_num_samps - samps_per_packet*i, samps_per_packet); -- cgit v1.2.3