Problem with streamed tags

hi all,

I have three blocks:

  1. MESSAGE_LOADER
    reads a binary file and outputs it byte by byte to the next block
    (PACKET_CREATOR). On every 28th byte (and on the 0th byte) it adds tags
    denoting the start of a PDU

  2. PACKET_CREATOR (tagged_stream_block)
    waits for 28 bytes to arrive. once this is accomplished, it reads the
    first of those 28 bytes and uses it for internal logic. the other 27
    bytes are the payload of a packet, to which it prepends a header and
    appends a crc (2 bytes). NOTE: the length of the header in bits is not
    divisible by 8. because of this, in order to have the whole packet in
    one single chunk of memory, I have to do tedious bit shifting of the 27
    payload bytes that come after the header… once the packet is created, I
    want to pass it to the next block, containing tags in the first header
    byte. So, now I’ve changed things: before, the tags were ‘connected’ to
    the first payload byte. now, I want them to be ‘connected’ to the first
    header byte, which was created in this very block.

  3. PACKET_VERIFIER (tagged_stream_block)
    for testing purposes, I want this block to receive the whole packet that
    was created in PACKET_CREATOR and write it to the screen. In order for
    the block to know when a packet starts, every first byte of a packet
    must contain the length of it.

My question is this: I don’t get this item enumeration thing in
gnuradio. between the first 2 blocks it was easy enough, as I had to
simply include tags in every 28th byte, and it is easy to picture item
enumeration there (the first byte of the file has offset 0, the second
one 1 etc). but how are the items enumerated between the PACKET_CREATOR
and the PACKET_VERIFIER block?? which item index should I use to add the
length tag to the first header byte??

I hope I have made myself sufficiently clear…if not, feel free to ask
for more details. any help is immensely appreciated!

thanks in advance!

On 05.08.2015 01:42, Mat Mat wrote:

My question is this: I don’t get this item enumeration thing in
gnuradio. between the first 2 blocks it was easy enough, as I had to
simply include tags in every 28th byte, and it is easy to picture item
enumeration there (the first byte of the file has offset 0, the second
one 1 etc). but how are the items enumerated between the PACKET_CREATOR
and the PACKET_VERIFIER block?? which item index should I use to add the
length tag to the first header byte??

Item 0 will have the first byte of the first packet, regardless of what
you’re actually doing. There’s a couple of blocks that do something like
this, and they all set the tag propagation policy to ‘NONE’ (which
requires manual propagation), and then get/set tags accordingly.

So, if you read the tag from input item 0, and then write one to output
item 0, I believe it’ll do what you wanted.

M

hey Martin,

many thanks for the reply! one more question about this though: every
time the work function is called in the PACKET_CREATOR, it reads 28
bytes and outputs 37 bytes (as confirmed by nitems_read(0) and
nitems_written(0)). From what you were saying, and from what I’ve read
from other sources, I got the following impression: in order to tag
every first byte of a packet at the output of PACKET_CREATOR, I have to
add the tag to the item with item offset equal to the current
nitems_written(0)-value in PACKET_CREATOR. Am I correct?

One other question:

Now I want to modulate the output of PACKET_CREATOR with GFSK and send
over the air using a USRP. Furthermore, each packet should be sent at a
different frequency (freq. hopping), which, as I’ve heard, can also be
achieved by tagging the input to the USRP sink which sets the center
frequency of the usrp (as far as I know, at least…). There is a
GFSK_mod block that would do the modulation for me. That’s a hier block.
However, I found no specification in it concerning tag propagation, but
I would need it to propagate tags to every first modulated symbol of a
packet to set the center frequency on which the packet should be
transmitted. Is there a simple way to achieve that without having to
re-implement the modulator in a custom block with added tag propagation?

many thanks for your help!

I’m guessing something went wrong here? :slight_smile: the post is empty

On 06.08.2015 10:57, Mat Mat wrote:

I’m guessing something went wrong here? :slight_smile: the post is empty

Urgh, no idea what happened. Main point was, use the QT GUI time sink to
visually check if tags are in the right spot.

M

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs