Re: [Discuss-gnuradio] Asynchronous Switch between two stream inputs to one output GNU Radio C++

2017-07-27 Thread Bastian Bloessl

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 _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

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


[Discuss-gnuradio] Asynchronous Switch between two stream inputs to one output GNU Radio C++

2017-07-26 Thread Cristian Rodríguez
Hi all

I have the next block:

[image: 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 _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.

How can I do that?

Thanks in advance.

Best regards,

Cristian
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio