def __init__(self, rx_callback, options): gr.hier_block2.__init__(self, "receive_path", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature gr.io_signature(0, 0, 0)) # Output signature options = copy.copy(options) # make a copy so we can destructively modify self._verbose = options.verbose self._log = options.log self._rx_callback = rx_callback # this callback is fired when there's a packet available # receiver self.ofdm_rx = \ blks2.ofdm_demod(options, callback=self._rx_callback) # Carrier Sensing Blocks alpha = 0.001 thresh = 30 # in dB, will have to adjust self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) self.connect(self, self.ofdm_rx) self.connect(self.ofdm_rx, self.probe) # Display some information about the setup if self._verbose: self._print_verbage()
def __init__(self, options, rx_callback): phy_base.__init__(self, options, rx_callback) # Transmit chain self._tx_mod = blks2.ofdm_mod(options, msgq_limit=4, pad_for_usrp=False) self.connect(self._tx_mod, gr.kludge_copy(gr.sizeof_gr_complex), self) # Receive chain self._rx_demod = blks2.ofdm_demod(options, callback=self._rx_callback) self.connect(self, gr.kludge_copy(gr.sizeof_gr_complex), self._rx_demod)