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,
39 const std::string &length_tag_name =
""
42 "uhd tag source demo",
43 gr::io_signature::make(0, 0, 0),
44 gr::io_signature::make(1, 1, sizeof(std::complex<float>))
46 _time_secs(start_secs),
47 _time_fracs(start_fracs),
48 _samp_rate(samp_rate),
49 _samps_per_burst(samp_rate*burst_duration),
50 _cycle_duration(idle_duration + burst_duration),
51 _samps_left_in_burst(1),
53 _firstrun(not length_tag_name.empty()),
105 std::complex<float> *output =
reinterpret_cast<std::complex<float> *
>(output_items[0]);
106 for (
size_t i = 0; i < size_t(noutput_items); i++) {
107 output[i] = std::complex<float>(0.7, 0.7);
114 _do_new_burst =
false;
115 _samps_left_in_burst = _samps_per_burst;
131 _time_fracs += _cycle_duration;
133 _time_fracs = std::modf(_time_fracs, &intpart);
140 if (_samps_left_in_burst <
size_t(noutput_items)){
147 _do_new_burst =
true;
148 noutput_items = _samps_left_in_burst;
151 _samps_left_in_burst -= noutput_items;
152 return noutput_items;
158 const double _samp_rate;
160 const double _cycle_duration;
PMT_API pmt_t from_long(long x)
Return the pmt value that represents the integer x.
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:616
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:99
PMT_API const pmt_t PMT_T
std::string name() const
Definition: basic_block.h:149
std::vector< const void * > gr_vector_const_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:38
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:59
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()
#define PMT_NIL
Definition: pmt.h:252
sync_block(void)
Definition: sync_block.h:40
PMT_API bool is_null(const pmt_t &x)
Return true if x is the empty list, otherwise return false.
void make_length_tag(const uint64_t tag_count, const uint64_t burst_len)
Definition: tag_source_demo.h:86
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:78
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
tag_source_demo(const uint64_t start_secs, const double start_fracs, const double samp_rate, const double idle_duration, const double burst_duration, const std::string &length_tag_name="")
Definition: tag_source_demo.h:33
void make_sob_tag(const uint64_t tag_count)
Definition: tag_source_demo.h:70