def __init__(self, dataPort=1, ducIndex=1, ducRateIndex=1, hostname='ndr651', localInterface="eth6", txChannel=1): gr.top_block.__init__(self, "NDR651 Single Tx/Rx Example") Qt.QWidget.__init__(self) self.setWindowTitle("NDR651 Single Tx/Rx Example") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "ndr651_single_trx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.dataPort = dataPort self.ducIndex = ducIndex self.ducRateIndex = ducRateIndex self.hostname = hostname self.localInterface = localInterface self.txChannel = txChannel ################################################## # Variables ################################################## self.confPath = confPath = os.path.expanduser("~/.ndr651_single_trx.cfg") self._txFreqCfg_config = ConfigParser.ConfigParser() self._txFreqCfg_config.read(confPath) try: txFreqCfg = self._txFreqCfg_config.getfloat('tx', 'freq') except: txFreqCfg = 1000 self.txFreqCfg = txFreqCfg self._txAttenCfg_config = ConfigParser.ConfigParser() self._txAttenCfg_config.read(confPath) try: txAttenCfg = self._txAttenCfg_config.getint('tx', 'atten') except: txAttenCfg = 0 self.txAttenCfg = txAttenCfg self.radioObj = radioObj = crd.getRadioObject("ndr651", verbose=False) self._ducFreqCfg_config = ConfigParser.ConfigParser() self._ducFreqCfg_config.read(confPath) try: ducFreqCfg = self._ducFreqCfg_config.getfloat('duc', 'fre') except: ducFreqCfg = 0 self.ducFreqCfg = ducFreqCfg self._ducAttenCfg_config = ConfigParser.ConfigParser() self._ducAttenCfg_config.read(confPath) try: ducAttenCfg = self._ducAttenCfg_config.getfloat('duc', 'atten') except: ducAttenCfg = 0 self.ducAttenCfg = ducAttenCfg self._cwFreqCfg_config = ConfigParser.ConfigParser() self._cwFreqCfg_config.read(confPath) try: cwFreqCfg = self._cwFreqCfg_config.getfloat('cw', 'freq') except: cwFreqCfg = 1.25 self.cwFreqCfg = cwFreqCfg self._cwAmpCfg_config = ConfigParser.ConfigParser() self._cwAmpCfg_config.read(confPath) try: cwAmpCfg = self._cwAmpCfg_config.getfloat('cw', 'amp1') except: cwAmpCfg = -1.0 self.cwAmpCfg = cwAmpCfg self.txFreq = txFreq = txFreqCfg self.txAtten = txAtten = txAttenCfg self.radioParam = radioParam = {"type":"ndr651", "host":hostname, "port":8617, "obj":radioObj} self.ducRateSet = ducRateSet = radioObj.getWbducRateSet() self.ducFreq = ducFreq = ducFreqCfg self.ducAtten = ducAtten = ducAttenCfg self.cwFreq = cwFreq = cwFreqCfg self.cwAmp = cwAmp = cwAmpCfg ################################################## # Blocks ################################################## self._txFreq_range = Range(2, 6000, 40, txFreqCfg, 200) self._txFreq_win = RangeWidget(self._txFreq_range, self.set_txFreq, 'TX Freq (MHz)', "counter_slider", float) self.top_layout.addWidget(self._txFreq_win) self._txAtten_range = Range(0, 15, 1, txAttenCfg, 16) self._txAtten_win = RangeWidget(self._txAtten_range, self.set_txAtten, 'TX Atten', "counter_slider", int) self.top_layout.addWidget(self._txAtten_win) self._ducFreq_range = Range(-25.5, +25.5, 0.5, ducFreqCfg, 4001) self._ducFreq_win = RangeWidget(self._ducFreq_range, self.set_ducFreq, 'DUC Freq (MHz)', "counter_slider", float) self.top_layout.addWidget(self._ducFreq_win) self._ducAtten_range = Range(-20, 60, 1.0, ducAttenCfg, int(60/0.25)+1) self._ducAtten_win = RangeWidget(self._ducAtten_range, self.set_ducAtten, 'DUC Attenuation', "counter_slider", float) self.top_layout.addWidget(self._ducAtten_win) self._cwFreq_range = Range(-40.0, +40.0, 1.25, cwFreqCfg, int((80.0/2.5)+1)) self._cwFreq_win = RangeWidget(self._cwFreq_range, self.set_cwFreq, 'GR CW Freq (% BW)', "counter_slider", float) self.top_layout.addWidget(self._cwFreq_win) self._cwAmp_range = Range(-90, +10, 1, cwAmpCfg, 101) self._cwAmp_win = RangeWidget(self._cwAmp_range, self.set_cwAmp, 'GR CW Amp (dB)', "counter_slider", float) self.top_layout.addWidget(self._cwAmp_win) self.new_651_sink = CyberRadio.ndr651_sink(hostname, 1024, True) self.new_651_sink.setDUCParameters(ducIndex, ducRateIndex, txChannel) self.new_651_sink.setDUCFreq(ducFreq*1e6) self.new_651_sink.setDUCAtten(ducAtten) self.new_651_sink.setEthernetInterface(dataPort, localInterface, ducIndex+65000) self.new_651_sink.setTxFreq(txFreq) self.new_651_sink.setTxAtten(txAtten) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 1024) self.blocks_rotator_cc_0 = blocks.rotator_cc(float(cwFreq)*numpy.pi/50) self.analog_const_source_x_0 = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0, 10.0**(float(cwAmp)/20)) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.new_651_sink, 0))