discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] PDU Message Structure


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] PDU Message Structure
Date: Sat, 21 Nov 2015 18:27:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

Hi Devin,

had to look this up myself:
you're right, PDU messages air pmt::pair_t; it's a bit hard to read before, but as soon as you realize car gives you the first element of a pair, and cdr the second, things become clearer:

        d_curr_meta = pmt::car(msg);
        d_curr_vect = pmt::cdr(msg);
        d_curr_len = pmt::length(d_curr_vect);


So, the second part is the one containing data in a vector, i.e. what gets copied to the pdu_to_tagged_stream's output as items (see what happens with d_curr_vect in work()).
Now, what's the structure of d_curr_meta? Looking at l. 96ff:
      // Copy tags
      if (!pmt::eq(d_curr_meta, pmt::PMT_NIL) ) {
        pmt::pmt_t klist(pmt::dict_keys(d_curr_meta));
        for (size_t i = 0; i < pmt::length(klist); i++) {
          pmt::pmt_t k(pmt::nth(i, klist));
          pmt::pmt_t v(pmt::dict_ref(d_curr_meta, k, pmt::PMT_NIL));
          add_item_tag(0, nitems_written(0), k, v, alias_pmt());
        }
      }

we see that d_curr_meta is treated as a dictionary, and the key/pair values are added as stream tags.

So, you're probably doing it right:
The first part of your pair is the tags you want to have alongside with your samples, but something is wrong with the way you send samples, so:
what *is* the second part of your pair? Or am I completely misunderstanding you, and you want to somehow send the contents of your dictionary as stream items ("samples")?

Cheers,
Marcus

On 21.11.2015 16:45, devin kelly wrote:
Hello,

I have a block that emits pmt::dict messages.  I'd like to connect it to a PDU to Tagged Stream block.

My problem is that a dict isn't a pair and I run into this error:


If I place the dict in a pair, I won't get that error but I do get another error telling me my data needs to be a uniform vector.  

The dict has multiple data types in it so I'm not sure what the best way to proceed is.  What's a good way to (a good way to GR I mean) structure my messages?  Make them pairs where the first part is metadata and the second is a uniform vector?

Thanks,
Devin


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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]