Exemplo n.º 1
0
    def __init__(self):
        gr.top_block.__init__(self, "grc_cc1111_test_local_loop")

        ##################################################
        # Variables
        ##################################################
        self.symbole_rate = symbole_rate = 80000
        self.samp_rate = samp_rate = 2e6
        self.samp_per_sym = samp_per_sym = int(samp_rate / symbole_rate)
        self.preamble = preamble = '0101010101010101'
        self.myqueue_out = myqueue_out = gr.msg_queue(2)
        self.myqueue_in = myqueue_in = gr.msg_queue(2)
        self.bit_per_sym = bit_per_sym = 1
        self.access_code = access_code = '11010011100100011101001110010001'

        ##################################################
        # Blocks
        ##################################################
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=int(samp_per_sym),
        	bt=0.5,
        	verbose=False,
        	log=False,
        )
        self.digital_correlate_access_code_bb_0_0 = digital.correlate_access_code_bb(access_code, 1)
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(samp_per_sym*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_encoder_0 = cc1111.cc1111_packet_mod_base(cc1111.cc1111_packet_encoder(
                        samples_per_symbol=samp_per_sym,
                        bits_per_symbol=bit_per_sym,
                        preamble=preamble,
                        access_code=access_code,
                        pad_for_usrp=True,
        		do_whitening=True,
        		add_crc=True
                ),
        	source_queue=myqueue_in
        	)
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(myqueue_out,True, True, False, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0), (self.digital_binary_slicer_fb_0_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0_0, 0), (self.digital_correlate_access_code_bb_0_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0_0, 0), (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0), (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.digital_gmsk_mod_0, 0))
        self.connect((self.cc1111_cc1111_packet_encoder_0, 0), (self.blocks_throttle_0, 0))
Exemplo n.º 2
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1024000
        self.decimation = decimation = 10
        self.symbol_rate = symbol_rate = 38400
        self.input_rate = input_rate = samp_rate / decimation
        self.window_symbols = window_symbols = 1
        self.symbol_taps_length = symbol_taps_length = int(
            (float(input_rate) / symbol_rate))
        self.samples_per_symbol = samples_per_symbol = float(
            input_rate) / symbol_rate
        self.grab_freq = grab_freq = 868200000
        self.symbol_taps = symbol_taps = (1, ) * symbol_taps_length
        self.offset_sign2 = offset_sign2 = (-34780 * grab_freq) / 868200000
        self.offset_sign1 = offset_sign1 = (11600 * grab_freq) / 868200000
        self.gain_mu = gain_mu = 0.4 / samples_per_symbol
        self.fsk_deviation_hz = fsk_deviation_hz = 5200
        self.average_window = average_window = int(
            (input_rate * window_symbols / symbol_rate))

        ##################################################
        # Blocks
        ##################################################
        self.urmetEasyRead_urmetEasyRead_0 = urmetEasyRead.urmetEasyRead()
        self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb(
            '11010011100100011101001110010001', 1)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            samples_per_symbol, 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.02)
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(
            gr.msg_queue(1), False, True, True, True)
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_char * 1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       sys.argv[1], False)
        self.blocks_deinterleave_0 = blocks.deinterleave(
            gr.sizeof_float * 1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-128 - 128j, ))
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(40, 1)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.FXFIR1 = filter.freq_xlating_fir_filter_ccc(
            decimation, (1, ), -14e3, samp_rate)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.FXFIR1, 0), (self.analog_simple_squelch_cc_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_simple_squelch_cc_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_deinterleave_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_uchar_to_float_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.FXFIR1, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.blocks_deinterleave_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0),
                     (self.urmetEasyRead_urmetEasyRead_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.digital_correlate_access_code_bb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0, 0),
                     (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.urmetEasyRead_urmetEasyRead_0, 0),
                     (self.blocks_null_sink_1, 0))
    def __init__(self):
        gr.top_block.__init__(self, "grc_cc1111_hackrf_receiver")

        ##################################################
        # Variables
        ##################################################
        self.symbole_rate = symbole_rate = 40000
        self.samp_rate = samp_rate = 2e06
        self.rat_interop = rat_interop = 8
        self.rat_decim = rat_decim = 5
        self.firdes_transition_width = firdes_transition_width = 15000
        self.firdes_decim = firdes_decim = 4
        self.firdes_cuttoff = firdes_cuttoff = 21e3
        self.samp_per_sym = samp_per_sym = ((samp_rate/2/firdes_decim)*rat_interop/rat_decim) / symbole_rate
        self.myqueue_out = myqueue_out = gr.msg_queue(2)
        self.frequency_shift = frequency_shift = 520000
        self.frequency_center = frequency_center = 869.02e06
        self.freq_adjust1 = freq_adjust1 = 0
        self.firdes_filter = firdes_filter = firdes.low_pass(1,samp_rate/2, firdes_cuttoff, firdes_transition_width)
        self.access_code = access_code = '11010011100100011101001110010001'

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
                interpolation=rat_interop,
                decimation=rat_decim,
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "hackrf" )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(frequency_center-frequency_shift, 0)
        self.osmosdr_source_0.set_freq_corr(0, 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(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)
          
        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(2, (1, ), frequency_shift, samp_rate)
        self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(firdes_decim, (firdes_filter), freq_adjust1, samp_rate/2)
        self.digital_correlate_access_code_bb_0_0 = digital.correlate_access_code_bb(access_code, 1)
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(samp_per_sym*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(myqueue_out,True, True, False, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate/2,True)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_char*1)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0_0, 0), (self.digital_correlate_access_code_bb_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0), (self.digital_binary_slicer_fb_0_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.blocks_throttle_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0_0, 0), (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0), (self.blocks_null_sink_0_0, 0))
Exemplo n.º 4
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(
            self, title="Verisure (Securitas Direct) - demodulator")

        ##################################################
        # Variables
        ##################################################
        self.symbole_rate = symbole_rate = 38450
        self.samp_rate = samp_rate = 2.0e06
        self.rat_interop = rat_interop = 8
        self.rat_decim = rat_decim = 5
        self.frequency_tune = frequency_tune = 17.22e3
        self.frequency_shift = frequency_shift = 0.52e06
        self.frequency_center = frequency_center = 868.5e06
        self.firdes_transition_width = firdes_transition_width = 15000
        self.firdes_decim = firdes_decim = 4
        self.firdes_cutoff = firdes_cutoff = 21e3
        self.samp_per_sym = samp_per_sym = (
            (samp_rate / 2 / firdes_decim) * rat_interop /
            rat_decim) / symbole_rate
        self.rf_gain = rf_gain = 0
        self.myqueue = myqueue = gr.msg_queue(200)
        self.if_gain = if_gain = 20
        self.frequency = frequency = frequency_center + frequency_shift + frequency_tune
        self.freq_display = freq_display = frequency_center + frequency_shift + frequency_tune
        self.firdes_filter = firdes_filter = firdes.low_pass(
            1, samp_rate / 2, firdes_cutoff, firdes_transition_width)
        self.fft_sp = fft_sp = 50000
        self.crc_verbose = crc_verbose = False
        self.bb_gain = bb_gain = 20
        self.access_code = access_code = '11010011100100011101001110010001'

        ##################################################
        # Blocks
        ##################################################
        _rf_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rf_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rf_gain_sizer,
            value=self.rf_gain,
            callback=self.set_rf_gain,
            label="RF Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rf_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rf_gain_sizer,
            value=self.rf_gain,
            callback=self.set_rf_gain,
            minimum=0,
            maximum=14,
            num_steps=15,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_rf_gain_sizer, 0, 0, 1, 1)
        _if_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._if_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_if_gain_sizer,
            value=self.if_gain,
            callback=self.set_if_gain,
            label="IF Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._if_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_if_gain_sizer,
            value=self.if_gain,
            callback=self.set_if_gain,
            minimum=0,
            maximum=30,
            num_steps=31,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_if_gain_sizer, 0, 1, 1, 1)
        _frequency_tune_sizer = wx.BoxSizer(wx.VERTICAL)
        self._frequency_tune_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_frequency_tune_sizer,
            value=self.frequency_tune,
            callback=self.set_frequency_tune,
            label="Frequency Tuning",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._frequency_tune_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_frequency_tune_sizer,
            value=self.frequency_tune,
            callback=self.set_frequency_tune,
            minimum=-30e3,
            maximum=30e3,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_frequency_tune_sizer, 0, 3, 1, 1)
        _bb_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._bb_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_bb_gain_sizer,
            value=self.bb_gain,
            callback=self.set_bb_gain,
            label="BB Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._bb_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_bb_gain_sizer,
            value=self.bb_gain,
            callback=self.set_bb_gain,
            minimum=0,
            maximum=30,
            num_steps=31,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_bb_gain_sizer, 0, 2, 1, 1)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=frequency_center + frequency_shift + frequency_tune,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=fft_sp,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT",
            peak_hold=True,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 2, 0, 1, 4)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
            interpolation=rat_interop,
            decimation=rat_decim,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=int(samp_rate / 2 / fft_sp),
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "hackrf=0")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(frequency_center, 0)
        self.osmosdr_source_0.set_freq_corr(0, 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(rf_gain, 0)
        self.osmosdr_source_0.set_if_gain(if_gain, 0)
        self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(
            2, (1, ), frequency_shift + frequency_tune, samp_rate)
        self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(
            firdes_decim, (firdes_filter), 0, samp_rate / 2)
        self._freq_display_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.freq_display,
            callback=self.set_freq_display,
            label="Current Frequency",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._freq_display_static_text, 1, 0, 1, 4)
        self.digital_correlate_access_code_bb_0_0 = digital.correlate_access_code_bb(
            access_code, 1)
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(
            samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(
            myqueue, True, True, False, False)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_char * 1)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0_0, 0),
                     (self.digital_correlate_access_code_bb_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0),
                     (self.digital_binary_slicer_fb_0_0_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0_0, 0),
                     (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0),
                     (self.blocks_null_sink_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0),
                     (self.freq_xlating_fir_filter_xxx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_1, 0))
    def __init__(self):
        gr.top_block.__init__(self, "bladeRF_transceiver")

        ##################################################
        # Variables
        ##################################################
        self.symbole_rate = symbole_rate = 10e3
        self.samp_rate = samp_rate = 1e6
        self.rat_interop = rat_interop = 8
        self.rat_decim = rat_decim = 5
        self.firdes_transition_width = firdes_transition_width = 15000
        self.firdes_decim = firdes_decim = 4
        self.firdes_cuttoff = firdes_cuttoff = 21e3
        self.tx_valve_value = tx_valve_value = False
        self.tx_rf_gain = tx_rf_gain = 10
        self.tx_bb_gain = tx_bb_gain = -20
        self.samp_per_sym_source = samp_per_sym_source = ((samp_rate/2/firdes_decim)*rat_interop/rat_decim) / symbole_rate
        self.samp_per_sym = samp_per_sym = int(samp_rate / symbole_rate)
        self.rx_valve_value = rx_valve_value = False
        self.rx_rf_gain = rx_rf_gain = 3
        self.rx_bb_gain = rx_bb_gain = 20
        self.preamble = preamble = '0101010101010101'
        self.msg_source_msgq_in = msg_source_msgq_in = gr.msg_queue(2)
        self.msg_sink_msgq_out = msg_sink_msgq_out = gr.msg_queue(2)
        self.frequency_tx = frequency_tx = 450e6
        self.frequency_shift = frequency_shift = 520000
        self.frequency_rx = frequency_rx = 450.0e6
        self.firdes_filter = firdes_filter = firdes.low_pass(1,samp_rate/2, firdes_cuttoff, firdes_transition_width)
        self.bit_per_sym = bit_per_sym = 1
        self.bandwith = bandwith = 6e6
        self.access_code = access_code = '11010011100100011101001110010001'

        ##################################################
        # Blocks
        ##################################################
        self.xlating_fir_filter_1 = filter.freq_xlating_fir_filter_ccc(2, (1, ), frequency_shift, samp_rate)
        self.xlating_fir_filter_0 = filter.freq_xlating_fir_filter_ccc(firdes_decim, (firdes_filter), 0, samp_rate/2)
        self.tx_valve = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(tx_valve_value))
        self.throttle = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate/2,True)
        self.rx_valve = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(rx_valve_value))
        self.rational_resampler = filter.rational_resampler_ccc(
                interpolation=rat_interop,
                decimation=rat_decim,
                taps=None,
                fractional_bw=None,
        )
        self.quadrature_demod = analog.quadrature_demod_cf(2)
        self.osmosdr_source = osmosdr.source( args="numchan=" + str(1) + " " + "bladerf=0" )
        self.osmosdr_source.set_sample_rate(samp_rate)
        self.osmosdr_source.set_center_freq(frequency_rx-frequency_shift, 0)
        self.osmosdr_source.set_freq_corr(0, 0)
        self.osmosdr_source.set_dc_offset_mode(0, 0)
        self.osmosdr_source.set_iq_balance_mode(2, 0)
        self.osmosdr_source.set_gain_mode(False, 0)
        self.osmosdr_source.set_gain(rx_rf_gain, 0)
        self.osmosdr_source.set_if_gain(0, 0)
        self.osmosdr_source.set_bb_gain(rx_bb_gain, 0)
        self.osmosdr_source.set_antenna("", 0)
        self.osmosdr_source.set_bandwidth(bandwith, 0)
          
        self.osmosdr_sink = osmosdr.sink( args="numchan=" + str(1) + " " + "bladerf=0" )
        self.osmosdr_sink.set_sample_rate(samp_rate)
        self.osmosdr_sink.set_center_freq(frequency_tx, 0)
        self.osmosdr_sink.set_freq_corr(0, 0)
        self.osmosdr_sink.set_gain(tx_rf_gain, 0)
        self.osmosdr_sink.set_if_gain(0, 0)
        self.osmosdr_sink.set_bb_gain(tx_bb_gain, 0)
        self.osmosdr_sink.set_antenna("", 0)
        self.osmosdr_sink.set_bandwidth(bandwith, 0)
          
        self.gmsk_mod = digital.gmsk_mod(
        	samples_per_symbol=int(samp_per_sym),
        	bt=0.5,
        	verbose=False,
        	log=False,
        )
        self.correlate_access_code = digital.correlate_access_code_bb(access_code, 4)
        self.clock_recovery = digital.clock_recovery_mm_ff(samp_per_sym_source*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.cc1111_packet_encoder = cc1111.cc1111_packet_mod_base(cc1111.cc1111_packet_encoder(
                        samples_per_symbol=samp_per_sym,
                        bits_per_symbol=bit_per_sym,
                        preamble=preamble,
                        access_code=access_code,
                        pad_for_usrp=True,
        		do_whitening=True,
        		add_crc=True
                ),
        	source_queue=msg_source_msgq_in
        	)
        self.cc1111_packet_decoder = cc1111.cc1111_packet_decoder(msg_sink_msgq_out,True, True, False, True)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1)
        self.binary_slicer = digital.binary_slicer_fb()

        ##################################################
        # Connections
        ##################################################
        self.connect((self.binary_slicer, 0), (self.correlate_access_code, 0))    
        self.connect((self.cc1111_packet_decoder, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.cc1111_packet_encoder, 0), (self.gmsk_mod, 0))    
        self.connect((self.clock_recovery, 0), (self.binary_slicer, 0))    
        self.connect((self.correlate_access_code, 0), (self.cc1111_packet_decoder, 0))    
        self.connect((self.gmsk_mod, 0), (self.tx_valve, 0))    
        self.connect((self.osmosdr_source, 0), (self.rx_valve, 0))    
        self.connect((self.quadrature_demod, 0), (self.clock_recovery, 0))    
        self.connect((self.rational_resampler, 0), (self.quadrature_demod, 0))    
        self.connect((self.rx_valve, 0), (self.xlating_fir_filter_1, 0))    
        self.connect((self.throttle, 0), (self.xlating_fir_filter_0, 0))    
        self.connect((self.tx_valve, 0), (self.osmosdr_sink, 0))    
        self.connect((self.xlating_fir_filter_0, 0), (self.rational_resampler, 0))    
        self.connect((self.xlating_fir_filter_1, 0), (self.throttle, 0))    
Exemplo n.º 6
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Verisure (Securitas Direct) - demodulator")

        ##################################################
        # Variables
        ##################################################
        self.symbole_rate = symbole_rate = 38450
        self.samp_rate = samp_rate = 2.0e06
        self.rat_interop = rat_interop = 8
        self.rat_decim = rat_decim = 5
        self.frequency_tune = frequency_tune = 17.22e3
        self.frequency_shift = frequency_shift = 0.52e06
        self.frequency_center = frequency_center = 868.5e06
        self.firdes_transition_width = firdes_transition_width = 15000
        self.firdes_decim = firdes_decim = 4
        self.firdes_cutoff = firdes_cutoff = 21e3
        self.samp_per_sym = samp_per_sym = ((samp_rate/2/firdes_decim)*rat_interop/rat_decim) / symbole_rate
        self.rf_gain = rf_gain = 0
        self.myqueue = myqueue = gr.msg_queue(200)
        self.if_gain = if_gain = 20
        self.frequency = frequency = frequency_center + frequency_shift + frequency_tune
        self.freq_display = freq_display = frequency_center + frequency_shift + frequency_tune
        self.firdes_filter = firdes_filter = firdes.low_pass(1,samp_rate/2, firdes_cutoff, firdes_transition_width)
        self.fft_sp = fft_sp = 50000
        self.crc_verbose = crc_verbose = False
        self.bb_gain = bb_gain = 20
        self.access_code = access_code = '11010011100100011101001110010001'

        ##################################################
        # Blocks
        ##################################################
        _rf_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rf_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_rf_gain_sizer,
        	value=self.rf_gain,
        	callback=self.set_rf_gain,
        	label="RF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._rf_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_rf_gain_sizer,
        	value=self.rf_gain,
        	callback=self.set_rf_gain,
        	minimum=0,
        	maximum=14,
        	num_steps=15,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_rf_gain_sizer, 0, 0, 1, 1)
        _if_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._if_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_if_gain_sizer,
        	value=self.if_gain,
        	callback=self.set_if_gain,
        	label="IF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._if_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_if_gain_sizer,
        	value=self.if_gain,
        	callback=self.set_if_gain,
        	minimum=0,
        	maximum=30,
        	num_steps=31,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_if_gain_sizer, 0, 1, 1, 1)
        _frequency_tune_sizer = wx.BoxSizer(wx.VERTICAL)
        self._frequency_tune_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_frequency_tune_sizer,
        	value=self.frequency_tune,
        	callback=self.set_frequency_tune,
        	label="Frequency Tuning",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._frequency_tune_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_frequency_tune_sizer,
        	value=self.frequency_tune,
        	callback=self.set_frequency_tune,
        	minimum=-30e3,
        	maximum=30e3,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_frequency_tune_sizer, 0, 3, 1, 1)
        _bb_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._bb_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_bb_gain_sizer,
        	value=self.bb_gain,
        	callback=self.set_bb_gain,
        	label="BB Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._bb_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_bb_gain_sizer,
        	value=self.bb_gain,
        	callback=self.set_bb_gain,
        	minimum=0,
        	maximum=30,
        	num_steps=31,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_bb_gain_sizer, 0, 2, 1, 1)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=frequency_center + frequency_shift + frequency_tune,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=fft_sp,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT",
        	peak_hold=True,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 2, 0, 1, 4)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
                interpolation=rat_interop,
                decimation=rat_decim,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=int(samp_rate/2/fft_sp),
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "hackrf=0" )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(frequency_center, 0)
        self.osmosdr_source_0.set_freq_corr(0, 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(rf_gain, 0)
        self.osmosdr_source_0.set_if_gain(if_gain, 0)
        self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)
          
        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(2, (1, ), frequency_shift+frequency_tune, samp_rate)
        self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(firdes_decim, (firdes_filter), 0, samp_rate/2)
        self._freq_display_static_text = forms.static_text(
        	parent=self.GetWin(),
        	value=self.freq_display,
        	callback=self.set_freq_display,
        	label="Current Frequency",
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._freq_display_static_text, 1, 0, 1, 4)
        self.digital_correlate_access_code_bb_0_0 = digital.correlate_access_code_bb(access_code, 1)
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(samp_per_sym*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(myqueue,True, True, False, False)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_char*1)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0_0, 0), (self.digital_correlate_access_code_bb_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0), (self.digital_binary_slicer_fb_0_0_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0_0, 0), (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0), (self.blocks_null_sink_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0))
Exemplo n.º 7
0
    def __init__(self):
        gr.top_block.__init__(self, "grc_cc1111_hackrf_receiver")

        ##################################################
        # Variables
        ##################################################
        self.symbole_rate = symbole_rate = 40000
        self.samp_rate = samp_rate = 2e06
        self.rat_interop = rat_interop = 8
        self.rat_decim = rat_decim = 5
        self.firdes_transition_width = firdes_transition_width = 15000
        self.firdes_decim = firdes_decim = 4
        self.firdes_cuttoff = firdes_cuttoff = 21e3
        self.samp_per_sym = samp_per_sym = (
            (samp_rate / 2 / firdes_decim) * rat_interop /
            rat_decim) / symbole_rate
        self.myqueue_out = myqueue_out = gr.msg_queue(2)
        self.frequency_shift = frequency_shift = 520000
        self.frequency_center = frequency_center = 869.02e06
        self.freq_adjust1 = freq_adjust1 = 0
        self.firdes_filter = firdes_filter = firdes.low_pass(
            1, samp_rate / 2, firdes_cuttoff, firdes_transition_width)
        self.access_code = access_code = '11010011100100011101001110010001'

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
            interpolation=rat_interop,
            decimation=rat_decim,
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "hackrf")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(
            frequency_center - frequency_shift, 0)
        self.osmosdr_source_0.set_freq_corr(0, 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(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(
            2, (1, ), frequency_shift, samp_rate)
        self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(
            firdes_decim, (firdes_filter), freq_adjust1, samp_rate / 2)
        self.digital_correlate_access_code_bb_0_0 = digital.correlate_access_code_bb(
            access_code, 1)
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(
            samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(
            myqueue_out, True, True, False, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate / 2, True)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_char * 1)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_throttle_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0_0, 0),
                     (self.digital_correlate_access_code_bb_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0),
                     (self.digital_binary_slicer_fb_0_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0_0, 0),
                     (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0),
                     (self.blocks_null_sink_0_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="grc_cc1111_hackrf_receiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.symbole_rate = symbole_rate = 80000
        self.samp_rate = samp_rate = 2e06
        self.firdes_transition_width = firdes_transition_width = 15000
        self.firdes_cuttoff = firdes_cuttoff = 21e3
        self.samp_per_sym = samp_per_sym = int(samp_rate / symbole_rate)
        self.rat_interop = rat_interop = 8
        self.rat_decim = rat_decim = 5
        self.myqueue_out = myqueue_out = gr.msg_queue(2)
        self.frequency_shift = frequency_shift = 520000
        self.frequency_center = frequency_center = 433.6e06
        self.firdes_filter = firdes_filter = firdes.low_pass(
            1, samp_rate / 2, firdes_cuttoff, firdes_transition_width)
        self.firdes_decim = firdes_decim = 4
        self.access_code = access_code = '11010011100100011101001110010001'

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_waterfallsink2_0_1 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=frequency_center,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=5120,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Source",
            win=window.rectangular,
        )
        self.Add(self.wxgui_waterfallsink2_0_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=frequency_center,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=5120,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Filter",
            win=window.rectangular,
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
            interpolation=rat_interop,
            decimation=rat_decim,
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "hackrf=1")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(
            frequency_center - frequency_shift, 0)
        self.osmosdr_source_0.set_freq_corr(0, 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(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(
            2, (1, ), frequency_shift, samp_rate)
        self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(
            firdes_decim, (firdes_filter), 0, samp_rate / 2)
        self.digital_correlate_access_code_bb_0_0 = digital.correlate_access_code_bb(
            access_code, 1)
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(
            samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0_0 = digital.binary_slicer_fb()
        self.cc1111_cc1111_packet_decoder_0 = cc1111.cc1111_packet_decoder(
            myqueue_out, True, False, True, False)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, "/home/bkbilly/Desktop/hello_out.txt", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.cc1111_cc1111_packet_decoder_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0_0, 0),
                     (self.digital_correlate_access_code_bb_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0),
                     (self.digital_binary_slicer_fb_0_0_0, 0))
        self.connect((self.digital_correlate_access_code_bb_0_0, 0),
                     (self.cc1111_cc1111_packet_decoder_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0),
                     (self.freq_xlating_fir_filter_xxx_0_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_1, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.wxgui_waterfallsink2_0_1, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))