I wrote a block that writes the rx_time tag and another block that reads it. 
After reading them for a 20 to thirty calls to the work function, it stops 
getting any. The amount it reads varies from run to run. Any ideas?

This code snippet is from the work function my block that writes the tag. The 
cerr statement continues to print to the console until I stop execution.

<code>
    VITA49_packet_info packet_info = p_packet->get_VITA49_packet_info();
    if (m_do_send_tags)
    {
      double timestamp_in_seconds =
          static_cast<double>(p_packet->get_integer_seconds()) +
          static_cast<double>(p_packet->get_fraction_seconds()) * 1e-12;
      const pmt::pmt_t timestamp = pmt::make_tuple(
          pmt::from_uint64(static_cast<long long>(floor(timestamp_in_seconds))),
          pmt::from_double(timestamp_in_seconds - floor(timestamp_in_seconds)));
      std::cerr << "SEND (" << d_id << ") "
                << " tag_offset=" << m_tag_offset
                << std::setprecision(std::numeric_limits<double>::digits10 + 1)
                << " timesamp_in_seconds=" << timestamp_in_seconds << std::endl;
      add_item_tag(0, m_tag_offset, TIME_KEY, timestamp, d_id);
</code>

This code snippet is from my work function in the block that reads the tag. The 
cerr statement stops printing after twenty to thirty times suggesting that it 
no longer sees the time tags. The rest of the work function continues to 
operate properly.

<code>
  static const pmt::pmt_t TIME_KEY = pmt::string_to_symbol("rx_time");
  std::vector<tag_t> tags;
  get_tags_in_range(
      tags, 0, nitems_read(0), nitems_read(0) + noutput_items);
  std::vector<tag_t>::iterator itr;
  size_t j = 0;
  for (itr = tags.begin(); itr != tags.end(); itr++, j++)
  {
    if (pmt::eq((*itr).key, TIME_KEY))
    {
      d_real_time_seconds =
          static_cast<double>(pmt::to_uint64(pmt::tuple_ref((*itr).value, 0))) +
          static_cast<double>(pmt::to_double(pmt::tuple_ref((*itr).value, 1)));
      std::cerr << "RECEIVE (" << d_id << ") " << j
                << " tag_offset=" << (*itr).offset
                << " noutput_items=" << noutput_items
                << std::setprecision(std::numeric_limits<double>::digits10 + 1)
                << " time_seconds=" << d_real_time_seconds << std::endl;
    }
  }
}
<code>

/\/\ark.
--
Writing code accounts for 90 percent of programming. Debugging code accounts 
for the other 90 percent.



_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to