Exemple #1
0
    def __init__(self,
                 fftSize=1024,
                 windowType="blackmanharris",
                 iirAlpha=2.0**-3):
        gr.hier_block2.__init__(
            self,
            "LogMagFFT",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * fftSize),
            gr.io_signaturev(
                2, 2,
                [gr.sizeof_float * fftSize, gr.sizeof_gr_complex * fftSize]),
        )

        ##################################################
        # Parameters
        ##################################################
        self.fftSize = fftSize
        self.iirAlpha = iirAlpha
        self.windowType = windowType

        ##################################################
        # Variables
        ##################################################
        self.fftWindow = fftWindow = scipy.signal.get_window(
            windowType, fftSize)

        ##################################################
        # Blocks
        ##################################################
        self.singlePoleIIR = filter.single_pole_iir_filter_ff(
            iirAlpha, fftSize)
        self.nLog10 = CyberRadio.vector_nlog10_ff(10, fftSize, 0)

        self.fwdFFT = fft.fft_vcc(fftSize, True,
                                  (fftWindow / numpy.sum(fftWindow)), True, 1)
        self.compToMagSq = blocks.complex_to_mag_squared(fftSize)

        ##################################################
        # Connections
        ##################################################
        self.connect((self, 0), (self.fwdFFT, 0))
        self.connect((self.fwdFFT, 0), (self, 1))
        self.connect((self.fwdFFT, 0), (self.compToMagSq, 0))
        self.connect((self.compToMagSq, 0), (self.singlePoleIIR, 0))
        self.connect((self.singlePoleIIR, 0), (self.nLog10, 0))
        self.connect((self.nLog10, 0), (self, 0))
 def _get_configured_wbddc(self, wbddc_index, wbddc_param_list):
     self._set_wbddc_param_list(wbddc_index, wbddc_param_list, atinit=True)
     return CyberRadio.vita_iq_source_mk3(
         vita_type=wbddc_param_list[1],
         payload_size=self.vita_payload_size,
         vita_header_size=self.vita_header_size,
         vita_tail_size=self.vita_tail_size,
         byte_swapped=self.byte_swapped,
         iq_swapped=self.iq_swapped,
         iq_scale_factor=2**-15,
         host=self.udp_host_name,
         port=wbddc_param_list[0],
         ddc_coherent=self.ddcs_coherent,
         num_outputs=self.CyberRadio_NDR_driver_interface_0.getNumTuner() if self.ddcs_coherent else 1,
         tagged=self.tagged,
         debug=False,
     )
 def _get_configured_wbddc(self, wbddc_index, wbddc_param_list):
     self._set_wbddc_param_list(wbddc_index, wbddc_param_list, atinit=True)
     return CyberRadio.vita_iq_source_mk3(
         vita_type=wbddc_param_list[1],
         payload_size=self.vita_payload_size,
         vita_header_size=self.vita_header_size,
         vita_tail_size=self.vita_tail_size,
         byte_swapped=self.byte_swapped,
         iq_swapped=self.iq_swapped,
         iq_scale_factor=2 ** -15,
         host=self.udp_host_name,
         port=wbddc_param_list[0],
         ddc_coherent=self.ddcs_coherent,
         num_outputs=self.CyberRadio_NDR_driver_interface_0.getNumTuner() if self.ddcs_coherent else 1,
         tagged=self.tagged,
         debug=False,
     )
 def _get_configured_nbddc(self, nbddc_index, nbddc_param_list):
     self._set_nbddc_param_list(nbddc_index, nbddc_param_list, atinit=True)
     if nbddc_param_list[DDC_PARAM_IFACE] in self.tengig_iface_info:
         return CyberRadio.vita_iq_source(
             vita_type=nbddc_param_list[DDC_PARAM_VITA],
             payload_size=self.vita_payload_size,
             vita_header_size=self.vita_header_size,
             vita_tail_size=self.vita_tail_size,
             byte_swapped=self.byte_swapped,
             iq_swapped=self.iq_swapped,
             iq_scale_factor=2**-15,
             host=self.tengig_iface_info[nbddc_param_list[DDC_PARAM_IFACE]]["destIP"],
             port=nbddc_param_list[DDC_PARAM_STREAM],
             ddc_coherent=False,
             num_outputs=1,
             tagged=self.tagged,
             debug=self.debug,
         )
     else:
         self.logger.error("NBDDC %d: Interface \"%s\" not found in interface list.  DDC not configured." % (nbddc_index, str(nbddc_param_list[DDC_PARAM_IFACE])))
         return blocks.null_source(gr.sizeof_gr_complex * 1)
Exemple #5
0
    def __init__(
        self,
        radio_type="ndr304",
        radio_hostname="/dev/ndr47x",
        radio_port=921600,
        tuner1_index=-1,
        tuner1_freq=1e9,
        tuner1_atten=0,
        tuner2_index=-1,
        tuner2_freq=1e9,
        tuner2_atten=0,
        ddc1_index=-1,
        ddc1_wideband=True,
        ddc1_enable=True,
        ddc1_vita49_level=3,
        ddc1_rate_index=0,
        ddc1_freq=0.0,
        ddc1_udp_port=40001,
        ddc1_rf_source=-1,
        ddc1_data_port=1,
        ddc2_index=-1,
        ddc2_wideband=True,
        ddc2_enable=True,
        ddc2_vita49_level=3,
        ddc2_rate_index=0,
        ddc2_freq=0.0,
        ddc2_udp_port=40002,
        ddc2_rf_source=-1,
        ddc2_data_port=1,
        cal_freq=0.0,
        interface_dict={1: 'eth0'},
        verbose=True,
        other_args={},
    ):
        gr.hier_block2.__init__(
            self,
            "CyberRadio/NDR_demo_control",
            gr.io_signature(0, 0, 0),
            gr.io_signature(1, 1, gr.sizeof_char * 1),
        )
        self.fileLikeObjectSource = CyberRadio.file_like_object_source()
        self.connect((self.fileLikeObjectSource, 0), (self, 0))

        self.init = True
        self.set_radio_type(radio_type)
        self.set_radio_hostname(radio_hostname)
        self.set_radio_port(radio_port)
        self.set_tuner1_index(tuner1_index)
        self.set_tuner1_freq(tuner1_freq)
        self.set_tuner1_atten(tuner1_atten)
        self.set_tuner2_index(tuner2_index)
        self.set_tuner2_freq(tuner2_freq)
        self.set_tuner2_atten(tuner2_atten)
        self.set_ddc1_index(ddc1_index)
        self.set_ddc1_wideband(ddc1_wideband)
        self.set_ddc1_enable(ddc1_enable)
        self.set_ddc1_vita49_level(ddc1_vita49_level)
        self.set_ddc1_rate_index(ddc1_rate_index)
        self.set_ddc1_freq(ddc1_freq)
        self.set_ddc1_udp_port(ddc1_udp_port)
        self.set_ddc1_rf_source(ddc1_rf_source)
        self.set_ddc1_data_port(ddc1_data_port)
        self.set_ddc2_index(ddc2_index)
        self.set_ddc2_wideband(ddc2_wideband)
        self.set_ddc2_enable(ddc2_enable)
        self.set_ddc2_vita49_level(ddc2_vita49_level)
        self.set_ddc2_rate_index(ddc2_rate_index)
        self.set_ddc2_freq(ddc2_freq)
        self.set_ddc2_udp_port(ddc2_udp_port)
        self.set_ddc2_rf_source(ddc2_rf_source)
        self.set_ddc2_data_port(ddc2_data_port)
        self.set_cal_freq(cal_freq)
        self.set_interface_dict(interface_dict)
        self.set_verbose(verbose)
        self.set_other_args(other_args)

        self.init = False
        self.update_radio()
        self.update_tuner1()
        self.update_tuner2()
        self.update_ddc1()
        self.update_ddc2()
        self.update_cal()
        self.update_interface()
        self.update_verbose()
        self.update_other()
Exemple #6
0
    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))
 def __init__(self, 
              verbose_mode=True, 
              radio_device_name="/dev/ndr47x", 
              radio_baud_rate=921600, 
              gig_iface_to_use="eth0",
              coherent_mode=0,
              num_tuners=1,
              tuner1_param_list=[False, 900e6, 0],
              tuner2_param_list=[False, 900e6, 0],
              tuner3_param_list=[False, 900e6, 0],
              tuner4_param_list=[False, 900e6, 0],
              tuner5_param_list=[False, 900e6, 0],
              tuner6_param_list=[False, 900e6, 0],
              num_wbddcs=1,
              wbddc1_param_list=[40001, 0, 0, False, 0e6],
              wbddc2_param_list=[40002, 0, 0, False, 0e6],
              wbddc3_param_list=[40003, 0, 0, False, 0e6],
              wbddc4_param_list=[40004, 0, 0, False, 0e6],
              wbddc5_param_list=[40005, 0, 0, False, 0e6],
              wbddc6_param_list=[40006, 0, 0, False, 0e6],
              tagged=False,
              ):
     gr.hier_block2.__init__(
         self, "[CyberRadio] NDR304 Source",
         gr.io_signature(0, 0, 0),
         gr.io_signaturev((6 if coherent_mode & 0x02 > 0 else num_wbddcs) + 1, 
                          (6 if coherent_mode & 0x02 > 0 else num_wbddcs) + 1, 
                          [gr.sizeof_char*1] +
                          (6 if coherent_mode & 0x02 > 0 else num_wbddcs) * [gr.sizeof_gr_complex*1]), 
     )
     self.verbose_mode = verbose_mode
     self.radio_device_name = radio_device_name
     self.radio_baud_rate = radio_baud_rate
     self.gig_iface_to_use = gig_iface_to_use
     self.coherent_mode = coherent_mode
     self.tuners_coherent = (self.coherent_mode & 0x01 > 0)
     self.ddcs_coherent = (self.coherent_mode & 0x02 > 0)
     self.udp_host_name = CyberRadioDriver.getInterfaceAddresses(self.gig_iface_to_use)[1]
     self.num_tuners = num_tuners
     self.tuner1_param_list = tuner1_param_list
     if not self.tuners_coherent:
         self.tuner2_param_list = tuner2_param_list
         self.tuner3_param_list = tuner3_param_list
         self.tuner4_param_list = tuner4_param_list
         self.tuner5_param_list = tuner5_param_list
         self.tuner6_param_list = tuner6_param_list
     self.num_wbddcs = num_wbddcs
     self.wbddc1_param_list = wbddc1_param_list
     if not self.ddcs_coherent:
         self.wbddc2_param_list = wbddc2_param_list
         self.wbddc3_param_list = wbddc3_param_list
         self.wbddc4_param_list = wbddc4_param_list
         self.wbddc5_param_list = wbddc5_param_list
         self.wbddc6_param_list = wbddc6_param_list
     self.tagged = tagged
     self.CyberRadio_file_like_object_source_0 = CyberRadio.file_like_object_source()
     self.connect((self.CyberRadio_file_like_object_source_0, 0), (self, 0))
     self.CyberRadio_NDR_driver_interface_0 = CyberRadio.NDR_driver_interface(
         radio_type="ndr304",
         verbose=verbose_mode,
         log_file=self.CyberRadio_file_like_object_source_0,
         connect_mode="tty",
         dev_name=radio_device_name,
         baud_rate=radio_baud_rate,
     )
     self.vita_tail_size = self.CyberRadio_NDR_driver_interface_0.getVitaTailSize()
     self.vita_payload_size = self.CyberRadio_NDR_driver_interface_0.getVitaPayloadSize()
     self.vita_header_size = self.CyberRadio_NDR_driver_interface_0.getVitaHeaderSize()
     self.iq_swapped = self.CyberRadio_NDR_driver_interface_0.isIqSwapped()
     self.byte_swapped = self.CyberRadio_NDR_driver_interface_0.isByteswapped()
     self._set_coherent_mode(self.coherent_mode)
     self._set_udp_dest_info()
     if self.num_tuners >= 1:
         self._set_tuner_param_list(1, tuner1_param_list)
     if not self.tuners_coherent:
         if self.num_tuners >= 2:
             self._set_tuner_param_list(2, tuner2_param_list)
         if self.num_tuners >= 3:
             self._set_tuner_param_list(3, tuner3_param_list)
         if self.num_tuners >= 4:
             self._set_tuner_param_list(4, tuner4_param_list)
         if self.num_tuners >= 5:
             self._set_tuner_param_list(5, tuner5_param_list)
         if self.num_tuners >= 6:
             self._set_tuner_param_list(6, tuner6_param_list)
     self.wbddc_sources = {}
     if self.num_wbddcs >= 1:
         self.CyberRadio_vita_iq_source_wbddc_1 = self._get_configured_wbddc(1, wbddc1_param_list)
         if self.ddcs_coherent:
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 0), (self, 1))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 1), (self, 2))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 2), (self, 3))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 3), (self, 4))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 4), (self, 5))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 5), (self, 6))
         else:
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 0), (self, 1))
         self.wbddc_sources[1] = self.CyberRadio_vita_iq_source_wbddc_1
     if not self.ddcs_coherent:
         if self.num_wbddcs >= 2:
             self.CyberRadio_vita_iq_source_wbddc_2 = self._get_configured_wbddc(2, wbddc2_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_2, 0), (self, 2))
             self.wbddc_sources[2] = self.CyberRadio_vita_iq_source_wbddc_2
         if self.num_wbddcs >= 3:
             self.CyberRadio_vita_iq_source_wbddc_3 = self._get_configured_wbddc(3, wbddc3_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_3, 0), (self, 3))
             self.wbddc_sources[3] = self.CyberRadio_vita_iq_source_wbddc_3
         if self.num_wbddcs >= 4:
             self.CyberRadio_vita_iq_source_wbddc_4 = self._get_configured_wbddc(4, wbddc4_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_4, 0), (self, 4))
             self.wbddc_sources[4] = self.CyberRadio_vita_iq_source_wbddc_4
         if self.num_wbddcs >= 5:
             self.CyberRadio_vita_iq_source_wbddc_5 = self._get_configured_wbddc(5, wbddc5_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_5, 0), (self, 5))
             self.wbddc_sources[5] = self.CyberRadio_vita_iq_source_wbddc_5
         if self.num_wbddcs >= 6:
             self.CyberRadio_vita_iq_source_wbddc_6 = self._get_configured_wbddc(6, wbddc6_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_6, 0), (self, 6))
             self.wbddc_sources[6] = self.CyberRadio_vita_iq_source_wbddc_6
 def __init__(self, 
              verbose_mode=True, 
              radio_host_name="ndr651", 
              radio_host_port=8617, 
              tengig_iface_list=['eth10', 'eth11'], 
              num_tuners=1,
              tuner1_param_list=[False, 900e6, 0],
              tuner2_param_list=[False, 900e6, 0],
              num_wbddcs=1, 
              wbddc1_param_list=["eth10", 40001, 0, 0, False],
              wbddc2_param_list=["eth10", 40002, 0, 0, False],
              num_nbddcs=1, 
              nbddc1_param_list=["eth10", 41001, 0, 0, False, 0.0],
              nbddc2_param_list=["eth10", 41002, 0, 0, False, 0.0],
              nbddc3_param_list=["eth10", 41003, 0, 0, False, 0.0],
              nbddc4_param_list=["eth10", 41004, 0, 0, False, 0.0],
              nbddc5_param_list=["eth10", 41005, 0, 0, False, 0.0],
              nbddc6_param_list=["eth10", 41006, 0, 0, False, 0.0],
              nbddc7_param_list=["eth10", 41007, 0, 0, False, 0.0],
              nbddc8_param_list=["eth10", 41008, 0, 0, False, 0.0],
              nbddc9_param_list=["eth10", 41009, 0, 0, False, 0.0],
              nbddc10_param_list=["eth10", 41010, 0, 0, False, 0.0],
              nbddc11_param_list=["eth10", 41011, 0, 0, False, 0.0],
              nbddc12_param_list=["eth10", 41012, 0, 0, False, 0.0],
              nbddc13_param_list=["eth10", 41013, 0, 0, False, 0.0],
              nbddc14_param_list=["eth10", 41014, 0, 0, False, 0.0],
              nbddc15_param_list=["eth10", 41015, 0, 0, False, 0.0],
              nbddc16_param_list=["eth10", 41016, 0, 0, False, 0.0],
              tagged=False,
              debug=False,
              ):
     gr.hier_block2.__init__(
         self, "[CyberRadio] NDR651 Source",
         gr.io_signature(0, 0, 0),
         gr.io_signaturev(num_wbddcs + num_nbddcs + 1, 
                          num_wbddcs + num_nbddcs + 1, 
                          [gr.sizeof_char*1] +
                             num_wbddcs * [gr.sizeof_gr_complex*1] + \
                             num_nbddcs * [gr.sizeof_gr_complex*1]),
     )
     self.logger = gr.logger("CyberRadio")
     self.logger.set_level("INFO")
     self.tuner_param_lists = {}
     self.wbddc_sources = {}
     self.wbddc_param_lists = {}
     self.nbddc_sources = {}
     self.nbddc_param_lists = {}
     self.verbose_mode = verbose_mode
     self.radio_host_name = radio_host_name
     self.radio_host_port = radio_host_port
     self.tengig_iface_list = tengig_iface_list
     self.num_tuners = num_tuners
     self.tuner_param_lists[1] = tuner1_param_list
     self.tuner_param_lists[2] = tuner2_param_list
     self.num_wbddcs = num_wbddcs
     self.wbddc_param_lists[1] = wbddc1_param_list
     self.wbddc_param_lists[2] = wbddc2_param_list
     self.num_nbddcs = num_nbddcs
     self.nbddc_param_lists[1] = nbddc1_param_list
     self.nbddc_param_lists[2] = nbddc2_param_list
     self.nbddc_param_lists[3] = nbddc3_param_list
     self.nbddc_param_lists[4] = nbddc4_param_list
     self.nbddc_param_lists[5] = nbddc5_param_list
     self.nbddc_param_lists[6] = nbddc6_param_list
     self.nbddc_param_lists[7] = nbddc7_param_list
     self.nbddc_param_lists[8] = nbddc8_param_list
     self.nbddc_param_lists[9] = nbddc9_param_list
     self.nbddc_param_lists[10] = nbddc10_param_list
     self.nbddc_param_lists[11] = nbddc11_param_list
     self.nbddc_param_lists[12] = nbddc12_param_list
     self.nbddc_param_lists[13] = nbddc13_param_list
     self.nbddc_param_lists[14] = nbddc14_param_list
     self.nbddc_param_lists[15] = nbddc15_param_list
     self.nbddc_param_lists[16] = nbddc16_param_list
     self.tagged = tagged
     self.debug = debug
     self.CyberRadio_file_like_object_source_0 = CyberRadio.file_like_object_source()
     self.connect((self.CyberRadio_file_like_object_source_0, 0), (self, 0))
     self.CyberRadio_NDR_driver_interface_0 = CyberRadio.NDR_driver_interface(
         radio_type="ndr651",
         verbose=verbose_mode,
         log_file=self.CyberRadio_file_like_object_source_0,
         connect_mode="tcp",
         host_name=radio_host_name,
         host_port=radio_host_port,
     )
     self.vita_tail_size = self.CyberRadio_NDR_driver_interface_0.getVitaTailSize()
     self.vita_payload_size = self.CyberRadio_NDR_driver_interface_0.getVitaPayloadSize()
     self.vita_header_size = self.CyberRadio_NDR_driver_interface_0.getVitaHeaderSize()
     self.iq_swapped = self.CyberRadio_NDR_driver_interface_0.isIqSwapped()
     self.byte_swapped = self.CyberRadio_NDR_driver_interface_0.isByteswapped()
     # tengig_iface_info = Nested dictionary caching info for our 10GigE 
     # interfaces.  Keyed by interface name and datum keyword ("index", 
     # , "destMAC", "sourceIP", or "destIP").
     self.tengig_iface_info = {}
     self._get_tengig_iface_info()
     # UDP destination info needs to be tracked dynamically, since
     # DDCs can be freely assigned to any 10GigE port but there are
     # not enough DIP table entries to hard-code any assignments.
     self.udp_dest_dip_entries = {}
     self.udp_dest_dip_entry_range = self.CyberRadio_NDR_driver_interface_0.getGigEDipEntryIndexRange()
     self._set_udp_dest_info()
     for tuner_index in xrange(1, self.num_tuners + 1, 1):
         self._set_tuner_param_list(tuner_index, self.tuner_param_lists[tuner_index])
     for wbddc_index in xrange(1, self.num_wbddcs + 1, 1):
         self.wbddc_sources[wbddc_index] = self._get_configured_wbddc(
                                                 wbddc_index, 
                                                 self.wbddc_param_lists[wbddc_index])
         self.connect((self.wbddc_sources[wbddc_index], 0), (self, wbddc_index))
     for nbddc_index in xrange(1, self.num_nbddcs + 1, 1):
         self.nbddc_sources[nbddc_index] = self._get_configured_nbddc(
                                                 nbddc_index, 
                                                 self.nbddc_param_lists[nbddc_index])
         self.connect((self.nbddc_sources[nbddc_index], 0), (self, self.num_wbddcs + nbddc_index))
 def __init__(
     self,
     verbose_mode=True,
     radio_device_name="/dev/ndr47x",
     radio_baud_rate=921600,
     gig_iface_to_use="eth0",
     coherent_mode=0,
     num_tuners=1,
     tuner1_param_list=[False, 900e6, 0],
     tuner2_param_list=[False, 900e6, 0],
     tuner3_param_list=[False, 900e6, 0],
     tuner4_param_list=[False, 900e6, 0],
     tuner5_param_list=[False, 900e6, 0],
     tuner6_param_list=[False, 900e6, 0],
     num_wbddcs=1,
     wbddc1_param_list=[40001, 0, 0, False, 0e6],
     wbddc2_param_list=[40002, 0, 0, False, 0e6],
     wbddc3_param_list=[40003, 0, 0, False, 0e6],
     wbddc4_param_list=[40004, 0, 0, False, 0e6],
     wbddc5_param_list=[40005, 0, 0, False, 0e6],
     wbddc6_param_list=[40006, 0, 0, False, 0e6],
     tagged=False,
 ):
     gr.hier_block2.__init__(
         self,
         "[CyberRadio] NDR304 Source",
         gr.io_signature(0, 0, 0),
         gr.io_signaturev(
             (6 if coherent_mode & 0x02 > 0 else num_wbddcs) + 1,
             (6 if coherent_mode & 0x02 > 0 else num_wbddcs) + 1,
             [gr.sizeof_char * 1] + (6 if coherent_mode & 0x02 > 0 else num_wbddcs) * [gr.sizeof_gr_complex * 1],
         ),
     )
     self.verbose_mode = verbose_mode
     self.radio_device_name = radio_device_name
     self.radio_baud_rate = radio_baud_rate
     self.gig_iface_to_use = gig_iface_to_use
     self.coherent_mode = coherent_mode
     self.tuners_coherent = self.coherent_mode & 0x01 > 0
     self.ddcs_coherent = self.coherent_mode & 0x02 > 0
     self.udp_host_name = CyberRadioDriver.getInterfaceAddresses(self.gig_iface_to_use)[1]
     self.num_tuners = num_tuners
     self.tuner1_param_list = tuner1_param_list
     if not self.tuners_coherent:
         self.tuner2_param_list = tuner2_param_list
         self.tuner3_param_list = tuner3_param_list
         self.tuner4_param_list = tuner4_param_list
         self.tuner5_param_list = tuner5_param_list
         self.tuner6_param_list = tuner6_param_list
     self.num_wbddcs = num_wbddcs
     self.wbddc1_param_list = wbddc1_param_list
     if not self.ddcs_coherent:
         self.wbddc2_param_list = wbddc2_param_list
         self.wbddc3_param_list = wbddc3_param_list
         self.wbddc4_param_list = wbddc4_param_list
         self.wbddc5_param_list = wbddc5_param_list
         self.wbddc6_param_list = wbddc6_param_list
     self.tagged = tagged
     self.CyberRadio_file_like_object_source_0 = CyberRadio.file_like_object_source()
     self.connect((self.CyberRadio_file_like_object_source_0, 0), (self, 0))
     self.CyberRadio_NDR_driver_interface_0 = CyberRadio.NDR_driver_interface(
         radio_type="ndr304",
         verbose=verbose_mode,
         log_file=self.CyberRadio_file_like_object_source_0,
         connect_mode="tty",
         dev_name=radio_device_name,
         baud_rate=radio_baud_rate,
     )
     self.vita_tail_size = self.CyberRadio_NDR_driver_interface_0.getVitaTailSize()
     self.vita_payload_size = self.CyberRadio_NDR_driver_interface_0.getVitaPayloadSize()
     self.vita_header_size = self.CyberRadio_NDR_driver_interface_0.getVitaHeaderSize()
     self.iq_swapped = self.CyberRadio_NDR_driver_interface_0.isIqSwapped()
     self.byte_swapped = self.CyberRadio_NDR_driver_interface_0.isByteswapped()
     self._set_coherent_mode(self.coherent_mode)
     self._set_udp_dest_info()
     if self.num_tuners >= 1:
         self._set_tuner_param_list(1, tuner1_param_list)
     if not self.tuners_coherent:
         if self.num_tuners >= 2:
             self._set_tuner_param_list(2, tuner2_param_list)
         if self.num_tuners >= 3:
             self._set_tuner_param_list(3, tuner3_param_list)
         if self.num_tuners >= 4:
             self._set_tuner_param_list(4, tuner4_param_list)
         if self.num_tuners >= 5:
             self._set_tuner_param_list(5, tuner5_param_list)
         if self.num_tuners >= 6:
             self._set_tuner_param_list(6, tuner6_param_list)
     self.wbddc_sources = {}
     if self.num_wbddcs >= 1:
         self.CyberRadio_vita_iq_source_wbddc_1 = self._get_configured_wbddc(1, wbddc1_param_list)
         if self.ddcs_coherent:
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 0), (self, 1))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 1), (self, 2))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 2), (self, 3))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 3), (self, 4))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 4), (self, 5))
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 5), (self, 6))
         else:
             self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 0), (self, 1))
         self.wbddc_sources[1] = self.CyberRadio_vita_iq_source_wbddc_1
     if not self.ddcs_coherent:
         if self.num_wbddcs >= 2:
             self.CyberRadio_vita_iq_source_wbddc_2 = self._get_configured_wbddc(2, wbddc2_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_2, 0), (self, 2))
             self.wbddc_sources[2] = self.CyberRadio_vita_iq_source_wbddc_2
         if self.num_wbddcs >= 3:
             self.CyberRadio_vita_iq_source_wbddc_3 = self._get_configured_wbddc(3, wbddc3_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_3, 0), (self, 3))
             self.wbddc_sources[3] = self.CyberRadio_vita_iq_source_wbddc_3
         if self.num_wbddcs >= 4:
             self.CyberRadio_vita_iq_source_wbddc_4 = self._get_configured_wbddc(4, wbddc4_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_4, 0), (self, 4))
             self.wbddc_sources[4] = self.CyberRadio_vita_iq_source_wbddc_4
         if self.num_wbddcs >= 5:
             self.CyberRadio_vita_iq_source_wbddc_5 = self._get_configured_wbddc(5, wbddc5_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_5, 0), (self, 5))
             self.wbddc_sources[5] = self.CyberRadio_vita_iq_source_wbddc_5
         if self.num_wbddcs >= 6:
             self.CyberRadio_vita_iq_source_wbddc_6 = self._get_configured_wbddc(6, wbddc6_param_list)
             self.connect((self.CyberRadio_vita_iq_source_wbddc_6, 0), (self, 6))
             self.wbddc_sources[6] = self.CyberRadio_vita_iq_source_wbddc_6
 def __init__(self, 
              verbose_mode=True, 
              radio_host_name="ndr651", 
              radio_host_port=8617, 
              tengig_iface_list=['eth10', 'eth11'], 
              iq_scale_factor=2**15,
              num_transmitters=1,
              transmitter1_param_list=[False, 900, 0],
              transmitter2_param_list=[False, 900, 0],
              num_wbducs=1, 
              wbduc1_param_list=["eth10", 0, 0, 0, 1, 40001], 
              wbduc2_param_list=["eth10", 0, 0, 0, 1, 40002],
              wbduc3_param_list=["eth10", 0, 0, 0, 1, 40003],
              wbduc4_param_list=["eth10", 0, 0, 0, 1, 40004],
              wbduc5_param_list=["eth10", 0, 0, 0, 1, 40005],
              wbduc6_param_list=["eth10", 0, 0, 0, 1, 40006],
              wbduc7_param_list=["eth10", 0, 0, 0, 1, 40007],
              wbduc8_param_list=["eth10", 0, 0, 0, 1, 40008],
              debug=False,
              ):
     gr.hier_block2.__init__(
         self, "[CyberRadio] NDR651 Sink",
         gr.io_signaturev(num_wbducs, num_wbducs, 
                          num_wbducs * [gr.sizeof_gr_complex*1]),
         gr.io_signature(1, 1, gr.sizeof_char*1),
     )
     self.transmitter_param_lists = {}
     self.wbduc_sources = {}
     self.wbduc_param_lists = {}
     self.verbose_mode = verbose_mode
     self.radio_host_name = radio_host_name
     self.radio_host_port = radio_host_port
     self.tengig_iface_list = tengig_iface_list
     self.iq_scale_factor = iq_scale_factor
     self.num_transmitters = num_transmitters
     self.transmitter_param_lists[1] = transmitter1_param_list
     self.transmitter_param_lists[2] = transmitter2_param_list
     self.num_wbducs = num_wbducs
     self.wbduc_param_lists[1] = wbduc1_param_list
     self.wbduc_param_lists[2] = wbduc2_param_list
     self.wbduc_param_lists[3] = wbduc3_param_list
     self.wbduc_param_lists[4] = wbduc4_param_list
     self.wbduc_param_lists[5] = wbduc5_param_list
     self.wbduc_param_lists[6] = wbduc6_param_list
     self.wbduc_param_lists[7] = wbduc7_param_list
     self.wbduc_param_lists[8] = wbduc8_param_list
     self.debug = debug
     self.CyberRadio_file_like_object_source_0 = CyberRadio.file_like_object_source()
     self.CyberRadio_NDR_driver_interface_0 = CyberRadio.NDR_driver_interface(
         radio_type="ndr651",
         verbose=verbose_mode,
         log_file=self.CyberRadio_file_like_object_source_0,
         connect_mode="tcp",
         host_name=radio_host_name,
         host_port=radio_host_port,
     )
     self.connect((self.CyberRadio_file_like_object_source_0, 0), (self, 0))
     for transmitter_index in xrange(1, self.num_transmitters + 1, 1):
         self._set_transmitter_param_list(transmitter_index, 
                                          self.transmitter_param_lists[transmitter_index], 
                                          True)
     for wbduc_index in xrange(1, self.num_wbducs + 1, 1):
         self.wbduc_sources[wbduc_index] = self._get_configured_wbduc(
                                                 wbduc_index, 
                                                 self.wbduc_param_lists[wbduc_index])
         self.connect((self, wbduc_index-1), (self.wbduc_sources[wbduc_index], 0))
Exemple #11
0
    def __init__(
        self,
        radioType="ndr804",
        hostname="ndr308",
        verbose=True,
        interface="eth6",
        dataPort=1,
        tunerFreq=1000,
        tunerAtten=0,
        tunerFilter=1,
        tunerIndex=1,
        calFrequency=0,
        wbddcEnable=True,
        wbddcVitaLevel=3,
        wbddcRate=0,
        wbddcFormat=1,
        wbddcFreq=0.0,
        wbddcPort=10100,
        wbddcIndex=1,
        specRate=1,
        nbddcEnable=True,
        nbddcVitaLevel=3,
        nbddcRate=0.0,
        #~ nbddcFormat=0,
        nbddcDemodType=0,
        nbddcDemodBfo=0,
        nbddcDemodDcBlock=0,
        nbddcDemodAlcType=0,
        nbddcDemodAlcLevel=0,
        nbddcDemodSquelchLevel=0,
        nbddcDagcType=0,
        nbddcDagcLevel=0,
        nbddcFreq=0.0,
        nbddcPort=10101,
        nbddcIndex=46,
        otherNbddcEnable=False,
        otherNbddcPort=10102,
    ):
        gr.hier_block2.__init__(
            self,
            "CyberRadio/NDR_demo_control",
            gr.io_signature(0, 0, 0),
            gr.io_signature(1, 1, gr.sizeof_char * 1),
        )
        self.fileLikeObjectSource = CyberRadio.file_like_object_source()
        self.connect((self.fileLikeObjectSource, 0), (self, 0))

        print("radioType = %r (%s)" % (radioType, type(radioType)))
        print("hostname = %r (%s)" % (hostname, type(hostname)))
        print("verbose = %r (%s)" % (verbose, type(verbose)))
        print("interface = %r (%s)" % (interface, type(interface)))
        print("dataPort = %r (%s)" % (dataPort, type(dataPort)))
        print("tunerFreq = %r (%s)" % (tunerFreq, type(tunerFreq)))
        print("tunerAtten = %r (%s)" % (tunerAtten, type(tunerAtten)))
        print("tunerIndex = %r (%s)" % (tunerIndex, type(tunerIndex)))
        print("calFrequency = %r (%s)" % (calFrequency, type(calFrequency)))
        print("wbddcEnable = %r (%s)" % (wbddcEnable, type(wbddcEnable)))
        print("wbddcVitaLevel = %r (%s)" %
              (wbddcVitaLevel, type(wbddcVitaLevel)))
        print("wbddcRate = %r (%s)" % (wbddcRate, type(wbddcRate)))
        print("wbddcFormat = %r (%s)" % (wbddcFormat, type(wbddcFormat)))
        print("wbddcFreq = %r (%s)" % (wbddcFreq, type(wbddcFreq)))
        print("wbddcPort = %r (%s)" % (wbddcPort, type(wbddcPort)))
        print("wbddcIndex = %r (%s)" % (wbddcIndex, type(wbddcIndex)))
        print("specRate = %r (%s)" % (specRate, type(specRate)))
        print("nbddcEnable = %r (%s)" % (nbddcEnable, type(nbddcEnable)))
        print("nbddcVitaLevel = %r (%s)" %
              (nbddcVitaLevel, type(nbddcVitaLevel)))
        print("nbddcRate = %r (%s)" % (nbddcRate, type(nbddcRate)))
        print("nbddcFreq = %r (%s)" % (nbddcFreq, type(nbddcFreq)))
        print("nbddcPort = %r (%s)" % (nbddcPort, type(nbddcPort)))
        print("nbddcIndex = %r (%s)" % (nbddcIndex, type(nbddcIndex)))
        print("otherNbddcEnable = %r (%s)" %
              (otherNbddcEnable, type(otherNbddcEnable)))
        print("otherNbddcPort = %r (%s)" %
              (otherNbddcPort, type(otherNbddcPort)))

        self.init = True
        self.set_radioType(radioType)
        self.set_hostname(hostname)
        self.set_verbose(verbose)
        #~ self.set_interface( interface )
        #~ self.set_dataPort( dataPort )
        self.set_tunerFreq(tunerFreq)
        self.set_tunerAtten(tunerAtten)
        self.set_tunerFilter(tunerFilter)
        self.set_tunerIndex(tunerIndex)
        self.set_calFrequency(calFrequency)
        self.set_wbddcEnable(wbddcEnable)
        self.set_wbddcVitaLevel(wbddcVitaLevel)
        self.set_wbddcRate(wbddcRate)
        self.set_wbddcFormat(wbddcFormat)
        self.set_wbddcFreq(wbddcFreq)
        self.set_wbddcPort(wbddcPort)
        self.set_wbddcIndex(wbddcIndex)
        self.set_specRate(specRate)
        self.set_nbddcEnable(nbddcEnable)
        self.set_nbddcVitaLevel(nbddcVitaLevel)
        self.set_nbddcRate(nbddcRate)
        #~ self.set_nbddcFormat( nbddcFormat )
        self.set_nbddcDemodType(nbddcDemodType)
        self.set_nbddcDemodBfo(nbddcDemodBfo)
        self.set_nbddcDemodDcBlock(nbddcDemodDcBlock)
        self.set_nbddcDemodAlcType(nbddcDemodAlcType)
        self.set_nbddcDemodAlcLevel(nbddcDemodAlcLevel)
        self.set_nbddcDemodSquelchLevel(nbddcDemodSquelchLevel)
        self.set_nbddcDagcType(nbddcDagcType)
        self.set_nbddcDagcLevel(nbddcDagcLevel)
        self.set_nbddcFreq(nbddcFreq)
        self.set_nbddcPort(nbddcPort)
        self.set_nbddcIndex(nbddcIndex)
        self.set_otherNbddcEnable(otherNbddcEnable)
        self.set_otherNbddcPort(otherNbddcPort)

        self.init = False
        self.radio = crd.getRadioObject(
            self.radioType,
            verbose=self.verbose,
            logFile=self.fileLikeObjectSource,
        )
        self.radio.connect("tcp", self.hostname, 8617)
        self.set_dataPort(interface, dataPort)
        for dipIndex, udpPort in (
            (self.wbddcDipIndex, self.wbddcPort),
            (self.nbddcDipIndex, self.nbddcPort),
            (self.otherNbddcDipIndex, self.otherNbddcPort),
            (self.spectralDipIndex, self.wbddcPort + 4),
            (self.demodDipIndex, self.wbddcPort + 5),
        ):
            self.setDipEntry(dipIndex, udpPort)
        self.disableWbddc(True)
        self.disableNbddc(True)
        self.updateWbddc()
        self.updateNbddc()
        self.updateTuner()
        self.updateCal()
    def __init__(self,
                 basePort=22200,
                 dataPort=1,
                 hostnameOrDevice='/dev/ndr47x',
                 ifname='eth6',
                 radioType='ndr304',
                 udpPortOrBaudrate=921600,
                 verbose=1,
                 vitaLevel=3,
                 wbfftRate=8,
                 wbfftSize=10,
                 wideband2=0):
        gr.top_block.__init__(self, "NDR Demo GUI (QT)")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("NDR Demo GUI (QT)")
        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", "ndr_qt_demo_gui")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.basePort = basePort
        self.dataPort = dataPort
        self.hostnameOrDevice = hostnameOrDevice
        self.ifname = ifname
        self.radioType = radioType
        self.udpPortOrBaudrate = udpPortOrBaudrate
        self.verbose = verbose
        self.vitaLevel = vitaLevel
        self.wbfftRate = wbfftRate
        self.wbfftSize = wbfftSize
        self.wideband2 = wideband2

        ##################################################
        # Variables
        ##################################################
        self.radioClass = radioClass = crd.getRadioClass(radioType, )
        self.ch2_wb = ch2_wb = bool(
            wideband2) or radioType.strip().lower() in ("ndr304", "ndr472")
        self.ch2_rateSet = ch2_rateSet = radioClass.getWbddcRateSet(
        ) if ch2_wb else radioClass.getNbddcRateSet()
        self.ch1_rateSet = ch1_rateSet = radioClass.getWbddcRateSet()
        self.ch2_rateIndex = ch2_rateIndex = sorted(ch2_rateSet.keys())[0]
        self.ch1_rateIndex = ch1_rateIndex = sorted(ch1_rateSet.keys())[0]
        self.radioRsp = radioRsp = ""
        self.macAndIpList = macAndIpList = crd.getInterfaceAddresses(ifname)
        self.ch2_rfAttenRange = ch2_rfAttenRange = [
            int(i) for i in radioClass.getTunerAttenuationRange()
        ] if ch2_wb else [0, 0]
        self.ch2_fs = ch2_fs = ch2_rateSet[ch2_rateIndex]
        self.ch2_channelList = ch2_channelList = radioClass.getWbddcIndexRange(
        )[1::2] if ch2_wb else radioClass.getNbddcIndexRange()
        self.ch1_updateRate = ch1_updateRate = wbfftRate
        self.ch1_fs = ch1_fs = ch1_rateSet[ch1_rateIndex]
        self.ch1_fftSize = ch1_fftSize = int(2**wbfftSize)
        self.ch1_channelList = ch1_channelList = radioClass.getWbddcIndexRange(
        )[0::2] if ch2_wb else radioClass.getWbddcIndexRange()
        self.udpPortList = udpPortList = [basePort, basePort + 1]
        self.radioRspDisplay = radioRspDisplay = radioRsp
        self.radioCmd = radioCmd = ''
        self.logfile = logfile = os.path.join(
            "/public", "ndrDemoGui", "ndrCmd.%s.log" %
            datetime.datetime.now().strftime("%y%m%d-%H%M%S"))
        self.ipAddress = ipAddress = macAndIpList[1]
        self.fftColSpan = fftColSpan = 6
        self.ch2_updateRate = ch2_updateRate = ch1_updateRate if ch2_wb else 4 * ch1_updateRate
        self.ch2_rfFreqRange = ch2_rfFreqRange = [
            int(i / 1e6) for i in radioClass.getTunerFrequencyRange()
        ] if ch2_wb else [0, 0]
        self.ch2_rfFreq = ch2_rfFreq = int(
            sum(radioClass.getTunerFrequencyRange()) / 2e6) if ch2_wb else 0
        self.ch2_rfAtten = ch2_rfAtten = ch2_rfAttenRange[0]
        self.ch2_index = ch2_index = ch2_channelList[0]
        self.ch2_fsLabel = ch2_fsLabel = "%sHz" % (num_to_str(ch2_fs))
        self.ch2_fftSize = ch2_fftSize = ch1_fftSize if ch2_wb else ch1_fftSize / 2
        self.ch2_ddcFreq = ch2_ddcFreq = 0
        self.ch1_rfFreq = ch1_rfFreq = int(
            sum(radioClass.getTunerFrequencyRange()) / 2e6)
        self.ch1_rfAtten = ch1_rfAtten = int(
            radioClass.getTunerAttenuationRange()[0])
        self.ch1_index = ch1_index = ch1_channelList[0]
        self.ch1_fsLabel = ch1_fsLabel = "%sHz" % (num_to_str(ch1_fs))
        self.ch1_ddcFreq = ch1_ddcFreq = 0

        ##################################################
        # Blocks
        ##################################################
        self._ch2_rfFreq_range = Range(
            int(radioClass.getTunerFrequencyRange()[0] / 1e6) if ch2_wb else 0,
            int(radioClass.getTunerFrequencyRange()[1] / 1e6) if ch2_wb else 0,
            20,
            int(sum(radioClass.getTunerFrequencyRange()) /
                2e6) if ch2_wb else 0, 200)
        self._ch2_rfFreq_win = RangeWidget(self._ch2_rfFreq_range,
                                           self.set_ch2_rfFreq,
                                           'RF Freq (MHz)', "counter_slider",
                                           int)
        self.top_grid_layout.addWidget(self._ch2_rfFreq_win, 2, fftColSpan + 0,
                                       1, fftColSpan / 2)
        self._ch2_rfAtten_range = Range(ch2_rfAttenRange[0],
                                        ch2_rfAttenRange[1], 1,
                                        ch2_rfAttenRange[0], 200)
        self._ch2_rfAtten_win = RangeWidget(self._ch2_rfAtten_range,
                                            self.set_ch2_rfAtten,
                                            'RF Atten (dB)', "counter_slider",
                                            int)
        self.top_grid_layout.addWidget(self._ch2_rfAtten_win, 2,
                                       fftColSpan + fftColSpan / 2, 1,
                                       fftColSpan / 2)
        self._ch2_rateIndex_options = sorted(ch2_rateSet.keys())
        self._ch2_rateIndex_labels = map(str, self._ch2_rateIndex_options)
        self._ch2_rateIndex_tool_bar = Qt.QToolBar(self)
        self._ch2_rateIndex_tool_bar.addWidget(Qt.QLabel('Rate Index' + ": "))
        self._ch2_rateIndex_combo_box = Qt.QComboBox()
        self._ch2_rateIndex_tool_bar.addWidget(self._ch2_rateIndex_combo_box)
        for label in self._ch2_rateIndex_labels:
            self._ch2_rateIndex_combo_box.addItem(label)
        self._ch2_rateIndex_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._ch2_rateIndex_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._ch2_rateIndex_options.index(i)))
        self._ch2_rateIndex_callback(self.ch2_rateIndex)
        self._ch2_rateIndex_combo_box.currentIndexChanged.connect(
            lambda i: self.set_ch2_rateIndex(self._ch2_rateIndex_options[i]))
        self.top_grid_layout.addWidget(self._ch2_rateIndex_tool_bar, 1,
                                       fftColSpan + 1, 1, 1)
        self._ch2_index_options = ch2_channelList
        self._ch2_index_labels = map(str, self._ch2_index_options)
        self._ch2_index_tool_bar = Qt.QToolBar(self)
        self._ch2_index_tool_bar.addWidget(
            Qt.QLabel("%sDDC" % ("WB" if ch2_wb else "NB") + ": "))
        self._ch2_index_combo_box = Qt.QComboBox()
        self._ch2_index_tool_bar.addWidget(self._ch2_index_combo_box)
        for label in self._ch2_index_labels:
            self._ch2_index_combo_box.addItem(label)
        self._ch2_index_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._ch2_index_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._ch2_index_options.index(i)))
        self._ch2_index_callback(self.ch2_index)
        self._ch2_index_combo_box.currentIndexChanged.connect(
            lambda i: self.set_ch2_index(self._ch2_index_options[i]))
        self.top_grid_layout.addWidget(self._ch2_index_tool_bar, 1,
                                       fftColSpan + 0, 1, 1)
        self._ch2_ddcFreq_range = Range(
            (radioClass.getWbddcFrequencyRange()
             if ch2_wb else radioClass.getNbddcFrequencyRange())[0] / 1e3,
            (radioClass.getWbddcFrequencyRange() if ch2_wb else
             radioClass.getNbddcFrequencyRange())[1] / 1e3, 10, 0, 200)
        self._ch2_ddcFreq_win = RangeWidget(self._ch2_ddcFreq_range,
                                            self.set_ch2_ddcFreq, 'Freq (kHz)',
                                            "counter_slider", float)
        self.top_grid_layout.addWidget(self._ch2_ddcFreq_win, 1,
                                       fftColSpan + fftColSpan / 2, 1,
                                       fftColSpan / 2)
        self._ch1_rfFreq_range = Range(
            int(radioClass.getTunerFrequencyRange()[0] / 1e6),
            int(radioClass.getTunerFrequencyRange()[1] / 1e6), 20,
            int(sum(radioClass.getTunerFrequencyRange()) / 2e6), 200)
        self._ch1_rfFreq_win = RangeWidget(self._ch1_rfFreq_range,
                                           self.set_ch1_rfFreq,
                                           'RF Freq (MHz)', "counter_slider",
                                           int)
        self.top_grid_layout.addWidget(self._ch1_rfFreq_win, 2, 0, 1,
                                       fftColSpan / 2)
        self._ch1_rfAtten_range = Range(
            int(radioClass.getTunerAttenuationRange()[0]),
            int(radioClass.getTunerAttenuationRange()[1]), 1,
            int(radioClass.getTunerAttenuationRange()[0]), 200)
        self._ch1_rfAtten_win = RangeWidget(self._ch1_rfAtten_range,
                                            self.set_ch1_rfAtten,
                                            'RF Atten (dB)', "counter_slider",
                                            int)
        self.top_grid_layout.addWidget(self._ch1_rfAtten_win, 2,
                                       fftColSpan / 2, 1, fftColSpan / 2)
        self._ch1_rateIndex_options = sorted(ch1_rateSet.keys())
        self._ch1_rateIndex_labels = map(str, self._ch1_rateIndex_options)
        self._ch1_rateIndex_tool_bar = Qt.QToolBar(self)
        self._ch1_rateIndex_tool_bar.addWidget(Qt.QLabel('Rate Index' + ": "))
        self._ch1_rateIndex_combo_box = Qt.QComboBox()
        self._ch1_rateIndex_tool_bar.addWidget(self._ch1_rateIndex_combo_box)
        for label in self._ch1_rateIndex_labels:
            self._ch1_rateIndex_combo_box.addItem(label)
        self._ch1_rateIndex_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._ch1_rateIndex_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._ch1_rateIndex_options.index(i)))
        self._ch1_rateIndex_callback(self.ch1_rateIndex)
        self._ch1_rateIndex_combo_box.currentIndexChanged.connect(
            lambda i: self.set_ch1_rateIndex(self._ch1_rateIndex_options[i]))
        self.top_grid_layout.addWidget(self._ch1_rateIndex_tool_bar, 1, 1, 1,
                                       1)
        self._ch1_index_options = ch1_channelList
        self._ch1_index_labels = map(str, self._ch1_index_options)
        self._ch1_index_tool_bar = Qt.QToolBar(self)
        self._ch1_index_tool_bar.addWidget(Qt.QLabel('WBDDC' + ": "))
        self._ch1_index_combo_box = Qt.QComboBox()
        self._ch1_index_tool_bar.addWidget(self._ch1_index_combo_box)
        for label in self._ch1_index_labels:
            self._ch1_index_combo_box.addItem(label)
        self._ch1_index_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._ch1_index_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._ch1_index_options.index(i)))
        self._ch1_index_callback(self.ch1_index)
        self._ch1_index_combo_box.currentIndexChanged.connect(
            lambda i: self.set_ch1_index(self._ch1_index_options[i]))
        self.top_grid_layout.addWidget(self._ch1_index_tool_bar, 1, 0, 1, 1)
        self._ch1_ddcFreq_range = Range(
            radioClass.getWbddcFrequencyRange()[0] / 1e3,
            radioClass.getWbddcFrequencyRange()[1] / 1e3, 10, 0, 200)
        self._ch1_ddcFreq_win = RangeWidget(self._ch1_ddcFreq_range,
                                            self.set_ch1_ddcFreq, 'Freq (kHz)',
                                            "counter_slider", float)
        self.top_grid_layout.addWidget(self._ch1_ddcFreq_win, 1,
                                       fftColSpan / 2, 1, fftColSpan / 2)
        self.ndrDemoControlBlock = CyberRadio.NDR_demo_control(
            radio_type=str(radioType),
            radio_hostname=str(hostnameOrDevice),
            radio_port=int(udpPortOrBaudrate),
            tuner1_index=ch1_index,
            tuner1_freq=float(1e6 * ch1_rfFreq),
            tuner1_atten=ch1_rfAtten,
            tuner2_index=ch2_index if ch2_wb else -1,
            tuner2_freq=float(1e6 * ch2_rfFreq),
            tuner2_atten=ch2_rfAtten,
            ddc1_index=ch1_index,
            ddc1_wideband=True,
            ddc1_enable=True,
            ddc1_vita49_level=vitaLevel,
            ddc1_rate_index=ch1_rateIndex,
            ddc1_freq=ch1_ddcFreq * 1e3,
            ddc1_udp_port=udpPortList[0],
            ddc1_rf_source=-1,
            ddc1_data_port=dataPort,
            ddc2_index=ch2_index,
            ddc2_wideband=ch2_wb,
            ddc2_enable=True,
            ddc2_vita49_level=vitaLevel,
            ddc2_rate_index=ch2_rateIndex,
            ddc2_freq=1e3 * ch2_ddcFreq,
            ddc2_udp_port=udpPortList[1],
            ddc2_rf_source=-1 if ch2_wb else ch1_index,
            ddc2_data_port=dataPort,
            cal_freq=0.0,
            interface_dict={dataPort: str(ifname)},
            verbose=bool(verbose),
            other_args={})
        self.ch2_tabs = Qt.QTabWidget()
        self.ch2_tabs_widget_0 = Qt.QWidget()
        self.ch2_tabs_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.ch2_tabs_widget_0)
        self.ch2_tabs_grid_layout_0 = Qt.QGridLayout()
        self.ch2_tabs_layout_0.addLayout(self.ch2_tabs_grid_layout_0)
        self.ch2_tabs.addTab(self.ch2_tabs_widget_0, 'Spectrum')
        self.ch2_tabs_widget_1 = Qt.QWidget()
        self.ch2_tabs_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.ch2_tabs_widget_1)
        self.ch2_tabs_grid_layout_1 = Qt.QGridLayout()
        self.ch2_tabs_layout_1.addLayout(self.ch2_tabs_grid_layout_1)
        self.ch2_tabs.addTab(self.ch2_tabs_widget_1, 'Time')
        self.top_grid_layout.addWidget(self.ch2_tabs, 0, fftColSpan, 1,
                                       fftColSpan)
        self.ch1_tabs = Qt.QTabWidget()
        self.ch1_tabs_widget_0 = Qt.QWidget()
        self.ch1_tabs_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.ch1_tabs_widget_0)
        self.ch1_tabs_grid_layout_0 = Qt.QGridLayout()
        self.ch1_tabs_layout_0.addLayout(self.ch1_tabs_grid_layout_0)
        self.ch1_tabs.addTab(self.ch1_tabs_widget_0, 'Spectrum')
        self.ch1_tabs_widget_1 = Qt.QWidget()
        self.ch1_tabs_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.ch1_tabs_widget_1)
        self.ch1_tabs_grid_layout_1 = Qt.QGridLayout()
        self.ch1_tabs_layout_1.addLayout(self.ch1_tabs_grid_layout_1)
        self.ch1_tabs.addTab(self.ch1_tabs_widget_1, 'Waterfall')
        self.top_grid_layout.addWidget(self.ch1_tabs, 0, 0, 1, fftColSpan)
        self._radioRspDisplay_tool_bar = Qt.QToolBar(self)
        self._radioRspDisplay_tool_bar.addWidget(
            Qt.QLabel('Command Response' + ": "))
        self._radioRspDisplay_line_edit = Qt.QLineEdit(
            str(self.radioRspDisplay))
        self._radioRspDisplay_tool_bar.addWidget(
            self._radioRspDisplay_line_edit)
        self._radioRspDisplay_line_edit.returnPressed.connect(
            lambda: self.set_radioRspDisplay(
                str(str(self._radioRspDisplay_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._radioRspDisplay_tool_bar, 3, 2, 1,
                                       2 * fftColSpan - 2)

        def _radioRsp_probe():
            while True:
                val = self.ndrDemoControlBlock.get_radio_rsp()
                try:
                    self.set_radioRsp(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _radioRsp_thread = threading.Thread(target=_radioRsp_probe)
        _radioRsp_thread.daemon = True
        _radioRsp_thread.start()

        self._radioCmd_tool_bar = Qt.QToolBar(self)
        self._radioCmd_tool_bar.addWidget(Qt.QLabel('Manual Command' + ": "))
        self._radioCmd_line_edit = Qt.QLineEdit(str(self.radioCmd))
        self._radioCmd_tool_bar.addWidget(self._radioCmd_line_edit)
        self._radioCmd_line_edit.returnPressed.connect(
            lambda: self.set_radioCmd(
                str(str(self._radioCmd_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._radioCmd_tool_bar, 3, 0, 1, 2)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            ch1_fftSize,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            ch1_rfFreq * 1e6 + ch1_ddcFreq * 1e3,  #fc
            ch1_fs,  #bw
            'Ch 1 (Wideband)',  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(1.0 / ch1_updateRate)
        self.qtgui_waterfall_sink_x_0.enable_grid(True)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [5, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-120, 0)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.ch1_tabs_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1024,  #size
            ch2_fs,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not False:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.ch2_tabs_layout_1.addWidget(self._qtgui_time_sink_x_0_win)
        self._ch2_fsLabel_tool_bar = Qt.QToolBar(self)

        if None:
            self._ch2_fsLabel_formatter = None
        else:
            self._ch2_fsLabel_formatter = lambda x: x

        self._ch2_fsLabel_tool_bar.addWidget(Qt.QLabel('fs' + ": "))
        self._ch2_fsLabel_label = Qt.QLabel(
            str(self._ch2_fsLabel_formatter(self.ch2_fsLabel)))
        self._ch2_fsLabel_tool_bar.addWidget(self._ch2_fsLabel_label)
        self.top_grid_layout.addWidget(self._ch2_fsLabel_tool_bar, 1,
                                       fftColSpan + 2, 1, 1)

        self.ch2_fftDisplay = qtgui.freq_sink_c(
            ch2_fftSize,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            (ch2_rfFreq if ch2_wb else ch1_rfFreq) * 1e6 +
            ch2_ddcFreq * 1e3,  #fc
            ch2_fs,  #bw
            "Channel 2 (%sband)" % ("Wide" if ch2_wb else "Narrow"),  #name
            1  #number of inputs
        )
        self.ch2_fftDisplay.set_update_time(1.0 / ch2_updateRate)
        self.ch2_fftDisplay.set_y_axis(-120, 0)
        self.ch2_fftDisplay.set_y_label('Relative Gain', 'dB')
        self.ch2_fftDisplay.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.ch2_fftDisplay.enable_autoscale(False)
        self.ch2_fftDisplay.enable_grid(True)
        self.ch2_fftDisplay.set_fft_average(0.2)
        self.ch2_fftDisplay.enable_axis_labels(True)
        self.ch2_fftDisplay.enable_control_panel(False)

        if not False:
            self.ch2_fftDisplay.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.ch2_fftDisplay.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "red", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.ch2_fftDisplay.set_line_label(i, "Data {0}".format(i))
            else:
                self.ch2_fftDisplay.set_line_label(i, labels[i])
            self.ch2_fftDisplay.set_line_width(i, widths[i])
            self.ch2_fftDisplay.set_line_color(i, colors[i])
            self.ch2_fftDisplay.set_line_alpha(i, alphas[i])

        self._ch2_fftDisplay_win = sip.wrapinstance(
            self.ch2_fftDisplay.pyqwidget(), Qt.QWidget)
        self.ch2_tabs_layout_0.addWidget(self._ch2_fftDisplay_win)
        self._ch1_fsLabel_tool_bar = Qt.QToolBar(self)

        if None:
            self._ch1_fsLabel_formatter = None
        else:
            self._ch1_fsLabel_formatter = lambda x: x

        self._ch1_fsLabel_tool_bar.addWidget(Qt.QLabel('fs' + ": "))
        self._ch1_fsLabel_label = Qt.QLabel(
            str(self._ch1_fsLabel_formatter(self.ch1_fsLabel)))
        self._ch1_fsLabel_tool_bar.addWidget(self._ch1_fsLabel_label)
        self.top_grid_layout.addWidget(self._ch1_fsLabel_tool_bar, 1, 2, 1, 1)

        self.ch1_fftDisplay = qtgui.freq_sink_c(
            ch1_fftSize,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            ch1_rfFreq * 1e6 + ch1_ddcFreq * 1e3,  #fc
            ch1_fs,  #bw
            'Channel 1 (Wideband)',  #name
            1  #number of inputs
        )
        self.ch1_fftDisplay.set_update_time(1.0 / ch1_updateRate)
        self.ch1_fftDisplay.set_y_axis(-120, 0)
        self.ch1_fftDisplay.set_y_label('Relative Gain', 'dB')
        self.ch1_fftDisplay.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.ch1_fftDisplay.enable_autoscale(False)
        self.ch1_fftDisplay.enable_grid(True)
        self.ch1_fftDisplay.set_fft_average(0.2)
        self.ch1_fftDisplay.enable_axis_labels(True)
        self.ch1_fftDisplay.enable_control_panel(False)

        if not False:
            self.ch1_fftDisplay.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.ch1_fftDisplay.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "red", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.ch1_fftDisplay.set_line_label(i, "Data {0}".format(i))
            else:
                self.ch1_fftDisplay.set_line_label(i, labels[i])
            self.ch1_fftDisplay.set_line_width(i, widths[i])
            self.ch1_fftDisplay.set_line_color(i, colors[i])
            self.ch1_fftDisplay.set_line_alpha(i, alphas[i])

        self._ch1_fftDisplay_win = sip.wrapinstance(
            self.ch1_fftDisplay.pyqwidget(), Qt.QWidget)
        self.ch1_tabs_layout_0.addWidget(self._ch1_fftDisplay_win)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, logfile,
                                                   False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_file_descriptor_sink_0 = blocks.file_descriptor_sink(
            gr.sizeof_char * 1, 1)
        self.CyberRadio_vita_udp_rx_0_0 = CyberRadio.vita_udp_rx(
            macAndIpList[1], udpPortList[1], radioClass.getVitaHeaderSize(),
            radioClass.getVitaPayloadSize() / 4,
            radioClass.getVitaHeaderSize() +
            radioClass.getVitaPayloadSize() + radioClass.getVitaTailSize(),
            radioClass.isByteswapped(), False, False, False)
        self.CyberRadio_vita_udp_rx_0 = CyberRadio.vita_udp_rx(
            macAndIpList[1], udpPortList[0], radioClass.getVitaHeaderSize(),
            radioClass.getVitaPayloadSize() / 4,
            radioClass.getVitaHeaderSize() +
            radioClass.getVitaPayloadSize() + radioClass.getVitaTailSize(),
            radioClass.isByteswapped(), False, False, False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.CyberRadio_vita_udp_rx_0, 0),
                     (self.ch1_fftDisplay, 0))
        self.connect((self.CyberRadio_vita_udp_rx_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.CyberRadio_vita_udp_rx_0_0, 0),
                     (self.ch2_fftDisplay, 0))
        self.connect((self.CyberRadio_vita_udp_rx_0_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.ndrDemoControlBlock, 0),
                     (self.blocks_file_descriptor_sink_0, 0))
        self.connect((self.ndrDemoControlBlock, 0),
                     (self.blocks_file_sink_0, 0))
    def __init__(self,
                 avgGainList=[
                     1.0 / 8,
                     1.0 / 32,
                 ],
                 dipIndex=-1,
                 doLog10=True,
                 enable=True,
                 fftSize=int(2**17),
                 fftWindowType='flattop',
                 index=1,
                 localInterface="",
                 otherDdcArgs={},
                 otherTunerArgs={},
                 outSize=int((40.0 / 51.2) * (2**17)),
                 radioInterface=1,
                 radioParam={
                     "type": "ndr804-ptt",
                     "host": "ndr308",
                     "port": 8617,
                     "obj": None
                 },
                 rate=16,
                 rfAtten=0,
                 rfFilter=1,
                 rfFreq=1000,
                 udpPort=11000):
        numOut = len(avgGainList) + 1
        gr.hier_block2.__init__(
            self,
            "Local NDR804-PTT Snapshot Source",
            gr.io_signature(0, 0, 0),
            gr.io_signaturev(numOut, numOut,
                             [gr.sizeof_float * outSize] * numOut),
        )
        self.message_port_register_hier_in("rfFreq")
        self.message_port_register_hier_in("clearAvg")
        self.message_port_register_hier_out("rfFreq")

        ##################################################
        # Parameters
        ##################################################
        self.avgGainList = avgGainList
        self.dipIndex = dipIndex
        self.doLog10 = doLog10 = bool(doLog10)
        self.enable = enable = bool(enable)
        self.fftSize = fftSize = int(fftSize)
        self.fftWindowType = fftWindowType
        self.index = index
        self.localInterface = localInterface
        self.otherDdcArgs = otherDdcArgs
        self.otherTunerArgs = otherTunerArgs
        self.outSize = outSize
        self.radioInterface = radioInterface
        self.radioParam = radioParam
        self.rate = rate
        self.rfAtten = rfAtten
        self.rfFilter = rfFilter
        self.rfFreq = rfFreq
        self.udpPort = udpPort

        ##################################################
        # Variables
        ##################################################
        self.fftWindow = fftWindow = scipy.signal.get_window(
            fftWindowType, fftSize)
        self.windowScale = windowScale = fftWindow.sum() / fftWindow.size

        ##################################################
        # Blocks
        ##################################################
        self.tunerControl = CyberRadio.generic_tuner_control_block(
            radioParam, index, True, rfFreq, rfAtten, rfFilter, otherTunerArgs,
            False)
        self.snapshotToVector = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, fftSize)
        self.snapshotSource = CyberRadio.snapshot_source_c(
            '0.0.0.0', udpPort, fftSize, rate)
        if doLog10:
            self.log10_direct = CyberRadio.vector_nlog10_ff(10, outSize, 0)
            self.nullSink_direct = blocks.null_sink(gr.sizeof_float * outSize)
        else:
            self.log10_direct = None
        self.fftBlock = fft.fft_vcc(fftSize, True,
                                    (fftWindow / fftWindow.sum()), True, 1)
        self.extractPacketPayload = CyberRadio.vector_keep_m_in_n(
            gr.sizeof_gr_complex, outSize, fftSize, (fftSize - outSize) / 2)
        self.ddcControl = CyberRadio.generic_ddc_control_block(
            radioParam,
            index,
            "",  #idString
            bool(enable),
            True,
            0,
            1,
            0,
            index,
            0,
            radioInterface,
            dipIndex,
            localInterface,
            udpPort,
            otherDdcArgs,
            False)
        self.compToMagSq = blocks.complex_to_mag_squared(outSize)
        self.avgFilterList = []
        self.avgNullSinkList = []
        self.avgLog10List = []

        for i in range(numOut - 1):
            #cep test self.avgFilterList.append( filter.single_pole_iir_filter_ff(avgGainList[i], outSize) )
            self.avgFilterList.append(
                CyberRadio.vector_single_pole_iir_filter_ff(
                    avgGainList[i], outSize, True))
            self.avgNullSinkList.append(
                blocks.null_sink(gr.sizeof_float * outSize))
            if doLog10:
                self.avgLog10List.append(
                    CyberRadio.vector_nlog10_ff(10, outSize, 0))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self, 'rfFreq'), (self.tunerControl, 'rfFreq'))
        self.msg_connect((self.tunerControl, 'rfFreq'), (self, 'rfFreq'))

        for i in range(numOut - 1):
            self.connect((self.compToMagSq, 0), (self.avgFilterList[i], 0))
            #cep test self.msg_connect((self, 'clearAvg'), (self.avgFilterList[i], 'clear'))
            if doLog10:
                self.connect((self.avgFilterList[i], 0),
                             (self.avgLog10List[i], 0))
                self.connect((self.avgLog10List[i], 0),
                             (self.avgNullSinkList[i], 0))
                self.connect((self.avgLog10List[i], 0), (self, i + 1))
            else:
                self.connect((self.avgFilterList[i], 0),
                             (self.avgNullSinkList[i], 0))
                self.connect((self.avgFilterList[i], 0), (self, i + 1))
        if doLog10:
            self.connect((self.compToMagSq, 0), (self.log10_direct, 0))
            self.connect((self.log10_direct, 0), (self.nullSink_direct, 0))
            self.connect((self.log10_direct, 0), (self, 0))
        else:
            self.connect((self.compToMagSq, 0), (self, 0))
        self.connect((self.extractPacketPayload, 0), (self.compToMagSq, 0))
        self.connect((self.fftBlock, 0), (self.extractPacketPayload, 0))
        self.connect((self.snapshotToVector, 0), (self.fftBlock, 0))
        self.connect((self.snapshotSource, 0), (self.snapshotToVector, 0))
 def __init__(
     self,
     verbose_mode=True,
     radio_device_name="/dev/ndr47x",
     radio_baud_rate=921600,
     gig_iface_to_use="eth0",
     num_tuners=1,
     tuner1_param_list=[False, 900e6, 0],
     tuner2_param_list=[False, 900e6, 0],
     num_wbddcs=1,
     wbddc1_param_list=[40001, 0, 0, False, 0e6],
     wbddc2_param_list=[40002, 0, 0, False, 0e6],
     tagged=False,
 ):
     gr.hier_block2.__init__(
         self,
         "[CyberRadio] NDR472 Source",
         gr.io_signature(0, 0, 0),
         gr.io_signaturev(num_wbddcs + 1, num_wbddcs + 1,
                          [gr.sizeof_char * 1] +
                          num_wbddcs * [gr.sizeof_gr_complex * 1]),
     )
     self.verbose_mode = verbose_mode
     self.radio_device_name = radio_device_name
     self.radio_baud_rate = radio_baud_rate
     self.gig_iface_to_use = gig_iface_to_use
     self.udp_host_name = CyberRadioDriver.getInterfaceAddresses(
         self.gig_iface_to_use)[1]
     self.num_tuners = num_tuners
     self.tuner1_param_list = tuner1_param_list
     self.tuner2_param_list = tuner2_param_list
     self.num_wbddcs = num_wbddcs
     self.wbddc1_param_list = wbddc1_param_list
     self.wbddc2_param_list = wbddc2_param_list
     self.tagged = tagged
     self.CyberRadio_file_like_object_source_0 = CyberRadio.file_like_object_source(
     )
     self.connect((self.CyberRadio_file_like_object_source_0, 0), (self, 0))
     self.CyberRadio_NDR_driver_interface_0 = CyberRadio.NDR_driver_interface(
         radio_type="ndr472",
         verbose=verbose_mode,
         log_file=self.CyberRadio_file_like_object_source_0,
         connect_mode="tty",
         dev_name=radio_device_name,
         baud_rate=radio_baud_rate,
     )
     self.vita_tail_size = self.CyberRadio_NDR_driver_interface_0.getVitaTailSize(
     )
     self.vita_payload_size = self.CyberRadio_NDR_driver_interface_0.getVitaPayloadSize(
     )
     self.vita_header_size = self.CyberRadio_NDR_driver_interface_0.getVitaHeaderSize(
     )
     self.iq_swapped = self.CyberRadio_NDR_driver_interface_0.isIqSwapped()
     self.byte_swapped = self.CyberRadio_NDR_driver_interface_0.isByteswapped(
     )
     self._set_udp_dest_info()
     if self.num_tuners >= 1:
         self._set_tuner_param_list(1, tuner1_param_list)
     if self.num_tuners >= 2:
         self._set_tuner_param_list(2, tuner2_param_list)
     self.wbddc_sources = {}
     if self.num_wbddcs >= 1:
         self.CyberRadio_vita_iq_source_wbddc_1 = self._get_configured_wbddc(
             1, wbddc1_param_list)
         self.connect((self.CyberRadio_vita_iq_source_wbddc_1, 0),
                      (self, 1))
         self.wbddc_sources[1] = self.CyberRadio_vita_iq_source_wbddc_1
     if self.num_wbddcs >= 2:
         self.CyberRadio_vita_iq_source_wbddc_2 = self._get_configured_wbddc(
             2, wbddc2_param_list)
         self.connect((self.CyberRadio_vita_iq_source_wbddc_2, 0),
                      (self, 2))
         self.wbddc_sources[2] = self.CyberRadio_vita_iq_source_wbddc_2
Exemple #15
0
    def __init__(self, radioHostname='192.168.0.20', radioType='ndr364'):
        gr.top_block.__init__(self, "Freq Msg Strobe Test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Freq Msg Strobe Test")
        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", "frq_strobe_test")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.radioHostname = radioHostname
        self.radioType = radioType

        ##################################################
        # Variables
        ##################################################
        self.radioObj = radioObj = crd.getRadioObject(radioType, verbose=bool(False), host=radioHostname)
        self.wbddcRateSet = wbddcRateSet = dict( [(k,v) for k,v in radioObj.getWbddcRateSet().iteritems() if radioObj.getDdcDataFormat(True).get(k,"iq")!="real"] )
        self.configFilePath = configFilePath = os.path.expanduser( os.path.join("~",".%s_demo.cfg"%(radioObj.name.lower(),)) )
        self._cfg_wbddcRateIndex_config = ConfigParser.ConfigParser()
        self._cfg_wbddcRateIndex_config.read(configFilePath)
        try: cfg_wbddcRateIndex = self._cfg_wbddcRateIndex_config.getint('wbddc', 'rate_index')
        except: cfg_wbddcRateIndex = sorted(wbddcRateSet.keys())[0]
        self.cfg_wbddcRateIndex = cfg_wbddcRateIndex
        self._cfg_iirAvgExp_config = ConfigParser.ConfigParser()
        self._cfg_iirAvgExp_config.read(configFilePath)
        try: cfg_iirAvgExp = self._cfg_iirAvgExp_config.getint('gui', 'iirAvgExp')
        except: cfg_iirAvgExp = int(3)
        self.cfg_iirAvgExp = cfg_iirAvgExp
        self.wbddcRateIndex = wbddcRateIndex = cfg_wbddcRateIndex
        self.wbddcBwSet = wbddcBwSet = dict( [(k,v) for k,v in radioObj.getWbddcBwSet().iteritems() if radioObj.getDdcDataFormat(True).get(k,"iq")!="real"] )
        self.iirAvgExp = iirAvgExp = cfg_iirAvgExp
        self._cfg_tunerIndex_config = ConfigParser.ConfigParser()
        self._cfg_tunerIndex_config.read(configFilePath)
        try: cfg_tunerIndex = self._cfg_tunerIndex_config.getint('tuner', 'index')
        except: cfg_tunerIndex = radioObj.getTunerIndexRange()[0]
        self.cfg_tunerIndex = cfg_tunerIndex
        self._cfg_tunerAtten_config = ConfigParser.ConfigParser()
        self._cfg_tunerAtten_config.read(configFilePath)
        try: cfg_tunerAtten = self._cfg_tunerAtten_config.getint('tuner', 'atten')
        except: cfg_tunerAtten = int(radioObj.getTunerAttenuationRange()[0])
        self.cfg_tunerAtten = cfg_tunerAtten
        self._cfg_rfFreqMhz_config = ConfigParser.ConfigParser()
        self._cfg_rfFreqMhz_config.read(configFilePath)
        try: cfg_rfFreqMhz = self._cfg_rfFreqMhz_config.getint('tuner', 'freq')
        except: cfg_rfFreqMhz = int(radioObj.getTunerFrequencyRange()[0]/1e6)
        self.cfg_rfFreqMhz = cfg_rfFreqMhz
        self._cfg_refLevel_config = ConfigParser.ConfigParser()
        self._cfg_refLevel_config.read(configFilePath)
        try: cfg_refLevel = self._cfg_refLevel_config.getint('display', 'ref_level')
        except: cfg_refLevel = 0
        self.cfg_refLevel = cfg_refLevel
        self._cfg_dynRange_config = ConfigParser.ConfigParser()
        self._cfg_dynRange_config.read(configFilePath)
        try: cfg_dynRange = self._cfg_dynRange_config.getint('display', 'dyn_range')
        except: cfg_dynRange = 120
        self.cfg_dynRange = cfg_dynRange
        self.wbSampleRate = wbSampleRate = wbddcRateSet[wbddcRateIndex]
        self.wbBw = wbBw = wbddcBwSet[wbddcRateIndex]
        self.udpBasePort = udpBasePort = 0xcafe
        self.tunerIndex = tunerIndex = cfg_tunerIndex
        self.tunerAtten = tunerAtten = cfg_tunerAtten
        self.samp_rate = samp_rate = 10e6
        self.rfFreqMhz = rfFreqMhz = cfg_rfFreqMhz
        self.refLevel = refLevel = cfg_refLevel
        self.pauseScan = pauseScan = False
        self.iirAlpha = iirAlpha = 2.0**(float(-iirAvgExp))
        self.fStep = fStep = 100
        self.f2 = f2 = int(radioObj.getTunerFrequencyRange()[1]/1e6)
        self.f1 = f1 = 100
        self.dynRange = dynRange = cfg_dynRange
        self.dwell = dwell = 0.5

        ##################################################
        # Blocks
        ##################################################
        self.wbTabs = Qt.QTabWidget()
        self.wbTabs_widget_0 = Qt.QWidget()
        self.wbTabs_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.wbTabs_widget_0)
        self.wbTabs_grid_layout_0 = Qt.QGridLayout()
        self.wbTabs_layout_0.addLayout(self.wbTabs_grid_layout_0)
        self.wbTabs.addTab(self.wbTabs_widget_0, 'Spectrum')
        self.top_grid_layout.addWidget(self.wbTabs, 1,0,1,3)
        self.controlTabs = Qt.QTabWidget()
        self.controlTabs_widget_0 = Qt.QWidget()
        self.controlTabs_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.controlTabs_widget_0)
        self.controlTabs_grid_layout_0 = Qt.QGridLayout()
        self.controlTabs_layout_0.addLayout(self.controlTabs_grid_layout_0)
        self.controlTabs.addTab(self.controlTabs_widget_0, 'control')
        self.top_grid_layout.addWidget(self.controlTabs, 0,0,1,1)
        self._wbddcRateIndex_options = sorted(wbddcRateSet.keys())
        self._wbddcRateIndex_labels = ["%d: %ssps"%(k,num_to_str(wbddcRateSet[k])) for k in sorted(wbddcRateSet.keys())]
        self._wbddcRateIndex_tool_bar = Qt.QToolBar(self)
        self._wbddcRateIndex_tool_bar.addWidget(Qt.QLabel('WBDDC Sample Rate'+": "))
        self._wbddcRateIndex_combo_box = Qt.QComboBox()
        self._wbddcRateIndex_tool_bar.addWidget(self._wbddcRateIndex_combo_box)
        for label in self._wbddcRateIndex_labels: self._wbddcRateIndex_combo_box.addItem(label)
        self._wbddcRateIndex_callback = lambda i: Qt.QMetaObject.invokeMethod(self._wbddcRateIndex_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._wbddcRateIndex_options.index(i)))
        self._wbddcRateIndex_callback(self.wbddcRateIndex)
        self._wbddcRateIndex_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_wbddcRateIndex(self._wbddcRateIndex_options[i]))
        self.controlTabs_grid_layout_0.addWidget(self._wbddcRateIndex_tool_bar, 0,1,1,1)
        self._tunerIndex_options = radioObj.getTunerIndexRange()
        self._tunerIndex_labels = map(str, self._tunerIndex_options)
        self._tunerIndex_tool_bar = Qt.QToolBar(self)
        self._tunerIndex_tool_bar.addWidget(Qt.QLabel('Tuner Index'+": "))
        self._tunerIndex_combo_box = Qt.QComboBox()
        self._tunerIndex_tool_bar.addWidget(self._tunerIndex_combo_box)
        for label in self._tunerIndex_labels: self._tunerIndex_combo_box.addItem(label)
        self._tunerIndex_callback = lambda i: Qt.QMetaObject.invokeMethod(self._tunerIndex_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._tunerIndex_options.index(i)))
        self._tunerIndex_callback(self.tunerIndex)
        self._tunerIndex_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_tunerIndex(self._tunerIndex_options[i]))
        self.controlTabs_grid_layout_0.addWidget(self._tunerIndex_tool_bar, 0,0,1,1)
        self._tunerAtten_range = Range(int(radioObj.getTunerAttenuationRange()[0]), int(radioObj.getTunerAttenuationRange()[1]), int(radioObj.getTunerAttenuationRes()), cfg_tunerAtten, 200)
        self._tunerAtten_win = RangeWidget(self._tunerAtten_range, self.set_tunerAtten, 'Tuner Atten (dB)', "counter", int)
        self.controlTabs_grid_layout_0.addWidget(self._tunerAtten_win, 0,2,1,1)
        self._rfFreqMhz_range = Range(int(radioObj.getTunerFrequencyRange()[0]/1e6), int(radioObj.getTunerFrequencyRange()[1]/1e6), 10, cfg_rfFreqMhz, 200)
        self._rfFreqMhz_win = RangeWidget(self._rfFreqMhz_range, self.set_rfFreqMhz, 'Tuner Freq (MHz)', "counter_slider", int)
        self.controlTabs_grid_layout_0.addWidget(self._rfFreqMhz_win, 0,3,1,2)
        self._refLevel_range = Range(-120, +10, 5, cfg_refLevel, (130/5)+1)
        self._refLevel_win = RangeWidget(self._refLevel_range, self.set_refLevel, "Ref.\nLevel\n(dB)", "dial", int)
        self.wbTabs_grid_layout_0.addWidget(self._refLevel_win, 0,1,1,1)
        self._pauseScan_options = (False, True, )
        self._pauseScan_labels = ('Run', 'Pause', )
        self._pauseScan_group_box = Qt.QGroupBox('Scan')
        self._pauseScan_box = Qt.QHBoxLayout()
        class variable_chooser_button_group(Qt.QButtonGroup):
            def __init__(self, parent=None):
                Qt.QButtonGroup.__init__(self, parent)
            @pyqtSlot(int)
            def updateButtonChecked(self, button_id):
                self.button(button_id).setChecked(True)
        self._pauseScan_button_group = variable_chooser_button_group()
        self._pauseScan_group_box.setLayout(self._pauseScan_box)
        for i, label in enumerate(self._pauseScan_labels):
        	radio_button = Qt.QRadioButton(label)
        	self._pauseScan_box.addWidget(radio_button)
        	self._pauseScan_button_group.addButton(radio_button, i)
        self._pauseScan_callback = lambda i: Qt.QMetaObject.invokeMethod(self._pauseScan_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._pauseScan_options.index(i)))
        self._pauseScan_callback(self.pauseScan)
        self._pauseScan_button_group.buttonClicked[int].connect(
        	lambda i: self.set_pauseScan(self._pauseScan_options[i]))
        self.controlTabs_grid_layout_0.addWidget(self._pauseScan_group_box, 1,0,1,1)
        self._fStep_range = Range(1, 1000, 10, 100, 200)
        self._fStep_win = RangeWidget(self._fStep_range, self.set_fStep, 'Step (MHz)', "counter", float)
        self.controlTabs_grid_layout_0.addWidget(self._fStep_win, 1,3,1,1)
        self._f2_range = Range(int(radioObj.getTunerFrequencyRange()[0]/1e6), int(radioObj.getTunerFrequencyRange()[1]/1e6), 10, int(radioObj.getTunerFrequencyRange()[1]/1e6), 200)
        self._f2_win = RangeWidget(self._f2_range, self.set_f2, 'f2 (MHz)', "counter", float)
        self.controlTabs_grid_layout_0.addWidget(self._f2_win, 1,2,1,1)
        self._f1_range = Range(int(radioObj.getTunerFrequencyRange()[0]/1e6), int(radioObj.getTunerFrequencyRange()[1]/1e6), 10, 100, 200)
        self._f1_win = RangeWidget(self._f1_range, self.set_f1, 'f1 (MHz)', "counter", float)
        self.controlTabs_grid_layout_0.addWidget(self._f1_win, 1,1,1,1)
        self._dynRange_range = Range(5, 200, 5, cfg_dynRange, (195/5)+1)
        self._dynRange_win = RangeWidget(self._dynRange_range, self.set_dynRange, "Dyn.\nRange\n(dB)", "dial", int)
        self.wbTabs_grid_layout_0.addWidget(self._dynRange_win, 1,1,1,1)
        self._dwell_range = Range(0.001, 10.0, 0.1, 0.5, 200)
        self._dwell_win = RangeWidget(self._dwell_range, self.set_dwell, 'dwell', "counter", float)
        self.controlTabs_grid_layout_0.addWidget(self._dwell_win, 1,4,1,1)
        self.z_tunerControl = CyberRadio.generic_tuner_control_block(
                    radioObj,
                    tunerIndex,
                    True,
                    1000,
                    tunerAtten,
                    1,
                    None,
                    {},
                    False
                     )
        self.y_ddcControl = CyberRadio.generic_ddc_control_block(
                    radioObj,
                    tunerIndex,
                    True,
                    True,
                    wbddcRateIndex,
                    0,
                    0,
                    tunerIndex,
                    0,
                    -1,
                    -1,
                    '',
                    udpBasePort,
                    {},
                    True
                     )
        self.uhd_usrp_sink_1 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		otw_format='sc8',
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_1.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_1.set_center_freq(uhd.tune_request_t((rfFreqMhz+1)*1e6, 2*samp_rate), 0)
        self.uhd_usrp_sink_1.set_gain(20, 0)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	4096, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	wbSampleRate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(1.0/32)
        self.qtgui_freq_sink_x_0.set_y_axis(refLevel-dynRange, refLevel)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(0.2)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not False:
          self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.wbTabs_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,3,1)
        self._iirAvgExp_range = Range(0, 8, 1, cfg_iirAvgExp, 200)
        self._iirAvgExp_win = RangeWidget(self._iirAvgExp_range, self.set_iirAvgExp, 'Avg.', "dial", int)
        self.wbTabs_grid_layout_0.addWidget(self._iirAvgExp_win, 2,1,1,1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, radioObj.getVitaPayloadSize()/4)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.7, ))
        self.blocks_message_debug_1 = blocks.message_debug()
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 0.1, 1, 0)
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(1)
        self.CyberRadio_zero_copy_source_0 = CyberRadio.zero_copy_source(
              '255.255.255.255', udpBasePort,
              1, radioObj.getVitaHeaderSize(), radioObj.getVitaPayloadSize()/4,
              radioObj.isByteswapped(), radioObj.isIqSwapped(),
              "ip proto 17 and ip dst 255.255.255.255 and udp dst port %d"%(udpBasePort,), True,
               )
        self.CyberRadio_generic_group_control_block_0 = CyberRadio.generic_group_control_block(
                  radioObj,
                  0,
                  False,
                  True,
                  ([0,1,2,3,]),
                  {},
                  False,
                   )
        self.CyberRadio_freq_msg_strobe_0 = CyberRadio.freq_msg_strobe(
              pause = bool(pauseScan),
              f1 = f1,
              f2 = f2,
              step = fStep,
              dwell = dwell,
              wrap = True,
              fManual = rfFreqMhz,
              msgUnits = 1.0,
              msgRes = 1.0e6,
              debug = False,
               )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.CyberRadio_freq_msg_strobe_0, 'freq'), (self.uhd_usrp_sink_1, 'command'))
        self.msg_connect((self.CyberRadio_freq_msg_strobe_0, 'freq'), (self.z_tunerControl, 'freq'))
        self.msg_connect((self.y_ddcControl, 'status'), (self.blocks_message_debug_1, 'print'))
        self.msg_connect((self.z_tunerControl, 'freq'), (self.qtgui_freq_sink_x_0, 'freq'))
        self.connect((self.CyberRadio_zero_copy_source_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.uhd_usrp_sink_1, 0))
        self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_freq_sink_x_0, 0))
    def __init__(
        self,
        radioParam={
            "type": "ndr804-ptt",
            "host": "ndr308",
            "port": 8617,
            "obj": None
        },
        index=1,
        enable=True,
        idString="USER",
        rate=0,
        ddcFreq=0,
        tunerIndex=1,
        radioInterface=1,
        dipIndex=-1,
        localInterface="eth6",
        udpPort=11000,
        testFilename="",
        otherDdcArgs={},
    ):
        gr.hier_block2.__init__(
            self,
            "NDR804-PTT Narrowband IQ Source",
            gr.io_signature(0, 0, 0),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )
        self.message_port_register_hier_out("control")
        self.message_port_register_hier_in("control")

        ##################################################
        # Parameters
        ##################################################
        self.ddcFreq = ddcFreq
        self.dipIndex = dipIndex
        self.index = index
        self.localInterface = localInterface
        self.otherDdcArgs = otherDdcArgs
        self.radioInterface = radioInterface
        self.radioParam = radioParam
        self.rate = rate
        self.tunerIndex = tunerIndex
        self.udpPort = udpPort
        self.enable = enable
        self.idString = idString
        self.testFilename = testFilename

        ##################################################
        # Blocks
        ##################################################
        self.vitaIqSource = CyberRadio.vita_iq_source_2(
            3,
            1024 * 4 / 4,
            9 * 4,
            1 * 4,
            False,
            True,
            "0.0.0.0",
            udpPort,
            False,
            False,
            False,
        )
        self.vecToStream = blocks.vector_to_stream(gr.sizeof_gr_complex * 1,
                                                   1024 / 4)
        self.nullSink = blocks.null_sink(gr.sizeof_int * (9 + 1024 / 4 + 1))
        self.ddcControl = generic_ddc_control_block(
            radioParam,
            index,
            self.idString,
            enable,  # enable
            False,  # wideband
            rate,
            0,
            ddcFreq,
            tunerIndex,
            0,
            radioInterface,
            dipIndex,
            localInterface,
            udpPort,
            dict(otherDdcArgs),
            False)

        if self.testFilename != "":
            self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                     31250, True)
            self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex(
                False, False)
            self.blocks_file_source_0 = blocks.file_source(
                gr.sizeof_short * 1, self.testFilename, True)
            self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
                (1.0 / 32767, ))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ddcControl, 'control'), (self, 'control'))
        self.msg_connect((self, 'control'), (self.ddcControl, 'control'))

        if self.testFilename != "":
            self.connect((self.blocks_multiply_const_vxx_0, 0), (self, 0))
            self.connect((self.blocks_throttle_0, 0),
                         (self.blocks_multiply_const_vxx_0, 0))
            self.connect((self.blocks_interleaved_short_to_complex_0, 0),
                         (self.blocks_throttle_0, 0))
            self.connect((self.blocks_file_source_0, 0),
                         (self.blocks_interleaved_short_to_complex_0, 0))
        else:
            self.connect((self.vecToStream, 0), (self, 0))
            self.connect((self.vitaIqSource, 0), (self.nullSink, 0))
            self.connect((self.vitaIqSource, 1), (self.vecToStream, 0))