Switch between rx and tx

Hi everyone

I want to make a receiver that can send the received data back to the
transmitter.
So I defined my top block as follows:

class my_top_block(gr.top_block):
def init(self, modulator, demodulator, rx_callback, options):
gr.top_block.init(self)
options.tx_freq=24e8
options.rx_freq=25e8
options.bitrate=5e5
options.tx_gain=17.5
options.rx_gain=49.5

    # Get the modulation's bits_per_symbol
    args = modulator.extract_kwargs_from_options(options)
    symbol_rate = options.bitrate /

modulator(**args).bits_per_symbol()

    self.sink = uhd_transmitter(options.args, symbol_rate,
                                options.samples_per_symbol,
                                options.tx_freq, options.tx_gain,
                                options.spec, options.antenna,
                                options.verbose)

    self.source = uhd_receiver(options.args, symbol_rate,
                               options.samples_per_symbol,
                               options.rx_freq, options.rx_gain,
                               options.spec, options.antenna,
                               options.verbose)
    options.samples_per_symbol = self.source._sps

    self.txpath = transmit_path(modulator, options)
    self.rxpath = receive_path(demodulator, rx_callback, options)

    self.connect(self.txpath, self.sink)
    self.connect(self.source, self.rxpath)

The problem is that if I define self.source after self.sink, I can only
receive data, while if I define self.sink after self.source, I can only
send data.
My device is USRP N210.

Best regards!

Dong W.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs