>>>>> In my code, I'm using the variable d_max_pkts. So, when d_num_pkts_output
>>>>>> = d_max_pkts, the program stops:
>>>>>
>>>>> if (d_num_pkts_output >= d_max_pkts)
>>>>> return 0;
>>>>>
>>>>> 3. Yes, my BLOCK 1 is as follows:
>>>>>
>>>>> block(
>>>>> //"gr uhd amsg source",
>>>>> "BLOCK 1",
>>>>> gr_make_io_signature(0, 0, 0),
>>>>> gr_make_io_signature(0, 0, 0),
>>>>> msg_signature(false, 1)
>>>>>
>>>>>
>>>>> Thanks again for your advice,
>>>>>
>>>>> Regards,
>>>>>
>>>>> Jose
>>>>>
>>>>>
>>>>> On Wed, Oct 17, 2012 at 5:14 PM, John Malsbury <
address@hidden
>>>>>> wrote:
>>>>>
>>>>>> So, block 2 is never processing the data? What are you using to set
>>>>>> the "N"? Does the uhd_amsg_source have the same i/o as the original block
>>>>>> - no inputs, one msg output?
>>>>>>
>>>>>> If you're looking to something to generate periodic msg's with
>>>>>> arbirtrary key and value, the heart_beat block in my pre-cog branch might
>>>>>> help...
>>>>>>
>>>>>> -John
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Oct 16, 2012 at 11:34 PM, Jose Torres Diaz <
>>>>>>
address@hidden> wrote:
>>>>>>
>>>>>>> Hi John,
>>>>>>>
>>>>>>> I wrote the code in C++ based on UHD_AMsg_source.cc, provided in
>>>>>>> GRExtras. In my work function, I've finished it using return -1 (ie. the
>>>>>>> block has finished processing correctly) as shown below:
>>>>>>>
>>>>>>> int work(
>>>>>>> const InputItems &,
>>>>>>> const OutputItems &
>>>>>>> ){
>>>>>>> //work definition here (ie. generate a packet and post
>>>>>>> downstream)
>>>>>>> return -1; //done running, work done status
>>>>>>> }
>>>>>>>
>>>>>>> However, in that way the block in GNU Radio Companion runs only once.
>>>>>>> The other possibility is not to use "return" at all, but in that case what
>>>>>>> I have is:
>>>>>>>
>>>>>>> 1. BLOCK 1 generates a packet
>>>>>>> 2. BLOCK 1 post the packet downstream
>>>>>>>
>>>>>>> Step 1 and 2 repeats "N times". When finishes, it gives the control
>>>>>>> to BLOCK 2 to process the message. However, I need a sequence as follows:
>>>>>>>
>>>>>>> 1. BLOCK 1 generates a packet
>>>>>>> 2. BLOCK 1 post the packet downstream
>>>>>>> 3. BLOCK 2 process the packet
>>>>>>> 4. BLOCK 2 post the message again downstream and so on...
>>>>>>>
>>>>>>> Step 1 to 4 should repeat "N times".
>>>>>>>
>>>>>>> Thanks again for your help,
>>>>>>>
>>>>>>> Jose
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Oct 17, 2012 at 4:52 PM, John Malsbury <
>>>>>>>
address@hidden> wrote:
>>>>>>>
>>>>>>>> Jose,
>>>>>>>>
>>>>>>>> Try a while(1) with a block and a blocking call to pop msg's off
>>>>>>>> the queue:
>>>>>>>>
>>>>>>>> self.pop_msg_queue()
>>>>>>>>
>>>>>>>> Should help you avoid the return -1
>>>>>>>>
>>>>>>>> Or maybe I've misunderstood your problem...?
>>>>>>>>
>>>>>>>> -John
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Oct 16, 2012 at 11:18 PM, Jose Torres Diaz <
>>>>>>>>
address@hidden> wrote:
>>>>>>>>
>>>>>>>>> Hi All,
>>>>>>>>>
>>>>>>>>> I'm working with 2 blocks that I've created using "UHD_AMsg_Source"
>>>>>>>>> as a reference model. In these blocks, I am passing pmt_dict type as
>>>>>>>>> messages, ie:
>>>>>>>>>
>>>>>>>>> this->post_msg(0, AMSG_KEY, dictionary,_id);
>>>>>>>>>
>>>>>>>>> Where, dictionary contains data/metadata that I can read in the
>>>>>>>>> next block downstream.
>>>>>>>>>
>>>>>>>>> BLOCK 1 -- (pmt_dict included in the message) --> BLOCK 2
>>>>>>>>>
>>>>>>>>> The blocks are working ok, but the problem is that when I want to
>>>>>>>>> generate several packets and post them downstream, BLOCK 1 runs until
>>>>>>>>> finishes and then BLOCK 2 takes the control until finishes. The problem is
>>>>>>>>> the "return" sentence in my work function. I did 2 possible ways
>>>>>>>>>
>>>>>>>>> Option 1: Using -1
>>>>>>>>>
>>>>>>>>> work {
>>>>>>>>> //work here
>>>>>>>>> return -1
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> In this way BLOCK 1 stops working after one iteration and it does
>>>>>>>>> not run as many times as I want.
>>>>>>>>>
>>>>>>>>> Option 1: Not using return
>>>>>>>>>
>>>>>>>>> work {
>>>>>>>>> //work here
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> In this way BLOCK 1 runs many times and posts messages downstream
>>>>>>>>> all those times, but it gives the control to BLOCK 2 when it finishes.
>>>>>>>>> Then, BLOCK 2 takes the messages from the message queue. However, this
>>>>>>>>> implementation is not useful for me. BLOCK 1 should post a message
>>>>>>>>> downstream and then, BLOCK 2 takes the message and work with the packet.
>>>>>>>>>
>>>>>>>>> Any suggestion is welcome, thanks a lot for your time,
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Jose
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Discuss-gnuradio mailing list
>>>>>>>>>
address@hidden
>>>>>>>>>
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
>
address@hidden
>
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio