discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Asynchronous Switch between two stream inputs to


From: Bastian Bloessl
Subject: Re: [Discuss-gnuradio] Asynchronous Switch between two stream inputs to one output GNU Radio C++
Date: Thu, 27 Jul 2017 08:21:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hi,

On 07/27/2017 01:19 AM, Cristian Rodríguez wrote:
Imágenes integradas 1
This block just receive signal for one of the two ports at the same time. In this way, for example if it receives in the IN0, in the IN1 there's nothing. Depending on the parameter Initial Standard I select which input must pass to the output, that as supposed, is the input in which I have signal.

Then, i wrote the next forecast() method.

     void forecast(int noutput_items, gr_vector_int &ninput_items_required){
     if(d_st_aux == 0){
         ninput_items_required[0] = 0;
         ninput_items_required[1] = noutput_items;//Tx Xbee
     }else{
         ninput_items_required[0] = noutput_items;//Tx Wifi
         ninput_items_required[1] = 0;
     }
       }

In that way I just take the input that has signal, and that works perfectly.

The problem is when, through the third input, I send a command in order to change the input that I want to read. That's done by way of re-writing the value of *d_st_aux*, it occurs in real time. For this case, I would need that forecast method changes in real time, the ninput_items_required, but it doesn't work. I think the block is just calling the forecast method when it starts, but I need to call forecast in real time.

I think the general design of the block is OK. After the message is received forecast() and (depending on forecast() and the availability of samples) work() will also be called. That means forecast() is *not* only run during initialization of the block.

Maybe the actual problem is at a different part of the code. Or maybe things happen in a different order then you expect. I would recommend to add some debug output to forecast(), work(), and the message handler. That might help to debug the problem.


Best,
Bastian



reply via email to

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