Exemplo n.º 1
1
	def __init__(self, options, queue):
		gr.top_block.__init__(self)

		if options.filename is not None:
			self.fs = gr.file_source(gr.sizeof_gr_complex, options.filename)
			self.rate = options.rate

		else:
			self.u = uhd.usrp_source(options.addr,
									 io_type=uhd.io_type.COMPLEX_FLOAT32,
									 num_channels=1)

			if options.subdev is not None:
				self.u.set_subdev_spec(options.subdev, 0)
				
			self.u.set_samp_rate(options.rate)
			self.rate = self.u.get_samp_rate()

			# Set the antenna
			if(options.antenna):
				self.u.set_antenna(options.antenna, 0)
			
			self.centerfreq = options.centerfreq
			print "Tuning to: %fMHz" % (self.centerfreq - options.error)
			if not(self.tune(options.centerfreq - options.error)):
				print "Failed to set initial frequency"

			if options.gain is None: #set to halfway
				g = self.u.get_gain_range()
				options.gain = (g.start()+g.stop()) / 2.0

			print "Setting gain to %i" % options.gain
			self.u.set_gain(options.gain)

			self.u.set_bandwidth(options.bandwidth)

		print "Samples per second is %i" % self.rate

		self._syms_per_sec = 3600;


		options.samples_per_second = self.rate
		options.syms_per_sec = self._syms_per_sec
		options.gain_mu = 0.01
		options.mu=0.5
		options.omega_relative_limit = 0.3
		options.syms_per_sec = self._syms_per_sec
		options.offset = options.centerfreq - options.freq
		print "Control channel offset: %f" % options.offset

		self.demod = fsk_demod(options)
		self.start_correlator = gr.correlate_access_code_tag_bb("10101100",
		                                                        0,
		                                                        "smartnet_preamble") #should mark start of packet
		self.smartnet_deinterleave = smartnet.deinterleave()
		self.smartnet_crc = smartnet.crc(queue)

		if options.filename is None:
			self.connect(self.u, self.demod)
		else:
			self.connect(self.fs, self.demod)

		self.connect(self.demod, self.start_correlator, self.smartnet_deinterleave, self.smartnet_crc)

		#hook up the audio patch
		if options.audio:
			self.audiorate = 48000
			self.audiotaps = gr.firdes.low_pass(1, self.rate, 8000, 2000, gr.firdes.WIN_HANN)
			self.prefilter_decim = int(self.rate / self.audiorate) #might have to use a rational resampler for audio
			print "Prefilter decimation: %i" % self.prefilter_decim
			self.audio_prefilter = gr.freq_xlating_fir_filter_ccf(self.prefilter_decim, #decimation
									      self.audiotaps, #taps
									      0, #freq offset
									      self.rate) #sampling rate

			#on a trunked network where you know you will have good signal, a carrier power squelch works well. real FM receviers use a noise squelch, where
			#the received audio is high-passed above the cutoff and then fed to a reverse squelch. If the power is then BELOW a threshold, open the squelch.
			self.squelch = gr.pwr_squelch_cc(options.squelch, #squelch point
											   alpha = 0.1, #wat
											   ramp = 10, #wat
											   gate = False)

			self.audiodemod = blks2.fm_demod_cf(self.rate/self.prefilter_decim, #rate
							    1, #audio decimation
							    4000, #deviation
							    3000, #audio passband
							    4000, #audio stopband
							    1, #gain
							    75e-6) #deemphasis constant

			#the filtering removes FSK data woobling from the subaudible channel (might be able to combine w/lpf above)
			self.audiofilttaps = gr.firdes.high_pass(1, self.audiorate, 300, 50, gr.firdes.WIN_HANN)
			self.audiofilt = gr.fir_filter_fff(1, self.audiofilttaps)
			self.audiogain = gr.multiply_const_ff(options.volume)
			self.audiosink = audio.sink (self.audiorate, "")
#			self.audiosink = gr.wavfile_sink("test.wav", 1, self.audiorate, 8)

			self.mute()

			if options.filename is None:
				self.connect(self.u, self.audio_prefilter)
			else:
				self.connect(self.fs, self.audio_prefilter)

#			self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audioresamp, self.audiosink)
			self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audiosink)
	def __init__(self, options, queue):
		gr.top_block.__init__(self)

		self.u = uhd.usrp_source(options.addr,
								 io_type=uhd.io_type.COMPLEX_FLOAT32,
								 num_channels=1)

		if options.subdev is not None:
			self.u.set_subdev_spec(options.subdev, 0)
		self.u.set_samp_rate(options.rate)
		self.rate = self.u.get_samp_rate()

		# Set the antenna
		if(options.antenna):
			self.u.set_antenna(options.antenna, 0)
		
		self.centerfreq = options.centerfreq
		print "Tuning to: %fMHz" % (self.centerfreq - options.error)
		if not(self.tune(options.centerfreq - options.error)):
			print "Failed to set initial frequency"

		if options.gain is None: #set to halfway
			g = self.u.get_gain_range()
			options.gain = (g.start()+g.stop()) / 2.0

		print "Setting gain to %i" % options.gain
		self.u.set_gain(options.gain)

		self.u.set_bandwidth(options.bandwidth)
		
		print "Samples per second is %i" % self.rate

		self._syms_per_sec = 3600;

		options.audiorate = 11025
		options.rate = self.rate

		options.samples_per_second = self.rate #yeah i know it's on the list
		options.syms_per_sec = self._syms_per_sec
		options.gain_mu = 0.01
		options.mu=0.5
		options.omega_relative_limit = 0.3
		options.syms_per_sec = self._syms_per_sec
		options.offset = options.centerfreq - options.freq
		print "Control channel offset: %f" % options.offset

		self.demod = fsk_demod(options)
		self.start_correlator = digital.correlate_access_code_bb("10101100",0) #should mark start of packet
		self.smartnet_sync = smartnet.sync()
		self.smartnet_deinterleave = smartnet.deinterleave()
		self.smartnet_parity = smartnet.parity()
		self.smartnet_crc = smartnet.crc()
		self.smartnet_packetize = smartnet.packetize()
		self.parse = smartnet.parse(queue) #packet-based. this simply posts lightly-formatted messages to the queue.

		self.connect(self.u, self.demod)

		self.connect(self.demod, self.start_correlator, self.smartnet_sync, self.smartnet_deinterleave, self.smartnet_parity, self.smartnet_crc, self.smartnet_packetize, self.parse)
Exemplo n.º 3
0
	def __init__(self, options, queue):
		gr.top_block.__init__(self)

		self.u = usrp.source_c()
		self.u.set_mux(usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))
		self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
		print "Using RX d'board %s" % self.subdev.side_and_name()
		self.u.set_decim_rate(options.decim)
		self.centerfreq = options.centerfreq
		print "Tuning to: %fMHz" % (self.centerfreq - options.error)
		if not(self.tune(options.centerfreq - options.error)):
			print "Failed to set initial frequency"
	
		if options.gain is None: #set to halfway
			g = self.subdev.gain_range()
			options.gain = (g[0]+g[1]) / 2.0

		print "Setting gain to %i" % options.gain
		self.subdev.set_gain(options.gain)

		if self.subdev.name() == "DBS Rx":
			self.subdev.set_bw(options.bandwidth) #only for DBSRX
			print "Setting DBS RX bandwidth to %fMHz" % float(options.bandwidth / 1e6)

		self.rate = self.u.adc_rate() / options.decim
		
		print "Samples per second is %i" % self.rate

		self._syms_per_sec = 3600;

		options.audiorate = 11025
		options.rate = self.rate

		options.samples_per_second = self.rate #yeah i know it's on the list
		options.syms_per_sec = self._syms_per_sec
		options.gain_mu = 0.01
		options.mu=0.5
		options.omega_relative_limit = 0.3
		options.syms_per_sec = self._syms_per_sec
		options.offset = options.centerfreq - options.freq
		print "Control channel offset: %f" % options.offset

		self.demod = fsk_demod(options)
		self.start_correlator = gr.correlate_access_code_bb("10101100",0) #should mark start of packet
		self.smartnet_sync = smartnet.sync()
		self.smartnet_deinterleave = smartnet.deinterleave()
		self.smartnet_parity = smartnet.parity()
		self.smartnet_crc = smartnet.crc()
		self.smartnet_packetize = smartnet.packetize()
		self.parse = smartnet.parse(queue) #packet-based. this simply posts lightly-formatted messages to the queue.

		self.connect(self.u, self.demod)

		self.connect(self.demod, self.start_correlator, self.smartnet_sync, self.smartnet_deinterleave, self.smartnet_parity, self.smartnet_crc, self.smartnet_packetize, self.parse)
Exemplo n.º 4
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self)

        self.u = usrp.source_c()
        self.u.set_mux(
            usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))
        self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
        print "Using RX d'board %s" % self.subdev.side_and_name()
        self.u.set_decim_rate(options.decim)
        self.centerfreq = options.centerfreq
        print "Tuning to: %fMHz" % (self.centerfreq - options.error)
        if not (self.tune(options.centerfreq - options.error)):
            print "Failed to set initial frequency"

        if options.gain is None:  #set to halfway
            g = self.subdev.gain_range()
            options.gain = (g[0] + g[1]) / 2.0

        print "Setting gain to %i" % options.gain
        self.subdev.set_gain(options.gain)

        if self.subdev.name() == "DBS Rx":
            self.subdev.set_bw(options.bandwidth)  #only for DBSRX
            print "Setting DBS RX bandwidth to %fMHz" % float(
                options.bandwidth / 1e6)

        self.rate = self.u.adc_rate() / options.decim

        print "Samples per second is %i" % self.rate

        self._syms_per_sec = 3600

        options.audiorate = 11025
        options.rate = self.rate

        options.samples_per_second = self.rate  #yeah i know it's on the list
        options.syms_per_sec = self._syms_per_sec
        options.gain_mu = 0.01
        options.mu = 0.5
        options.omega_relative_limit = 0.3
        options.syms_per_sec = self._syms_per_sec
        options.offset = options.centerfreq - options.freq
        print "Control channel offset: %f" % options.offset

        self.demod = fsk_demod(options)
        self.start_correlator = gr.correlate_access_code_bb(
            "10101100", 0)  #should mark start of packet
        self.smartnet_sync = smartnet.sync()
        self.smartnet_deinterleave = smartnet.deinterleave()
        self.smartnet_parity = smartnet.parity()
        self.smartnet_crc = smartnet.crc()
        self.smartnet_packetize = smartnet.packetize()
        self.parse = smartnet.parse(
            queue
        )  #packet-based. this simply posts lightly-formatted messages to the queue.

        self.connect(self.u, self.demod)

        self.connect(self.demod, self.start_correlator, self.smartnet_sync,
                     self.smartnet_deinterleave, self.smartnet_parity,
                     self.smartnet_crc, self.smartnet_packetize, self.parse)
    def __init__(self, options, queue):
        gr.top_block.__init__(self)

        if options.filename is not None:
            self.fs = gr.file_source(gr.sizeof_gr_complex, options.filename)
            self.rate = options.rate

        else:
            self.u = uhd.usrp_source(options.addr,
                                     io_type=uhd.io_type.COMPLEX_FLOAT32,
                                     num_channels=1)

            if options.subdev is not None:
                self.u.set_subdev_spec(options.subdev, 0)

            self.u.set_samp_rate(options.rate)
            self.rate = self.u.get_samp_rate()

            # Set the antenna
            if (options.antenna):
                self.u.set_antenna(options.antenna, 0)

            self.centerfreq = options.centerfreq
            print "Tuning to: %fMHz" % (self.centerfreq - options.error)
            if not (self.tune(options.centerfreq - options.error)):
                print "Failed to set initial frequency"

            if options.gain is None:  #set to halfway
                g = self.u.get_gain_range()
                options.gain = (g.start() + g.stop()) / 2.0

            print "Setting gain to %i" % options.gain
            self.u.set_gain(options.gain)

            self.u.set_bandwidth(options.bandwidth)

        print "Samples per second is %i" % self.rate

        self._syms_per_sec = 3600

        options.samples_per_second = self.rate
        options.syms_per_sec = self._syms_per_sec
        options.gain_mu = 0.01
        options.mu = 0.5
        options.omega_relative_limit = 0.3
        options.syms_per_sec = self._syms_per_sec
        options.offset = options.centerfreq - options.freq
        print "Control channel offset: %f" % options.offset

        self.demod = fsk_demod(options)
        self.start_correlator = gr.correlate_access_code_tag_bb(
            "10101100", 0, "smartnet_preamble")  #should mark start of packet
        self.smartnet_deinterleave = smartnet.deinterleave()
        self.smartnet_crc = smartnet.crc(queue)

        if options.filename is None:
            self.connect(self.u, self.demod)
        else:
            self.connect(self.fs, self.demod)

        self.connect(self.demod, self.start_correlator,
                     self.smartnet_deinterleave, self.smartnet_crc)

        #hook up the audio patch
        if options.audio:
            self.audiorate = 48000
            self.audiotaps = gr.firdes.low_pass(1, self.rate, 8000, 2000,
                                                gr.firdes.WIN_HANN)
            self.prefilter_decim = int(
                self.rate / self.audiorate
            )  #might have to use a rational resampler for audio
            print "Prefilter decimation: %i" % self.prefilter_decim
            self.audio_prefilter = gr.freq_xlating_fir_filter_ccf(
                self.prefilter_decim,  #decimation
                self.audiotaps,  #taps
                0,  #freq offset
                self.rate)  #sampling rate

            #on a trunked network where you know you will have good signal, a carrier power squelch works well. real FM receviers use a noise squelch, where
            #the received audio is high-passed above the cutoff and then fed to a reverse squelch. If the power is then BELOW a threshold, open the squelch.
            self.squelch = gr.pwr_squelch_cc(
                options.squelch,  #squelch point
                alpha=0.1,  #wat
                ramp=10,  #wat
                gate=False)

            self.audiodemod = blks2.fm_demod_cf(
                self.rate / self.prefilter_decim,  #rate
                1,  #audio decimation
                4000,  #deviation
                3000,  #audio passband
                4000,  #audio stopband
                1,  #gain
                75e-6)  #deemphasis constant

            #the filtering removes FSK data woobling from the subaudible channel (might be able to combine w/lpf above)
            self.audiofilttaps = gr.firdes.high_pass(1, self.audiorate, 300,
                                                     50, gr.firdes.WIN_HANN)
            self.audiofilt = gr.fir_filter_fff(1, self.audiofilttaps)
            self.audiogain = gr.multiply_const_ff(options.volume)
            self.audiosink = audio.sink(self.audiorate, "")
            #			self.audiosink = gr.wavfile_sink("test.wav", 1, self.audiorate, 8)

            self.mute()

            if options.filename is None:
                self.connect(self.u, self.audio_prefilter)
            else:
                self.connect(self.fs, self.audio_prefilter)

#			self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audioresamp, self.audiosink)
            self.connect(self.audio_prefilter, self.squelch, self.audiodemod,
                         self.audiofilt, self.audiogain, self.audiosink)
    def __init__(self, options, queue):
        gr.top_block.__init__(self)

        if options.filename is not None:
            self.fs = gr.file_source(gr.sizeof_gr_complex, options.filename)
            self.rate = options.rate

        else:
            #self.u = uhd.usrp_source(options.addr,
            #						 io_type=uhd.io_type.COMPLEX_FLOAT32,
            #						 num_channels=1)

            self.rtl = osmosdr.source_c(args="nchan=" + str(1) + " " + "")
            self.rtl.set_sample_rate(options.rate)
            self.rate = options.rate  #self.rtl.get_samp_rate()
            self.rtl.set_center_freq(options.centerfreq, 0)
            #self.rtl.set_freq_corr(options.ppm, 0)

            self.centerfreq = options.centerfreq
            print "Tuning to: %fMHz" % (self.centerfreq - options.error)
            if not (self.tune(options.centerfreq - options.error)):
                print "Failed to set initial frequency"

            if options.gain is None:
                options.gain = 10
            if options.bbgain is None:
                options.bbgain = 25
            if options.ifgain is None:
                options.ifgain = 25

            print "Setting RF gain to %i" % options.gain
            print "Setting BB gain to %i" % options.bbgain
            print "Setting IF gain to %i" % options.ifgain

            self.rtl.set_gain(options.gain, 0)
            self.rtl.set_if_gain(options.ifgain, 0)
            self.rtl.set_bb_gain(options.bbgain, 0)
            #self.rtl.set_gain_mode(1,0)

        print "Samples per second is %i" % self.rate

        self._syms_per_sec = 3600

        options.samples_per_second = self.rate
        options.syms_per_sec = self._syms_per_sec
        options.gain_mu = 0.01
        options.mu = 0.5
        options.omega_relative_limit = 0.3
        options.syms_per_sec = self._syms_per_sec
        options.offset = options.centerfreq - options.freq
        print "Control channel offset: %f" % options.offset

        self.offset = gr.sig_source_c(self.rate, gr.GR_SIN_WAVE,
                                      options.offset, 1.0, 0.0)

        # for some reason using the xlating filter to do the offset makes thing barf with the HackRF, Multiply CC seems to work

        options.offset = 0

        self.mixer = gr.multiply_cc()

        self.demod = fsk_demod(options)
        self.start_correlator = gr.correlate_access_code_tag_bb(
            "10101100", 0, "smartnet_preamble")  #should mark start of packet
        self.smartnet_deinterleave = smartnet.deinterleave()
        self.smartnet_crc = smartnet.crc(queue)

        #rerate = float(self.rate / float(first_decim)) / float(7200)
        #print "resampling factor: %f\n" % rerate

        #if rerate.is_integer():
        #    print "using pfb decimator\n"
        #    self.resamp = blks2.pfb_decimator_ccf(int(rerate))
        #else:
        #    print "using pfb resampler\n"
        #    self.resamp = blks2.pfb_arb_resampler_ccf(1 / rerate)

        if options.filename is None:
            #self.connect(self.u, self.demod)
            self.connect(self.rtl, (self.mixer, 0))
            self.connect(self.offset, (self.mixer, 1))
            self.connect(self.mixer, self.demod)
            #    self.connect(self.rtl, self.demod)
        else:
            self.connect(self.fs, self.demod)

        self.connect(self.demod, self.start_correlator,
                     self.smartnet_deinterleave, self.smartnet_crc)

        #hook up the audio patch
        if options.audio:
            self.audiorate = 48000
            self.audiotaps = gr.firdes.low_pass(1, self.rate, 8000, 2000,
                                                gr.firdes.WIN_HANN)
            self.prefilter_decim = int(
                self.rate / self.audiorate
            )  #might have to use a rational resampler for audio
            print "Prefilter decimation: %i" % self.prefilter_decim
            self.audio_prefilter = gr.freq_xlating_fir_filter_ccf(
                self.prefilter_decim,  #decimation
                self.audiotaps,  #taps
                0,  #freq offset
                self.rate)  #sampling rate

            #on a trunked network where you know you will have good signal, a carrier power squelch works well. real FM receviers use a noise squelch, where
            #the received audio is high-passed above the cutoff and then fed to a reverse squelch. If the power is then BELOW a threshold, open the squelch.
            #self.squelch = gr.pwr_squelch_cc(options.squelch, #squelch point
            #								   alpha = 0.1, #wat
            #								   ramp = 10, #wat
            #								   gate = False)

            self.audiodemod = blks2.fm_demod_cf(
                self.rate / self.prefilter_decim,  #rate
                1,  #audio decimation
                4000,  #deviation
                3000,  #audio passband
                4000,  #audio stopband
                1,  #gain
                75e-6)  #deemphasis constant

            #the filtering removes FSK data woobling from the subaudible channel (might be able to combine w/lpf above)
            self.audiofilttaps = gr.firdes.high_pass(1, self.audiorate, 300,
                                                     50, gr.firdes.WIN_HANN)
            self.audiofilt = gr.fir_filter_fff(1, self.audiofilttaps)
            self.audiogain = gr.multiply_const_ff(options.volume)
            self.audiosink = audio.sink(self.audiorate, "")
            #			self.audiosink = gr.wavfile_sink("test.wav", 1, self.audiorate, 8)

            #self.mute()

            if options.filename is None:
                #self.connect(self.u, self.audio_prefilter)
                self.connect(self.rtl, self.audio_prefilter)
            else:
                self.connect(self.fs, self.audio_prefilter)

#			self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audioresamp, self.audiosink)
#	real		self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audiosink)
            self.connect(self.audio_prefilter, self.audiodemod, self.audiofilt,
                         self.audiogain, self.audiosink)
	def __init__(self, options, queue):
		gr.top_block.__init__(self)

		if options.filename is not None:
			self.fs = gr.file_source(gr.sizeof_gr_complex, options.filename)
			self.rate = options.rate

		else:
			#self.u = uhd.usrp_source(options.addr,
			#						 io_type=uhd.io_type.COMPLEX_FLOAT32,
			#						 num_channels=1)

                    
                    self.rtl = osmosdr.source_c( args="nchan=" + str(1) + " " + ""  )
                    self.rtl.set_sample_rate(options.rate)
                    self.rate = options.rate #self.rtl.get_samp_rate()
                    self.rtl.set_center_freq(options.centerfreq, 0)
                    #self.rtl.set_freq_corr(options.ppm, 0)
                    
		
                    self.centerfreq = options.centerfreq
                    print "Tuning to: %fMHz" % (self.centerfreq - options.error)
                    if not(self.tune(options.centerfreq - options.error)):
			print "Failed to set initial frequency"

                    if options.gain is None: 
			options.gain = 10
                    if options.bbgain is None: 
			options.bbgain = 25
                    if options.ifgain is None: 
			options.ifgain = 25


                    print "Setting RF gain to %i" % options.gain
                    print "Setting BB gain to %i" % options.bbgain
                    print "Setting IF gain to %i" % options.ifgain

                    self.rtl.set_gain(options.gain, 0) 
                    self.rtl.set_if_gain(options.ifgain,0)
                    self.rtl.set_bb_gain(options.bbgain,0)
                    #self.rtl.set_gain_mode(1,0)

		print "Samples per second is %i" % self.rate

		self._syms_per_sec = 3600;


		options.samples_per_second = self.rate
		options.syms_per_sec = self._syms_per_sec
		options.gain_mu = 0.01
		options.mu=0.5
		options.omega_relative_limit = 0.3
		options.syms_per_sec = self._syms_per_sec
		options.offset = options.centerfreq - options.freq
		print "Control channel offset: %f" % options.offset

                self.offset = gr.sig_source_c(self.rate, gr.GR_SIN_WAVE,
                                              options.offset, 1.0, 0.0)
		
		# for some reason using the xlating filter to do the offset makes thing barf with the HackRF, Multiply CC seems to work

		options.offset = 0

                self.mixer = gr.multiply_cc()

		self.demod = fsk_demod(options)
		self.start_correlator = gr.correlate_access_code_tag_bb("10101100",
		                                                        0,
		                                                        "smartnet_preamble") #should mark start of packet
		self.smartnet_deinterleave = smartnet.deinterleave()
		self.smartnet_crc = smartnet.crc(queue)

                #rerate = float(self.rate / float(first_decim)) / float(7200)
                #print "resampling factor: %f\n" % rerate
                
                #if rerate.is_integer():
                #    print "using pfb decimator\n"
                #    self.resamp = blks2.pfb_decimator_ccf(int(rerate))
                #else:
                #    print "using pfb resampler\n"
                #    self.resamp = blks2.pfb_arb_resampler_ccf(1 / rerate)

		if options.filename is None:
			#self.connect(self.u, self.demod)
                    self.connect(self.rtl, (self.mixer, 0))
                    self.connect(self.offset, (self.mixer, 1))                    
                    self.connect(self.mixer, self.demod)
                    #    self.connect(self.rtl, self.demod)
		else:
			self.connect(self.fs, self.demod)

		self.connect(self.demod, self.start_correlator, self.smartnet_deinterleave, self.smartnet_crc)

		#hook up the audio patch
		if options.audio:
			self.audiorate = 48000
			self.audiotaps = gr.firdes.low_pass(1, self.rate, 8000, 2000, gr.firdes.WIN_HANN)
			self.prefilter_decim = int(self.rate / self.audiorate) #might have to use a rational resampler for audio
			print "Prefilter decimation: %i" % self.prefilter_decim
			self.audio_prefilter = gr.freq_xlating_fir_filter_ccf(self.prefilter_decim, #decimation
									      self.audiotaps, #taps
									      0, #freq offset
									      self.rate) #sampling rate

			#on a trunked network where you know you will have good signal, a carrier power squelch works well. real FM receviers use a noise squelch, where
			#the received audio is high-passed above the cutoff and then fed to a reverse squelch. If the power is then BELOW a threshold, open the squelch.
			#self.squelch = gr.pwr_squelch_cc(options.squelch, #squelch point
			#								   alpha = 0.1, #wat
			#								   ramp = 10, #wat
			#								   gate = False)

			self.audiodemod = blks2.fm_demod_cf(self.rate/self.prefilter_decim, #rate
							    1, #audio decimation
							    4000, #deviation
							    3000, #audio passband
							    4000, #audio stopband
							    1, #gain
							    75e-6) #deemphasis constant

			#the filtering removes FSK data woobling from the subaudible channel (might be able to combine w/lpf above)
			self.audiofilttaps = gr.firdes.high_pass(1, self.audiorate, 300, 50, gr.firdes.WIN_HANN)
			self.audiofilt = gr.fir_filter_fff(1, self.audiofilttaps)
			self.audiogain = gr.multiply_const_ff(options.volume)
			self.audiosink = audio.sink (self.audiorate, "")
#			self.audiosink = gr.wavfile_sink("test.wav", 1, self.audiorate, 8)

			#self.mute()

			if options.filename is None:
				#self.connect(self.u, self.audio_prefilter)
                                self.connect(self.rtl, self.audio_prefilter)
			else:
				self.connect(self.fs, self.audio_prefilter)

#			self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audioresamp, self.audiosink)
#	real		self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audiosink)
			self.connect(self.audio_prefilter, self.audiodemod, self.audiofilt, self.audiogain, self.audiosink)
Exemplo n.º 8
0
    def __init__(self):
        gr.top_block.__init__(self, "Aprs Decode Test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Aprs Decode Test")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "aprs_decode_test")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            512,  #size
            samp_rate,  #samp_rate
            "",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

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

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

        if not False:
            self.qtgui_time_sink_x_1.disable_legend()

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

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

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

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

        if not False:
            self.qtgui_time_sink_x_0.disable_legend()

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

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

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.fsk_demod_0 = fsk_demod(
            baud=1200,
            fsk_hi_tone=2200,
            fsk_lo_tone=1200,
            in_sps=40,
            out_sps=2,
        )
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            2 * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/handiko/aprs_test.wav', True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   'aprs_bytes.txt', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((48, ))
        self.audio_sink_0 = audio.sink(samp_rate, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_1, 1))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.fsk_demod_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.qtgui_time_sink_x_1, 0))
        self.connect((self.fsk_demod_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.fsk_demod_0, 0), (self.qtgui_time_sink_x_0, 0))
Exemplo n.º 9
0
    def __init__(self, options, queue):
        gr.top_block.__init__(self)

        if options.filename is not None:
            self.fs = block.file_source(gr.sizeof_gr_complex, options.filename)
            self.rate = options.rate

        else:
            try:
                import osmosdr
                self.u = osmosdr.source(options.args)
            except Exception:
                sys.stderr.write("osmosdr source_c creation failure\n")
                sys.exit(1)

            if options.gains:
                for tup in options.gains.split(","):
                    name, gain = tup.split(":")
                    gain = int(gain)
                    sys.stderr.write("setting gain %s to %d\n" % (name, gain))
                    self.u.set_gain(gain, name)

            self.rate = self.u.set_sample_rate(options.rate)
            self.u.set_bandwidth(self.rate)

            if options.freq_corr:
                self.u.set_freq_corr(options.freq_corr)

            # Set the antenna
            if (options.antenna):
                self.u.set_antenna(options.antenna, 0)

            self.centerfreq = options.centerfreq
            print "Tuning to: %fMHz" % (self.centerfreq - options.error)
            if not (self.tune(options.centerfreq - options.error)):
                print "Failed to set initial frequency"

        print "Samples per second is %i" % self.rate

        self._syms_per_sec = 3600

        options.samples_per_second = self.rate
        options.syms_per_sec = self._syms_per_sec
        options.gain_mu = 0.01
        options.mu = 0.5
        options.omega_relative_limit = 0.3
        options.syms_per_sec = self._syms_per_sec
        options.offset = options.centerfreq - options.freq
        print "Control channel offset: %f" % options.offset

        self.demod = fsk_demod(options)
        self.start_correlator = digital.correlate_access_code_tag_bb(
            "10101100", 0, "smartnet_preamble")  #should mark start of packet
        self.smartnet_deinterleave = smartnet.deinterleave()
        self.smartnet_crc = smartnet.crc(queue)

        if options.filename is None:
            self.connect(self.u, self.demod)
        else:
            self.connect(self.fs, self.demod)

        self.connect(self.demod, self.start_correlator,
                     self.smartnet_deinterleave, self.smartnet_crc)

        #hook up the audio patch
        if options.audio:
            self.audiorate = 48000
            self.audiotaps = filter.firdes.low_pass(1, self.rate, 8000, 2000,
                                                    filter.firdes.WIN_HANN)
            self.prefilter_decim = int(
                self.rate / self.audiorate
            )  #might have to use a rational resampler for audio
            print "Prefilter decimation: %i" % self.prefilter_decim
            self.audio_prefilter = filter.freq_xlating_fir_filter_ccf(
                self.prefilter_decim,  #decimation
                self.audiotaps,  #taps
                0,  #freq offset
                self.rate)  #sampling rate

            #on a trunked network where you know you will have good signal, a carrier power squelch works well. real FM receviers use a noise squelch, where
            #the received audio is high-passed above the cutoff and then fed to a reverse squelch. If the power is then BELOW a threshold, open the squelch.
            self.squelch = analog.pwr_squelch_cc(
                options.squelch,  #squelch point
                alpha=0.1,  #wat
                ramp=10,  #wat
                gate=False)

            self.audiodemod = blks2.fm_demod_cf(
                self.rate / self.prefilter_decim,  #rate
                1,  #audio decimation
                4000,  #deviation
                3000,  #audio passband
                4000,  #audio stopband
                1,  #gain
                75e-6)  #deemphasis constant

            #the filtering removes FSK data woobling from the subaudible channel (might be able to combine w/lpf above)
            self.audiofilttaps = filter.firdes.high_pass(
                1, self.audiorate, 300, 50, filter.firdes.WIN_HANN)
            self.audiofilt = filter.fir_filter_fff(1, self.audiofilttaps)
            self.audiogain = blocks.multiply_const_ff(options.volume)
            self.audiosink = audio.sink(self.audiorate, "")
            #           self.audiosink = smartnet.wavfile_sink("test.wav", 1, self.audiorate, 8)

            self.mute()

            if options.filename is None:
                self.connect(self.u, self.audio_prefilter)
            else:
                self.connect(self.fs, self.audio_prefilter)

#           self.connect(self.audio_prefilter, self.squelch, self.audiodemod, self.audiofilt, self.audiogain, self.audioresamp, self.audiosink)
            self.connect(self.audio_prefilter, self.squelch, self.audiodemod,
                         self.audiofilt, self.audiogain, self.audiosink)
	def __init__(self, options, queue):
		gr.top_block.__init__(self)
                
                
		self.rtl = osmosdr.source_c( args="nchan=" + str(1) + " " + ""  )
		self.rtl.set_sample_rate(options.rate)
		self.rtl.set_center_freq(options.centerfreq, 0)
		self.rtl.set_freq_corr(options.ppm, 0)
		self.rtl.set_gain_mode(1, 0)
		
		self.centerfreq = options.centerfreq
		print "Tuning to: %fMHz" % (self.centerfreq - options.error)
		if not(self.tune(options.centerfreq - options.error)):
			print "Failed to set initial frequency"

		if options.gain is None: 
			options.gain = 10
		if options.bbgain is None: 
			options.bbgain = 25
		if options.ifgain is None: 
			options.ifgain = 25


		print "Setting RF gain to %i" % options.gain
		print "Setting BB gain to %i" % options.bbgain
		print "Setting IF gain to %i" % options.ifgain

		self.rtl.set_gain(options.gain, 0) 
		self.rtl.set_if_gain(options.ifgain,0)
		self.rtl.set_bb_gain(options.bbgain,0)
		
                self.rate = options.rate
		
		print "Samples per second is %i" % self.rate

		self._syms_per_sec = 3600;

		options.audiorate = 11025
		options.rate = self.rate

		options.samples_per_second = self.rate #yeah i know it's on the list
		options.syms_per_sec = self._syms_per_sec
		options.gain_mu = 0.01
		options.mu=0.5
		options.omega_relative_limit = 0.3
		options.syms_per_sec = self._syms_per_sec
		options.offset = options.centerfreq - options.freq
		print "Control channel offset: %f" % options.offset


                self.offset = gr.sig_source_c(self.rate, gr.GR_SIN_WAVE,
                                              options.offset, 1.0, 0.0)
		
		# for some reason using the xlating filter to do the offset makes thing barf with the HackRF, Multiply CC seems to work

		options.offset = 0

                self.mixer = gr.multiply_cc()

		self.demod = fsk_demod(options)

		self.start_correlator = gr.correlate_access_code_tag_bb("10101100",
                                                            0,
                                                            "smartnet_preamble") #should mark start of packet



		self.smartnet_deinterleave = smartnet.deinterleave()
		self.smartnet_crc = smartnet.crc(queue)

		
                self.connect(self.rtl, (self.mixer, 0))
                self.connect(self.offset, (self.mixer, 1))                    
                self.connect(self.mixer, self.demod)

		self.connect(self.demod, self.start_correlator, self.smartnet_deinterleave, self.smartnet_crc)
Exemplo n.º 11
0
    def __init__(self):
        gr.top_block.__init__(self, "Aprs Regenerate")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Aprs Regenerate")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "aprs_regenerate")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48e3

        ##################################################
        # Blocks
        ##################################################
        self.show_text_0 = display.show_text()
        self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._show_text_0_win)
        self.satellites_nrzi_encode_0 = satellites.nrzi_encode()
        self.satellites_nrzi_decode_0 = satellites.nrzi_decode()
        self.satellites_hdlc_framer_0 = satellites.hdlc_framer(preamble_bytes=80, postamble_bytes=4)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate/40, #samp_rate
        	"", #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-4.5, 4.5)
        
        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [2, 0, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, 0, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.fsk_demod_0 = fsk_demod(
            baud=1200,
            fsk_hi_tone=2200,
            fsk_lo_tone=1200,
            in_sps=40,
            out_sps=2,
        )
        self.epy_block_0 = epy_block_0.blk()
        self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(2*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf((1200,2200), 1)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_wavfile_source_0 = blocks.wavfile_source('/home/handiko/aprs_regenerate.wav', True)
        self.blocks_vco_f_0 = blocks.vco_f(48000, 2*math.pi, 0.1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char*1, 40)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len')
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.afsk_afsk1200_0 = afsk.afsk1200(48000,4)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.epy_block_0, 'in'))    
        self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.satellites_hdlc_framer_0, 'in'))    
        self.msg_connect((self.epy_block_0, 'out'), (self.blocks_socket_pdu_0, 'pdus'))    
        self.msg_connect((self.satellites_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus'))    
        self.connect((self.afsk_afsk1200_0, 0), (self.show_text_0, 0))    
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.satellites_nrzi_encode_0, 0))    
        self.connect((self.blocks_repeat_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.fsk_demod_0, 0))    
        self.connect((self.blocks_vco_f_0, 0), (self.afsk_afsk1200_0, 0))    
        self.connect((self.blocks_vco_f_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.satellites_nrzi_decode_0, 0))    
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_vco_f_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 1))    
        self.connect((self.fsk_demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))    
        self.connect((self.satellites_nrzi_decode_0, 0), (self.digital_hdlc_deframer_bp_0, 0))    
        self.connect((self.satellites_nrzi_encode_0, 0), (self.blocks_repeat_0, 0))    
Exemplo n.º 12
0
    def __init__(self):
        gr.top_block.__init__(self, "Tlm Rec")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Tlm Rec")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "tlm_rec")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.audio_rate = audio_rate = 48e3
        self.sps = sps = int(audio_rate / 1200)
        self.samp_rate = samp_rate = 300e3
        self.mm_sps = mm_sps = 2
        self.gain_mu = gain_mu = 0.9

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=int(audio_rate),
            decimation=int(samp_rate),
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
            8192,  #size
            24000,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1)

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

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

        if not True:
            self.qtgui_time_sink_x_0_0_0.disable_legend()

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

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

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            1200,  #samp_rate
            "",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

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

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

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

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

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

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.fsk_demod_0 = fsk_demod(
            baud=1200,
            fsk_hi_tone=2300,
            fsk_lo_tone=1200,
            in_sps=sps,
            out_sps=mm_sps,
        )
        self.fft_filter_xxx_1 = filter.fft_filter_fff(1, (firdes.band_pass(
            0.2, audio_rate, 900, 2500, 500, firdes.WIN_BLACKMAN)), 1)
        self.fft_filter_xxx_1.declare_sample_delay(0)
        self.fft_filter_xxx_0 = filter.fft_filter_ccc(
            1, (firdes.low_pass(1, samp_rate, audio_rate / 2, audio_rate / 4,
                                firdes.WIN_BLACKMAN)), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            mm_sps * (1 + 0.0), 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=4e-6,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0 + 1.0j, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_rotator_cc_0 = blocks.rotator_cc(-(-16.2e3 / samp_rate) *
                                                     2 * math.pi)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/handiko/gqrx_20180319_072938_433268400_300000_fc.raw',
            False)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(
            audio_rate / (2 * math.pi * 24e3 / 8.0))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.fft_filter_xxx_1, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_rotator_cc_0, 0))
        self.connect((self.blocks_rotator_cc_0, 0), (self.fft_filter_xxx_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.fft_filter_xxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.fft_filter_xxx_1, 0), (self.audio_sink_0, 0))
        self.connect((self.fft_filter_xxx_1, 0), (self.fsk_demod_0, 0))
        self.connect((self.fsk_demod_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.fsk_demod_0, 0), (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.channels_channel_model_0, 0))
Exemplo n.º 13
0
    def __init__(self):
        gr.top_block.__init__(self, "APRS Symbol Recovery")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("APRS Symbol Recovery")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "aprs_symbol_recov")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.ch_rate = ch_rate = 48e3
        self.bb_rate = bb_rate = 192e3
        self.afsk_spec = afsk_spec = [1200, 1200, 2200]
        self.thresh = thresh = -50*2
        self.samp_rate = samp_rate = 2.88e6
        self.rfgain = rfgain = 10
        self.out_sps = out_sps = 2
        self.in_sps = in_sps = int(ch_rate) / afsk_spec[0]
        self.gain_mu = gain_mu = 0.175
        self.freq = freq = 144.39e6
        self.dev_ppm = dev_ppm = 52
        self.bb_decim = bb_decim = int(bb_rate)/int(ch_rate)
        self.afgain = afgain = -7

        ##################################################
        # Blocks
        ##################################################
        self._rfgain_range = Range(0, 49, 1, 10, 100)
        self._rfgain_win = RangeWidget(self._rfgain_range, self.set_rfgain, 'RF Gain (dB)', "counter_slider", float)
        self.top_grid_layout.addWidget(self._rfgain_win, 3,0,1,1)
        self.show_text_2 = display.show_text()
        self._show_text_2_win = sip.wrapinstance(self.show_text_2.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._show_text_2_win, 2,2,2,1)
        self.show_text_0 = display.show_text()
        self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._show_text_0_win, 2,0,1,2)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	4096, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	192e3, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(False)
        
        if not False:
          self.qtgui_waterfall_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [6, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])
        
        self.qtgui_waterfall_sink_x_0.set_intensity_range(-105, -20)
        
        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 0,2,1,1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	1200, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-4.2, 4.2)
        
        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [2, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 1,0,1,3)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	2048, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	144.39e6, #fc
        	192e3, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-120, -10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(0.2)
        self.qtgui_freq_sink_x_0.enable_axis_labels(False)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [2, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [0.8, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,1,2)
        self.pfb_decimator_ccf_0_0 = pfb.decimator_ccf(
        	  int(samp_rate / ch_rate),
        	  (),
        	  0,
        	  100,
                  True,
                  True)
        self.pfb_decimator_ccf_0_0.declare_sample_delay(0)
        	
        self.pfb_decimator_ccf_0 = pfb.decimator_ccf(
        	  int(samp_rate / bb_rate),
        	  (),
        	  0,
        	  100,
                  True,
                  True)
        self.pfb_decimator_ccf_0.declare_sample_delay(0)
        	
        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(freq, 0)
        self.osmosdr_source_0.set_freq_corr(dev_ppm, 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(rfgain, 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.hdlc_to_ax25 = hdlc_to_ax25.blk()
        self.fsk_demod_0 = fsk_demod(
            baud=afsk_spec[0],
            fsk_hi_tone=afsk_spec[2],
            fsk_lo_tone=afsk_spec[1],
            in_sps=in_sps,
            out_sps=out_sps,
        )
        self.fft_filter_xxx_1 = filter.fft_filter_fff(1, (firdes.band_pass(1,ch_rate,400,5e3,400,firdes.WIN_BLACKMAN)), 1)
        self.fft_filter_xxx_1.declare_sample_delay(0)
        self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(out_sps*(1+0.0), 0.25*gain_mu*gain_mu, 0.5, gain_mu, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False)
        self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len')
        self.blocks_not_xx_0 = blocks.not_bb()
        self.blocks_and_const_xx_0 = blocks.and_const_bb(1)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(ch_rate/(2*math.pi*12e3/8.0))
        self.afsk_afsk1200_0 = afsk.afsk1200(int(ch_rate),4)
        self._afgain_range = Range(-20, -1, 0.1, -7, 100)
        self._afgain_win = RangeWidget(self._afgain_range, self.set_afgain, 'AF Gain (dB)', "counter_slider", float)
        self.top_grid_layout.addWidget(self._afgain_win, 3,1,1,1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.hdlc_to_ax25, 'hdlc in'))    
        self.msg_connect((self.hdlc_to_ax25, 'ax25 out'), (self.blocks_pdu_to_tagged_stream_1, 'pdus'))    
        self.msg_connect((self.hdlc_to_ax25, 'ax25 out'), (self.blocks_socket_pdu_0, 'pdus'))    
        self.connect((self.afsk_afsk1200_0, 0), (self.show_text_2, 0))    
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.fft_filter_xxx_1, 0))    
        self.connect((self.blocks_and_const_xx_0, 0), (self.digital_hdlc_deframer_bp_0, 0))    
        self.connect((self.blocks_not_xx_0, 0), (self.blocks_and_const_xx_0, 0))    
        self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.show_text_0, 0))    
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_not_xx_0, 0))    
        self.connect((self.fft_filter_xxx_1, 0), (self.afsk_afsk1200_0, 0))    
        self.connect((self.fft_filter_xxx_1, 0), (self.fsk_demod_0, 0))    
        self.connect((self.fsk_demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.pfb_decimator_ccf_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.pfb_decimator_ccf_0_0, 0))    
        self.connect((self.pfb_decimator_ccf_0, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.pfb_decimator_ccf_0, 0), (self.qtgui_waterfall_sink_x_0, 0))    
        self.connect((self.pfb_decimator_ccf_0_0, 0), (self.analog_quadrature_demod_cf_0, 0))    
Exemplo n.º 14
0
    def __init__(self, options, args, queue):
        gr.top_block.__init__(self)

        self.options = options
        self.args = args
        self.rate = int(options.rate)
        
        if options.filename is None and options.udp is None and not options.rtlsdr:
          #UHD source by default
          from gnuradio import uhd
          self.u = uhd.single_usrp_source(options.args, uhd.io_type_t.COMPLEX_FLOAT32, 1)
          time_spec = uhd.time_spec(0.0)
          self.u.set_time_now(time_spec)
        
          #if(options.rx_subdev_spec is None):
          #  options.rx_subdev_spec = ""
          #self.u.set_subdev_spec(options.rx_subdev_spec)
          if not options.antenna is None:
            self.u.set_antenna(options.antenna)
        
          self.u.set_samp_rate(rate)
          self.rate = int(self.u.get_samp_rate()) #retrieve actual
        
          if options.gain is None: #set to halfway
            g = self.u.get_gain_range()
            options.gain = (g.start()+g.stop()) / 2.0
        
          if not(self.tune(options.freq)):
            print "Failed to set initial frequency"
        
          print "Setting gain to %i" % options.gain
          self.u.set_gain(options.gain)
          print "Gain is %i" % self.u.get_gain()
          
        elif options.rtlsdr: #RTLSDR dongle
            import osmosdr
            self.u = osmosdr.source_c(options.args)
            self.u.set_sample_rate(2.4e6) #fixed for RTL dongles
            if not self.u.set_center_freq(options.centerfreq - options.error):
                print "Failed to set initial frequency"
        
            self.u.set_gain_mode(0) #manual gain mode
            if options.gain is None:
                options.gain = 25#34
                
            self.u.set_gain(options.gain)
            print "Gain is %i" % self.u.get_gain()
        
            use_resampler = True
            self.rate=2.4e6
                    
        else:
          if options.filename is not None:
            self.u = gr.file_source(gr.sizeof_gr_complex, options.filename)
          elif options.udp is not None:
            self.u = gr.udp_source(gr.sizeof_gr_complex, "localhost", options.udp)
          else:
            raise Exception("No valid source selected")
        
        
        print "Samples per second is %i" % self.rate
        
        self._syms_per_sec = 3600;
        
        options.audiorate = 11025
        options.rate = self.rate
        
        options.samples_per_second = self.rate #yeah i know it's on the list
        options.syms_per_sec = self._syms_per_sec
        options.gain_mu = 0.01
        options.mu=0.5
        options.omega_relative_limit = 0.3
        options.syms_per_sec = self._syms_per_sec
        options.offset = options.centerfreq - options.freq
        print "Control channel offset: %f" % options.offset
        
        self.demod = fsk_demod(options)
        self.start_correlator = gr.correlate_access_code_tag_bb("10101100",0,"smartnet_preamble") #should mark start of packet #digital.
        #self.start_correlator = digital.correlate_access_code_bb("10101100",0) #should mark start of packet #digital.
#        self.smartnet_sync = smartnet.sync()
        self.smartnet_deinterleave = smartnet.deinterleave()
#        self.smartnet_parity = smartnet.parity()
        self.smartnet_crc = smartnet.crc(queue)
#        self.smartnet_packetize = smartnet.packetize()
#        self.parse = smartnet.parse(queue) #packet-based. this simply posts lightly-formatted messages to the queue.
        
        self.connect(self.u, self.demod)
                                                        #self.smartnet_sync,        self.smartnet_parity,
        self.connect(self.demod, self.start_correlator,  self.smartnet_deinterleave,  self.smartnet_crc)#, self.smartnet_packetize, self.parse)
Exemplo n.º 15
0
    def __init__(self):
        gr.top_block.__init__(self, "Aprs Rx Test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Aprs Rx Test")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "aprs_rx_test")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48e3
        self.sps = sps = int(samp_rate / 1200)
        self.gain_mu = gain_mu = 0.175

        ##################################################
        # Blocks
        ##################################################
        self.show_text_0 = display.show_text()
        self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(),
                                                 Qt.QWidget)
        self.top_grid_layout.addWidget(self._show_text_0_win, 2, 0, 1, 2)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            2048,  #size
            1024,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

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

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

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

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

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.fsk_demod_0 = fsk_demod(
            baud=1200,
            fsk_hi_tone=2200,
            fsk_lo_tone=1200,
            in_sps=sps,
            out_sps=2,
        )
        self.fft_filter_xxx_0 = filter.fft_filter_fff(1, (firdes.band_pass(
            1, samp_rate, 1000, 2400, 300, firdes.WIN_BLACKMAN)), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.epy_block_0 = epy_block_0.blk()
        self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(32, 500)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            2 * (1 + 0.0), 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/handiko/aprs_test.wav', True)
        self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_not_xx_0 = blocks.not_bb()
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.1, ))
        self.blocks_and_const_xx_0 = blocks.and_const_bb(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(int(samp_rate), '', True)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_f(
            analog.GR_UNIFORM, 0.1, 0, 8192)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'),
                         (self.epy_block_0, 'hdlc in'))
        self.msg_connect((self.epy_block_0, 'ax25 out'),
                         (self.blocks_pdu_to_tagged_stream_1, 'pdus'))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.fft_filter_xxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.fsk_demod_0, 0))
        self.connect((self.blocks_and_const_xx_0, 0),
                     (self.digital_hdlc_deframer_bp_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_not_xx_0, 0),
                     (self.blocks_and_const_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_1, 0),
                     (self.show_text_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blocks_not_xx_0, 0))
        self.connect((self.fft_filter_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.fsk_demod_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
Exemplo n.º 16
0
    def __init__(self):
        gr.top_block.__init__(self, "TLM RTL RX")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("TLM RTL RX")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "tlm_rtl")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 40
        self.samp_rate = samp_rate = 300e3
        self.nfilt = nfilt = 40
        self.gain_mu = gain_mu = 0.5
        self.ch_rate = ch_rate = 96e3
        self.cfreq = cfreq = 144.12
        self.audio_rate = audio_rate = 48e3

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'RF Spectrum')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'RF Spectrogram')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Demod')
        self.top_grid_layout.addWidget(self.tab, 0, 0, 1, 1)
        self._cfreq_tool_bar = Qt.QToolBar(self)
        self._cfreq_tool_bar.addWidget(Qt.QLabel('Center Freq. (MHz)' + ": "))
        self._cfreq_line_edit = Qt.QLineEdit(str(self.cfreq))
        self._cfreq_tool_bar.addWidget(self._cfreq_line_edit)
        self._cfreq_line_edit.returnPressed.connect(lambda: self.set_cfreq(
            eng_notation.str_to_num(str(self._cfreq_line_edit.text().toAscii())
                                    )))
        self.top_grid_layout.addWidget(self._cfreq_tool_bar, 2, 0, 1, 1)
        self.show_text_0 = display.show_text()
        self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(),
                                                 Qt.QWidget)
        self.top_grid_layout.addWidget(self._show_text_0_win, 1, 0, 1, 1)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=8,
            decimation=40,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=int(audio_rate),
            decimation=int(samp_rate),
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            8192,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            cfreq * 1e6,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not False:
            self.qtgui_waterfall_sink_x_0.disable_legend()

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

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

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-100, -20)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            8192 * 2,  #size
            1200 * 8,  #samp_rate
            "",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-15, 15)

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

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_TAG,
                                                  qtgui.TRIG_SLOPE_POS, 0.0,
                                                  200e-3, 0, 'start')
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not False:
            self.qtgui_time_sink_x_0.disable_legend()

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

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

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c(
            4096,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            cfreq * 1e6,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-120, 0)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(True)
        self.qtgui_freq_sink_x_1.set_fft_average(0.2)
        self.qtgui_freq_sink_x_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        if not False:
            self.qtgui_freq_sink_x_1.disable_legend()

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

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

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_freq_sink_x_1_win)
        self.handiko_parse_frame_0 = handiko.parse_frame()
        self.handiko_frame_detect_0 = handiko.frame_detect()
        self.fsk_demod_1 = fsk_demod(
            baud=1200,
            fsk_hi_tone=2200,
            fsk_lo_tone=1200,
            in_sps=40,
            out_sps=8,
        )
        self.fsk_demod_0 = fsk_demod(
            baud=1200,
            fsk_hi_tone=2200,
            fsk_lo_tone=1200,
            in_sps=sps,
            out_sps=2,
        )
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(
            2 * (1 + 0.0), 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.carrier_detect_0 = carrier_detect(
            hi=0.7,
            low=0.5,
            gain=10e3,
            filter_len=400,
        )
        self.blocks_throttle_2 = blocks.throttle(gr.sizeof_float * 1, 1200 * 8,
                                                 True)
        self.blocks_throttle_1 = blocks.throttle(gr.sizeof_float * 1, 1200 * 8,
                                                 True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001',
                                                     10000, False)
        self.blocks_rotator_cc_0 = blocks.rotator_cc(0)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_multiply_const_vxx_5 = blocks.multiply_const_vcc((2, ))
        self.blocks_multiply_const_vxx_3 = blocks.multiply_const_vff((4, ))
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((7, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/handiko/gqrx_20180404_011711_144119900_300000_fc.raw', True)
        self.blocks_delay_3 = blocks.delay(gr.sizeof_float * 1, 0)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 0)
        self.blocks_burst_tagger_0 = blocks.burst_tagger(gr.sizeof_float)
        self.blocks_burst_tagger_0.set_true_tag('start', True)
        self.blocks_burst_tagger_0.set_false_tag('stop', False)

        self.blocks_add_const_vxx_3 = blocks.add_const_vff((-5, ))
        self.blocks_add_const_vxx_2 = blocks.add_const_vff((5, ))
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
            audio_rate=int(audio_rate),
            quad_rate=int(audio_rate),
            tau=75e-6,
            max_dev=5e3,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.handiko_frame_detect_0, 'frame out'),
                         (self.handiko_parse_frame_0, 'frame in'))
        self.msg_connect((self.handiko_parse_frame_0, 'info out'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.msg_connect((self.handiko_parse_frame_0, 'info out'),
                         (self.blocks_socket_pdu_0, 'pdus'))
        self.connect((self.analog_nbfm_rx_0, 0),
                     (self.blocks_burst_tagger_0, 0))
        self.connect((self.analog_nbfm_rx_0, 0), (self.fsk_demod_0, 0))
        self.connect((self.analog_nbfm_rx_0, 0), (self.fsk_demod_1, 0))
        self.connect((self.blocks_add_const_vxx_2, 0),
                     (self.blocks_throttle_2, 0))
        self.connect((self.blocks_add_const_vxx_3, 0),
                     (self.blocks_throttle_1, 0))
        self.connect((self.blocks_burst_tagger_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_delay_3, 0),
                     (self.blocks_multiply_const_vxx_3, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_rotator_cc_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0),
                     (self.blocks_add_const_vxx_2, 0))
        self.connect((self.blocks_multiply_const_vxx_3, 0),
                     (self.blocks_add_const_vxx_3, 0))
        self.connect((self.blocks_multiply_const_vxx_5, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.show_text_0, 0))
        self.connect((self.blocks_rotator_cc_0, 0),
                     (self.blocks_multiply_const_vxx_5, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_throttle_1, 0),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.blocks_throttle_2, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.carrier_detect_0, 0),
                     (self.blocks_burst_tagger_0, 1))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.handiko_frame_detect_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.fsk_demod_0, 0),
                     (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.fsk_demod_1, 0), (self.blocks_delay_3, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_nbfm_rx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.carrier_detect_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_delay_0, 0))