Python gnuradio.gr.sizeof_gr_complex() Examples

The following are 15 code examples of gnuradio.gr.sizeof_gr_complex(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gnuradio.gr , or try the search function .
Example #1
Source File: wideband_receiver.py    From examples with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, OSR=4, fc=939.4e6, samp_rate=0.4e6):
        gr.hier_block2.__init__(
            self, "Wideband receiver",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(0, 0, 0),
        )
        self.message_port_register_hier_out("bursts")
        self.message_port_register_hier_out("msgs")
        self.__init(OSR, fc, samp_rate) 
Example #2
Source File: usrp_recv.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate 
        self.rf_gain = rf_gain 
        self.port = port 
        self.if_gain = if_gain 
        self.frequency = frequency 
        self.freq_correction = freq_correction 
        self.bb_gain = bb_gain 
        self.bandwidth = bandwidth 

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + 'uhd'
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(frequency, 0)
        self.osmosdr_source_0.set_freq_corr(freq_correction, 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(bandwidth, 0)
        self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex*1, '127.0.0.1', port, False)



        self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0)) 
Example #3
Source File: usrp_send.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_sink_0 = osmosdr.sink(
            args="numchan=" + str(1) + " " + 'uhd'
        )
        self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_sink_0.set_sample_rate(sample_rate)
        self.osmosdr_sink_0.set_center_freq(frequency, 0)
        self.osmosdr_sink_0.set_freq_corr(freq_correction, 0)
        self.osmosdr_sink_0.set_gain(rf_gain, 0)
        self.osmosdr_sink_0.set_if_gain(if_gain, 0)
        self.osmosdr_sink_0.set_bb_gain(bb_gain, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(bandwidth, 0)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex * 1, '127.0.0.1', port, 65536, False)

        self.connect((self.blocks_udp_source_0, 0), (self.osmosdr_sink_0, 0)) 
Example #4
Source File: bladerf_recv.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + 'bladerf'
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(frequency, 0)
        self.osmosdr_source_0.set_freq_corr(freq_correction, 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(bandwidth, 0)
        self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)

        self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0)) 
Example #5
Source File: hackrf_recv.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + 'hackrf'
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(frequency, 0)
        self.osmosdr_source_0.set_freq_corr(freq_correction, 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(bandwidth, 0)
        self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)

        self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0)) 
Example #6
Source File: sdrplay_recv.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + 'sdrplay'
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(frequency, 0)
        self.osmosdr_source_0.set_freq_corr(freq_correction, 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(bandwidth, 0)
        self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)

        self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0)) 
Example #7
Source File: funcube_recv.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + 'fcd'
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(frequency, 0)
        self.osmosdr_source_0.set_freq_corr(freq_correction, 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(bandwidth, 0)
        self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)

        self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0)) 
Example #8
Source File: rtl-sdr_recv.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + 'rtl'
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(frequency, 0)
        self.osmosdr_source_0.set_freq_corr(freq_correction, 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(bandwidth, 0)
        self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)

        self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0)) 
Example #9
Source File: hackrf_send.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_sink_0 = osmosdr.sink(
            args="numchan=" + str(1) + " " + 'hackrf'
        )
        self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_sink_0.set_sample_rate(sample_rate)
        self.osmosdr_sink_0.set_center_freq(frequency, 0)
        self.osmosdr_sink_0.set_freq_corr(freq_correction, 0)
        self.osmosdr_sink_0.set_gain(rf_gain, 0)
        self.osmosdr_sink_0.set_if_gain(if_gain, 0)
        self.osmosdr_sink_0.set_bb_gain(bb_gain, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(bandwidth, 0)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex * 1, '127.0.0.1', port, 65536, False)

        self.connect((self.blocks_udp_source_0, 0), (self.osmosdr_sink_0, 0)) 
Example #10
Source File: bladerf_send.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
        gr.top_block.__init__(self, "Top Block")

        self.sample_rate = sample_rate
        self.rf_gain = rf_gain
        self.port = port
        self.if_gain = if_gain
        self.frequency = frequency
        self.freq_correction = freq_correction
        self.bb_gain = bb_gain
        self.bandwidth = bandwidth

        self.osmosdr_sink_0 = osmosdr.sink(
            args="numchan=" + str(1) + " " + 'bladerf'
        )
        self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_sink_0.set_sample_rate(sample_rate)
        self.osmosdr_sink_0.set_center_freq(frequency, 0)
        self.osmosdr_sink_0.set_freq_corr(freq_correction, 0)
        self.osmosdr_sink_0.set_gain(rf_gain, 0)
        self.osmosdr_sink_0.set_if_gain(if_gain, 0)
        self.osmosdr_sink_0.set_bb_gain(bb_gain, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(bandwidth, 0)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex * 1, '127.0.0.1', port, 65536, False)

        self.connect((self.blocks_udp_source_0, 0), (self.osmosdr_sink_0, 0)) 
Example #11
Source File: demod_rf.py    From waveconverter with MIT License 4 votes vote down vote up
def __init__(self, samp_rate_in, samp_rate_out, center_freq, 
                 tune_freq, channel_width, transition_width, threshold,
                 iq_filename, dig_out_filename):
        gr.top_block.__init__(self)

        
        ##################################################
        # Variables
        ##################################################
        self.cutoff_freq = channel_width/2
        self.firdes_taps = firdes.low_pass(1, samp_rate_in, 
                                           self.cutoff_freq, 
                                           transition_width)
        
        ##################################################
        # Blocks
        ##################################################
        self.tuning_filter_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_in/samp_rate_out), 
                                                                  (self.firdes_taps), 
                                                                  tune_freq-center_freq, 
                                                                  samp_rate_in)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, iq_filename, False)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1*threshold, ))

        # message sink is primary method of getting baseband data into waveconverter        
        self.sink_queue = gr.msg_queue()
        self.blocks_message_sink_0 = blocks.message_sink(gr.sizeof_char*1, self.sink_queue, False)
        
        # if directed, we also dump the baseband data into a file
        if len(dig_out_filename) > 0:
            print "Outputing baseband to waveform to " + dig_out_filename
            self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, dig_out_filename, False)
            self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.tuning_filter_0, 0))
        self.connect((self.tuning_filter_0, 0), (self.blocks_complex_to_mag_0, 0))

        self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_message_sink_0, 0))
        if len(dig_out_filename) > 0:
            self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0, 0))


##############################################################
# This flowgraph consists of the following blocks:
# - a File Source that 
# - a Frequency Translating FIR filter that tunes to the target signal
# - a quadrature demod block that demodules the FSK signal
# - an Add Const block that shifts the demodulated signal downwards, centering
#   it around zero on the y-axis
# - a Binary Slicer that converts centered signal from floating point to binary
# - a File Sink that outputs 
Example #12
Source File: demod_rf.py    From waveconverter with MIT License 4 votes vote down vote up
def __init__(self, samp_rate_in, samp_rate_out, center_freq, 
                 tune_freq, channel_width, transition_width, threshold, fsk_deviation, fskSquelch,
                 iq_filename, dig_out_filename):
        gr.top_block.__init__(self)
        
        ##################################################
        # Variables
        ##################################################
        self.cutoff_freq = channel_width/2
        self.firdes_taps = firdes.low_pass(1, samp_rate_in, 
                                           self.cutoff_freq, 
                                           transition_width)
        
        ##################################################
        # Blocks
        ##################################################
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, iq_filename, False)
        self.blocks_tuning_filter_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_in/samp_rate_out), 
                                                                         (self.firdes_taps), 
                                                                         tune_freq-center_freq, 
                                                                         samp_rate_in)
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(fskSquelch, 1, 1, False)
        self.blocks_quadrature_demod_0 = analog.quadrature_demod_cf(samp_rate_out/(2*pi*fsk_deviation/2))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1*threshold, ))
        self.blocks_digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        
        # swapped message sink for file sink
        #self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, dig_out_filename, False)
        #self.blocks_file_sink_0.set_unbuffered(False)
        self.sink_queue = gr.msg_queue()
        self.blocks_message_sink_0 = blocks.message_sink(gr.sizeof_char*1, self.sink_queue, False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.blocks_tuning_filter_0, 0))
        self.connect((self.blocks_tuning_filter_0, 0), (self.analog_pwr_squelch_xx_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0), (self.blocks_quadrature_demod_0, 0))
        self.connect((self.blocks_quadrature_demod_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_digital_binary_slicer_fb_0, 0))
        
        #self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_digital_binary_slicer_fb_0, 0), (self.blocks_message_sink_0, 0))
        
##############################################################
# This flowgraph consists of the following blocks:
# - a File Source that 
# - a Frequency Translating FIR filter that tunes to the target signal
# - a quadrature demod block that demodules the FSK signal
# - an Add Const block that shifts the demodulated signal downwards, centering
#   it around zero on the y-axis
# - a Binary Slicer that converts centered signal from floating point to binary
# - a File Sink that outputs 
Example #13
Source File: get_bcch_msgs_from_cfile.py    From examples with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, fc=937e6, input_file_name="input.cfile", samp_rate=100.0e6/174.0, osr=4):
        gr.top_block.__init__(self, "Get Bcch Msgs From Cfile")

        ##################################################
        # Parameters
        ##################################################
        self.fc = fc
        self.input_file_name = input_file_name
        self.samp_rate = samp_rate
        self.osr = osr

        ##################################################
        # Blocks
        ##################################################
        self.gsm_receiver_0 = grgsm.receiver(4, ([0]), ([]), False)
        self.gsm_message_printer_0 = grgsm.message_printer(pmt.intern(""), False,
            False, False)
        self.gsm_input_0 = grgsm.gsm_input(
            ppm=0,
            osr=osr,
            fc=fc,
            samp_rate_in=samp_rate,
        )
        self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder()
        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc, samp_rate, osr)
        self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(
            timeslot_nr=0,
        )
        self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000, False)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000, False)
        self.blocks_message_debug_0 = blocks.message_debug()
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/piotr/Odbiornik_gsm/gr-gsm/test_data/vf_call6_a725_d174_g5_Kc1EF00BAB3BAC7002.cfile", False)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.gsm_bcch_ccch_demapper_0, 'bursts'), (self.gsm_control_channels_decoder_0, 'bursts'))    
        self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.blocks_message_debug_0, 'print'))    
        self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.gsm_input_0, 'ctrl_in'))    
        self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self.blocks_socket_pdu_0, 'pdus'))    
        self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self.gsm_message_printer_0, 'msgs'))    
        self.msg_connect((self.gsm_receiver_0, 'C0'), (self.gsm_bcch_ccch_demapper_0, 'bursts'))    
        self.msg_connect((self.gsm_receiver_0, 'measurements'), (self.gsm_clock_offset_control_0, 'measurements'))    
        self.connect((self.blocks_file_source_0, 0), (self.gsm_input_0, 0))    
        self.connect((self.gsm_input_0, 0), (self.gsm_receiver_0, 0)) 
Example #14
Source File: uplink_decoding_multi_rtl.py    From examples with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, osr=4):
        gr.top_block.__init__(self, "Uplink decoding demo")

        ##################################################
        # Parameters
        ##################################################
        self.osr = osr

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6

        ##################################################
        # Blocks
        ##################################################
        self.socket_pdu_server = blocks.socket_pdu("UDP_SERVER", '127.0.0.1', '4729', 10000, False)
        self.gsm_sdcch8_demapper_0 = grgsm.gsm_sdcch8_demapper(
            timeslot_nr=1,
        )
        self.gsm_receiver_with_uplink_0 = grgsm.receiver(4, ([22]), ([2]), True)
        self.gsm_message_printer_0_0 = grgsm.message_printer(pmt.intern(""), False,
            False, False)
        self.gsm_input_0_0 = grgsm.gsm_input(
            ppm=0,
            osr=4,
            fc=947.8e6-45e6,
            samp_rate_in=samp_rate,
        )
        self.gsm_input_0 = grgsm.gsm_input(
            ppm=0,
            osr=4,
            fc=947.8e6,
            samp_rate_in=samp_rate,
        )
        self.gsm_decryption_0_3 = grgsm.decryption(([0x46,0x77,0x2d,0x54,0xa3,0xa3,0xc3,0x1c]), 1)
        self.gsm_control_channels_decoder_0_1_0 = grgsm.control_channels_decoder()
        self.gsm_control_channels_decoder_0_1 = grgsm.control_channels_decoder()
        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(947.8e6, samp_rate, osr)
        self.blocks_socket_pdu_0_0_0 = blocks.socket_pdu("UDP_CLIENT", '127.0.0.1', '4729', 10000, False)
        self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, 'sms_multirtl_uplink_tail.cfile', False)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, 'sms_multirtl_downlink_tail.cfile', False)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.gsm_input_0, 'ctrl_in'))    
        self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.gsm_input_0_0, 'ctrl_in'))    
        self.msg_connect((self.gsm_control_channels_decoder_0_1, 'msgs'), (self.blocks_socket_pdu_0_0_0, 'pdus'))    
        self.msg_connect((self.gsm_control_channels_decoder_0_1, 'msgs'), (self.gsm_message_printer_0_0, 'msgs'))    
        self.msg_connect((self.gsm_control_channels_decoder_0_1_0, 'msgs'), (self.blocks_socket_pdu_0_0_0, 'pdus'))    
        self.msg_connect((self.gsm_control_channels_decoder_0_1_0, 'msgs'), (self.gsm_message_printer_0_0, 'msgs'))    
        self.msg_connect((self.gsm_decryption_0_3, 'bursts'), (self.gsm_control_channels_decoder_0_1_0, 'bursts'))    
        self.msg_connect((self.gsm_receiver_with_uplink_0, 'measurements'), (self.gsm_clock_offset_control_0, 'measurements'))    
        self.msg_connect((self.gsm_receiver_with_uplink_0, 'C0'), (self.gsm_sdcch8_demapper_0, 'bursts'))    
        self.msg_connect((self.gsm_sdcch8_demapper_0, 'bursts'), (self.gsm_control_channels_decoder_0_1, 'bursts'))    
        self.msg_connect((self.gsm_sdcch8_demapper_0, 'bursts'), (self.gsm_decryption_0_3, 'bursts'))    
        self.connect((self.blocks_file_source_0, 0), (self.gsm_input_0, 0))    
        self.connect((self.blocks_file_source_0_0, 0), (self.gsm_input_0_0, 0))    
        self.connect((self.gsm_input_0, 0), (self.gsm_receiver_with_uplink_0, 0))    
        self.connect((self.gsm_input_0_0, 0), (self.gsm_receiver_with_uplink_0, 1)) 
Example #15
Source File: receiver_with_decoder.py    From examples with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, OSR=4, chan_num=0, fc=939.4e6, osr=4, ppm=0, samp_rate=0.2e6):
        gr.hier_block2.__init__(
            self, "Receiver With Decoder",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(0, 0, 0),
        )
        self.message_port_register_hier_out("bursts")
        self.message_port_register_hier_out("msgs")

        ##################################################
        # Parameters
        ##################################################
        self.OSR = OSR
        self.chan_num = chan_num
        self.fc = fc
        self.osr = osr
        self.ppm = ppm
        self.samp_rate = samp_rate

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_out = samp_rate_out = 1625000.0/6.0*OSR

        ##################################################
        # Blocks
        ##################################################
        self.gsm_receiver_0 = grgsm.receiver(OSR, ([chan_num]), ([]), False)
        self.gsm_input_0 = grgsm.gsm_input(
            ppm=ppm,
            osr=OSR,
            fc=fc,
            samp_rate_in=samp_rate,
        )
        self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder()
        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc, samp_rate, osr)
        self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(
            timeslot_nr=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.gsm_bcch_ccch_demapper_0, 'bursts'), (self.gsm_control_channels_decoder_0, 'bursts'))    
        self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.gsm_input_0, 'ctrl_in'))    
        self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self, 'bursts'))    
        self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self, 'msgs'))    
        self.msg_connect((self.gsm_receiver_0, 'C0'), (self.gsm_bcch_ccch_demapper_0, 'bursts'))    
        self.msg_connect((self.gsm_receiver_0, 'measurements'), (self.gsm_clock_offset_control_0, 'measurements'))    
        self.connect((self.gsm_input_0, 0), (self.gsm_receiver_0, 0))    
        self.connect((self, 0), (self.gsm_input_0, 0))