[Top][All Lists]

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

Re: [Discuss-gnuradio] Message passing as input and output in block (C++

From: Jose Torres Diaz
Subject: Re: [Discuss-gnuradio] Message passing as input and output in block (C++ coding)
Date: Wed, 10 Oct 2012 15:45:57 +1030

Hi Josh,

I've check the documentation and also my variables. I've found that my list is a PMT pair or PMT dict:

    std::cout << std::endl << "checking if pair:" <<pmt::pmt_is_pair(BLOB_METADATA)<< std::endl; //This gave me true
    std::cout << std::endl << "checking if dict:" <<pmt::pmt_is_dict(BLOB_METADATA)<< std::endl; //This gave me true

So, when I have to post the message downstream, I am using as follows:

this->post_msg(0,BLOB_METADATA,_msg.value,_id);  //BLOB_METADATA is a list

However, BLOB_METADATA should be symbol type (http://gnuradio.org/doc/doxygen/classgr__block.html#a7578dece9d597abe61db91aae8a0df83). In my case, it is a list which is PMT dict type.

Is there any way that I can post this list?, I mean, is there any way that I can convert PMT dict type into PMT symb type?.

Thanks for your help,


On Wed, Oct 10, 2012 at 2:22 PM, Jose Torres Diaz <address@hidden> wrote:
Hi Josh,

I've checked this information and it is very useful. I've solved several issues that I had before. However, it is still complaining when I post a BLOB_METADATA (which is a pmt_list) downstream. What I have is the following:

BLOCK 1  --- > BLOCK 2 (both blocks use message passing as blobs)

In BLOCK 1 (work function):

 while (_offset == 0){
         _msg = this->pop_msg_queue(); //Reading the incoming blob
           if (pmt::pmt_is_blob(_msg.value))
         std::cout << std::endl << "found a blob in BLOCK 1" << std::endl;

         break; }
       if (pmt::pmt_blob_length(_msg.value) == 0)
     std::cout << std::endl << "empty blob in BLOCK 1" << std::endl;
     return -1;}   

    pmt::pmt_t BLOB_METADATA = pmt_list3(blob_key,blob_key2,blob_key3);
    //For debugging
    std::cout << std::endl << "Making a list" << std::endl;
    std::cout << std::endl << "this is the list:" <<BLOB_METADATA<< std::endl;

     this->post_msg(0,BLOB_METADATA,_msg.value,_id);  //BLOB_METADATA is a list

In BLOCK 2 (work function):

 while (_offset == 0){
        _msg = this->pop_msg_queue(); //Reading the incoming blob
             if (pmt::pmt_is_blob(_msg.value))
         std::cout << std::endl << "found a blob in -BLOCK 2" << std::endl;

         break; }
         if (pmt::pmt_blob_length(_msg.value) == 0)
         std::cout << std::endl << "empty blob in BLOCK 2" << std::endl;

         return -1;} //empty blob, we are done here

this->post_msg(0,_msg); //Pass the message as it is

//For debugging
     std::cout << std::endl << "posting a message downstream" << std::endl;
     std::cout << std::endl << "DEBUG FROM BLOB TO BLOB 10/10" << std::endl;
     std::cout << boost::format("value previous block=%8d, id previous block=%16s ")

I'm passing a message from BLOCK 1 to BLOCK 2, then I changed the key value and I replaced it as a list (BLOB_METADATA). Everything is running, but it seems to be that the message is not passed from BLOCK 1 to BLOCK 2, here is my errors in GNU Radio Companion:

thread[thread-per-block[8]: <gr_block msg_sourcer (9)>]: gr_block_detail::add_item_tag key: wrong_type : (st2_uplink burst_start_key burst_bb_gain)

Note: st2_uplink burst_start_key burst_bb_gain is the value inside blob1, blob2 and blob3 in the list

Is there any restrictions passing a pmt_list from one block to another?, or is there any constraint when I read the incoming blob from BLOCK 1 into BLOCK 2?.

Thanks a lot for your help,



On Wed, Oct 10, 2012 at 9:14 AM, Josh Blum <address@hidden> wrote:

> I generated the BLOB_METADATA as pmt::pmt_t type. However, I cannot post
> blob_data because is related to _msg (in the previous example), which is a
> gr_tag_t type.

There are two post_msg methods. The key/value version of the method is a
convenience method that makes a gr_tag_t and sets key and value


> If a copy this blob for example to a new blob as you suggested previously,
> can I then post using: this->post_msg(0, BLOB_METADATA,blob_data, _id); ?.
> I mean, will it change to pmt_t type?.

The value parameter has to be type pmt::pmt_t

There is a function to create a blob from ptr and length:


reply via email to

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