Beispiel #1
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "rtl_flex_noX")
        self.options = options
        self.offset = 0.0
        self.adj_time = time.time()
        self.verbose = options.verbose
        self.log = options.log

        # Set up rtl source
        self.u = osmosdr.source(args="%s" % (options.device))
        # set Freq
        self.u.set_center_freq(options.freq + options.calibration, 0)

        # Grab 250 KHz of spectrum
        self.u.set_sample_rate(250e3)
        rate = self.u.get_sample_rate()
        if rate != 250e3:
            print "Unable to set required sample rate of 250 Ksps (got %f)" % rate
            sys.exit(1)
        # Set gain
        if options.rx_gain is None:
            grange = self.u.get_gain_range()
            options.rx_gain = float(grange.start() + grange.stop()) / 2.0
            print "\nNo gain specified."
            print "Setting gain to %f (from [%f, %f])" % (options.rx_gain, grange.start(), grange.stop())

        self.u.set_gain(options.rx_gain, 0)

        taps = optfir.low_pass(1.0, 250e3, 11000, 12500, 0.1, 60)

        self.chan = filter.freq_xlating_fir_filter_ccf(10, taps, 0.0, 250e3)
        self.flex = pager.flex_demod(queue, options.freq, options.verbose, options.log)

        self.connect(self.u, self.chan, self.flex)
Beispiel #2
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "usrp_flex_all")

        if options.from_file is not None:
            src = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from file", options.from_file
        else:
            src = usrp.source_c()
            if options.rx_subdev_spec is None:
                options.rx_subdev_spec = usrp.pick_rx_subdevice(src)
            subdev = usrp.selected_subdev(src, options.rx_subdev_spec)
            src.set_mux(
                usrp.determine_rx_mux_value(src, options.rx_subdev_spec))
            src.set_decim_rate(20)
            result = usrp.tune(src, 0, subdev,
                               930.5125e6 + options.calibration)
            if options.verbose:
                print "Using", subdev.name(), " for receiving."
                print "Tuned USRP to", 930.5125e6 + options.calibration

        taps = gr.firdes.low_pass(1.0, 1.0, 1.0 / 128.0 * 0.4,
                                  1.0 / 128.0 * 0.1, gr.firdes.WIN_HANN)

        if options.verbose:
            print "Channel filter has", len(taps), "taps"

        bank = blks2.analysis_filterbank(128, taps)
        self.connect(src, bank)

        if options.log and options.from_file == None:
            src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(src, src_sink)

        for i in range(128):
            if i < 64:
                freq = 930.5e6 + i * 25e3
            else:
                freq = 928.9e6 + (i - 64) * 25e3

            if (freq < 929.0e6 or freq > 932.0e6):
                self.connect((bank, i), gr.null_sink(gr.sizeof_gr_complex))
            else:
                self.connect((bank, i),
                             pager.flex_demod(queue, freq, options.verbose,
                                              options.log))
                if options.log:
                    self.connect(
                        (bank, i),
                        gr.file_sink(gr.sizeof_gr_complex, 'chan_' + '%3.3f' %
                                     (freq / 1e6) + '.dat'))
Beispiel #3
0
    def __init__(self, options, queue):
	gr.top_block.__init__(self, "usrp_flex_all")

        if options.from_file is not None:
            src = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from file", options.from_file
        else:
            src = usrp.source_c()
            if options.rx_subdev_spec is None:
                options.rx_subdev_spec = usrp.pick_rx_subdevice(src)
            subdev = usrp.selected_subdev(src, options.rx_subdev_spec)
            src.set_mux(usrp.determine_rx_mux_value(src, options.rx_subdev_spec))
            src.set_decim_rate(20)
            result = usrp.tune(src, 0, subdev, 930.5125e6+options.calibration)
            if options.verbose:
                print "Using", subdev.name(), " for receiving."
                print "Tuned USRP to", 930.5125e6+options.calibration
                
        taps = gr.firdes.low_pass(1.0,
                                  1.0,
                                  1.0/128.0*0.4,
                                  1.0/128.0*0.1,
                                  gr.firdes.WIN_HANN)

        if options.verbose:
            print "Channel filter has", len(taps), "taps"

        bank = blks2.analysis_filterbank(128, taps)
        self.connect(src, bank)

        if options.log and options.from_file == None:
            src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(src, src_sink)

        for i in range(128):
	    if i < 64:
		freq = 930.5e6+i*25e3
	    else:
		freq = 928.9e6+(i-64)*25e3

	    if (freq < 929.0e6 or freq > 932.0e6):
                self.connect((bank, i), gr.null_sink(gr.sizeof_gr_complex))
	    else:
            	self.connect((bank, i), pager.flex_demod(queue, freq, options.verbose, options.log))
                if options.log:
                    self.connect((bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat'))
Beispiel #4
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "rtl_flex_noX")
        self.options = options
        self.offset = 0.0
        self.adj_time = time.time()
        self.verbose = options.verbose
        self.log = options.log

        # Set up rtl source
        self.u = osmosdr.source(args="%s" % (options.device))
        #set Freq
        self.u.set_center_freq(options.freq + options.calibration, 0)

        # Grab 250 KHz of spectrum
        self.u.set_sample_rate(250e3)
        rate = self.u.get_sample_rate()
        if rate != 250e3:
            print "Unable to set required sample rate of 250 Ksps (got %f)" % rate
            sys.exit(1)
        #Set gain
        if options.rx_gain is None:
            grange = self.u.get_gain_range()
            options.rx_gain = float(grange.start() + grange.stop()) / 2.0
            print "\nNo gain specified."
            print "Setting gain to %f (from [%f, %f])" % \
                (options.rx_gain, grange.start(), grange.stop())

        self.u.set_gain(options.rx_gain, 0)

        taps = optfir.low_pass(1.0, 250e3, 11000, 12500, 0.1, 60)

        self.chan = filter.freq_xlating_fir_filter_ccf(10, taps, 0.0, 250e3)
        self.flex = pager.flex_demod(queue, options.freq, options.verbose,
                                     options.log)

        self.connect(self.u, self.chan, self.flex)
Beispiel #5
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "usrp_flex")
        self.options = options
        self.offset = 0.0
        self.adj_time = time.time()
        self.verbose = options.verbose

        if options.from_file is None:
            # Set up USRP source
            self.u = uhd.usrp_source(device_addr=options.address,
                                     stream_args=uhd.stream_args('fc32'))

            # Grab 250 KHz of spectrum
            # (A UHD facility to get sample rate range and granularity would be useful)
            self.u.set_samp_rate(250e3)
            rate = self.u.get_samp_rate()
            if rate != 250e3:
                print "Unable to set required sample rate of 250 Ksps (got %f)" % rate
                sys.exit(1)

            # Tune daughterboard
            r = self.u.set_center_freq(options.freq + options.calibration, 0)
            if not r:
                frange = self.u.get_freq_range()
                sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
                                     (freq, frange.start(), frange.stop()))
                sys.exit(1)

            # if no gain was specified, use the mid-point in dB
            if options.rx_gain is None:
                grange = self.u.get_gain_range()
                options.rx_gain = float(grange.start() + grange.stop()) / 2.0
                print "\nNo gain specified."
                print "Setting gain to %f (from [%f, %f])" % \
                    (options.rx_gain, grange.start(), grange.stop())

            self.u.set_gain(options.rx_gain, 0)

        else:
            # Use supplied file as source of samples
            self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from", options.from_file

        if options.log and not options.from_file:
            usrp_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.u, usrp_sink)

        # Set up 22KHz-wide bandpass about center frequency. Decimate by 10
        # to get channel rate of 25Ksps
        taps = optfir.low_pass(
            1.0,  # Filter gain
            250e3,  # Sample rate
            11000,  # One-sided modulation bandwidth
            12500,  # One-sided channel bandwidth
            0.1,  # Passband ripple
            60)  # Stopband attenuation

        if options.verbose:
            print "Channel filter has", len(taps), "taps."

        self.chan = gr.freq_xlating_fir_filter_ccf(
            10,  # Decimation rate
            taps,  # Filter taps
            0.0,  # Offset frequency
            250e3)  # Sample rate

        if options.log:
            chan_sink = gr.file_sink(gr.sizeof_gr_complex, 'chan.dat')
            self.connect(self.chan, chan_sink)

        # FLEX protocol demodulator
        self.flex = pager.flex_demod(queue, options.freq, options.verbose,
                                     options.log)

        self.connect(self.u, self.chan, self.flex)
Beispiel #6
0
    def __init__(self, options, queue):
        grc_wxgui.top_block_gui.__init__(self, title="Pager Rx")

        ##################################################
        # Variables
        ##################################################
        self.band = band = 929.5e6
        self.frequencies = [929.1875e6, 929.2875e6, 929.6625e6]
        self.samp_rate = samp_rate = 1200000
        self.corr = corr = 0
        self.gain = gain = 40.0
        self.channel_rate = channel_rate = 25000

        ##################################################
        # Blocks
        ##################################################
        _corr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._corr_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            label="Frequency correction",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._corr_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            minimum=-150,
            maximum=150,
            num_steps=300,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_corr_sizer, 0, 1, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label="Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=49.6,
            num_steps=124,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_gain_sizer, 0, 0, 1, 1)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=0,
            dynamic_range=50,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=channel_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Channel Waterfall",
        )
        self.Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=band,
            dynamic_range=50,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Band Waterfall",
        )
        self.GridAdd(self.wxgui_waterfallsink2_0.win, 1, 0, 1, 2)

        def wxgui_waterfallsink2_0_callback(x, y):
            self.set_click_freq(x)

        self.add = blocks.add_vcc(1)

        self.wxgui_waterfallsink2_0.set_callback(
            wxgui_waterfallsink2_0_callback)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(band, 0)
        self.osmosdr_source_0.set_freq_corr(corr, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(gain, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.channel_filter = []
        self.flex = []

        for x in range(len(self.frequencies)):
            frequency = self.frequencies[x]
            self.channel_filter.append(
                filter.freq_xlating_fir_filter_ccc(
                    samp_rate / channel_rate, (filter.optfir.low_pass(
                        1.0, samp_rate, 11000, 12500, 0.1, 60)),
                    frequency - band, samp_rate))

            # FLEX protocol demodulator
            self.flex.append(
                pager.flex_demod(queue, frequency, False,
                                 False))  # options.verbose, options.log

            self.connect((self.osmosdr_source_0, 0),
                         (self.channel_filter[x], 0))
            self.connect((self.channel_filter[x], 0), (self.add, x))
            self.connect((self.channel_filter[x], 0), (self.flex[x], 0))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.osmosdr_source_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.add, 0), (self.wxgui_waterfallsink2_1, 0))
Beispiel #7
0
    def __init__(self, options, queue):
        grc_wxgui.top_block_gui.__init__(self, title="RTL FLEX reciever")
        self.options = options
        self.offset = 0.0
        self.adj_time = time.time()
        self.verbose = options.verbose
        self.log = options.log
        self.fft_enable = options.fft

        # Set up rtl source
        self.u = osmosdr.source(args="%s" % (options.device))
        #set Freq
        self.u.set_center_freq(options.freq + options.calibration, 0)

        # Grab 250 KHz of spectrum
        self.u.set_sample_rate(250e3)
        rate = self.u.get_sample_rate()
        if rate != 250e3:
            print "Unable to set required sample rate of 250 Ksps (got %f)" % rate
            sys.exit(1)
        #Set gain
        if options.rx_gain is None:
            grange = self.u.get_gain_range()
            options.rx_gain = float(grange.start() + grange.stop()) / 2.0
            print "\nNo gain specified."
            print "Setting gain to %f (from [%f, %f])" % \
                (options.rx_gain, grange.start(), grange.stop())

        self.u.set_gain(options.rx_gain, 0)

        taps = optfir.low_pass(1.0, 250e3, 11000, 12500, 0.1, 60)

        self.chan = filter.freq_xlating_fir_filter_ccf(10, taps, 0.0, 250e3)
        if self.fft_enable:
            self.fftsink = fftsink2.fft_sink_c(
                self.GetWin(),
                baseband_freq=options.freq + options.calibration,
                y_per_div=10,
                y_divs=10,
                ref_level=0,
                ref_scale=2.0,
                sample_rate=250e3,
                fft_size=1024,
                fft_rate=15,
                average=True,
                avg_alpha=None,
                title="RTL Output",
                peak_hold=False,
            )
            self.Add(self.fftsink.win)

            self.fftsink2 = fftsink2.fft_sink_c(
                self.GetWin(),
                baseband_freq=options.freq + options.calibration,
                y_per_div=10,
                y_divs=10,
                ref_level=0,
                ref_scale=2.0,
                sample_rate=250e3,
                fft_size=1024,
                fft_rate=15,
                average=True,
                avg_alpha=None,
                title="Decoder input (After the filters)",
                peak_hold=False,
            )
            self.Add(self.fftsink2.win)

        self.flex = pager.flex_demod(queue, options.freq, options.verbose,
                                     options.log)

        self.connect(self.u, self.chan, self.flex)
        if self.fft_enable:
            self.connect(self.u, self.fftsink)
            self.connect(self.chan, self.fftsink2)
    def __init__(self, options, queue):
	gr.top_block.__init__(self, "usrp_flex_all")

        if options.from_file is not None:
            self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from file", options.from_file
        else:
            # Set up USRP source
            self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32'))

            # Grab 1 MHz of spectrum
            # (A UHD facility to get sample rate range and granularity would be useful)
            self.u.set_samp_rate(1e6)
            rate = self.u.get_samp_rate()
            if rate != 1e6:
                print "Unable to set required sample rate of 1 Msps (got %f)" % rate
                sys.exit(1)
                
            # Tune daughterboard
            r = self.u.set_center_freq(options.freq+options.calibration, 0)
            if not r:
                frange = self.u.get_freq_range()
                sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
                                     (freq, frange.start(), frange.stop()))
                sys.exit(1)

            # if no gain was specified, use the mid-point in dB
            if options.rx_gain is None:
                grange = self.u.get_gain_range()
                options.rx_gain = float(grange.start()+grange.stop())/2.0
                print "\nNo gain specified."
                print "Setting gain to %f (from [%f, %f])" % \
                    (options.rx_gain, grange.start(), grange.stop())
        
            self.u.set_gain(options.rx_gain, 0)


        taps = gr.firdes.low_pass(1.0,
                                  1.0,
                                  1.0/40.0*0.4,
                                  1.0/40.0*0.1,
                                  gr.firdes.WIN_HANN)

        if options.verbose:
            print "Channel filter has", len(taps), "taps"

        bank = blks2.analysis_filterbank(40, taps)
        self.connect(self.u, bank)

        if options.log and options.from_file == None:
            src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.u, src_sink)

        for i in range(40):
	    if i < 20:
		freq = options.freq+i*25e3
	    else:
		freq = options.freq-0.5e6+(i-20)*25e3

	    self.connect((bank, i), pager.flex_demod(queue, freq, options.verbose, options.log))
	    if options.log:
		self.connect((bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat'))
Beispiel #9
0
    def __init__(self, options, queue):
        grc_wxgui.top_block_gui.__init__(self, title="RTL FLEX reciever")
        self.options = options
        self.offset = 0.0
        self.adj_time = time.time()
        self.verbose = options.verbose
        self.log = options.log
        self.fft_enable = options.fft

        # Set up rtl source
        self.u = osmosdr.source( args="%s"%(options.device) )
        #set Freq
        self.u.set_center_freq(options.freq+options.calibration, 0)

        # Grab 250 KHz of spectrum
        self.u.set_sample_rate(250e3)
        rate = self.u.get_sample_rate()
        if rate != 250e3:
            print "Unable to set required sample rate of 250 Ksps (got %f)" % rate
            sys.exit(1)
        #Set gain
        if options.rx_gain is None:
            grange = self.u.get_gain_range()
            options.rx_gain = float(grange.start()+grange.stop())/2.0
            print "\nNo gain specified."
            print "Setting gain to %f (from [%f, %f])" % \
                (options.rx_gain, grange.start(), grange.stop())

        self.u.set_gain(options.rx_gain, 0)

        taps = optfir.low_pass(1.0,
                               250e3,
                               11000,
                               12500,
                               0.1,
                               60)


        self.chan = filter.freq_xlating_fir_filter_ccf(10,
                                                   taps,
                                                   0.0,
                                                   250e3)
        if self.fft_enable:
            self.fftsink = fftsink2.fft_sink_c(
                self.GetWin(),
                baseband_freq=options.freq+options.calibration,
                y_per_div=10,
                y_divs=10,
                ref_level=0,
                ref_scale=2.0,
                sample_rate=250e3,
                fft_size=1024,
                fft_rate=15,
                average=True,
                avg_alpha=None,
                title="RTL Output",
                peak_hold=False,
            )
            self.Add(self.fftsink.win)

            self.fftsink2 = fftsink2.fft_sink_c(
                self.GetWin(),
                baseband_freq=options.freq+options.calibration,
                y_per_div=10,
                y_divs=10,
                ref_level=0,
                ref_scale=2.0,
                sample_rate=250e3,
                fft_size=1024,
                fft_rate=15,
                average=True,
                avg_alpha=None,
                title="Decoder input (After the filters)",
                peak_hold=False,
            )
            self.Add(self.fftsink2.win)

        self.flex = pager.flex_demod(queue, options.freq, options.verbose, options.log)

        self.connect(self.u, self.chan, self.flex)
        if self.fft_enable:
            self.connect(self.u, self.fftsink)
            self.connect(self.chan, self.fftsink2)
Beispiel #10
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "usrp_flex")
        self.options = options
        self.offset = 0.0
        self.adj_time = time.time()
        self.verbose = options.verbose

        if options.from_file is None:
            # Set up USRP source with specified RX daughterboard
            self.src = usrp.source_c()
            if options.rx_subdev_spec == None:
                options.rx_subdev_spec = usrp.pick_rx_subdevice(self.src)
            self.subdev = usrp.selected_subdev(self.src,
                                               options.rx_subdev_spec)
            self.src.set_mux(
                usrp.determine_rx_mux_value(self.src, options.rx_subdev_spec))

            # Grab 250 KHz of spectrum (sample rate becomes 250 ksps complex)
            self.src.set_decim_rate(256)

            # If no gain specified, set to midrange
            if options.gain is None:
                g = self.subdev.gain_range()
                options.gain = (g[0] + g[1]) / 2.0
            self.subdev.set_gain(options.gain)

            # Tune daughterboard
            actual_frequency = options.frequency + options.calibration
            tune_result = usrp.tune(self.src, 0, self.subdev, actual_frequency)
            if not tune_result:
                sys.stderr.write("Failed to set center frequency to " +
                                 ` actual_frequency ` + "\n")
                sys.exit(1)

            if options.verbose:
                print "Using RX daughterboard", self.subdev.side_and_name()
                print "USRP gain is", options.gain
                print "USRP tuned to", actual_frequency

        else:
            # Use supplied file as source of samples
            self.src = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from", options.from_file

        if options.log and not options.from_file:
            usrp_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.src, usrp_sink)

        # Set up 22KHz-wide bandpass about center frequency. Decimate by 10
        # to get channel rate of 25Ksps
        taps = optfir.low_pass(
            1.0,  # Filter gain
            250e3,  # Sample rate
            11000,  # One-sided modulation bandwidth
            12500,  # One-sided channel bandwidth
            0.1,  # Passband ripple
            60)  # Stopband attenuation

        if options.verbose:
            print "Channel filter has", len(taps), "taps."

        self.chan = gr.freq_xlating_fir_filter_ccf(
            10,  # Decimation rate
            taps,  # Filter taps
            0.0,  # Offset frequency
            250e3)  # Sample rate

        if options.log:
            chan_sink = gr.file_sink(gr.sizeof_gr_complex, 'chan.dat')
            self.connect(self.chan, chan_sink)

        # FLEX protocol demodulator
        self.flex = pager.flex_demod(queue, options.frequency, options.verbose,
                                     options.log)

        self.connect(self.src, self.chan, self.flex)
Beispiel #11
0
    def __init__(self, options, queue):
        grc_wxgui.top_block_gui.__init__(self, title="Pager Rx")

        ##################################################
        # Variables
        ##################################################
        self.band = band = 929.5e6
        self.click_freq = click_freq = band - 500000 + 12500
        self.channel = channel = round(
            (click_freq - (band - 500000 - 12500)) / 25000)
        self.samp_rate = samp_rate = 1200000
        self.freq = freq = band - 512500 + (channel * 25000)
        self.corr = corr = 0
        self.gain = gain = 40.0
        self.channel_rate = channel_rate = 25000

        ##################################################
        # Blocks
        ##################################################
        self._freq_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.freq,
            callback=self.set_freq,
            label="Frequency",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._freq_static_text, 1, 2, 1, 1)
        _corr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._corr_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            label="Frequency correction",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._corr_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            minimum=-150,
            maximum=150,
            num_steps=300,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_corr_sizer, 0, 2, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label="Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=49.6,
            num_steps=124,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_gain_sizer, 0, 0, 1, 2)
        self._band_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.band,
            callback=self.set_band,
            label='band',
            choices=[929.5e6, 931.5e6],
            labels=["929-930", "931-932"],
            style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._band_chooser, 1, 0, 1, 1)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=0,
            dynamic_range=50,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=channel_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Channel Waterfall",
        )
        self.Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=band,
            dynamic_range=50,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Band Waterfall",
        )
        self.GridAdd(self.wxgui_waterfallsink2_0.win, 2, 0, 1, 3)

        def wxgui_waterfallsink2_0_callback(x, y):
            self.set_click_freq(x)

        self.wxgui_waterfallsink2_0.set_callback(
            wxgui_waterfallsink2_0_callback)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(band, 0)
        self.osmosdr_source_0.set_freq_corr(corr, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(gain, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            samp_rate / channel_rate,
            (filter.optfir.low_pass(1.0, samp_rate, 11000, 12500, 0.1, 60)),
            freq - band, samp_rate)
        _channel_sizer = wx.BoxSizer(wx.VERTICAL)
        self._channel_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_channel_sizer,
            value=self.channel,
            callback=self.set_channel,
            label='channel',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._channel_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_channel_sizer,
            value=self.channel,
            callback=self.set_channel,
            minimum=1,
            maximum=40,
            num_steps=39,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_channel_sizer, 1, 1, 1, 1)

        # FLEX protocol demodulator
        self.flex = pager.flex_demod(queue, 0, False,
                                     False)  # options.verbose, options.log

        ##################################################
        # Connections
        ##################################################
        self.connect((self.osmosdr_source_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.wxgui_waterfallsink2_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.flex, 0))
Beispiel #12
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "flex_hackrf")

        # Set up HackRF source
        self.u = osmosdr.source(args="numchan=" + str(1) + " " + "")
        self.u.set_freq_corr(0, 0)
        self.u.set_dc_offset_mode(0, 0)
        self.u.set_iq_balance_mode(0, 0)
        self.u.set_gain_mode(False, 0)
        self.u.set_gain(0, 0)
        self.u.set_if_gain(20, 0)
        self.u.set_bb_gain(20, 0)
        self.u.set_antenna("", 0)
        self.u.set_bandwidth(0, 0)

        # Tune hackRF
        r = self.u.set_center_freq(options.freq + options.calibration, 0)
        if not r:
            frange = self.u.get_freq_range()
            sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
                  (freq, frange.start(), frange.stop()))
            sys.exit(1)

        if options.verbose:
            print "Tuned to center frequency", (
                options.freq + options.calibration) / 1e6, "MHz"

        # Grab >=3 MHz of spectrum, evenly divisible by 25 KHz channels
        # (A UHD facility to get sample rate range and granularity would be useful)

        self.u.set_sample_rate(
            3.125e6)  # Works if USRP is 100 Msps and can decimate by 32
        rate = self.u.get_sample_rate()

        if rate != 3.125e6:
            self.u.set_sample_rate(
                3.2e6)  # Works if USRP is 64 Msps and can decimate by 20
            rate = self.u.get_sample_rate()
            if (rate != 3.2e6):
                print "Unable to set required sample rate for >= 3MHz of 25 KHz channels."
                sys.exit(1)

        self.nchan = int(rate / 25e3)
        if options.verbose:
            print "\nReceiving", rate / 1e6, "MHz of bandwidth containing", self.nchan, "baseband channels."

        taps = filter.firdes.low_pass(1.0, 1.0, 1.0 / self.nchan * 0.4,
                                      1.0 / self.nchan * 0.1,
                                      filter.firdes.WIN_HANN)

        if options.verbose:
            print "Channel filter has", len(taps), "taps"

        self.bank = filter.analysis_filterbank(self.nchan, taps)
        self.connect(self.u, self.bank)

        mid_chan = int(self.nchan / 2)
        for i in range(self.nchan):
            if i < mid_chan:
                freq = options.freq + i * 25e3
            else:
                freq = options.freq - (self.nchan - i) * 25e3

            if (freq < 929.0e6 or freq > 932.0e6):
                self.connect((self.bank, i),
                             blocks.null_sink(gr.sizeof_gr_complex))
            else:
                self.connect((self.bank, i),
                             pager.flex_demod(queue, freq, options.verbose))
Beispiel #13
0
    def __init__(self, options, queue):
	gr.top_block.__init__(self, "usrp_flex_all")

        if options.from_file is not None:
            self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            self.nchan = options.nchan
            if options.verbose:
                print "Reading samples from file", options.from_file
                print "User specified file contains", options.nchan, "25 KHz channels."

        else:
            # Set up USRP source
            self.u = uhd.usrp_source(device_addr=options.address,
                                     io_type=uhd.io_type.COMPLEX_FLOAT32,
                                     num_channels=1)

            # Tune daughterboard
            r = self.u.set_center_freq(options.freq+options.calibration, 0)
            if not r:
                frange = self.u.get_freq_range()
                sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
                                     (freq, frange.start(), frange.stop()))
                sys.exit(1)

            if options.verbose:
                print "Tuned to center frequency", (options.freq+options.calibration)/1e6, "MHz"

            # if no gain was specified, use the mid-point in dB
            if options.rx_gain is None:
                grange = self.u.get_gain_range()
                options.rx_gain = float(grange.start()+grange.stop())/2.0
                print "\nNo gain specified."
                print "Setting gain to %f (from [%f, %f])" % \
                    (options.rx_gain, grange.start(), grange.stop())
        
            self.u.set_gain(options.rx_gain, 0)

            # Grab >=3 MHz of spectrum, evenly divisible by 25 KHz channels
            # (A UHD facility to get sample rate range and granularity would be useful)

            self.u.set_samp_rate(3.125e6) # Works if USRP is 100 Msps and can decimate by 32
            rate = self.u.get_samp_rate()

            if rate != 3.125e6:
                self.u.set_samp_rate(3.2e6) # Works if USRP is 64 Msps and can decimate by 20
                rate = self.u.get_samp_rate()
                if (rate != 3.2e6):
                    print "Unable to set required sample rate for >= 3MHz of 25 KHz channels."
                    sys.exit(1)
            
            self.nchan = int(rate/25e3)
            if options.verbose:
                print "\nReceiving", rate/1e6, "MHz of bandwidth containing", self.nchan, "baseband channels."
                    
        taps = gr.firdes.low_pass(1.0,
                                  1.0,
                                  1.0/self.nchan*0.4,
                                  1.0/self.nchan*0.1,
                                  gr.firdes.WIN_HANN)

        if options.verbose:
            print "Channel filter has", len(taps), "taps"

        self.bank = blks2.analysis_filterbank(self.nchan, taps)
        self.connect(self.u, self.bank)

        if options.log and options.from_file == None:
            src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.u, src_sink)

        mid_chan = int(self.nchan/2)
        for i in range(self.nchan):
	    if i < mid_chan:
		freq = 930.5e6+i*25e3
	    else:
		freq = 930.5e6-(self.nchan-i)*25e3

	    if (freq < 929.0e6 or freq > 932.0e6):
                self.connect((self.bank, i), gr.null_sink(gr.sizeof_gr_complex))
	    else:
            	self.connect((self.bank, i), pager.flex_demod(queue, freq, options.verbose, options.log))
                if options.log:
                    self.connect((self.bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat'))
    def __init__(self, options, queue):
	gr.top_block.__init__(self, "usrp_flex_all")

        if options.from_file is not None:
            self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            self.nchan = options.nchan
            if options.verbose:
                print "Reading samples from file", options.from_file
                print "User specified file contains", options.nchan, "25 KHz channels."

        else:
            # Set up USRP source
            self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32'))

            # Tune daughterboard
            r = self.u.set_center_freq(options.freq+options.calibration, 0)
            if not r:
                frange = self.u.get_freq_range()
                sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
                                     (freq, frange.start(), frange.stop()))
                sys.exit(1)

            if options.verbose:
                print "Tuned to center frequency", (options.freq+options.calibration)/1e6, "MHz"

            # if no gain was specified, use the mid-point in dB
            if options.rx_gain is None:
                grange = self.u.get_gain_range()
                options.rx_gain = float(grange.start()+grange.stop())/2.0
                print "\nNo gain specified."
                print "Setting gain to %f (from [%f, %f])" % \
                    (options.rx_gain, grange.start(), grange.stop())
        
            self.u.set_gain(options.rx_gain, 0)

            # Grab >=3 MHz of spectrum, evenly divisible by 25 KHz channels
            # (A UHD facility to get sample rate range and granularity would be useful)

            self.u.set_samp_rate(3.125e6) # Works if USRP is 100 Msps and can decimate by 32
            rate = self.u.get_samp_rate()

            if rate != 3.125e6:
                self.u.set_samp_rate(3.2e6) # Works if USRP is 64 Msps and can decimate by 20
                rate = self.u.get_samp_rate()
                if (rate != 3.2e6):
                    print "Unable to set required sample rate for >= 3MHz of 25 KHz channels."
                    sys.exit(1)
            
            self.nchan = int(rate/25e3)
            if options.verbose:
                print "\nReceiving", rate/1e6, "MHz of bandwidth containing", self.nchan, "baseband channels."
                    
        taps = gr.firdes.low_pass(1.0,
                                  1.0,
                                  1.0/self.nchan*0.4,
                                  1.0/self.nchan*0.1,
                                  gr.firdes.WIN_HANN)

        if options.verbose:
            print "Channel filter has", len(taps), "taps"

        self.bank = blks2.analysis_filterbank(self.nchan, taps)
        self.connect(self.u, self.bank)

        if options.log and options.from_file == None:
            src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.u, src_sink)

        mid_chan = int(self.nchan/2)
        for i in range(self.nchan):
	    if i < mid_chan:
		freq = 930.5e6+i*25e3
	    else:
		freq = 930.5e6-(self.nchan-i)*25e3

	    if (freq < 929.0e6 or freq > 932.0e6):
                self.connect((self.bank, i), gr.null_sink(gr.sizeof_gr_complex))
	    else:
            	self.connect((self.bank, i), pager.flex_demod(queue, freq, options.verbose, options.log))
                if options.log:
                    self.connect((self.bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat'))
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "usrp_flex_all")

        if options.from_file is not None:
            self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from file", options.from_file
        else:
            # Set up USRP source
            self.u = uhd.usrp_source(device_addr=options.address,
                                     stream_args=uhd.stream_args('fc32'))

            # Grab 1 MHz of spectrum
            # (A UHD facility to get sample rate range and granularity would be useful)
            self.u.set_samp_rate(1e6)
            rate = self.u.get_samp_rate()
            if rate != 1e6:
                print "Unable to set required sample rate of 1 Msps (got %f)" % rate
                sys.exit(1)

            # Tune daughterboard
            r = self.u.set_center_freq(options.freq + options.calibration, 0)
            if not r:
                frange = self.u.get_freq_range()
                sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
                                     (freq, frange.start(), frange.stop()))
                sys.exit(1)

            # if no gain was specified, use the mid-point in dB
            if options.rx_gain is None:
                grange = self.u.get_gain_range()
                options.rx_gain = float(grange.start() + grange.stop()) / 2.0
                print "\nNo gain specified."
                print "Setting gain to %f (from [%f, %f])" % \
                    (options.rx_gain, grange.start(), grange.stop())

            self.u.set_gain(options.rx_gain, 0)

        taps = gr.firdes.low_pass(1.0, 1.0, 1.0 / 40.0 * 0.4, 1.0 / 40.0 * 0.1,
                                  gr.firdes.WIN_HANN)

        if options.verbose:
            print "Channel filter has", len(taps), "taps"

        bank = blks2.analysis_filterbank(40, taps)
        self.connect(self.u, bank)

        if options.log and options.from_file == None:
            src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.u, src_sink)

        for i in range(40):
            if i < 20:
                freq = options.freq + i * 25e3
            else:
                freq = options.freq - 0.5e6 + (i - 20) * 25e3

            self.connect((bank, i),
                         pager.flex_demod(queue, freq, options.verbose,
                                          options.log))
            if options.log:
                self.connect(
                    (bank, i),
                    gr.file_sink(gr.sizeof_gr_complex,
                                 'chan_' + '%3.3f' % (freq / 1e6) + '.dat'))
Beispiel #16
0
    def __init__(self, queue):
        grc_wxgui.top_block_gui.__init__(self, title="Pager 6Ch Decode")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2000000
        self.xlate_decimation = xlate_decimation = 80
        self.hunter_freq_5 = hunter_freq_5 = 0
        self.hunter_freq_4 = hunter_freq_4 = 0
        self.hunter_freq_3 = hunter_freq_3 = 0
        self.hunter_freq_2 = hunter_freq_2 = 0
        self.hunter_freq_1 = hunter_freq_1 = 0
        self.hunter_freq_0 = hunter_freq_0 = 0
        self.gain = gain = 10
        self.frequency = frequency = 929000000
        self.filter_width = filter_width = 5120
        self.fft_taps = fft_taps = filter.firdes.low_pass_2(
            1, samp_rate, 10000, 1000, 0.1)
        self.fft_n_elements = fft_n_elements = 2048

        ##################################################
        # Blocks
        ##################################################
        _hunter_freq_5_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_5_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_hunter_freq_5_sizer,
            value=self.hunter_freq_5,
            callback=self.set_hunter_freq_5,
            label='hunter_freq_5',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._hunter_freq_5_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_hunter_freq_5_sizer,
            value=self.hunter_freq_5,
            callback=self.set_hunter_freq_5,
            minimum=-5000000,
            maximum=5000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_hunter_freq_5_sizer)
        _hunter_freq_4_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_4_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_hunter_freq_4_sizer,
            value=self.hunter_freq_4,
            callback=self.set_hunter_freq_4,
            label='hunter_freq_4',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._hunter_freq_4_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_hunter_freq_4_sizer,
            value=self.hunter_freq_4,
            callback=self.set_hunter_freq_4,
            minimum=-5000000,
            maximum=5000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_hunter_freq_4_sizer)
        _hunter_freq_3_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_3_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_hunter_freq_3_sizer,
            value=self.hunter_freq_3,
            callback=self.set_hunter_freq_3,
            label='hunter_freq_3',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._hunter_freq_3_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_hunter_freq_3_sizer,
            value=self.hunter_freq_3,
            callback=self.set_hunter_freq_3,
            minimum=-5000000,
            maximum=5000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_hunter_freq_3_sizer)
        _hunter_freq_2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_2_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_hunter_freq_2_sizer,
            value=self.hunter_freq_2,
            callback=self.set_hunter_freq_2,
            label='hunter_freq_2',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._hunter_freq_2_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_hunter_freq_2_sizer,
            value=self.hunter_freq_2,
            callback=self.set_hunter_freq_2,
            minimum=-5000000,
            maximum=5000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_hunter_freq_2_sizer)
        _hunter_freq_1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_1_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_hunter_freq_1_sizer,
            value=self.hunter_freq_1,
            callback=self.set_hunter_freq_1,
            label='hunter_freq_1',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._hunter_freq_1_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_hunter_freq_1_sizer,
            value=self.hunter_freq_1,
            callback=self.set_hunter_freq_1,
            minimum=-5000000,
            maximum=5000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_hunter_freq_1_sizer)
        _hunter_freq_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_0_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_hunter_freq_0_sizer,
            value=self.hunter_freq_0,
            callback=self.set_hunter_freq_0,
            label='hunter_freq_0',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._hunter_freq_0_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_hunter_freq_0_sizer,
            value=self.hunter_freq_0,
            callback=self.set_hunter_freq_0,
            minimum=-5000000,
            maximum=5000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_hunter_freq_0_sizer)
        _frequency_sizer = wx.BoxSizer(wx.VERTICAL)
        self._frequency_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_frequency_sizer,
            value=self.frequency,
            callback=self.set_frequency,
            label='Frequency',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._frequency_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_frequency_sizer,
            value=self.frequency,
            callback=self.set_frequency,
            minimum=80000000,
            maximum=1100000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_frequency_sizer)
        self.zeromq_push_sink_0_0 = zeromq.push_sink(gr.sizeof_float,
                                                     fft_n_elements,
                                                     'tcp://127.0.0.1:9000',
                                                     100, False, -1)
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ('localhost', 8080), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(
            target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=frequency,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='master_plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              '')
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(frequency, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(40, 0)
        self.rtlsdr_source_0.set_if_gain(0, 0)
        self.rtlsdr_source_0.set_bb_gain(0, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(samp_rate, 0)

        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='gain',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=50,
            num_steps=50,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self.freq_xlating_fft_filter_ccc_0_0_3 = filter.freq_xlating_fft_filter_ccc(
            xlate_decimation, (fft_taps), frequency + hunter_freq_5, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_3.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_3.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0_2 = filter.freq_xlating_fft_filter_ccc(
            xlate_decimation, (fft_taps), frequency + hunter_freq_4, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_2.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_2.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0_1 = filter.freq_xlating_fft_filter_ccc(
            xlate_decimation, (fft_taps), frequency + hunter_freq_3, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_1.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_1.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0_0 = filter.freq_xlating_fft_filter_ccc(
            xlate_decimation, (fft_taps), frequency + hunter_freq_2, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_0.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0 = filter.freq_xlating_fft_filter_ccc(
            xlate_decimation, (fft_taps), frequency + hunter_freq_1, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(
            xlate_decimation, (fft_taps), frequency + hunter_freq_0, samp_rate)
        self.freq_xlating_fft_filter_ccc_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0)
        _filter_width_sizer = wx.BoxSizer(wx.VERTICAL)
        self._filter_width_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_filter_width_sizer,
            value=self.filter_width,
            callback=self.set_filter_width,
            label='filter_width',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._filter_width_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_filter_width_sizer,
            value=self.filter_width,
            callback=self.set_filter_width,
            minimum=2048,
            maximum=40960,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_filter_width_sizer)
        self.fft_vxx_0 = fft.fft_vcc(fft_n_elements, True,
                                     (window.blackmanharris(fft_n_elements)),
                                     True, 1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_n_elements)
        self.blocks_stream_to_vector_1 = blocks.stream_to_vector(
            gr.sizeof_float * 1, fft_n_elements)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, fft_n_elements)
        self.blocks_null_sink_0_0_3 = blocks.null_sink(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_sink_0_0_2 = blocks.null_sink(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_sink_0_0_1 = blocks.null_sink(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        # FLEX protocol demodulator
        self.flex0 = pager.flex_demod(queue, 0, False,
                                      False)  # options.verbose, options.log
        self.flex1 = pager.flex_demod(queue, 0, False,
                                      False)  # options.verbose, options.log
        self.flex2 = pager.flex_demod(queue, 0, False,
                                      False)  # options.verbose, options.log
        self.flex3 = pager.flex_demod(queue, 0, False,
                                      False)  # options.verbose, options.log
        self.flex4 = pager.flex_demod(queue, 0, False,
                                      False)  # options.verbose, options.log
        self.flex5 = pager.flex_demod(queue, 0, False,
                                      False)  # options.verbose, options.log

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_stream_to_vector_1, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_stream_to_vector_1, 0),
                     (self.zeromq_push_sink_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.flex0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0, 0),
                     (self.flex1, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_0, 0),
                     (self.flex2, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_1, 0),
                     (self.flex3, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_2, 0),
                     (self.flex4, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_3, 0),
                     (self.flex5, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0_0_1, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0_0_2, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0_0_3, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
    def __init__(self, queue):
        grc_wxgui.top_block_gui.__init__(self, title="Pager 6Ch Decode")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2000000
        self.xlate_decimation = xlate_decimation = 80
        self.hunter_freq_5 = hunter_freq_5 = 0
        self.hunter_freq_4 = hunter_freq_4 = 0
        self.hunter_freq_3 = hunter_freq_3 = 0
        self.hunter_freq_2 = hunter_freq_2 = 0
        self.hunter_freq_1 = hunter_freq_1 = 0
        self.hunter_freq_0 = hunter_freq_0 = 0
        self.gain = gain = 10
        self.frequency = frequency = 929000000
        self.filter_width = filter_width = 5120
        self.fft_taps = fft_taps = filter.firdes.low_pass_2(1, samp_rate, 2000, 1000, 0.1)
        self.fft_n_elements = fft_n_elements = 2048

        ##################################################
        # Blocks
        ##################################################
        _hunter_freq_5_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_5_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_5_sizer,
        	value=self.hunter_freq_5,
        	callback=self.set_hunter_freq_5,
        	label='hunter_freq_5',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._hunter_freq_5_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_5_sizer,
        	value=self.hunter_freq_5,
        	callback=self.set_hunter_freq_5,
        	minimum=-1000000,
        	maximum=1000000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_hunter_freq_5_sizer)
        _hunter_freq_4_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_4_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_4_sizer,
        	value=self.hunter_freq_4,
        	callback=self.set_hunter_freq_4,
        	label='hunter_freq_4',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._hunter_freq_4_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_4_sizer,
        	value=self.hunter_freq_4,
        	callback=self.set_hunter_freq_4,
        	minimum=-1000000,
        	maximum=1000000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_hunter_freq_4_sizer)
        _hunter_freq_3_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_3_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_3_sizer,
        	value=self.hunter_freq_3,
        	callback=self.set_hunter_freq_3,
        	label='hunter_freq_3',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._hunter_freq_3_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_3_sizer,
        	value=self.hunter_freq_3,
        	callback=self.set_hunter_freq_3,
        	minimum=-1000000,
        	maximum=1000000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_hunter_freq_3_sizer)
        _hunter_freq_2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_2_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_2_sizer,
        	value=self.hunter_freq_2,
        	callback=self.set_hunter_freq_2,
        	label='hunter_freq_2',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._hunter_freq_2_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_2_sizer,
        	value=self.hunter_freq_2,
        	callback=self.set_hunter_freq_2,
        	minimum=-1000000,
        	maximum=1000000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_hunter_freq_2_sizer)
        _hunter_freq_1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_1_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_1_sizer,
        	value=self.hunter_freq_1,
        	callback=self.set_hunter_freq_1,
        	label='hunter_freq_1',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._hunter_freq_1_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_1_sizer,
        	value=self.hunter_freq_1,
        	callback=self.set_hunter_freq_1,
        	minimum=-1000000,
        	maximum=1000000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_hunter_freq_1_sizer)
        _hunter_freq_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._hunter_freq_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_0_sizer,
        	value=self.hunter_freq_0,
        	callback=self.set_hunter_freq_0,
        	label='hunter_freq_0',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._hunter_freq_0_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_hunter_freq_0_sizer,
        	value=self.hunter_freq_0,
        	callback=self.set_hunter_freq_0,
        	minimum=-1000000,
        	maximum=1000000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_hunter_freq_0_sizer)
        _frequency_sizer = wx.BoxSizer(wx.VERTICAL)
        self._frequency_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_frequency_sizer,
        	value=self.frequency,
        	callback=self.set_frequency,
        	label='Frequency',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._frequency_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_frequency_sizer,
        	value=self.frequency,
        	callback=self.set_frequency,
        	minimum=80000000,
        	maximum=1100000000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_frequency_sizer)
        self.zeromq_push_sink_0_0 = zeromq.push_sink(gr.sizeof_float, fft_n_elements, 'tcp://127.0.0.1:9000', 100, False, -1)
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(('localhost', 8080), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=frequency,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='master_plot',
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(frequency, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(20, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label='gain',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=50,
        	num_steps=50,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_gain_sizer)
        self.freq_xlating_fft_filter_ccc_0_0_3 = filter.freq_xlating_fft_filter_ccc(xlate_decimation, (fft_taps), frequency + hunter_freq_5, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_3.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_3.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0_2 = filter.freq_xlating_fft_filter_ccc(xlate_decimation, (fft_taps), frequency + hunter_freq_4, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_2.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_2.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0_1 = filter.freq_xlating_fft_filter_ccc(xlate_decimation, (fft_taps), frequency + hunter_freq_3, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_1.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_1.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0_0 = filter.freq_xlating_fft_filter_ccc(xlate_decimation, (fft_taps), frequency + hunter_freq_2, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_0.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0 = filter.freq_xlating_fft_filter_ccc(xlate_decimation, (fft_taps), frequency + hunter_freq_1, samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(xlate_decimation, (fft_taps), frequency + hunter_freq_0, samp_rate)
        self.freq_xlating_fft_filter_ccc_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0)
        _filter_width_sizer = wx.BoxSizer(wx.VERTICAL)
        self._filter_width_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_filter_width_sizer,
        	value=self.filter_width,
        	callback=self.set_filter_width,
        	label='filter_width',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._filter_width_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_filter_width_sizer,
        	value=self.filter_width,
        	callback=self.set_filter_width,
        	minimum=2048,
        	maximum=40960,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_filter_width_sizer)
        self.fft_vxx_0 = fft.fft_vcc(fft_n_elements, True, (window.blackmanharris(fft_n_elements)), True, 1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, fft_n_elements)
        self.blocks_stream_to_vector_1 = blocks.stream_to_vector(gr.sizeof_float*1, fft_n_elements)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_n_elements)
        self.blocks_null_sink_0_0_3 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0_0_2 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0_0_1 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        # FLEX protocol demodulator
        self.flex0 = pager.flex_demod(queue, 0, False, False) # options.verbose, options.log
        self.flex1 = pager.flex_demod(queue, 0, False, False) # options.verbose, options.log
        self.flex2 = pager.flex_demod(queue, 0, False, False) # options.verbose, options.log
        self.flex3 = pager.flex_demod(queue, 0, False, False) # options.verbose, options.log
        self.flex4 = pager.flex_demod(queue, 0, False, False) # options.verbose, options.log
        self.flex5 = pager.flex_demod(queue, 0, False, False) # options.verbose, options.log

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_stream_to_vector_1, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_stream_to_vector_1, 0), (self.zeromq_push_sink_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.flex0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0, 0), (self.flex1, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_0, 0), (self.flex2, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_1, 0), (self.flex3, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_2, 0), (self.flex4, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_3, 0), (self.flex5, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fft_filter_ccc_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fft_filter_ccc_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fft_filter_ccc_0_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fft_filter_ccc_0_0_1, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fft_filter_ccc_0_0_2, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fft_filter_ccc_0_0_3, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
Beispiel #18
0
    def __init__(self, options, queue):
        grc_wxgui.top_block_gui.__init__(self, title="Pager Rx")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.band = band = 929.5e6
        self.frequencies = [929.1875e6, 929.2875e6, 929.6625e6]
        self.samp_rate = samp_rate = 1200000
        self.corr = corr = 0
        self.gain = gain = 40.0
        self.channel_rate = channel_rate = 25000

        ##################################################
        # Blocks
        ##################################################
        _corr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._corr_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_corr_sizer,
        	value=self.corr,
        	callback=self.set_corr,
        	label="Frequency correction",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._corr_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_corr_sizer,
        	value=self.corr,
        	callback=self.set_corr,
        	minimum=-150,
        	maximum=150,
        	num_steps=300,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_corr_sizer, 0, 1, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=49.6,
        	num_steps=124,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_gain_sizer, 0, 0, 1, 1)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	dynamic_range=50,
        	ref_level=-20,
        	ref_scale=2.0,
        	sample_rate=channel_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Channel Waterfall",
        )
        self.Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=band,
        	dynamic_range=50,
        	ref_level=-20,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Band Waterfall",
        )
        self.GridAdd(self.wxgui_waterfallsink2_0.win, 1, 0, 1, 2)
        def wxgui_waterfallsink2_0_callback(x, y):
        	self.set_click_freq(x)
        self.add = blocks.add_vcc(1)
        
        self.wxgui_waterfallsink2_0.set_callback(wxgui_waterfallsink2_0_callback)
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(band, 0)
        self.osmosdr_source_0.set_freq_corr(corr, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(0, 0)
        self.osmosdr_source_0.set_gain(gain, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)
          
        self.channel_filter = []
        self.flex = []

        for x in range(len(self.frequencies)):
            frequency = self.frequencies[x]
            self.channel_filter.append(filter.freq_xlating_fir_filter_ccc(samp_rate / channel_rate, (filter.optfir.low_pass(1.0, samp_rate, 11000, 12500, 0.1, 60)), frequency - band, samp_rate))

            # FLEX protocol demodulator
            self.flex.append(pager.flex_demod(queue, frequency, False, False)) # options.verbose, options.log

            self.connect((self.osmosdr_source_0, 0), (self.channel_filter[x], 0))
            self.connect((self.channel_filter[x], 0), (self.add, x))
            self.connect((self.channel_filter[x], 0), (self.flex[x], 0))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.add, 0), (self.wxgui_waterfallsink2_1, 0))
Beispiel #19
0
    def __init__(self, options, queue):
        grc_wxgui.top_block_gui.__init__(self, title="Pager Rx")

        ##################################################
        # Variables
        ##################################################
        self.band = band = 929.5e6
        self.click_freq = click_freq = band - 500000 + 12500
        self.channel = channel = round((click_freq - (band - 500000 - 12500)) / 25000)
        self.samp_rate = samp_rate = 1200000
        self.freq = freq = band - 512500 + (channel * 25000)
        self.corr = corr = 0
        self.gain = gain = 40.0
        self.channel_rate = channel_rate = 25000

        ##################################################
        # Blocks
        ##################################################
        self._freq_static_text = forms.static_text(
        	parent=self.GetWin(),
        	value=self.freq,
        	callback=self.set_freq,
        	label="Frequency",
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._freq_static_text, 1, 2, 1, 1)
        _corr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._corr_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_corr_sizer,
        	value=self.corr,
        	callback=self.set_corr,
        	label="Frequency correction",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._corr_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_corr_sizer,
        	value=self.corr,
        	callback=self.set_corr,
        	minimum=-150,
        	maximum=150,
        	num_steps=300,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_corr_sizer, 0, 2, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=49.6,
        	num_steps=124,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_gain_sizer, 0, 0, 1, 2)
        self._band_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.band,
        	callback=self.set_band,
        	label='band',
        	choices=[929.5e6,931.5e6],
        	labels=["929-930","931-932"],
        	style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._band_chooser, 1, 0, 1, 1)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	dynamic_range=50,
        	ref_level=-20,
        	ref_scale=2.0,
        	sample_rate=channel_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Channel Waterfall",
        )
        self.Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=band,
        	dynamic_range=50,
        	ref_level=-20,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Band Waterfall",
        )
        self.GridAdd(self.wxgui_waterfallsink2_0.win, 2, 0, 1, 3)
        def wxgui_waterfallsink2_0_callback(x, y):
        	self.set_click_freq(x)

        self.wxgui_waterfallsink2_0.set_callback(wxgui_waterfallsink2_0_callback)
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(band, 0)
        self.osmosdr_source_0.set_freq_corr(corr, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(gain, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(samp_rate / channel_rate, (filter.optfir.low_pass(1.0, samp_rate, 11000, 12500, 0.1, 60)), freq - band, samp_rate)
        _channel_sizer = wx.BoxSizer(wx.VERTICAL)
        self._channel_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_channel_sizer,
        	value=self.channel,
        	callback=self.set_channel,
        	label='channel',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._channel_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_channel_sizer,
        	value=self.channel,
        	callback=self.set_channel,
        	minimum=1,
        	maximum=40,
        	num_steps=39,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_channel_sizer, 1, 1, 1, 1)

        # FLEX protocol demodulator
        self.flex = pager.flex_demod(queue, 0, False, False) # options.verbose, options.log

        ##################################################
        # Connections
        ##################################################
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_waterfallsink2_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.flex, 0))
Beispiel #20
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "usrp_flex")
        self.options = options
	self.offset = 0.0
	self.adj_time = time.time()
	self.verbose = options.verbose
			
	if options.from_file is None:
            # Set up USRP source
            self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32'))

            # Grab 250 KHz of spectrum
            # (A UHD facility to get sample rate range and granularity would be useful)
            self.u.set_samp_rate(250e3)
            rate = self.u.get_samp_rate()
            if rate != 250e3:
                print "Unable to set required sample rate of 250 Ksps (got %f)" % rate
                sys.exit(1)
                
            # Tune daughterboard
            r = self.u.set_center_freq(options.freq+options.calibration, 0)
            if not r:
                frange = self.u.get_freq_range()
                sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
                                     (freq, frange.start(), frange.stop()))
                sys.exit(1)

            # if no gain was specified, use the mid-point in dB
            if options.rx_gain is None:
                grange = self.u.get_gain_range()
                options.rx_gain = float(grange.start()+grange.stop())/2.0
                print "\nNo gain specified."
                print "Setting gain to %f (from [%f, %f])" % \
                    (options.rx_gain, grange.start(), grange.stop())
        
            self.u.set_gain(options.rx_gain, 0)
	    	    
        else:
            # Use supplied file as source of samples
            self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from", options.from_file
	    
        if options.log and not options.from_file:
            usrp_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.u, usrp_sink)

        # Set up 22KHz-wide bandpass about center frequency. Decimate by 10
        # to get channel rate of 25Ksps
        taps = optfir.low_pass(1.0,   # Filter gain
                               250e3, # Sample rate
                               11000, # One-sided modulation bandwidth
                               12500, # One-sided channel bandwidth
                               0.1,   # Passband ripple
                               60)    # Stopband attenuation
	
	if options.verbose:
	    print "Channel filter has", len(taps), "taps."

        self.chan = gr.freq_xlating_fir_filter_ccf(10,    # Decimation rate
                                                   taps,  # Filter taps
                                                   0.0,   # Offset frequency
                                                   250e3) # Sample rate

	if options.log:
	    chan_sink = gr.file_sink(gr.sizeof_gr_complex, 'chan.dat')
	    self.connect(self.chan, chan_sink)

        # FLEX protocol demodulator
        self.flex = pager.flex_demod(queue, options.freq, options.verbose, options.log)

        self.connect(self.u, self.chan, self.flex)
Beispiel #21
0
	def __init__(self, options, queue):
		gr.top_block.__init__(self, "flex_hackrf")

		# Set up HackRF source
		self.u = osmosdr.source( args="numchan=" + str(1) + " " + "" )
		self.u.set_freq_corr(0, 0)
		self.u.set_dc_offset_mode(0, 0)
		self.u.set_iq_balance_mode(0, 0)
		self.u.set_gain_mode(False, 0)
		self.u.set_gain(0, 0)
		self.u.set_if_gain(20, 0)
		self.u.set_bb_gain(20, 0)
		self.u.set_antenna("", 0)
		self.u.set_bandwidth(0, 0)

		# Tune hackRF
		r = self.u.set_center_freq(options.freq+options.calibration, 0)
		if not r:
			frange = self.u.get_freq_range()
			sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \
								 (freq, frange.start(), frange.stop()))
			sys.exit(1)

		if options.verbose:
			print "Tuned to center frequency", (options.freq+options.calibration)/1e6, "MHz"

		# Grab >=3 MHz of spectrum, evenly divisible by 25 KHz channels
		# (A UHD facility to get sample rate range and granularity would be useful)

		self.u.set_sample_rate(3.125e6) # Works if USRP is 100 Msps and can decimate by 32
		rate = self.u.get_sample_rate()

		if rate != 3.125e6:
			self.u.set_sample_rate(3.2e6) # Works if USRP is 64 Msps and can decimate by 20
			rate = self.u.get_sample_rate()
			if (rate != 3.2e6):
				print "Unable to set required sample rate for >= 3MHz of 25 KHz channels."
				sys.exit(1)

		self.nchan = int(rate/25e3)
		if options.verbose:
			print "\nReceiving", rate/1e6, "MHz of bandwidth containing", self.nchan, "baseband channels."

		taps = filter.firdes.low_pass(1.0,1.0,1.0/self.nchan*0.4,1.0/self.nchan*0.1,filter.firdes.WIN_HANN)

		if options.verbose:
			print "Channel filter has", len(taps), "taps"

		self.bank = filter.analysis_filterbank(self.nchan, taps)
		self.connect(self.u, self.bank)

		mid_chan = int(self.nchan/2)
		for i in range(self.nchan):
			if i < mid_chan:
				freq = options.freq+i*25e3
			else:
				freq = options.freq-(self.nchan-i)*25e3

			if (freq < 929.0e6 or freq > 932.0e6):
				self.connect((self.bank, i), blocks.null_sink(gr.sizeof_gr_complex))
			else:
				self.connect((self.bank, i), pager.flex_demod(queue, freq, options.verbose))
Beispiel #22
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self, "usrp_flex")
        self.options = options
	self.offset = 0.0
	self.adj_time = time.time()
	self.verbose = options.verbose
			
	if options.from_file is None:
            # Set up USRP source with specified RX daughterboard
            self.src = usrp.source_c()
            if options.rx_subdev_spec == None:
                options.rx_subdev_spec = usrp.pick_rx_subdevice(self.src)
            self.subdev = usrp.selected_subdev(self.src, options.rx_subdev_spec)
            self.src.set_mux(usrp.determine_rx_mux_value(self.src, options.rx_subdev_spec))

            # Grab 250 KHz of spectrum (sample rate becomes 250 ksps complex)
            self.src.set_decim_rate(256)
	    	    
            # If no gain specified, set to midrange
            if options.gain is None:
                g = self.subdev.gain_range()
                options.gain = (g[0]+g[1])/2.0
            self.subdev.set_gain(options.gain)

            # Tune daughterboard
            actual_frequency = options.frequency+options.calibration
            tune_result = usrp.tune(self.src, 0, self.subdev, actual_frequency)
            if not tune_result:
                sys.stderr.write("Failed to set center frequency to "+`actual_frequency`+"\n")
                sys.exit(1)

            if options.verbose:
                print "Using RX daughterboard", self.subdev.side_and_name()
                print "USRP gain is", options.gain
                print "USRP tuned to", actual_frequency
            
        else:
            # Use supplied file as source of samples
            self.src = gr.file_source(gr.sizeof_gr_complex, options.from_file)
            if options.verbose:
                print "Reading samples from", options.from_file
	    
        if options.log and not options.from_file:
            usrp_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat')
            self.connect(self.src, usrp_sink)

        # Set up 22KHz-wide bandpass about center frequency. Decimate by 10
        # to get channel rate of 25Ksps
        taps = optfir.low_pass(1.0,   # Filter gain
                               250e3, # Sample rate
                               11000, # One-sided modulation bandwidth
                               12500, # One-sided channel bandwidth
                               0.1,   # Passband ripple
                               60)    # Stopband attenuation
	
	if options.verbose:
	    print "Channel filter has", len(taps), "taps."

        self.chan = gr.freq_xlating_fir_filter_ccf(10,    # Decimation rate
                                                   taps,  # Filter taps
                                                   0.0,   # Offset frequency
                                                   250e3) # Sample rate

	if options.log:
	    chan_sink = gr.file_sink(gr.sizeof_gr_complex, 'chan.dat')
	    self.connect(self.chan, chan_sink)

        # FLEX protocol demodulator
        self.flex = pager.flex_demod(queue, options.frequency, options.verbose, options.log)

        self.connect(self.src, self.chan, self.flex)