24 #include <boost/foreach.hpp>
25 #include <boost/format.hpp>
35 const double start_fracs,
36 const double samp_rate,
37 const double idle_duration,
38 const double burst_duration
41 "uhd tag source demo",
42 gr::io_signature::make(0, 0, 0),
43 gr::io_signature::make(1, 1, sizeof(std::complex<float>))
45 _time_secs(start_secs),
46 _time_fracs(start_fracs),
47 _samp_rate(samp_rate),
48 _samps_per_burst(samp_rate*burst_duration),
49 _cycle_duration(idle_duration + burst_duration),
50 _samps_left_in_burst(1),
89 std::complex<float> *output =
reinterpret_cast<std::complex<float> *
>(output_items[0]);
90 for (
size_t i = 0; i < size_t(noutput_items); i++){
91 output[i] = std::complex<float>(0.7, 0.7);
98 _do_new_burst =
false;
99 _samps_left_in_burst = _samps_per_burst;
104 _time_fracs += _cycle_duration;
106 _time_fracs = std::modf(_time_fracs, &intpart);
113 if (_samps_left_in_burst <
size_t(noutput_items)){
115 _do_new_burst =
true;
116 noutput_items = _samps_left_in_burst;
119 _samps_left_in_burst -= noutput_items;
120 return noutput_items;
126 const double _samp_rate;
128 const double _cycle_duration;
void add_item_tag(unsigned int which_output, uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid=pmt::PMT_F)
Adds a new tag onto the given output buffer.
Definition: block.h:605
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
just like gr::block::general_work, only this arranges to call consume_each for you ...
Definition: tag_source_demo.h:83
PMT_API const pmt_t PMT_T
std::string name() const
Definition: basic_block.h:147
std::vector< const void * > gr_vector_const_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:38
tag_source_demo(const uint64_t start_secs, const double start_fracs, const double samp_rate, const double idle_duration, const double burst_duration)
Definition: tag_source_demo.h:33
PMT_API pmt_t string_to_symbol(const std::string &s)
Return the symbol whose name is s.
void make_time_tag(const uint64_t tag_count)
Definition: tag_source_demo.h:56
std::vector< void * > gr_vector_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:37
PMT_API pmt_t from_uint64(uint64_t x)
Return the pmt value that represents the uint64 x.
uint64_t nitems_written(unsigned int which_output)
Return the number of items written on output stream which_output.
unsigned __int64 uint64_t
Definition: stdint.h:90
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
#define false
Definition: stdbool.h:33
PMT_API pmt_t make_tuple()
sync_block(void)
Definition: sync_block.h:40
Definition: tag_source_demo.h:29
PMT_API pmt_t from_double(double x)
Return the pmt value that represents double x.
void make_eob_tag(const uint64_t tag_count)
Definition: tag_source_demo.h:75
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:56
void make_sob_tag(const uint64_t tag_count)
Definition: tag_source_demo.h:67