Dear Anil,

Not every 64 items,but work() function is called if there are more than 64
items in the input stream (buffer).

Regards,
Jeon.

2015-06-19 11:51 GMT+09:00 Anil Kumar Yerrapragada <yanilkumar2...@gmail.com
>:

> Hi,
>
> A quick question on tags.
>
> I'm coding a custom block in python and my forecast function is like so:
>
> def forecast(self, noutput_items, ninput_items_required):
>         #setup size of input_items[i] for work call
>         for i in range(len(ninput_items_required)):
>             ninput_items_required[i] = 64
>
> If my understanding is correct, every 64 items, the block's work function
> is called.
>
> Each time work is called, I want to add a tag to the first of the 64
> elements that come in (the *value* of my tag is a list). So I used:
>
> lst = (1, 2, 3, 4) #example
>
>         item_index = 0
>         offset = self.nitems_written(0) + item_index
>         key = pmt.string_to_symbol("example")
>         value = pmt.to_pmt(lst)
>
>         self.add_item_tag(0, offset, key, value)
>
> This works. I can see the tag being added when I use a QT time sink.
>
> But when I add some print statements and check what I noticed is that tags
> are being added at indicies 0, 8192, 16384 etc. Basically multiples of 8192
> which is the full length of the input buffer in0 = input_items[0].
>
> Shouldn't self.nitems_written(0) be 64 each time?
>
> What I really want is tags being added at 0, 64, 128 etc. I'm sure I'm
> missing something pretty silly.
>
> Thanks
> Anil
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to