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 ")
%_msg.value
%_msg.srcid
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,
Regards,
JoseOn 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
https://github.com/guruofquality/grextras/blob/master/include/gnuradio/block.h#L208
> 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:
http://gnuradio.org/cgit/gnuradio.git/tree/gruel/src/include/gruel/pmt.h#n330
-josh