You need to follow the code into the other modules that are imported by benchmark_rx.py. The rx_callback function is passed as an argument to the constructor of my_top_block, which in turn passes it to the constructor of usrp_receive_path (in usrp_receive_path.py). In usrp_receive_path, the function is then passed to the constructor of the class receive_path (in receive_path.py), which then passes it to the constructor of class demod_pkts in the blks2 namespace.
Now here it may get a little confusing, because (1) there is no blks2.py file if you want to look up the code for demod_pkts, and (2) the relevant code is in a different part of the gnuradio source tree. The code for class demod_pkts is actually in <GR_ROOT_DIR>/gnuradio-core/src/python/gnuradio/blks2impl/pkt.py. In pkt.py, you'll see that demod_pkts spawns a thread that listens for messages dispatched over a queue, and invokes the rx_callback function passed to it each time it receives a message. The queue is asynchronously fed by a flow-graph (including filter, demodulator, correlator etc.) in the demod_pkts class that receives samples from a source and converts to packets. The code for making and un-making packets is in <GR_ROOT_DIR>/gnuradio-core/src/python/gnuradio/packet_utils.py. Disclaimer: I'm on an outdated version of the source tree, so things may not be exactly as I described them. Hope this helps. Kunal On Sat, May 21, 2011 at 3:20 AM, yulong yang <yyl....@gmail.com> wrote: > Hi all, > > I have been reading the benchmark_rx.py codes.I want to add the channel > sensing and selecting in callback function. > > I understand rx_callback in benchmark_rx is a function that make the block > wait for packet generating from the data that received from the receive_path > while running. But how dose it work exactly? Is the tb.wait() waiting for > this callback? Why I cannot find anywhere that have called this function in > the script, dose it run automatically? > > Thank you in advance. > > > > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio